https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64078

--- Comment #9 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
this should avoid the random '<memory cannot be printed>' issue:

Index: object-size-9.c
===================================================================
--- object-size-9.c    (revision 222007)
+++ 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)


But this still fails:
make check-gcc-c++ RUNTESTFLAGS="ubsan.exp=object-size-9.c
--target_board='unix{-fpic}'"

Running /home/ed/gnu/gcc-trunk/gcc/testsuite/g++.dg/ubsan/ubsan.exp ...
FAIL: c-c++-common/ubsan/object-size-9.c   -O2  output pattern test, is
c-c++-common/ubsan/object-size-9.c:21:11: runtime error: load of address
0x7ffdfb19d63c with insufficient space for an object of type 'char'
0x7ffdfb19d63c: note: pointer points here
  01 00 00 00 00 00 00 00  85 d3 55 06 3e 2b 00 00  00 00 00 00 00 00 00 00  00
00 00 00 00 00 00 00
              ^ 
c-c++-common/ubsan/object-size-9.c:34:8: runtime error: index 12 out of bounds
for type 'char [8]'
c-c++-common/ubsan/object-size-9.c:64:15: runtime error: index 12 out of bounds
for type 'U [10]'
c-c++-common/ubsan/object-size-9.c:64:17: runtime error: load of address
0x000000603030 with insufficient space for an object of type 'unsigned int'
0x000000603030: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
c-c++-common/ubsan/object-size-9.c:78:13: runtime error: load of address
0x000000603030 with insufficient space for an object of type 'unsigned int'
0x000000603030: note: pointer points here
 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
00 00 00  00 00 00 00
              ^ 
, should match load of address [^
^M]* with insufficient space for an object of type 'char'[^
^M]*(
|
|^M)[^
^M]*note: pointer points here[^
^M]*(
|
|^M)[^
^M]*[^
^M]*(
|
|^M)[^
^M]*\^[^
^M]*(
|
|^M)[^
^M]*index 12 out of bounds for type 'char \[8\]'[^
^M]*(
|
|^M)[^
^M]*store to address [^
^M]* with insufficient space for an object of type 'char'[^
^M]*(
|
|^M)[^
^M]*note: pointer points here[^
^M]*(
|
|^M)[^
^M]*[^
^M]*(
|
|^M)[^
^M]*\^[^
^M]*(
|

Reply via email to