Hi, On Mon, 7 Sep 2015 12:07:00, Marek Polacek wrote: > > On Sun, Sep 06, 2015 at 07:21:13PM +0200, Bernd Edlinger wrote: >> Hi, >> >> we observed sporadic failures of the following two test cases (see PR64078): >> c-c++-common/ubsan/object-size-9.c and c-c++-common/ubsan/object-size-10.c >> >> For object-size-9.c this happens in a reproducible way when -fpic option is >> used: >> If that option is used, it is slightly less desirable to inline the >> functions, but if an explicit >> "inline" is added, the function is still in-lined, even if -fpic is used. > > So if we rely on the function being inlined I think it would be better to add > the always_inline attribute. >
I tried to replace inline by __attribute__((always_inline)), but unfortunately it does not work: FAIL: c-c++-common/ubsan/object-size-9.c -O2 (test for excess errors) Excess errors: /home/ed/gnu/gcc-trunk/gcc/testsuite/c-c++-common/ubsan/object-size-9.c:47:1: warning: always_inline function might not be inlinable [-Wattributes] /home/ed/gnu/gcc-trunk/gcc/testsuite/c-c++-common/ubsan/object-size-9.c:32:1: warning: always_inline function might not be inlinable [-Wattributes] /home/ed/gnu/gcc-trunk/gcc/testsuite/c-c++-common/ubsan/object-size-9.c:47:1: error: inlining failed in call to always_inline 'C f3(int)': function body can be overwritten at link time /home/ed/gnu/gcc-trunk/gcc/testsuite/c-c++-common/ubsan/object-size-9.c:94:10: error: called from here the diagnostics are just a little different when the function is inlined or not. Bernd.