------- Comment #12 from dberlin at gcc dot gnu dot org 2007-06-20 20:03 ------- Subject: Re: [4.2 Regression] -fstrict-aliasing causes skipped code
On 20 Jun 2007 15:12:53 -0000, rguenth at gcc dot gnu dot org <[EMAIL PROTECTED]> wrote: > > > ------- Comment #9 from rguenth at gcc dot gnu dot org 2007-06-20 15:12 > ------- > Confirmed. > > struct barstruct { char const* some_string; }; > > void changethepointer(struct barstruct**); > > void baz() > { > struct barstruct bar1; > struct barstruct* barptr = &bar1; > changethepointer(&barptr); > barptr->some_string = "Everything's OK!"; > } > > > We end up with > > baz () > { > struct barstruct * barptr; > struct barstruct bar1; > struct barstruct * barptr.0; > > <bb 2>: > # barptr_2 = V_MUST_DEF <barptr_1>; > barptr = &bar1; > # barptr_6 = V_MAY_DEF <barptr_2>; > # SFT.1_7 = V_MAY_DEF <SFT.1_4>; > # NONLOCAL.7_8 = V_MAY_DEF <NONLOCAL.7_5>; > changethepointer (&barptr); > # VUSE <barptr_6>; > barptr.0_3 = barptr; > # SFT.1_9 = V_MAY_DEF <SFT.1_7>; > barptr.0_3->some_string = &"Everything\'s OK!"[0]; > return; > > } > > because of a wrong points-to set again: Why do you believe this is wrong? It looks exactly right > > barptr.0_3 = { bar1 } > > The constraints are > > Constraints: > > ANYTHING = &ANYTHING > READONLY = &ANYTHING > INTEGER = &ANYTHING > ESCAPED_VARS = *ESCAPED_VARS > NONLOCAL.7 = ESCAPED_VARS > ESCAPED_VARS = &NONLOCAL.7 > ESCAPED_VARS = &NONLOCAL.7 > barptr = &bar1 > ESCAPED_VARS = &bar1 > ESCAPED_VARS = &barptr > barptr.0_3 = barptr > > where ESCAPED_VARS = &barptr looks wrong? I'd say it needs to be > ESCAPED_VARS = barptr instead. No, it's right on that part. It says ESCAPED_VARS points to barptr. ESCAPED_VARS = *ESCAPED_VARS will take care of making it point what barptr points to. What is missing here is that we should be doing barptr = ESCAPED_VARS when we see &barptr passed to the call. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32328