gcc 11.3 loader error (also gcc 12.1) #3296
Replies: 7 comments 11 replies
-
Calling in @fxcoudert for GCC specific help |
Beta Was this translation helpful? Give feedback.
-
So this looks like an issue at least one another person has been seeing: iains/gcc-11-branch#3 In order to debug it, we would need some more information, ideally a minimal reproducer. Could you tell us:
|
Beta Was this translation helpful? Give feedback.
-
I am going to try to construct a minimal example today since this is
occurring inside the build of a 300K+ line program -- though the compile
and link lines are modestly simple.
I will note that after several hours I located an error in the source
code. The error, however, in my opinion should not have caused a link
error -- a compile warning or a runtime error, yes, but not a link error.
Here is the error in a nutshell:
0) subroutine sub1 that will be linked to a main program
1) Unintialized integer :: k
2) Local array real (kind=9) :: myarray(4)
3) Setting myarray(k) = myvalue -- with k never defined
4) Passing myarray to another subroutine call sub2(myarray)
5) Linking main sub1 and sub2 together throws the error. main, sub1, and
sub2 all compile fine.
Minimally my compile lines looks like
gfortran -c -g -O2 -Wall sub1.f
gfortran -c -g -O2 -Wall sub2.f
gfortran -c -g -O2 -Wall fmain.f
gfortran fmain.o sub1.o sub2.o
Trying to make a minimal example, however, is proving to be hard because
-Wall is catching the uninitialized variable. So it seems that the error
really stems from -Wuninitialized not seeing my uninitialized variable.
There are other features to the actual error that I have not described
above (global structures -- i.e. common blocks and some libraries). I will
try to progressively make my minimal example more complex until it
reproduces the problem.
For what it is worth, I have attached the .s file from the compile of the
actual subroutine (called sld1d1u.f). The symbol for the uninitialized
variable in the actual code is l (ell). It compiled without warning even
though l (ell) is uninitialized, completely local, and -Wall was used.
(No .i file was produced with the -save-temps flag).
…-sanjay
On Sun, May 22, 2022 at 2:38 AM FX Coudert ***@***.***> wrote:
So this looks like an issue at least one another person has been seeing:
iains/gcc-11-branch#3 <iains/gcc-11-branch#3>
In order to debug it, we would need some more information, ideally a
minimal reproducer. Could you tell us:
- what you're compiling
- what is the command line that is producing this error
- re-run the same and add the -save-temps flag, and send the
intermediate files (.i and .s)
—
Reply to this email directly, view it on GitHub
<#3296 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADIUN4SBT6ET3D3E6BFIQFTVLH57VANCNFSM5WS3OX5A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Here is my minimal example (attached zip file). A bit of a mess but fully self-contained. I left in all the IF checks but took out all the CALLs to other routines and all the computations except for one line (search for epsv, note in the real code the right-hand-side is properly initialized, only unil is uninitialized). To build and see the error: gfortran -save-temps -c -g -O2 -Wall pjint2d.f The error occurs on link: ld: in section __TEXT,__text reloc 13: symbol index out of range file 'sld2d1u.o' for architecture arm64 The compile of sld2d1u.f does not catch the uninitialized variable "unil" and this appear to be the cause of the link error. Note commenting out the call to pjint2d will remove the error. Here is my -v on the compiler: Thanks in advance for looking at this, |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I can confirm that 12.1 will compile and link on the reduced test case (albeit missing the uninitialized). |
Beta Was this translation helpful? Give feedback.
-
In case it is helpful, here is the .s for the reduced test case from an intel Mac using 11.3. The compile again misses the uninitialized variable but will link. |
Beta Was this translation helpful? Give feedback.
-
Upon upgrading to GCC to 11.3 (from 11.2), I am experiencing a loader error:
I looked in the .s file for the subroutine for __TEXT and see the following but I don't know enough to be able to figure out what is going on (making a standalone example displaying the same error will be quite hard).
Note, the same error occurs with gcc@12 (gcc 12.1).
(1) Any hints on how to chase this down?
(2) Is there a way to re-install gcc 11.2?
here is the output to brew config and brew doctor
brew config
brew doctor
Beta Was this translation helpful? Give feedback.
All reactions