[Bug inline-asm/17346] [3.5 Regression] linux kernel: handwritten offsetof break inline asm

matz at suse dot de gcc-bugzilla@gcc.gnu.org
Thu Sep 9 12:48:00 GMT 2004


------- Additional Comments From matz at suse dot de  2004-09-09 12:48 -------
The kernel does use offsetof().  But of course it has its own headers, 
defining this macro to the usual construct, instead of using 
__builtin_offsetof (which didn't exist in older compilers).  I was merely 
expanding the offsetof macro in the testcase by hand, in order to make it 
visible, where exactly it breaks. 
 
And I would extend this to not just const-fold in asms.  There is no reason 
to not do this optimization also outside.  There is enough code out there 
which still uses the legacy definition of offsetof.  Why pessimize it? 
(This doesn't mean that this construct should be regarded as a constant 
in the language sense.  My point was, that it does boil down to a constant, 
no matter what the language says). 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17346



More information about the Gcc-bugs mailing list