On 09/19/16 23:27, Jeff Law wrote:
> On 09/19/2016 03:08 PM, Bernd Edlinger wrote:
>>> Would it work to break this up into distinct tests, exit()-ing from each
>>> function rather than returning back to main?
>> Yes. I think how this test is designed, each function must be inlined,
>> or it will fail anyway. It was for instance impossible to pass the
>> ubsan test, if -fno-inline was used as RUNTESTFLAGS.
> Presumably the dg-skip-if is ensuring that we're only testing with -O2
> turned on.
>> Therefore it works as well, if main avoids to return and calls
>> exit(0) instead, with a specific comment of course.
>> See https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01985.html
> That works for me.
Then I will commit this on trunk and active branches.
2016-09-22 Bernd Edlinger <bernd.edlin...@hotmail.de>
Tom de Vries <t...@codesourcery.com>
* c-c++-common/ubsan/object-size-9.c: Call __builtin_exit in C++.
--- c-c++-common/ubsan/object-size-9.c (Revision 240355)
+++ c-c++-common/ubsan/object-size-9.c (Arbeitskopie)
@@ -93,5 +93,9 @@ main (void)
+ /* Stack may be smashed by f2/f3 above. */
+ __builtin_exit (0);