------- Comment #1 from rguenth at gcc dot gnu dot org 2007-09-07 10:06 ------- The problem is that DCE2 deletes the my_char = 121; store because aliasing thinks the array reference doesn't alias the scalar:
;; Function sub0 (sub0) sub0 () { char[1:1] & my_char_ref; char D.874; char my_char; <bb 2>: # my_char_4 = VDEF <my_char_3(D)> my_char = 121; my_char_ref_1 = (char[1:1] &) &my_char; # VUSE <NMT.30_5(D)> D.874_2 = (*my_char_ref_1)[1]{lb: 1 sz: 1}; if (D.874_2 != 121) goto <bb 3>; else goto <bb 4>; <bb 3>: _gfortran_abort (); <bb 4>: return; } aliasing has similar problems where references are not combined completely in some places like my_char_ref_1 = (char[1:1] &) &my_char; # VUSE <NMT.30_5(D)> D.874_2 = (*my_char_ref_1)[1]{lb: 1 sz: 1}; we might be able to work around this by properly doing the propagation. Finally a nice small testcase though ;) -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dberlin at gcc dot gnu dot | |org, rguenth at gcc dot gnu | |dot org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |alias, wrong-code Last reconfirmed|0000-00-00 00:00:00 |2007-09-07 10:06:13 date| | Summary|[gfortran] inlining problem |[4.3 Regression] Wrong alias | |for accessing scalar through | |array Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33330