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

--- Comment #11 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
I don't know if that is a bug or not.

I see that -fpic does not inline f2 and f3.

The two messages seem to be always missing when
not inlined...

So, how about this:

Index: gcc/testsuite/c-c++-common/ubsan/object-size-9.c
===================================================================
--- gcc/testsuite/c-c++-common/ubsan/object-size-9.c    (revision 222007)
+++ 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;


With this patch,

make check-gcc-c++ RUNTESTFLAGS="ubsan.exp=object-size-9.c
--target_board='unix{-fpic,-mcmodel=medium,-fpic\
-mcmodel=medium,-mcmodel=large,-fpic\ -mcmodel=large}'"

passes, but

make check-gcc-c++ RUNTESTFLAGS="ubsan.exp=object-size-9.c
--target_board='unix{-fno-inline}'"

still fails of course.

Reply via email to