public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix 20020425-1.c
@ 2011-04-12 23:36 Mike Stump
  2011-04-22  2:56 ` Mike Stump
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Stump @ 2011-04-12 23:36 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

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.


[-- Attachment #2: fold.diffs.txt --]
[-- Type: text/plain, Size: 1213 bytes --]

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.

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);
 }
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix 20020425-1.c
  2011-04-12 23:36 Fix 20020425-1.c Mike Stump
@ 2011-04-22  2:56 ` Mike Stump
  2011-04-22 12:30   ` Richard Guenther
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Stump @ 2011-04-22  2:56 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-patches

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix 20020425-1.c
  2011-04-22  2:56 ` Mike Stump
@ 2011-04-22 12:30   ` Richard Guenther
  2011-04-23  0:18     ` Mike Stump
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2011-04-22 12:30 UTC (permalink / raw)
  To: Mike Stump; +Cc: Joseph S. Myers, gcc-patches

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>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix 20020425-1.c
  2011-04-22 12:30   ` Richard Guenther
@ 2011-04-23  0:18     ` Mike Stump
  2011-04-23 11:31       ` Richard Guenther
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Stump @ 2011-04-23  0:18 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Joseph S. Myers, gcc-patches

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fix 20020425-1.c
  2011-04-23  0:18     ` Mike Stump
@ 2011-04-23 11:31       ` Richard Guenther
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Guenther @ 2011-04-23 11:31 UTC (permalink / raw)
  To: Mike Stump; +Cc: Joseph S. Myers, gcc-patches

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-04-23  9:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-12 23:36 Fix 20020425-1.c Mike Stump
2011-04-22  2:56 ` Mike Stump
2011-04-22 12:30   ` Richard Guenther
2011-04-23  0:18     ` Mike Stump
2011-04-23 11:31       ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).