------- Comment #16 from rguenth at gcc dot gnu dot org 2007-05-01 13:35 ------- Created an attachment (id=13468) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13468&action=view) slightly simplified testcase
I don't see anything wrong with the testcase. I changed it to not take the address of dummy, but pass zero instead. This reduces the diff of initial aliasing to - # _A_b1_61 = V_MAY_DEF <_A_b1_54>; - # SFT.70_62 = V_MAY_DEF <SFT.70_55>; - # SFT.71_63 = V_MAY_DEF <SFT.71_56>; - # SFT.72_64 = V_MAY_DEF <SFT.72_57>; - # SFT.73_65 = V_MAY_DEF <SFT.73_58>; - # NONLOCAL.79_66 = V_MAY_DEF <NONLOCAL.79_60>; + # SFT.79_61 = V_MAY_DEF <SFT.79_57>; this_41->rep_ = rep_42; but before DCE (which makes a mess out of this testcase) we have practically indentical dumps for A::bar() - Note that A::bar() is the offending function that gets mis-optimized. We DCE the initialization of the function pointer so we segfault at the indirect call to it. @@ -78,21 +78,21 @@ sigc::slot0 A::bar() (this) { ... @@ -129,7 +129,7 @@ _A_func_2 = foo; this_3 = (struct functor_base *) &D.2378; this_4 = this_3; - # SFT.73_6 = V_MUST_DEF <SFT.73_5>; + # SFT.80_6 = V_MUST_DEF <SFT.80_5>; D.2378.func_ptr_ = foo; _A_functor_7 = &D.2378; # _A_b1_9 = V_MUST_DEF <_A_b1_8>; @@ -151,33 +151,33 @@ this_24 = (struct functor_base *) this_23; this_25 = this_24; # D.2951_27 = V_MUST_DEF <D.2951_26>; - # VUSE <SFT.73_6>; + # VUSE <SFT.80_6>; D.2951 = D.2378; - # SFT.70_50 = V_MAY_DEF <SFT.70_49>; + # SFT.77_50 = V_MAY_DEF <SFT.77_49>; # VUSE <D.2951_27>; this_20->functor_ = D.2951; this_28 = &D.2514.bound1_; this_29 = &D.2514.bound1_; _A_argument_30 = &_A_b1; D.2953_31 = 0B; - # SFT.70_68 = V_MUST_DEF <SFT.70_50>; + # SFT.77_63 = V_MUST_DEF <SFT.77_50>; D.2514.bound1_.visited_ = D.2953_31; functor_32 = &D.2514; # _A_b1_54 = V_MAY_DEF <_A_b1_9>; - # SFT.70_55 = V_MAY_DEF <SFT.70_68>; - # SFT.71_56 = V_MAY_DEF <SFT.71_52>; - # SFT.72_57 = V_MAY_DEF <SFT.72_45>; - # SFT.73_58 = V_MAY_DEF <SFT.73_6>; - # NONLOCAL.79_59 = V_MAY_DEF <NONLOCAL.79_53>; - D.3052_33 = operator new (20); - this_34 = (struct typed_slot_rep<sigc::bind_functor<-0x000000001, sigc::pointer_functor1<void*, void*>, void*> > *) D.3052_33; + # SFT.77_55 = V_MAY_DEF <SFT.77_63>; + # SFT.78_56 = V_MAY_DEF <SFT.78_52>; + # SFT.79_57 = V_MAY_DEF <SFT.79_45>; + # SFT.80_58 = V_MAY_DEF <SFT.80_6>; + # NONLOCAL.86_59 = V_MAY_DEF <NONLOCAL.86_53>; + D.3059_33 = operator new (20); + this_34 = (struct typed_slot_rep<sigc::bind_functor<-0x000000001, sigc::pointer_functor1<void*, void*>, void*> > *) D.3059_33; this_35 = this_34; functor_36 = &D.2514; this_37 = &this_35->D.2649; this_38 = this_37; - # NONLOCAL.79_60 = V_MAY_DEF <NONLOCAL.79_59>; - # VUSE <SFT.70_55>; - # VUSE <SFT.71_56>; + # NONLOCAL.86_60 = V_MAY_DEF <NONLOCAL.86_59>; + # VUSE <SFT.77_55>; + # VUSE <SFT.78_56>; this_35->functor_ = D.2514; rep_39 = (struct slot_rep *) this_34; this_40 = &<retval>.D.2330; @@ -185,14 +185,14 @@ rep_42 = rep_39; this_43 = (struct functor_base *) &<retval>.D.2330; this_44 = this_43; - # SFT.72_69 = V_MUST_DEF <SFT.72_57>; + # SFT.79_64 = V_MUST_DEF <SFT.79_57>; <retval>.D.2330.rep_ = rep_42; - D.3058_46 = rep_39; - D.3060_47 = call_it; - D.3060_48 = call_it; - # NONLOCAL.79_67 = V_MAY_DEF <NONLOCAL.79_60>; - D.3058_46->call_ = call_it; - # VUSE <SFT.72_69>; + D.3065_46 = rep_39; + D.3067_47 = call_it; + D.3067_48 = call_it; + # NONLOCAL.86_62 = V_MAY_DEF <NONLOCAL.86_60>; + D.3065_46->call_ = call_it; + # VUSE <SFT.79_64>; return <retval>; } Still the DCE diff contains <bb 2>: - # SFT.73_6 = V_MUST_DEF <SFT.73_5>; + # SFT.80_6 = V_MUST_DEF <SFT.80_5>; D.2378.func_ptr_ = foo; # _A_b1_9 = V_MUST_DEF <_A_b1_8>; _A_b1 = 0B; - this_19 = &D.2514.D.2511.functor_; - this_20 = this_19; - # D.2951_27 = V_MUST_DEF <D.2951_26>; - # VUSE <SFT.73_6>; - D.2951 = D.2378; - # SFT.70_50 = V_MAY_DEF <SFT.70_49>; - # VUSE <D.2951_27>; - this_20->functor_ = D.2951; D.2953_31 = 0B; - # SFT.70_68 = V_MUST_DEF <SFT.70_50>; + # SFT.77_63 = V_MUST_DEF <SFT.77_49>; D.2514.bound1_.visited_ = D.2953_31; where we removed the assignment D.2951 = D.2378; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30252