public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478
@ 2013-05-06 10:37 allan at archlinux dot org
  2013-05-06 10:42 ` [Bug middle-end/57184] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: allan at archlinux dot org @ 2013-05-06 10:37 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

             Bug #: 57184
           Summary: ICE in expand_expr_real_1, at expr.c:10478
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: allan@archlinux.org


Created attachment 30038
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30038
testcase

With 4.8.0 20130502 I get an ICE when compiling the attached test case, but
only with -g and some optimization (-O{s,1,2,3}).


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

* [Bug middle-end/57184] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
@ 2013-05-06 10:42 ` mpolacek at gcc dot gnu.org
  2013-05-06 10:47 ` [Bug middle-end/57184] [4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-05-06 10:42 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
      Known to work|                            |4.7.3
   Target Milestone|---                         |4.9.0
      Known to fail|                            |4.8.0, 4.9.0

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-05-06 10:42:45 UTC ---
Confirmed.

0x6e0e03 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
    /home/marek/src/gcc/gcc/expr.c:10476
0x6ebe8b expand_expr
    /home/marek/src/gcc/gcc/expr.h:444
0x6ebe8b expand_expr_addr_expr_1
    /home/marek/src/gcc/gcc/expr.c:7578
0x6e177a expand_expr_addr_expr
    /home/marek/src/gcc/gcc/expr.c:7701
0x6e177a expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
    /home/marek/src/gcc/gcc/expr.c:10434
0x689d4d expand_expr
    /home/marek/src/gcc/gcc/expr.h:444
0x689d4d rtl_for_decl_init
    /home/marek/src/gcc/gcc/dwarf2out.c:15027
0x68a32b rtl_for_decl_location
    /home/marek/src/gcc/gcc/dwarf2out.c:15234
0x6ada5d add_location_or_const_value_attribute
    /home/marek/src/gcc/gcc/dwarf2out.c:15350
0x6ada5d add_location_or_const_value_attribute
    /home/marek/src/gcc/gcc/dwarf2out.c:15332
0x6b4518 dwarf2out_finish
    /home/marek/src/gcc/gcc/dwarf2out.c:23661
Please submit a full bug report,
with preprocessed source if appropriate.


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

* [Bug middle-end/57184] [4.8/4.9 Regression] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
  2013-05-06 10:42 ` [Bug middle-end/57184] " mpolacek at gcc dot gnu.org
@ 2013-05-06 10:47 ` mpolacek at gcc dot gnu.org
  2013-05-06 10:59 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-05-06 10:47 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-06
     Ever Confirmed|0                           |1


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

* [Bug middle-end/57184] [4.8/4.9 Regression] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
  2013-05-06 10:42 ` [Bug middle-end/57184] " mpolacek at gcc dot gnu.org
  2013-05-06 10:47 ` [Bug middle-end/57184] [4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2013-05-06 10:59 ` mpolacek at gcc dot gnu.org
  2013-05-06 11:18 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-05-06 10:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-05-06 10:59:39 UTC ---
Looks like COMPOUND_LITERAL_EXPR isn't gimplified properly.


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

* [Bug middle-end/57184] [4.8/4.9 Regression] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
                   ` (2 preceding siblings ...)
  2013-05-06 10:59 ` mpolacek at gcc dot gnu.org
@ 2013-05-06 11:18 ` mpolacek at gcc dot gnu.org
  2013-05-06 11:24 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-05-06 11:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-05-06 11:18:35 UTC ---
Started with http://gcc.gnu.org/r195136


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

* [Bug middle-end/57184] [4.8/4.9 Regression] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
                   ` (3 preceding siblings ...)
  2013-05-06 11:18 ` mpolacek at gcc dot gnu.org
@ 2013-05-06 11:24 ` jakub at gcc dot gnu.org
  2013-05-06 11:48 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-06 11:24 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-05-06 11:24:08 UTC ---
Simplified testcase:
struct S {};
void bar (struct S *const);
static struct S *const c = &(struct S) {};

void
foo (void)
{
  bar (c);
}

Without my fix the invalid tree sharing caused canonicalize_constructor_val to
remove the COMPOUND_LITERAL_EXPR from the ADDR_EXPR in DECL_INITIAL of the
variable and replace it with the compound literal decl, but now that doesn't
happen anymore.


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

