[Bug middle-end/36767] [4.3/4.4 Regression] Segmentation fault with -fprofile-arcs -O2

2008-07-15 Thread jakub at gcc dot gnu dot org


--- Comment #3 from jakub at gcc dot gnu dot org  2008-07-15 15:09 ---
Shorter testcase:
// { dg-do compile }
// { dg-options "-O2 -fprofile-arcs" }
struct A { A (); ~A (); };
A a[2];

What seems to be going on is that:
#0  create_temporary_var (type=0x73252780) at ../../gcc/cp/init.c:2613
#1  0x005fd921 in get_temp_regvar (type=0x73252780,
init=0x7324d500) at ../../gcc/cp/init.c:2635
#2  0x005fdfad in build_vec_init (base=0x7324d500,
maxindex=0x7325c180, init=0x0, explicit_default_init_p=0 '\0',
from_array=0, complain=tf_warning_or_error) at ../../gcc/cp/init.c:2759
#3  0x005f71be in build_aggr_init (exp=0x73209e60, init=0x0,
flags=0, complain=tf_warning_or_error) at ../../gcc/cp/init.c:1279
#4  0x0044b5de in build_aggr_init_full_exprs (decl=0x73209e60,
init=0x0, flags=0) at ../../gcc/cp/decl.c:4978
#5  0x0044c648 in check_initializer (decl=0x73209e60, init=0x0,
flags=0, cleanup=0x7fffde00) at ../../gcc/cp/decl.c:5104
#6  0x0044fc53 in cp_finish_decl (decl=0x73209e60, init=0x0,
init_const_expr_p=0 '\0', asmspec_tree=0x0, flags=0) at
../../gcc/cp/decl.c:5579

creates a VAR_DECL while current_function_decl == NULL.  Later on
one_static_initialization_or_destruction puts all its uses (and DECL_EXPR for
it) into the artificial __static_initialization_or_destruction, but from what I
can see nothing actually fixes up DECL_CONTEXT of the variable to the function
it has been put into.  If I manually set DECL_CONTEXT of these variables
in one_static_initialization_or_destruction, it compiles just fine.

If not and the vars make it through to the expander, they have DECL_NAME () ==
NULL and that leads to infinite recursion during mangling.

I wonder where is the best place to fix the contexts up though.
Either one_static_initialization_or_destruction could walk_tree init,
look for DECL_EXPRs with artificial VAR_DECLs with NULL DECL_CONTEXT, or
say cp-gimplify.c could do that.


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||jason at gcc dot gnu dot org


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



[Bug middle-end/36767] [4.3/4.4 Regression] Segmentation fault with -fprofile-arcs -O2

2008-07-10 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

  Component|c++ |middle-end
  Known to fail||4.3.1
  Known to work||4.2.4
   Priority|P3  |P1


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