diff mbox

Fix PR64078

Message ID AM4PR0701MB2162BF0CFEBD75F89C320784E4C90@AM4PR0701MB2162.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Bernd Edlinger Sept. 22, 2016, 1:18 p.m. UTC
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.
>
> jeff

OK, thanks.
Then I will commit this on trunk and active branches.


Bernd.
diff mbox

Patch

2016-09-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>
	    Tom de Vries  <tom@codesourcery.com>

	PR testsuite/77411
	* c-c++-common/ubsan/object-size-9.c: Call __builtin_exit in C++.

Index: c-c++-common/ubsan/object-size-9.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)
 #endif
   f4 (12);
   f5 (12);
+#ifdef __cplusplus
+  /* Stack may be smashed by f2/f3 above.  */
+  __builtin_exit (0);
+#endif
   return 0;
 }