* [Bug middle-end/57184] [4.8/4.9 Regression] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
                   ` (4 preceding siblings ...)
  2013-05-06 11:24 ` jakub at gcc dot gnu.org
@ 2013-05-06 11:48 ` jakub at gcc dot gnu.org
  2013-05-06 11:50 ` [Bug debug/57184] " jakub at gcc dot gnu.org
  2013-05-07 10:39 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-06 11:48 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

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                     |

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-05-06 11:47:58 UTC ---
Created attachment 30039
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30039
gcc49-pr57184.patch

So, I see 3 different ways to fix this:

1) something like:
--- gcc/dwarf2out.c.jj2013-04-26 08:49:53.000000000 +0200
+++ gcc/dwarf2out.c2013-05-06 13:33:20.077898452 +0200
@@ -14933,6 +14933,9 @@ reference_to_unused (tree * tp, int * wa
     }
   else if (TREE_CODE (*tp) == STRING_CST && !TREE_ASM_WRITTEN (*tp))
     return *tp;
+  /* expand_expr can't handle COMPOUND_LITERAL_EXPRs.  */
+  else if (TREE_CODE (*tp) == COMPOUND_LITERAL_EXPR)
+    return *tp;

   return NULL_TREE;
 }
where we'd just give up on COMPOUND_LITERAL_EXPRs in the initializers for debug
info purposes, unfortunately we generate worse debug info in that case

2) rtl_for_decl_init could notice this case, unshare_expr the expression and
tweak it, but that means extra 2 walk_tree calls on the initializer before
expand_expr, with two different callbacks

3) just allow expand_expr on ADDR_EXPR of COMPOUND_LITERAL_EXPR if
EXPAND_INITIALIZER
Attached patch implements 3), which is quite simple and allows to have good
debug info in this case too.


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

* [Bug debug/57184] [4.8/4.9 Regression] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
                   ` (5 preceding siblings ...)
  2013-05-06 11:48 ` jakub at gcc dot gnu.org
@ 2013-05-06 11:50 ` jakub at gcc dot gnu.org
  2013-05-07 10:39 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-06 11:50 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |debug
   Target Milestone|4.9.0                       |4.8.1


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

* [Bug debug/57184] [4.8/4.9 Regression] ICE in expand_expr_real_1, at expr.c:10478
  2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
                   ` (6 preceding siblings ...)
  2013-05-06 11:50 ` [Bug debug/57184] " jakub at gcc dot gnu.org
@ 2013-05-07 10:39 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-07 10:39 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57184

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-05-07 10:39:37 UTC ---
Author: jakub
Date: Tue May  7 08:28:01 2013
New Revision: 198666

URL: http://gcc.gnu.org/viewcvs?rev=198666&root=gcc&view=rev
Log:
    PR debug/57184
    * expr.c (expand_expr_addr_expr_1): Handle COMPOUND_LITERAL_EXPR
    for modifier == EXPAND_INITIALIZER.

    * gcc.dg/pr57184.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr57184.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/expr.c
    trunk/gcc/testsuite/ChangeLog

Author: jakub
Date: Tue May  7 09:02:37 2013
New Revision: 198668

URL: http://gcc.gnu.org/viewcvs?rev=198668&root=gcc&view=rev
Log:
    PR debug/57184
    * expr.c (expand_expr_addr_expr_1): Handle COMPOUND_LITERAL_EXPR
    for modifier == EXPAND_INITIALIZER.

    * gcc.dg/pr57184.c: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/pr57184.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/expr.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2013-05-07 10:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06 10:37 [Bug middle-end/57184] New: ICE in expand_expr_real_1, at expr.c:10478 allan at archlinux dot org
2013-05-06 10:42 ` [Bug middle-end/57184] " mpolacek at gcc dot gnu.org
2013-05-06 10:47 ` [Bug middle-end/57184] [4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
2013-05-06 10:59 ` mpolacek at gcc dot gnu.org
2013-05-06 11:18 ` mpolacek at gcc dot gnu.org
2013-05-06 11:24 ` jakub at gcc dot gnu.org
2013-05-06 11:48 ` jakub at gcc dot gnu.org
2013-05-06 11:50 ` [Bug debug/57184] " jakub at gcc dot gnu.org
2013-05-07 10:39 ` 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).