Add C testcases for PR 86659
authorAndrew Pinski <apinski@marvell.com>
Fri, 13 Dec 2019 08:31:42 +0000 (08:31 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 13 Dec 2019 08:31:42 +0000 (00:31 -0800)
testsuite/ChangeLog:
2019-12-13  Andrew Pinski  <apinski@marvell.com>

       * gcc.c-torture/execute/pr86659-1.c: New test.
       * gcc.c-torture/execute/pr86659-2.c: New test.

From-SVN: r279338

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr86659-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr86659-2.c [new file with mode: 0644]

index 224f8abf93407283773da84d7f0163a4c3930619..021c2a0b7e163b7f48020525bf5792fe7bce6a55 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-13  Andrew Pinski  <apinski@marvell.com>
+
+       * gcc.c-torture/execute/pr86659-1.c: New test.
+       * gcc.c-torture/execute/pr86659-2.c: New test.
+
 2019-12-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/92904
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr86659-1.c b/gcc/testsuite/gcc.c-torture/execute/pr86659-1.c
new file mode 100644 (file)
index 0000000..693b9aa
--- /dev/null
@@ -0,0 +1,42 @@
+#define ENDIANBIG __attribute((scalar_storage_order ("big-endian")))
+
+typedef struct ENDIANBIG 
+{
+  unsigned long long  field0:29;
+  unsigned long long  field1:4; 
+  unsigned long long  field2:31;
+}struct1;  
+
+int
+main(void)
+{
+  int value1 = 0;
+  int value2 = 0;
+  int value3 = 0;
+  unsigned int flag;
+  struct1 var1;
+  var1.field0 = 23;
+  
+  flag = var1.field0;
+  value1 = ((var1.field0)?10:20);
+  if(var1.field0)
+    {
+      value2 =  10;
+    } else
+    {
+      value2 = 20;
+    }
+
+  value3 = ((flag)?10:20);
+
+  if (value1 != 10)
+    __builtin_abort ();
+
+  if (value2 != 10)
+    __builtin_abort ();
+
+  if (value3 != 10)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr86659-2.c b/gcc/testsuite/gcc.c-torture/execute/pr86659-2.c
new file mode 100644 (file)
index 0000000..71b98d7
--- /dev/null
@@ -0,0 +1,42 @@
+#define ENDIANBIG __attribute((scalar_storage_order ("little-endian")))
+
+typedef struct ENDIANBIG 
+{
+  unsigned long long  field0:29;
+  unsigned long long  field1:4; 
+  unsigned long long  field2:31;
+}struct1;  
+
+int
+main(void)
+{
+  int value1 = 0;
+  int value2 = 0;
+  int value3 = 0;
+  unsigned int flag;
+  struct1 var1;
+  var1.field0 = 23;
+  
+  flag = var1.field0;
+  value1 = ((var1.field0)?10:20);
+  if(var1.field0)
+    {
+      value2 =  10;
+    } else
+    {
+      value2 = 20;
+    }
+
+  value3 = ((flag)?10:20);
+
+  if (value1 != 10)
+    __builtin_abort ();
+
+  if (value2 != 10)
+    __builtin_abort ();
+
+  if (value3 != 10)
+    __builtin_abort ();
+
+  return 0;
+}