From: Andrew Pinski Date: Fri, 13 Dec 2019 08:31:42 +0000 (+0000) Subject: Add C testcases for PR 86659 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=db0aa34fb45afad19e56c573321d4c8ebaf56833;p=gcc.git Add C testcases for PR 86659 testsuite/ChangeLog: 2019-12-13 Andrew Pinski * gcc.c-torture/execute/pr86659-1.c: New test. * gcc.c-torture/execute/pr86659-2.c: New test. From-SVN: r279338 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 224f8abf934..021c2a0b7e1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-12-13 Andrew Pinski + + * gcc.c-torture/execute/pr86659-1.c: New test. + * gcc.c-torture/execute/pr86659-2.c: New test. + 2019-12-12 Jakub Jelinek 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 index 00000000000..693b9aa8438 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr86659-1.c @@ -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 index 00000000000..71b98d7fb46 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr86659-2.c @@ -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; +}