* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in glimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
@ 2011-04-26 9:40 ` rguenth at gcc dot gnu.org
2011-04-26 9:42 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-26 9:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.04.26 09:39:19
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in glimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
2011-04-26 9:40 ` [Bug c/48742] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-04-26 9:42 ` rguenth at gcc dot gnu.org
2011-04-26 11:04 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-26 9:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.4.4
Target Milestone|--- |4.5.4
Summary|Internal error in |[4.5/4.6/4.7 Regression]
|glimplify_expr |Internal error in
| |glimplify_expr
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in glimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
2011-04-26 9:40 ` [Bug c/48742] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
2011-04-26 9:42 ` rguenth at gcc dot gnu.org
@ 2011-04-26 11:04 ` jakub at gcc dot gnu.org
2011-04-26 11:28 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-26 11:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-26 11:03:50 UTC ---
Shorter testcase:
int
foo (void)
{
return 1 / 0 > 0;
}
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145254
C_MAYBE_CONST_EXPR leaking to gimplification.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in glimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (2 preceding siblings ...)
2011-04-26 11:04 ` jakub at gcc dot gnu.org
@ 2011-04-26 11:28 ` jakub at gcc dot gnu.org
2011-04-26 14:54 ` joseph at codesourcery dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-26 11:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsm28 at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-26 11:27:10 UTC ---
The problem is that first build_binary_op wraps 1 / 0 into C_MAYBE_CONST_EXPR,
if (!in_late_binary_op)
{
if (!op0_maybe_const || TREE_CODE (op0) != INTEGER_CST)
op0 = c_wrap_maybe_const (op0, !op0_maybe_const);
if (!op1_maybe_const || TREE_CODE (op1) != INTEGER_CST)
op1 = c_wrap_maybe_const (op1, !op1_maybe_const);
}
and later on the whole GT_EXPR with C_MAYBE_CONST_EXPR op0 and INTEGER_CST op1
is wrapped in yet another C_MAYBE_CONST_EXPR:
else if (TREE_CODE (ret) != INTEGER_CST && int_operands
&& !in_late_binary_op)
ret = note_integer_operands (ret);
Apparently, c_fully_fold_internal doesn't handle nested C_MAYBE_CONST_EXPRs
though, if it finds one, it doesn't recurse on the content and just returns it.
Joseph?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in glimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (3 preceding siblings ...)
2011-04-26 11:28 ` jakub at gcc dot gnu.org
@ 2011-04-26 14:54 ` joseph at codesourcery dot com
2011-04-26 15:18 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: joseph at codesourcery dot com @ 2011-04-26 14:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-04-26 14:50:47 UTC ---
There shouldn't be nested C_MAYBE_CONST_EXPR. The code you quote
> if (!in_late_binary_op)
> {
> if (!op0_maybe_const || TREE_CODE (op0) != INTEGER_CST)
> op0 = c_wrap_maybe_const (op0, !op0_maybe_const);
> if (!op1_maybe_const || TREE_CODE (op1) != INTEGER_CST)
> op1 = c_wrap_maybe_const (op1, !op1_maybe_const);
> }
is to avoid the result of folding getting folded again and to track how
constant that result is. But if int_operands I don't think this wrapping
of the operands is needed because the code after return_build_binary_op:
will deal with wrapping the result.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in glimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (4 preceding siblings ...)
2011-04-26 14:54 ` joseph at codesourcery dot com
@ 2011-04-26 15:18 ` jakub at gcc dot gnu.org
2011-04-26 15:28 ` [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in gimplify_expr joseph at codesourcery dot com
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-26 15:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-26 15:16:05 UTC ---
Created attachment 24104
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24104
gcc46-pr48742.patch
So do you mean something like this? Haven't bootstrapped/regtested it yet...
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in gimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (5 preceding siblings ...)
2011-04-26 15:18 ` jakub at gcc dot gnu.org
@ 2011-04-26 15:28 ` joseph at codesourcery dot com
2011-04-27 7:09 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: joseph at codesourcery dot com @ 2011-04-26 15:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-04-26 15:24:13 UTC ---
On Tue, 26 Apr 2011, jakub at gcc dot gnu.org wrote:
> Created attachment 24104
> --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24104
> gcc46-pr48742.patch
>
> So do you mean something like this? Haven't bootstrapped/regtested it yet...
Yes, that patch looks right.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in gimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (6 preceding siblings ...)
2011-04-26 15:28 ` [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in gimplify_expr joseph at codesourcery dot com
@ 2011-04-27 7:09 ` jakub at gcc dot gnu.org
2011-04-27 7:14 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-27 7:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-27 07:04:29 UTC ---
Author: jakub
Date: Wed Apr 27 07:04:25 2011
New Revision: 173011
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173011
Log:
PR c/48742
* c-typeck.c (build_binary_op): Don't wrap arguments if
int_operands is true.
* gcc.c-torture/compile/pr48742.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr48742.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-typeck.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5/4.6/4.7 Regression] Internal error in gimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (7 preceding siblings ...)
2011-04-27 7:09 ` jakub at gcc dot gnu.org
@ 2011-04-27 7:14 ` jakub at gcc dot gnu.org
2011-04-27 7:51 ` [Bug c/48742] [4.5 " jakub at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-27 7:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-27 07:05:56 UTC ---
Author: jakub
Date: Wed Apr 27 07:05:54 2011
New Revision: 173012
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173012
Log:
PR c/48742
* c-typeck.c (build_binary_op): Don't wrap arguments if
int_operands is true.
* gcc.c-torture/compile/pr48742.c: New test.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/compile/pr48742.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/c-typeck.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5 Regression] Internal error in gimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (8 preceding siblings ...)
2011-04-27 7:14 ` jakub at gcc dot gnu.org
@ 2011-04-27 7:51 ` jakub at gcc dot gnu.org
2011-05-03 16:35 ` jakub at gcc dot gnu.org
2011-05-03 17:36 ` jakub at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-27 7:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Known to work| |4.6.1, 4.7.0
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
Summary|[4.5/4.6/4.7 Regression] |[4.5 Regression] Internal
|Internal error in |error in gimplify_expr
|gimplify_expr |
Known to fail| |4.5.2
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-27 07:17:27 UTC ---
Fixed for 4.6+ so far.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5 Regression] Internal error in gimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (9 preceding siblings ...)
2011-04-27 7:51 ` [Bug c/48742] [4.5 " jakub at gcc dot gnu.org
@ 2011-05-03 16:35 ` jakub at gcc dot gnu.org
2011-05-03 17:36 ` jakub at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-03 16:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-03 16:34:37 UTC ---
Author: jakub
Date: Tue May 3 16:34:32 2011
New Revision: 173326
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173326
Log:
Backport from mainline
2011-04-27 Jakub Jelinek <jakub@redhat.com>
PR c/48742
* c-typeck.c (build_binary_op): Don't wrap arguments if
int_operands is true.
* gcc.c-torture/compile/pr48742.c: New test.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/compile/pr48742.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/c-typeck.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/48742] [4.5 Regression] Internal error in gimplify_expr
2011-04-23 19:23 [Bug c/48742] New: Internal error in glimplify_expr derek at knosof dot co.uk
` (10 preceding siblings ...)
2011-05-03 16:35 ` jakub at gcc dot gnu.org
@ 2011-05-03 17:36 ` jakub at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-03 17:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48742
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-03 17:18:36 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 13+ messages in thread