public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR64078
@ 2015-09-07  2:53 Bernd Edlinger
  2015-09-07 10:41 ` Marek Polacek
  0 siblings, 1 reply; 22+ messages in thread
From: Bernd Edlinger @ 2015-09-07  2:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, H.J. Lu

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

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.

But it may also happen randomly when the sanitizer tries to dump memory around an object,
that lies next to a non-accessible page, the sanitizer prints "<memory cannot be printed>"
in this case, which is not what the test case expects here.  As a work around I added
a large alignment attribute, to make sure, that the object cannot be at a page boundary.


Boot-strapped and regression-tested x86_64-linux-gnu.
OK for trunk?


Thanks,
Bernd.
 		 	   		  

[-- Attachment #2: changelog-pr64078.txt --]
[-- Type: text/plain, Size: 250 bytes --]

2015-09-06  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR testsuite/64078
	* c-c++-common/ubsan/object-size-9.c (s): Add alignment attribute.
	(f2, f3): Add inline attribute.
	* c-c++-common/ubsan/object-size-10.c (a, b): Add alignment attribute.

[-- Attachment #3: patch-pr64078.diff --]
[-- Type: application/octet-stream, Size: 1422 bytes --]

Index: gcc/testsuite/c-c++-common/ubsan/object-size-10.c
===================================================================
--- gcc/testsuite/c-c++-common/ubsan/object-size-10.c	(revision 224345)
+++ gcc/testsuite/c-c++-common/ubsan/object-size-10.c	(working copy)
@@ -2,8 +2,8 @@
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
 /* { dg-options "-fsanitize=undefined" } */
 
-static char a[128];
-static int b[128];
+static char a[128] __attribute__ ((aligned(4096)));
+static int b[128] __attribute__ ((aligned(4096)));
 
 __attribute__ ((noinline, noclone)) int
 fn1 (int i)
Index: gcc/testsuite/c-c++-common/ubsan/object-size-9.c
===================================================================
--- gcc/testsuite/c-c++-common/ubsan/object-size-9.c	(revision 224345)
+++ gcc/testsuite/c-c++-common/ubsan/object-size-9.c	(working copy)
@@ -11,7 +11,7 @@
 #endif
 struct U { int a : 5; int b : 19; int c : 8; };
 struct S { struct U d[10]; };
-struct S s;
+struct S s __attribute__ ((aligned(4096)));
 
 int
 f1 (struct T x, int i)
@@ -27,7 +27,7 @@
 /* { dg-output "\[^\n\r]*\\^\[^\n\r]*(\n|\r\n|\r)" } */
 
 #ifdef __cplusplus
-struct C
+inline struct C
 f2 (int i)
 {
   struct C x;
@@ -41,7 +41,7 @@
 /* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
 /* { dg-output "\[^\n\r]*\\^\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
 
-struct C
+inline struct C
 f3 (int i)
 {
   struct C x;

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-09-22 13:19 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-07  2:53 [PATCH] Fix PR64078 Bernd Edlinger
2015-09-07 10:41 ` Marek Polacek
2015-09-07 13:46   ` Bernd Edlinger
2015-09-08 19:30     ` Jeff Law
2015-09-09  9:18       ` Bernd Edlinger
2015-09-09 15:45         ` Jeff Law
2015-09-09 18:14           ` Bernd Edlinger
2015-09-17 15:06             ` Marek Polacek
2015-09-17 16:40               ` Jeff Law
2015-09-17 18:08                 ` Bernd Edlinger
2015-09-17 18:51                   ` Marek Polacek
2016-08-29  7:59                     ` Tom de Vries
2016-08-29 16:43                       ` Bernd Edlinger
2016-08-30  8:21                         ` Tom de Vries
2016-08-30  9:38                           ` Bernd Edlinger
2016-08-31  5:42                             ` Tom de Vries
2016-09-15 10:38                               ` Tom de Vries
2016-09-19 20:50                                 ` Jeff Law
2016-09-19 21:09                                   ` Bernd Edlinger
2016-09-19 21:34                                     ` Jeff Law
2016-09-22 13:26                                       ` Bernd Edlinger
2016-08-30  8:40                         ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).