This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR64078


On 09/09/2015 03:10 AM, Bernd Edlinger wrote:
Hi Jeff,

On Tue, 8 Sep 2015 13:27:12, Jeff Law wrote:

On 09/07/2015 07:46 AM, Bernd Edlinger wrote:
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.
Can't you attack this problem by making sure the function is not
interposable?


How could I do that?
You could probably make the function static or change its visibility via a function attribute (there's a visibility attribute which can take the values default, hidden protected or internal). Default visibility essentially means the function can be overridden. I think changing it to "protected" might work. Note if we do that, we may need some kind of target selector on the test since not all targets support the various visibility attributes.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]