[PATCH] Fix -Wshadow=local and undefined behavior in fortran/primary.c
Bernd Edlinger
bernd.edlinger@hotmail.de
Thu Oct 3 15:19:00 GMT 2019
Hi,
This fixes two -Wshadow=local warnings, and a undefined behavior that is
used in the loop termination logic here:
for (p = c - 1; p >= buffer; p--)
{
if (*p == '.')
continue;
In order to terminate the loop p is decremented until it points
to buffer-1 (buffer is alloca'd, so that is undefined behavior.
I changed that loop to
for (p = c; p > buffer;)
{
p--;
if (*p == '.')
continue;
There are a lot more -Wshadow=local warnings in the fortran subtree,
but they are not bug fixes, so I plan to commit them in the
following days, as obvious.
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?
Thanks
Bernd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-wshadow-fortran-primary.diff
Type: text/x-patch
Size: 2189 bytes
Desc: patch-wshadow-fortran-primary.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20191003/ec012341/attachment.bin>
More information about the Fortran
mailing list