[Bug fortran/108889] [12/13/14/15 Regression] (Re)Allocate in assignment shows used uninitialized memory warning with -Wall if LHS is unallocated
pault at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 8 05:39:07 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108889
--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to kargls from comment #7)
> (In reply to Paul Thomas from comment #6)
> > Created attachment 58586 [details]
> > Fix for this PR
> >
> > This does the job but it is still a bit clunky.
> >
> > Having recently used the location field of locus to determine decl order, I
> > rather think that it can be similarly used to determine, when an entity has
> > been assigned to in the current scope. I have a backlog of regressions to
> > attend to first. I will come back to this one very soon.
> >
> > Paul
>
> Does this also fix PR 106089? There's a patch in comment #3 of that
> PR that addresses a similar issue.
Hi Steve,
Yes, that's one and the same issue. One neat feature that will emerge from
adding an 'assigned_at' field to gfc_symbol is that the fortran front end can
issue a "used uninitialized" warning if -Wuninitialized is not set. For
example:
integer :: i, j
i = 1
i = j
print *, i
end
nagfor issues by default: Warning: test.f90, line 5: Symbol J referenced but
never set
Cheers
Paul
More information about the Gcc-bugs
mailing list