Understanding gfortran error

I am trying to get a (stupidly) big code to compile with GNU, and am hitting an error about a misplaced bracket at line 26000 of a file containing a thousand lines.
The exact error is pasted below :

f951: Fatal Error: Reading module ‘loc_interface_mod.mod’ at line 26022 column 35: Expected right parenthesis
compilation terminated.

Is there some way of outputting whatever intermediate representation this error message is actually referring to, so I can get an idea what I need to work around, and possibly what I could write as a reproducer to file with gnu developers?
Thanks!

1 Like

The .mod file generated by gfortran is actually a zipped lisp-like text file. Maybe you could unzip it and have a look of its contents, it may give an idea of what’s going on.

Also, be sure the .mod file was generated with the same compiler that’s now reading it.

1 Like

The mod file is definitely created by the same compiler as the one reading it.
Thanks for the information about the .mod format, I’ll have a look now.

The unzipped mod file has definitely given me a thread to pull on, many thanks!

1 Like

@dukeleto welcome to the Forum! This looks like a bug in GFortran. If you can do it, create a minimal reproducible example: keep minimizing your application using bisection (remove half of the files, see if the bug is still there, if so, continue; if not, revert the change and remove the other half, or less number of files). Ideally you’ll end up with one small module and a main program, and you compile the module, then the main program and you get the error above. Then report the bug with these two files to GFortran and they’ll fix it.

Also make sure this still happens with the latest GFortran release.

2 Likes

After having given up on this for some time, I came back to it and saw the light :smile:
The culprit turned out to be a coarray compilation flag (-fcoarray=single), applied more widely than to exclusively those files that need it.
The very frustrating aspect was that the compilation error was not triggered on the original fortran file (a module) where this flag was unnecessarily being applied, but rather on fortran in another library, which was using the module.
I will try to write a reproducer and submit to gcc, but thought I would leave a note here in case anyone meets similar behaviour and lands here thanks to google.

1 Like

Did you post a problem result on bugzillla? If so, it would be helpful if the PR number was posted here.

Thanks

Paul

2 Likes