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: [tree-ssa] fix spec2k perl miscompilation [patch]


On Thu, 2003-06-26 at 13:20, Diego Novillo wrote:
> On Wed, 2003-06-18 at 13:07, Jason Merrill wrote:
> > This patch only warns about a return statement as the last thing in a
> > statement-expression; it should handle other non-expressions, too, and void
> > expressions, for that matter.
> > 
> > Looking at this again, the last_expr_stmt stuff is unnecessarily
> > complicated; we are interested in the last statement period, not the last
> > expression statement.
> > 
> OK, thanks.  This is the new version of the patch.  It's in the last
> stages of bootstrapping, fixes SPEC's perl and emits the warning:
> 
> universal.c: In function `XS_UNIVERSAL_VERSION':
> universal.c:202: warning: statement-expressions should end with a non-void expression
> 
> OK if it passes all tests?
> 
> 
> Thanks.  Diego.
> 
> 
> 	* c-simplify.c (gimplify_stmt_expr): Handle statement-expressions
> 	that don't end in a non-void expression.  Emit a warning in that
> 	case.
> 
I forgot to include the new test case.  It's finished bootstrapping and
testing now.


Diego.

testsuite/ChangeLog.tree-ssa

	* gcc.dg/20030612-1.c: New test.

Index: testsuite/gcc.dg/20030612-1.c
===================================================================
RCS file: testsuite/gcc.dg/20030612-1.c
diff -N testsuite/gcc.dg/20030612-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/20030612-1.c	26 Jun 2003 18:59:28 -0000
***************
*** 0 ****
--- 1,22 ----
+ /* { dg-do run } */
+ /* { dg-options "-O2" } */
+ 
+ int A, B;
+ 
+ void foo()
+ {
+   long x = 3;
+   (void)({
+     A = B + x + ((1) - 1);
+     return;	/* { dg-warning "statement-expressions should end with a non-void expression" } */
+   });
+ }
+ 
+ main()
+ {
+   B = 5;
+   foo();
+   if (A != 8)
+     abort ();
+   return 0;
+ }


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