This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix -Wshadow=local and undefined behavior in fortran/primary.c


On Thu, Oct 03, 2019 at 03:19:15PM +0000, Bernd Edlinger wrote:
> 
> 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?
> 

Yes.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]