On Wed, Mar 7, 2012 at 12:52 PM, Glenn Fowler <[email protected]> wrote:
> thanks for the continuing { strict-aliasing sequence-point } discussion
> I'm a bit under the weather this week so responses may be sporadic
>
> one accomplishment was to get these gcc implementations installed
>
>        gcc version 4.7.0 20120225 (experimental) (GCC)
>        gcc version 4.7.0 20120302 (prerelease) (GCC)
>
> in order to reproduce the { strict-aliasing sequence-point } warnings
>
> however, both of these implementations have a bug in { -O2 -O3 } optimization
> the bug does not manifest for -O1 (all with -g also on)
>
> howto reproduce the bug
> on a linux.i386-64 host from $PACKAGEROOT (the dir containing bin package):
>
> mkdir -p arch/linux.i386-64-gcc47/bin tmp
> # NOTE: linux.i386-64-gcc47 is up to you
> #       you can do similarly for any number of intercepts
> #       we prefer to use the actual hosttype as the prefix
> # copy the attached cc intercept script to arch/linux.i386-64-gcc47/bin/cc
> chmod +x arch/linux.i386-64-gcc47/bin/cc
> # edit arch/linux.i386-64-gcc47/bin/cc to point to the full path of gcc 4.7
> bin/package make HOSTTYPE=linux.i386-64-gcc47
> A=$PWD/arch/linux.i386-64-gcc47
> cd tmp
> # copy the attached sfset.c to .
> arch/linux.i386-64-gcc47/bin/cc -I$A/include/ast -L$A/lib -o sfset sfset.c 
> -last
> ./sfset sfset.c
>
> a working version of the program should produce
>
> 00000003 00000003        3
> 00000013 00000023       19
> 00000853 00004123     2131
> 00000853 00004123     2131
> 00000013 00000023       19
>
> the -O2 or greater version of this program has been observed to produce
>
> 00000003 00000003        3
> 00000853 00004123     2131
> 00000853 00004123     2131
> 00000013 00000023       19
> 00000013 00000023       19
>
> since its the result of a bug the buggy output may differ for your 
> implementation
>
> run gdb with a breakpoint on sfset to see the problem
> I'm not a compiler guru but it looks like the optimizer sets up an 
> equivalence for
>        oflags = f->flags;
> at line 65 and fails to undo the equivalence, leading to the return at line 98
> being shunted to the return at line 60, even though f->flags is clearly 
> modified
> in the interim
>
> { dgk kpv gsf } don't have the time to deal with filing bug reports for these 
> kind of problems
> that's why we have :NOOPTIMIZE: assertions peppered throughout the build
>
> if anyone would like to pursue this through the proper gcc channels please 
> have at it
>
> this bug was caught by 2 strange ksh93 regressions
> compiling src/lib/libast/sfio/sfset.c with -O* off eliminates the regressions
>
> I'm adding this line to src/lib/libast/Makefile until the issue is resolved
>        "linux.i386-64*":NOOPTIMIZE: sfset.c
> so do any bug testing on the current release
> because the default build will bypass the bug starting with the next release

Has anyone filed such a bug yet? I'd like to have the bugzilla bug id
for this bug to escalate it.

Irek
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to