Quoting Richard Guenther <richard.guent...@gmail.com>:
On Sun, Sep 25, 2011 at 2:36 PM, Joern Rennecke <amyl...@spamcop.net> wrote:
This patch has not been reviewed for eight weeks.
----- Forwarded message from amyl...@spamcop.net -----
Date: Mon, 01 Aug 2011 01:01:13 -0400
From: Joern Rennecke <amyl...@spamcop.net>
Reply-To: Joern Rennecke <amyl...@spamcop.net>
Subject: RFA: Testsuite fixes (2/3): struct padding / alignment
To: gcc-patches@gcc.gnu.org
I am working with a target port that adds alignment and/or padding to
certain
structures. This causes some tests to fail that assume such padding does
not exist.
Fixed by adding a packed attribute to the structures in question.
I think you should instead dg-skip the tests on your target. At least ...
Done thusly.
2013-07-26 Joern Rennecke <joern.renne...@embecosm.com>
Skip tests that make assumptions about struct layout that don't hold
on epiphany:
* g++.dg/cpp0x/cast.C: Skip for epiphany-*-*.
* g++.dg/cpp0x/iop.C: Likewise.
* g++.dg/cpp0x/named_refs.C: Likewise.
* g++.dg/cpp0x/rv1p.C: Likewise.
* g++.dg/cpp0x/rv2p.C: Likewise.
* g++.dg/cpp0x/rv3p.C: Likewise.
* g++.dg/cpp0x/rv4p.C: Likewise.
* g++.dg/cpp0x/rv5p.C: Likewise.
* g++.dg/cpp0x/rv6p.C: Likewise.
* g++.dg/cpp0x/rv7p.C: Likewise.
* g++.dg/cpp0x/rv8p.C: Likewise.
* g++.dg/ext/strncpy-chk1.C: Likewise.
* gcc.dg/builtin-object-size-10.c: Likewise.
* gcc.dg/builtin-object-size-11.c: Likewise.
* gcc.dg/builtin-stringop-chk-1.c: Likewise.
* gcc.dg/pr25805.c: Likewise.
* gcc.c-torture/execute/builtins/memcpy-chk.x: New file.
* gcc.c-torture/execute/builtins/memmove-chk.x: Likewise.
* gcc.c-torture/execute/builtins/mempcpy-chk.x: Likewise.
* gcc.c-torture/execute/builtins/memset-chk.x: Likewise.
* gcc.c-torture/execute/builtins/snprintf-chk.x: Likewise.
* gcc.c-torture/execute/builtins/sprintf-chk.x: Likewise.
* gcc.c-torture/execute/builtins/stpcpy-chk.x: Likewise.
* gcc.c-torture/execute/builtins/strcat-chk.x: Likewise.
* gcc.c-torture/execute/builtins/strcpy-chk.x: Likewise.
* gcc.c-torture/execute/builtins/strncat-chk.x: Likewise.
* gcc.c-torture/execute/builtins/strncpy-chk.x: Likewise.
* gcc.c-torture/execute/builtins/vsnprintf-chk.x: Likewise.
* gcc.c-torture/execute/builtins/vsprintf-chk.x: Likewise.
* gcc.c-torture/execute/zerolen-2.x: Likewise.
Index: testsuite/gcc.c-torture/execute/zerolen-2.x
===================================================================
--- testsuite/gcc.c-torture/execute/zerolen-2.x (revision 0)
+++ testsuite/gcc.c-torture/execute/zerolen-2.x (revision 201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of larger-than-word padding.
+ # to make this true for struct foo on epiphany would require
+ # __attribute__((packed,aligned(__alignof__(word)))) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/mempcpy-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test4 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/vsprintf-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/vsprintf-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/vsprintf-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test3_sub struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/vsnprintf-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test3_sub struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/snprintf-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/snprintf-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/snprintf-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test3 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test4 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/memcpy-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/memcpy-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/memcpy-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test4 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/strncpy-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/strncpy-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/strncpy-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test4 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/strncat-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/strncat-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/strncat-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test3 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/sprintf-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/sprintf-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/sprintf-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test3 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/memset-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/memset-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/memset-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test3 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/memmove-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/memmove-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/memmove-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test5 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/strcpy-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/strcpy-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/strcpy-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test4 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.c-torture/execute/builtins/strcat-chk.x
===================================================================
--- testsuite/gcc.c-torture/execute/builtins/strcat-chk.x (revision 0)
+++ testsuite/gcc.c-torture/execute/builtins/strcat-chk.x (revision
201268)
@@ -0,0 +1,7 @@
+if [istarget "epiphany-*-*"] {
+ # This test assumes the absence of struct padding.
+ # to make this true for test3 struct A on epiphany would require
+ # __attribute__((packed)) .
+ return 1
+}
+return 0
Index: testsuite/gcc.dg/builtin-object-size-10.c
===================================================================
--- testsuite/gcc.dg/builtin-object-size-10.c (revision 201267)
+++ testsuite/gcc.dg/builtin-object-size-10.c (revision 201268)
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-objsz1-details" } */
+// { dg-skip-if "packed attribute missing for drone_source_packet" {
"epiphany-*-*" } { "*" } { "" } }
typedef struct {
char sentinel[4];
Index: testsuite/gcc.dg/builtin-object-size-11.c
===================================================================
--- testsuite/gcc.dg/builtin-object-size-11.c (revision 201267)
+++ testsuite/gcc.dg/builtin-object-size-11.c (revision 201268)
@@ -1,6 +1,7 @@
/* PR48985 */
/* { dg-do run } */
/* { dg-options "-std=gnu89" } */
+/* { dg-skip-if "packed attribute missing for struct s" { "epiphany-*-*" } {
"*" } { "" } } */
extern void abort (void);
Index: testsuite/gcc.dg/pr25805.c
===================================================================
--- testsuite/gcc.dg/pr25805.c (revision 201267)
+++ testsuite/gcc.dg/pr25805.c (revision 201268)
@@ -2,6 +2,7 @@
storage for d1.a. */
/* { dg-do run } */
/* { dg-options "" } */
+/* { dg-skip-if "packed attribute missing for d1" { "epiphany-*-*" } { "*" } {
"" } } */
extern void abort (void);
extern void exit (int);
Index: testsuite/gcc.dg/builtin-stringop-chk-1.c
===================================================================
--- testsuite/gcc.dg/builtin-stringop-chk-1.c (revision 201267)
+++ testsuite/gcc.dg/builtin-stringop-chk-1.c (revision 201268)
@@ -3,6 +3,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -std=gnu99 -ftrack-macro-expansion=0" } */
/* { dg-additional-options "-mstructure-size-boundary=8" { target arm*-*-* } }
*/
+// { dg-skip-if "packed attribute missing for t" { "epiphany-*-*" } { "*" } {
"" } }
extern void abort (void);
Index: testsuite/g++.dg/ext/strncpy-chk1.C
===================================================================
--- testsuite/g++.dg/ext/strncpy-chk1.C (revision 201267)
+++ testsuite/g++.dg/ext/strncpy-chk1.C (revision 201268)
@@ -1,6 +1,7 @@
// PR c++/40502
// { dg-do compile }
// { dg-options "-O2" }
+// { dg-skip-if "packed attribute missing for struct A" { "epiphany-*-*" } {
"*" } { "" } }
struct A { char x[12], y[35]; };
struct B { char z[50]; };
Index: testsuite/g++.dg/cpp0x/rv2p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv2p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv2p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/rv4p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv4p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv4p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/named_refs.C
===================================================================
--- testsuite/g++.dg/cpp0x/named_refs.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/named_refs.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one" { "epiphany-*-*" } {
"*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/rv6p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv6p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv6p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/cast.C
===================================================================
--- testsuite/g++.dg/cpp0x/cast.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/cast.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one" { "epiphany-*-*" } {
"*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/rv8p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv8p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv8p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/rv1p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv1p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv1p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/rv3p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv3p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv3p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/iop.C
===================================================================
--- testsuite/g++.dg/cpp0x/iop.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/iop.C (revision 201268)
@@ -8,6 +8,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one" { "epiphany-*-*" } {
"*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/rv5p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv5p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv5p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};
Index: testsuite/g++.dg/cpp0x/rv7p.C
===================================================================
--- testsuite/g++.dg/cpp0x/rv7p.C (revision 201267)
+++ testsuite/g++.dg/cpp0x/rv7p.C (revision 201268)
@@ -4,6 +4,7 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-skip-if "packed attribute missing for struct one/three/five/seven" {
"epiphany-*-*" } { "*" } { "" } }
template <bool> struct sa;
template <> struct sa<true> {};