[PATCH] no lowering of &a.b (and &a->b) in the C front-end

Andrew Pinski pinskia@physics.uc.edu
Mon Aug 23 03:00:00 GMT 2004

On Aug 22, 2004, at 5:28 PM, Zack Weinberg wrote:

> Andrew Pinski <pinskia@physics.uc.edu> writes:
>>> Can you give an example of code which is optimized better with your
>>> patch?
>> Yes, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15262 which contains 
>> an
>> example where we miscompile at this point with -O3 before this patch
>> we would not optimize anything away in main but with it we can 
>> optimize
>> everything away and only have a return left.
> Thanks.  Is this a true miscompilation, or just poor optimization?

There was both in there, with -O2 it would miscompile the function foo,
moving the store of the field after the access of the field which was 
in the code as after, but after the patch we don't do that but according
to Diego there might be still other chances for this miscompiling to
happen after this patch also but I could not find one yet.

Also there was poor optimization before this patch also and this is 
needed for
eon to be come better, see 
and there might be other bug reports about the same issue where GCC is 
&a.b into &a + offsetof(b,a) which we do not figure out in the tree 
as &a.b so we cannot change it back when we deference the variable 

Andrew Pinski

More information about the Gcc-patches mailing list