public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
@ 2011-04-19 14:50 doko at ubuntu dot com
2011-04-19 15:05 ` [Bug middle-end/48685] " rguenth at gcc dot gnu.org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: doko at ubuntu dot com @ 2011-04-19 14:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Summary: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at
gimplify.c:7034
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: doko@ubuntu.com
[forwarded from http://bugs.debian.org/623161]
works with 4.4.6, fails with 4.5, 4.6 branches and trunk
$ cat foo.c
int main() {
unsigned long int pixel;
((void)((1 == 2) ? ((void)(0)) : ((pixel) = 0)));
return 0;
}
$ gcc-snapshot-20110419/build/gcc/xgcc -Bgcc-snapshot-20110419/build/gcc/ foo.c
foo.c: In function 'main':
foo.c:3:10: internal compiler error: in gimplify_expr, at gimplify.c:7034
Please submit a full bug report,
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
@ 2011-04-19 15:05 ` rguenth at gcc dot gnu.org
2011-04-19 15:08 ` [Bug c/48685] " rguenth at gcc dot gnu.org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-19 15:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.04.19 15:04:39
Version|unknown |4.5.2
Target Milestone|--- |4.5.3
Ever Confirmed|0 |1
Known to fail| |4.5.0
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-19 15:04:39 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
2011-04-19 15:05 ` [Bug middle-end/48685] " rguenth at gcc dot gnu.org
@ 2011-04-19 15:08 ` rguenth at gcc dot gnu.org
2011-04-20 8:09 ` jakub at gcc dot gnu.org
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-19 15:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|middle-end |c
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-19 15:08:12 UTC ---
Some NON_LVALUE_EXPR survives. Probably a C constexpr fallout.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
2011-04-19 15:05 ` [Bug middle-end/48685] " rguenth at gcc dot gnu.org
2011-04-19 15:08 ` [Bug c/48685] " rguenth at gcc dot gnu.org
@ 2011-04-20 8:09 ` jakub at gcc dot gnu.org
2011-04-21 9:26 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-20 8:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jsm28 at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-20 08:08:27 UTC ---
int
main ()
{
int v = 1;
(void) (1 == 2 ? (void) 0 : (v = 0));
return v;
}
I believe normally c_fully_fold_internal drops NON_LVALUE_EXPRs in
STRIP_TYPE_NOPS at the end, but in this case the void type COND_EXPR is folded
into int type MODIFY_EXPR (and even a fold_convert wouldn't fix that up,
for MODIFY_EXPR it is just fold_ignored_result and still stays at the original
type) and thus the void type NON_LVALUE_EXPR is kept.
I wonder whether we should be creating NON_LVALUE_EXPRs with void type at all
(aren't void values never lvalues?), or when handling NON_LVALUE_EXPR in
c_fully_fold_internal we should drop them if they are void type.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (2 preceding siblings ...)
2011-04-20 8:09 ` jakub at gcc dot gnu.org
@ 2011-04-21 9:26 ` rguenth at gcc dot gnu.org
2011-04-21 15:37 ` joseph at codesourcery dot com
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-21 9:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (3 preceding siblings ...)
2011-04-21 9:26 ` rguenth at gcc dot gnu.org
@ 2011-04-21 15:37 ` joseph at codesourcery dot com
2011-04-22 11:43 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: joseph at codesourcery dot com @ 2011-04-21 15:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-04-21 15:36:26 UTC ---
The C front end should not depend on fold creating NON_LVALUE_EXPRs
anywhere, but I don't know if C++ has such dependencies. Where does the
NON_LVALUE_EXPR come from? In any case, I don't think NON_LVALUE_EXPR
should be used for type conversions; a NON_LVALUE_EXPR with void type
should only ever be used if the contained expression has void type (with
the same qualifiers), and under those conditions STRIP_TYPE_NOPS should
remove it.
c_fully_fold_internal needs to preserve the type of the expression, so
can't just remove a NON_LVALUE_EXPR that changes the type without adding
some other conversion to the new type - but as noted above, if a
NON_LVALUE_EXPR is changing the type I think the creation of that
NON_LVALUE_EXPR is what's wrong.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (4 preceding siblings ...)
2011-04-21 15:37 ` joseph at codesourcery dot com
@ 2011-04-22 11:43 ` jakub at gcc dot gnu.org
2011-04-22 16:54 ` joseph at codesourcery dot com
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 11:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 11:42:59 UTC ---
The NON_LVALUE_EXPR in question is created by the C FE, in build_c_cast:
4712 /* Don't let a cast be an lvalue. */
4713 if (value == expr)
4714 value = non_lvalue_loc (loc, value);
And it has void_type_node like its argument, which is void_type_node COND_EXPR.
The second argument of the COND_EXPR is void_type_node also, but the third is
a MODIFY_EXPR and for MODIFY_EXPR fold_convert_loc just refuses to convert it:
2030 case VOID_TYPE:
2031 tem = fold_ignored_result (arg);
2032 if (TREE_CODE (tem) == MODIFY_EXPR)
2033 goto fold_convert_exit;
2034 return fold_build1_loc (loc, NOP_EXPR, type, tem);
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (5 preceding siblings ...)
2011-04-22 11:43 ` jakub at gcc dot gnu.org
@ 2011-04-22 16:54 ` joseph at codesourcery dot com
2011-04-22 19:20 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: joseph at codesourcery dot com @ 2011-04-22 16:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-04-22 16:53:53 UTC ---
On Fri, 22 Apr 2011, jakub at gcc dot gnu.org wrote:
> And it has void_type_node like its argument, which is void_type_node COND_EXPR.
> The second argument of the COND_EXPR is void_type_node also, but the third is
> a MODIFY_EXPR and for MODIFY_EXPR fold_convert_loc just refuses to convert it:
> 2030 case VOID_TYPE:
> 2031 tem = fold_ignored_result (arg);
> 2032 if (TREE_CODE (tem) == MODIFY_EXPR)
> 2033 goto fold_convert_exit;
> 2034 return fold_build1_loc (loc, NOP_EXPR, type, tem);
I'd say that's a bug in fold_convert_loc; it should provide the interface
to the rest of the compiler that the return value always has the requested
type (or is error_mark_node).
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (6 preceding siblings ...)
2011-04-22 16:54 ` joseph at codesourcery dot com
@ 2011-04-22 19:20 ` jakub at gcc dot gnu.org
2011-04-23 10:19 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-22 19:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-22 19:20:38 UTC ---
Seems that was introduced by:
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00279.html
but we don't have GIMPLE_MODIFY_STMT any longer and MODIFY_EXPR does have a
type, so I guess we can just revert it. Will test that.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (8 preceding siblings ...)
2011-04-23 10:19 ` jakub at gcc dot gnu.org
@ 2011-04-23 10:19 ` jakub at gcc dot gnu.org
2011-04-23 10:21 ` [Bug c/48685] [4.5 Regression] " jakub at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-23 10:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-23 10:18:06 UTC ---
Author: jakub
Date: Sat Apr 23 10:18:03 2011
New Revision: 172895
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172895
Log:
PR c/48685
* fold-const.c (fold_convert_loc): Add NOP_EXPR when casting
to VOID_TYPE even around MODIFY_EXPR.
* gcc.dg/pr48685.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr48685.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (7 preceding siblings ...)
2011-04-22 19:20 ` jakub at gcc dot gnu.org
@ 2011-04-23 10:19 ` jakub at gcc dot gnu.org
2011-04-23 10:19 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-23 10:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-23 10:18:56 UTC ---
Author: jakub
Date: Sat Apr 23 10:18:54 2011
New Revision: 172896
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172896
Log:
PR c/48685
* fold-const.c (fold_convert_loc): Add NOP_EXPR when casting
to VOID_TYPE even around MODIFY_EXPR.
* gcc.dg/pr48685.c: New test.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/pr48685.c
Modified:
branches/gcc-4_6-branch/gcc/ChangeLog
branches/gcc-4_6-branch/gcc/fold-const.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5 Regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (9 preceding siblings ...)
2011-04-23 10:19 ` jakub at gcc dot gnu.org
@ 2011-04-23 10:21 ` jakub at gcc dot gnu.org
2011-04-28 15:53 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-23 10:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jakub at gcc dot gnu.org
|gnu.org |
Summary|[4.5/4.6/4.7 regression] |[4.5 Regression] ICE in
|ICE in gimplify_expr, at |gimplify_expr, at
|gimplify.c:7034 |gimplify.c:7034
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-23 10:20:08 UTC ---
Fixed for 4.6+ so far.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5 Regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (10 preceding siblings ...)
2011-04-23 10:21 ` [Bug c/48685] [4.5 Regression] " jakub at gcc dot gnu.org
@ 2011-04-28 15:53 ` rguenth at gcc dot gnu.org
2011-05-03 17:11 ` jakub at gcc dot gnu.org
2011-05-03 17:19 ` jakub at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-04-28 15:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.5.3 |4.5.4
--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-28 14:51:56 UTC ---
GCC 4.5.3 is being released, adjusting target milestone.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5 Regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (11 preceding siblings ...)
2011-04-28 15:53 ` rguenth at gcc dot gnu.org
@ 2011-05-03 17:11 ` jakub at gcc dot gnu.org
2011-05-03 17:19 ` jakub at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-03 17:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-03 16:33:15 UTC ---
Author: jakub
Date: Tue May 3 16:33:09 2011
New Revision: 173324
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173324
Log:
Backport from mainline
2011-04-23 Jakub Jelinek <jakub@redhat.com>
PR c/48685
* fold-const.c (fold_convert_loc): Add NOP_EXPR when casting
to VOID_TYPE even around MODIFY_EXPR.
* gcc.dg/pr48685.c: New test.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr48685.c
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/fold-const.c
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/48685] [4.5 Regression] ICE in gimplify_expr, at gimplify.c:7034
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
` (12 preceding siblings ...)
2011-05-03 17:11 ` jakub at gcc dot gnu.org
@ 2011-05-03 17:19 ` jakub at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-05-03 17:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48685
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-03 17:17:08 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2011-05-03 17:19 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 14:50 [Bug middle-end/48685] New: [4.5/4.6/4.7 regression] ICE in gimplify_expr, at gimplify.c:7034 doko at ubuntu dot com
2011-04-19 15:05 ` [Bug middle-end/48685] " rguenth at gcc dot gnu.org
2011-04-19 15:08 ` [Bug c/48685] " rguenth at gcc dot gnu.org
2011-04-20 8:09 ` jakub at gcc dot gnu.org
2011-04-21 9:26 ` rguenth at gcc dot gnu.org
2011-04-21 15:37 ` joseph at codesourcery dot com
2011-04-22 11:43 ` jakub at gcc dot gnu.org
2011-04-22 16:54 ` joseph at codesourcery dot com
2011-04-22 19:20 ` jakub at gcc dot gnu.org
2011-04-23 10:19 ` jakub at gcc dot gnu.org
2011-04-23 10:19 ` jakub at gcc dot gnu.org
2011-04-23 10:21 ` [Bug c/48685] [4.5 Regression] " jakub at gcc dot gnu.org
2011-04-28 15:53 ` rguenth at gcc dot gnu.org
2011-05-03 17:11 ` jakub at gcc dot gnu.org
2011-05-03 17:19 ` jakub at gcc dot gnu.org
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).