# Understanding gfortran error

**URL:** https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146
**Category:** GNU
**Created:** [June 5, 2024, 4:09pm UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146 "2024-06-05T16:09:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![dukeleto](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@dukeleto](https://fortran-lang.discourse.group/u/dukeleto)
#### Post date: [June 5, 2024, 4:09pm UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/1 "2024-06-05T16:09:45Z")

</div>

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 :

```auto
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!

---

<div class="post-metadata">

### Author: ![nja](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nja](https://fortran-lang.discourse.group/u/nja)
#### Post date: [June 5, 2024, 4:23pm UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/2 "2024-06-05T16:23:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dukeleto](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@dukeleto](https://fortran-lang.discourse.group/u/dukeleto)
#### Post date: [June 5, 2024, 4:25pm UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/3 "2024-06-05T16:25:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dukeleto](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@dukeleto](https://fortran-lang.discourse.group/u/dukeleto)
#### Post date: [June 5, 2024, 4:34pm UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/4 "2024-06-05T16:34:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)
#### Post date: [June 5, 2024, 4:38pm UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/5 "2024-06-05T16:38:29Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![dukeleto](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@dukeleto](https://fortran-lang.discourse.group/u/dukeleto)
#### Post date: [September 6, 2024, 8:42pm UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/6 "2024-09-06T20:42:42Z")

</div>

After having given up on this for some time, I came back to it and saw the light 😄  
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.

---

<div class="post-metadata">

### Author: ![PaulT](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@PaulT](https://fortran-lang.discourse.group/u/PaulT)
#### Post date: [September 16, 2024, 8:27am UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/7 "2024-09-16T08:27:05Z")

</div>

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

Thanks

Paul

---

<div class="post-metadata">

### Author: ![dukeleto](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@dukeleto](https://fortran-lang.discourse.group/u/dukeleto)
#### Post date: [September 19, 2024, 9:16am UTC](https://fortran-lang.discourse.group/t/understanding-gfortran-error/8146/8 "2024-09-19T09:16:02Z")

</div>

Paul,  
my first attempt at a naive reproducer … did not reproduce the behaviour. I will get back to it and file a reproducer once I have one, and will mention number here.  
Thanks
