aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2018-10-17 17:53:02 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2018-10-17 17:53:02 +0000
commit2068b1c267a519a279ca71f4db9c9baf354a6a5c (patch)
treebf633b8b07351cf0c7f5cb2a2347184499817d3b /gcc/testsuite/gcc.c-torture/execute
parentca569ae0acb27fcef7a85198be532b44d788d04c (diff)
PR middle-end/87623
* fold-const.c (fold_truth_andor_1): If the right side is not constant, bail out if both sides do not have the same storage order. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@265244 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr87623.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr87623.c b/gcc/testsuite/gcc.c-torture/execute/pr87623.c
new file mode 100644
index 00000000000..54d8b5e4571
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr87623.c
@@ -0,0 +1,34 @@
+/* PR middle-end/87623 */
+/* Testcase by George Thopas <george.thopas@gmail.com> */
+
+struct be {
+ unsigned short pad[1];
+ unsigned char a;
+ unsigned char b;
+} __attribute__((scalar_storage_order("big-endian")));
+
+typedef struct be t_be;
+
+struct le {
+ unsigned short pad[3];
+ unsigned char a;
+ unsigned char b;
+};
+
+typedef struct le t_le;
+
+int a_or_b_different(t_be *x,t_le *y)
+{
+ return (x->a != y->a) || (x->b != y->b);
+}
+
+int main (void)
+{
+ t_be x = { .a=1, .b=2 };
+ t_le y = { .a=1, .b=2 };
+
+ if (a_or_b_different(&x,&y))
+ __builtin_abort ();
+
+ return 0;
+}