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, Fortran] PR54599 (4/n) FIx issues found by Coverity scann


On 17/09/2012 09:47, Tobias Burnus wrote:
> This patch fixes some of the issues collected in the PR.
> 
> 
> Some remarks to the changed in the attached patch:
> 
> 
> -         gcc_assert (*format++ == '$');
> 
> That code gets executed when
>  "some error message with value %d for string %s"
> gets translated into
>  "some error message for string %2$s with value %1$d"
> 
> And without the ++ gfortran doesn't skip over the $ sign.
> 
> 
> +  gcc_assert (derived1 && derived2);
> One of the many places where we first check for non-NULL - and then
> dereference the pointer unconditionally.
> 
> 
> -              && ref->u.ar.as->lower && ref->u.ar.as->upper)
> 
> "lower" is an array of pointers but not a pointer itself - thus, "lower"
> is always != NULL. Ditto for upper.
> 
> 
> 
> -         break;
> +         continue;
> 
> It makes sense to walk through the loop more than once ;-)
> 
> +       size = int_size_in_bytes (type);
> +       gcc_assert (size >= 0);
> 
> The function returns a HOST_WIDE_INT or  -1 if it doesn't fit  into that
> signed variable. To silence the warning, I now check the result and
> added an assert.
> 
> 
> Build and regtested on x86-64-linux.
> OK for the trunk?
> 
> Tobias
OK


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