diff mbox

Fix 20020425-1.c

Message ID F0D8A782-85B1-4397-8F3D-0ED6E3176B74@comcast.net
State New
Headers show

Commit Message

Mike Stump April 12, 2011, 11:36 p.m. UTC
This fixes 20020425-1.c when the compiler under test is built with -O0 and we're on a machine with an 8 meg stack.

Ok?

2011-04-12  Mike Stump  <mikestump@comcast.net>

	* c-typeck.c (c_finish_if_stmt): Fold result.
	* fold-const.c (fold_ternary_loc): Handle an empty else.
This fixes 20020425-1.c so that it doesn't fail when the compiler is built with -O0. 

2011-04-12  Mike Stump  <mikestump@comcast.net>

	* c-typeck.c (c_finish_if_stmt): Fold result.
	* fold-const.c (fold_ternary_loc): Handle an empty else.

Comments

Mike Stump April 22, 2011, 1:40 a.m. UTC | #1
Ping?

On Apr 12, 2011, at 4:36 PM, Mike Stump wrote:

> This fixes 20020425-1.c when the compiler under test is built with -O0 and we're on a machine with an 8 meg stack.
> 
> Ok?
> 
> 2011-04-12  Mike Stump  <mikestump@comcast.net>
> 
> 	* c-typeck.c (c_finish_if_stmt): Fold result.
> 	* fold-const.c (fold_ternary_loc): Handle an empty else.
> 
> <fold.diffs.txt>
Richard Biener April 22, 2011, 9:05 a.m. UTC | #2
On Fri, Apr 22, 2011 at 3:40 AM, Mike Stump <mikestump@comcast.net> wrote:
> Ping?

The patch makes the testcase pointless.  It also makes the AST differ
more from the source form, so I don't think
it's a particularly good idea.

I think we shouldn't worry about this kind of testsuite fails.

Richard.

> On Apr 12, 2011, at 4:36 PM, Mike Stump wrote:
>
>> This fixes 20020425-1.c when the compiler under test is built with -O0 and we're on a machine with an 8 meg stack.
>>
>> Ok?
>>
>> 2011-04-12  Mike Stump  <mikestump@comcast.net>
>>
>>       * c-typeck.c (c_finish_if_stmt): Fold result.
>>       * fold-const.c (fold_ternary_loc): Handle an empty else.
>>
>> <fold.diffs.txt>
>
>
Mike Stump April 22, 2011, 11:43 p.m. UTC | #3
On Apr 22, 2011, at 2:05 AM, Richard Guenther wrote:
> I think we shouldn't worry about this kind of testsuite fails.

There are only two testcases in this class.  I'd rather have zero.  How do you propose to fix them?  For some reason, please just ignore the failures in the test suite doesn't seem right to me.  The next best option would be to trim the recursion required by the testcase until it passes.  Do you prefer that solution?
Richard Biener April 23, 2011, 9:08 a.m. UTC | #4
On Sat, Apr 23, 2011 at 1:43 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Apr 22, 2011, at 2:05 AM, Richard Guenther wrote:
>> I think we shouldn't worry about this kind of testsuite fails.
>
> There are only two testcases in this class.  I'd rather have zero.  How do you propose to fix them?  For some reason, please just ignore the failures in the test suite doesn't seem right to me.  The next best option would be to trim the recursion required by the testcase until it passes.  Do you prefer that solution?

No.  Either we care for the thing the testcase tests or we don't.  I
think we care for it for regular GCC builds, not for -O0 builds.
Thus, invent a way to skip the testcase for -O0 GCC builds and I'll be happy.

Richard.
diff mbox

Patch

Index: fold-const.c
===================================================================
--- fold-const.c	(revision 1279)
+++ fold-const.c	(working copy)
@@ -13260,6 +13260,8 @@ 
       return NULL_TREE;
 
     case COND_EXPR:
+      if (!op2)
+	return NULL_TREE;
       /* Pedantic ANSI C says that a conditional expression is never an lvalue,
 	 so all simple results must be passed through pedantic_non_lvalue.  */
       if (TREE_CODE (arg0) == INTEGER_CST)
Index: c-typeck.c
===================================================================
--- c-typeck.c	(revision 1279)
+++ c-typeck.c	(working copy)
@@ -8916,8 +8916,7 @@ 
 		     "suggest explicit braces to avoid ambiguous %<else%>");
     }
 
-  stmt = build3 (COND_EXPR, void_type_node, cond, then_block, else_block);
-  SET_EXPR_LOCATION (stmt, if_locus);
+  stmt = fold_build3_loc (if_locus, COND_EXPR, void_type_node, cond, then_block, else_block);
   add_stmt (stmt);
 }