Fix bogus warnings

Andreas Jaeger aj@suse.de
Sat Sep 18 11:43:00 GMT 2004


Jan Hubicka <jh@suse.cz> writes:

> Hi,
> the following testcase (simplified from libstdc++ headers by Paolo) gives bogus warning at -Wall about return statement being missing.  The problem is that gimplifier splits the while (true) into tmp=1;while (tmp)
> char *
> __unguarded_partition (char *__first, char *__last)
> {
>   while (true)
>     {
>       --__last;
>       if (!(__first < __last))
> 	return __first;
>       ++__first;
>     }
> }
>
> Bootstrapped/regtested ppc-linux, OK?
>
> 2004-09-18  Jan Hubicka  <jh@suse.cz>
> 	* gimplify.c (voidify_wrapper_expr): Avoid loading constant
> 	to register.

Please add something to the testsuite,

Andreas


> Index: gimplify.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
> retrieving revision 2.77
> diff -c -3 -p -r2.77 gimplify.c
> *** gimplify.c	15 Sep 2004 02:09:03 -0000	2.77
> --- gimplify.c	15 Sep 2004 18:21:49 -0000
> *************** voidify_wrapper_expr (tree wrapper, tree
> *** 807,812 ****
> --- 807,817 ----
>   	     have TREE_SIDE_EFFECTS set.  That is no longer accurate.  */
>   	  TREE_SIDE_EFFECTS (wrapper) = 1;
>   	}
> +       /* Optimize a little and avoid loading constants to register.  This is
> +          neccesary to avoid g++ from producing bogus warning about reachable
> +          end of function at -Wall.  */
> +       else if (is_gimple_min_invariant (*p) && !temp)
> + 	temp = *p;
>         else
>   	{
>   	  if (!temp)
>
>

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040918/b8b2f9a5/attachment.sig>


More information about the Gcc-patches mailing list