Warnings in simplify.c

Bernhard Fischer rep.dot.nop@gmail.com
Mon May 19 11:55:00 GMT 2008


On Sun, May 18, 2008 at 04:42:22PM -0700, Steve Kargl wrote:
>On Mon, May 19, 2008 at 12:08:52AM +0100, FX wrote:
>> I've started to see these:
>> 
>> >../../trunk/gcc/fortran/simplify.c: In function ?gfc_simplify_dble?:
>> >../../trunk/gcc/fortran/simplify.c:1097: warning: ?result? may be  
>> >used uninitialized in this function
>> >../../trunk/gcc/fortran/simplify.c: In function ?gfc_simplify_real?:
>> >../../trunk/gcc/fortran/simplify.c:3189: warning: ?result? may be  
>> >used uninitialized in this function
>> 
>> Is it possible they were introduced by Steve's recent patch?
>> 
>
>Nope.
>
>svn diff -r 135407:135408 simplify.c | more
>
>@@ -1123,7 +1124,10 @@ gfc_simplify_dble (gfc_expr *e)
>       ts.kind = gfc_default_double_kind;
>       result = gfc_copy_expr (e);
>       if (!gfc_convert_boz (result, &ts))
>-       return &gfc_bad_expr;
>+       {
>+         gfc_free_expr (result);
>+         return &gfc_bad_expr;
>+       }
>     }
> 
>   return range_check (result, "DBLE");
>
>As you can see, I added a gfc_free_expr() to complement the
>'result = gfc_copy_expr()'.
>
>If you want to silence the bogus warning,

Since gfc_internal_error has ATTRIBUTE_NORETURN and there is no flow
through gfc_simplify_dble() that leaves result uninitialized i'd
consider this a bug in the middle-end and as such it should be fixed
there.

I guess that putting the BOZ case as an else clause into the
switch-statement would be obvious enough so the ME groks it properly.
But that, too, is a workaround for a bug that should be fixed for real
and not papered over, imo.



More information about the Fortran mailing list