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.

Reply via email to