This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/81962] -Wmaybe-uninitialized refers to wrong line (and only works with -O3)
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 31 Dec 2017 16:42:29 +0000
- Subject: [Bug middle-end/81962] -Wmaybe-uninitialized refers to wrong line (and only works with -O3)
- Auto-submitted: auto-generated
- References: <bug-81962-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81962
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
> 1) The line that is referred to is not really the right one. In particular
> it does not contain any mention of 'alpha', which can be really confusing
> for larger codes. The warning should instead refer to the line "call
> ce3(alpha)".
It should be possible to track the location of the culprit across the various
dumps and find out when things go wrong. But this is very likely to be the
effect of inlining, and gcc should be able to print an inline "stack trace":
https://gcc.gnu.org/ml/gcc-patches/2017-12/msg00629.html
Something like:
ce.f90:9:0:
if (a <= 0.) then
inlined from ce.f90:NN:NN:
call ce3(alpha)
Warning: ‘alpha’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
ce.f90:16:0:
real :: alpha
note: ‘alpha’ was declared here