public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [testsuite, PR83612] Fix 'memory cannot be printed' in gcc.dg/ubsan/object-size-9.c
@ 2017-12-30 10:54 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2017-12-30 10:54 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches

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

Hi,

I ran into the following failure:
...
FAIL: gcc.dg/ubsan/object-size-9.c   -O2  output pattern test, is 
gcc.dg/ubsan/object-size-9.c:11:13: runtime error: load of address 
0x000000600ff2 with insufficient space for an object of type 'char'
0x000000600ff2: note: pointer points here
<memory cannot be printed>
...
The failure is because the test-case expects the sanitizer to access the 
memory and print its contents, but the memory happens not to be not 
accessible.

I've applied the same fix as was applied in 
c-c++-common/ubsan/object-size-9.c for PR sanitizer/64078: add an 
alignment attribute to the variable to ensure that the memory after the 
variable is accessible.

Tested on x86_64.

Committed as obvious.

Thanks,
- Tom

[-- Attachment #2: 0001-Fix-memory-cannot-be-printed-in-gcc.dg-ubsan-object-size-9.c.patch --]
[-- Type: text/x-patch, Size: 726 bytes --]

Fix 'memory cannot be printed' in gcc.dg/ubsan/object-size-9.c

2017-12-30  Tom de Vries  <tom@codesourcery.com>

	PR testsuite/83612
	* gcc.dg/ubsan/object-size-9 (t): Add alignment attribute.

---
 gcc/testsuite/gcc.dg/ubsan/object-size-9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/ubsan/object-size-9.c b/gcc/testsuite/gcc.dg/ubsan/object-size-9.c
index e0a2980..41c4a94 100644
--- a/gcc/testsuite/gcc.dg/ubsan/object-size-9.c
+++ b/gcc/testsuite/gcc.dg/ubsan/object-size-9.c
@@ -3,7 +3,7 @@
 /* { dg-options "-fsanitize=undefined" } */
 
 struct T { int c; char d[]; };
-struct T t = { 1, "a" };
+struct T t __attribute__ ((aligned(4096))) = { 1, "a" };
 
 int
 baz (int i)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-12-30 10:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-30 10:54 [testsuite, PR83612] Fix 'memory cannot be printed' in gcc.dg/ubsan/object-size-9.c 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).