Add dg-require-effective-target exceptions
authorAndrew Stubbs <ams@codesourcery.com>
Thu, 17 Jan 2019 12:35:28 +0000 (12:35 +0000)
committerAndrew Stubbs <ams@gcc.gnu.org>
Thu, 17 Jan 2019 12:35:28 +0000 (12:35 +0000)
There are a number of tests that fail because they assume that exceptions are
available, but GCN does not support them, yet.

This patch adds "dg-require-effective-target exceptions" in all the affected
tests.  There's probably an automatic way to test for exceptions, but the
current implementation simply says that AMD GCN does not support them.  This
should ensure that no other targets are affected by the change.

2019-01-17  Andrew Stubbs  <ams@codesourcery.com>
    Kwok Cheung Yeung  <kcy@codesourcery.com>
    Julian Brown  <julian@codesourcery.com>
    Tom de Vries  <tom@codesourcery.com>

gcc/
* doc/sourcebuild.texi: Document dg-required-effective-target
exceptions.

gcc/testsuite/
* c-c++-common/ubsan/pr71512-1.c: Require exceptions.
* c-c++-common/ubsan/pr71512-2.c: Require exceptions.
* gcc.c-torture/compile/pr34648.c: Require exceptions.
* gcc.c-torture/compile/pr41469.c: Require exceptions.
* gcc.dg/20111216-1.c: Require exceptions.
* gcc.dg/cleanup-10.c: Require exceptions.
* gcc.dg/cleanup-11.c: Require exceptions.
* gcc.dg/cleanup-12.c: Require exceptions.
* gcc.dg/cleanup-13.c: Require exceptions.
* gcc.dg/cleanup-5.c: Require exceptions.
* gcc.dg/cleanup-8.c: Require exceptions.
* gcc.dg/cleanup-9.c: Require exceptions.
* gcc.dg/gomp/pr29955.c: Require exceptions.
* gcc.dg/lto/pr52097_0.c: Require exceptions.
* gcc.dg/nested-func-5.c: Require exceptions.
* gcc.dg/pch/except-1.c: Require exceptions.
* gcc.dg/pch/valid-2.c: Require exceptions.
* gcc.dg/pr41470.c: Require exceptions.
* gcc.dg/pr42427.c: Require exceptions.
* gcc.dg/pr44545.c: Require exceptions.
* gcc.dg/pr47086.c: Require exceptions.
* gcc.dg/pr51481.c: Require exceptions.
* gcc.dg/pr51644.c: Require exceptions.
* gcc.dg/pr52046.c: Require exceptions.
* gcc.dg/pr54669.c: Require exceptions.
* gcc.dg/pr56424.c: Require exceptions.
* gcc.dg/pr64465.c: Require exceptions.
* gcc.dg/pr65802.c: Require exceptions.
* gcc.dg/pr67563.c: Require exceptions.
* gcc.dg/tree-ssa/pr41469-1.c: Require exceptions.
* gcc.dg/tree-ssa/ssa-dse-28.c: Require exceptions.
* gcc.dg/vect/pr46663.c: Require exceptions.
* lib/target-supports.exp (check_effective_target_exceptions): New.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r268025

36 files changed:
gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/pr71512-1.c
gcc/testsuite/c-c++-common/ubsan/pr71512-2.c
gcc/testsuite/gcc.c-torture/compile/pr34648.c
gcc/testsuite/gcc.c-torture/compile/pr41469.c
gcc/testsuite/gcc.dg/20111216-1.c
gcc/testsuite/gcc.dg/cleanup-10.c
gcc/testsuite/gcc.dg/cleanup-11.c
gcc/testsuite/gcc.dg/cleanup-12.c
gcc/testsuite/gcc.dg/cleanup-13.c
gcc/testsuite/gcc.dg/cleanup-5.c
gcc/testsuite/gcc.dg/cleanup-8.c
gcc/testsuite/gcc.dg/cleanup-9.c
gcc/testsuite/gcc.dg/gomp/pr29955.c
gcc/testsuite/gcc.dg/lto/pr52097_0.c
gcc/testsuite/gcc.dg/nested-func-5.c
gcc/testsuite/gcc.dg/pch/except-1.c
gcc/testsuite/gcc.dg/pch/valid-2.c
gcc/testsuite/gcc.dg/pr41470.c
gcc/testsuite/gcc.dg/pr42427.c
gcc/testsuite/gcc.dg/pr44545.c
gcc/testsuite/gcc.dg/pr47086.c
gcc/testsuite/gcc.dg/pr51481.c
gcc/testsuite/gcc.dg/pr51644.c
gcc/testsuite/gcc.dg/pr52046.c
gcc/testsuite/gcc.dg/pr54669.c
gcc/testsuite/gcc.dg/pr56424.c
gcc/testsuite/gcc.dg/pr64465.c
gcc/testsuite/gcc.dg/pr65802.c
gcc/testsuite/gcc.dg/pr67563.c
gcc/testsuite/gcc.dg/tree-ssa/pr41469-1.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-28.c
gcc/testsuite/gcc.dg/vect/pr46663.c
gcc/testsuite/lib/target-supports.exp

index 4cc44d7279cde3d50630504c4f6ad37c7f223276..2a4130e9193db4fdb280fcefd5ce0f4b92c4b07c 100644 (file)
@@ -1,3 +1,11 @@
+2019-01-17  Andrew Stubbs  <ams@codesourcery.com>
+           Kwok Cheung Yeung  <kcy@codesourcery.com>
+           Julian Brown  <julian@codesourcery.com>
+           Tom de Vries  <tom@codesourcery.com>
+
+       * doc/sourcebuild.texi: Document dg-required-effective-target
+       exceptions.
+
 2019-01-17  Andrew Stubbs  <ams@codesourcery.com>
            Kwok Cheung Yeung  <kcy@codesourcery.com>
            Julian Brown  <julian@codesourcery.com>
index 1970f44d6dcdab7a0fec281f77af340cbe94cc65..c93a516f9662830a03bf30448bb5de1d95ea6359 100644 (file)
@@ -2228,6 +2228,9 @@ Target uses @code{__cxa_atexit}.
 @item default_packed
 Target has packed layout of structure members by default.
 
+@item exceptions
+Target supports exceptions.
+
 @item fgraphite
 Target supports Graphite optimizations.
 
index 632da85dfbebdbbdeea72b85c86a5bcd12671d3b..c4e1dd5db7036c7de7616da347c992ac698bbd81 100644 (file)
@@ -1,3 +1,42 @@
+2019-01-17  Andrew Stubbs  <ams@codesourcery.com>
+           Kwok Cheung Yeung  <kcy@codesourcery.com>
+           Julian Brown  <julian@codesourcery.com>
+           Tom de Vries  <tom@codesourcery.com>
+
+       * c-c++-common/ubsan/pr71512-1.c: Require exceptions.
+       * c-c++-common/ubsan/pr71512-2.c: Require exceptions.
+       * gcc.c-torture/compile/pr34648.c: Require exceptions.
+       * gcc.c-torture/compile/pr41469.c: Require exceptions.
+       * gcc.dg/20111216-1.c: Require exceptions.
+       * gcc.dg/cleanup-10.c: Require exceptions.
+       * gcc.dg/cleanup-11.c: Require exceptions.
+       * gcc.dg/cleanup-12.c: Require exceptions.
+       * gcc.dg/cleanup-13.c: Require exceptions.
+       * gcc.dg/cleanup-5.c: Require exceptions.
+       * gcc.dg/cleanup-8.c: Require exceptions.
+       * gcc.dg/cleanup-9.c: Require exceptions.
+       * gcc.dg/gomp/pr29955.c: Require exceptions.
+       * gcc.dg/lto/pr52097_0.c: Require exceptions.
+       * gcc.dg/nested-func-5.c: Require exceptions.
+       * gcc.dg/pch/except-1.c: Require exceptions.
+       * gcc.dg/pch/valid-2.c: Require exceptions.
+       * gcc.dg/pr41470.c: Require exceptions.
+       * gcc.dg/pr42427.c: Require exceptions.
+       * gcc.dg/pr44545.c: Require exceptions.
+       * gcc.dg/pr47086.c: Require exceptions.
+       * gcc.dg/pr51481.c: Require exceptions.
+       * gcc.dg/pr51644.c: Require exceptions.
+       * gcc.dg/pr52046.c: Require exceptions.
+       * gcc.dg/pr54669.c: Require exceptions.
+       * gcc.dg/pr56424.c: Require exceptions.
+       * gcc.dg/pr64465.c: Require exceptions.
+       * gcc.dg/pr65802.c: Require exceptions.
+       * gcc.dg/pr67563.c: Require exceptions.
+       * gcc.dg/tree-ssa/pr41469-1.c: Require exceptions.
+       * gcc.dg/tree-ssa/ssa-dse-28.c: Require exceptions.
+       * gcc.dg/vect/pr46663.c: Require exceptions.
+       * lib/target-supports.exp (check_effective_target_exceptions): New.
+
 2019-01-17  Tamar Christina  <tamar.christina@arm.com>
 
        PR target/88851
index 2a90ab18d5179f2d22bbc24b8428a96a3c8058ba..8af93656d91d7b1ea6a7e2bff11e69d4b3f9f0e2 100644 (file)
@@ -1,5 +1,6 @@
 /* PR c/71512 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions -fsanitize=undefined" } */
+/* { dg-require-effective-target exceptions } */
 
 #include "../../gcc.dg/pr44545.c"
index 1c955930be83bc4be5eb6207a11e990c017ffc3b..0c1693488cad7cd3839cb7f677d9f11af1fb2fd2 100644 (file)
@@ -1,5 +1,6 @@
 /* PR c/71512 */
 /* { dg-do compile } */
 /* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv -fsanitize=undefined" } */
+/* { dg-require-effective-target exceptions } */
 
 #include "../../gcc.dg/pr47086.c"
index 8bcdae0501af1a4396faad30b4aace6660c9e3cb..90a88b90361f1285f024fd26131620da605e3300 100644 (file)
@@ -1,6 +1,7 @@
 /* PR tree-optimization/34648 */
 
 /* { dg-options "-fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 extern const unsigned short int **bar (void) __attribute__ ((const));
 const char *a;
index 5917794cc3468aa3ac39057b376a4fdb01f4b84f..923bca2f8485f8c73355a03d1f1392a8ff7f9e13 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-options "-fexceptions" } */
 /* { dg-skip-if "requires alloca" { ! alloca } { "-O0" } { "" } } */
+/* { dg-require-effective-target exceptions } */
 
 void
 af (void *a)
index cd82cf929849cc4da50b021c898502d677c2d827..7f9395e41e51bdf1f4fe330dc8ac9b816d0932c9 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fexceptions -fnon-call-exceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 extern void f2 () __attribute__ ((noreturn));
 void
index 16035b1ca437b0bb866c50138566ad68596f3176..1af63ea6eafeecd4923da8fbbc53af18786d9907 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
 /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
+/* { dg-require-effective-target exceptions } */
 /* Verify that cleanups work with exception handling through signal frames
    on alternate stack.  */
 
index ccc61ed41b873a12506b6d8d372261e9e53ee94f..c1f19fe2cf94a017cf2817f1f70cf2b96dd8593e 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
 /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
+/* { dg-require-effective-target exceptions } */
 /* Verify that cleanups work with exception handling through realtime signal
    frames on alternate stack.  */
 
index efb9a58ce8a28ec7c009dfc01692701bdbf20a75..2171e35de9da0658b9781fbdb7765bf7356fdcff 100644 (file)
@@ -4,6 +4,7 @@
 /* { dg-options "-O2 -fexceptions" } */
 /* { dg-skip-if "" { "ia64-*-hpux11.*" } } */
 /* { dg-skip-if "" { ! nonlocal_goto } } */
+/* { dg-require-effective-target exceptions } */
 /* Verify unwind info in presence of alloca.  */
 
 #include <unwind.h>
index 8a8db277dd6417e3ca6bdfc9395ee30f85ba8ee3..1b7ea5c4b284d6005a6ae0c8f3fcbb4441aa2752 100644 (file)
@@ -3,6 +3,7 @@
 /* { dg-options "-fexceptions" } */
 /* { dg-skip-if "" { "ia64-*-hpux11.*" } } */
 /* { dg-skip-if "" { ! nonlocal_goto } } */
+/* { dg-require-effective-target exceptions } */
 /* Verify DW_OP_* handling in the unwinder.  */
 
 #include <unwind.h>
index 4257f9e0398ba03df2bb3b049fd44e6a8f435e4f..9ed2a7c95f5f64115d7a0c9be5f78719f2926d8a 100644 (file)
@@ -3,6 +3,7 @@
 /* { dg-options "-fexceptions" } */
 /* { dg-skip-if "" { "ia64-*-hpux11.*" } } */
 /* { dg-skip-if "" { ! nonlocal_goto } } */
+/* { dg-require-effective-target exceptions } */
 /* Verify that cleanups work with exception handling.  */
 
 #include <unwind.h>
index 553c0385d5d2f462aaccf49c279b89608337aacf..45abdb2a0503d69fe659e9ba4328dcd27b0f6665 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
 /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
+/* { dg-require-effective-target exceptions } */
 /* Verify that cleanups work with exception handling through signal
    frames.  */
 
index fe2807234c24fcb13d5e4ffa90dcbbab93bf41df..98dc268e50d9dc11b57bfb86b4e55a08d4e753bc 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
 /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
+/* { dg-require-effective-target exceptions } */
 /* Verify that cleanups work with exception handling through realtime
    signal frames.  */
 
index e49c11cae1dd4993f4faf7a14f5962a59aa8e95d..102898c839367b529b979795917d05b6f68dd63a 100644 (file)
@@ -1,6 +1,7 @@
 /* PR c/29955 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fopenmp -fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 extern void bar (int);
 
index cd4af5d1f299808952b65242b0416131525f1c2a..1b3fda3b91139893aa7e3b5dc4fc437cccbedfb6 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-lto-options { { -O -flto -fexceptions -fnon-call-exceptions --param allow-store-data-races=0 } } } */
+/* { dg-require-effective-target exceptions } */
 
 typedef struct { unsigned int e0 : 16; } s1;
 typedef struct { unsigned int e0 : 16; } s2;
index 3545f37e5cc11dad0a16346cb375313d63ec4e81..591f8a2c1a9930d23bd19689f8114e7aa0611108 100644 (file)
@@ -2,6 +2,7 @@
 /* { dg-options "-fexceptions" } */
 /* PR28516: ICE generating ARM unwind directives for nested functions.  */
 /* { dg-require-effective-target trampolines } */
+/* { dg-require-effective-target exceptions } */
 
 void ex(int (*)(void));
 void foo(int i)
index f81b098d7d88111f91cf2f098a06708fdde52673..30350edbd39692c833c95c35fd387f353efa42a7 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-options "-fexceptions -I." } */
+/* { dg-require-effective-target exceptions } */
 #include "except-1.h"
 
 int main(void) 
index 3d8cb1427f3627125181b3836b6c496ade943712..15a57c9077e4cca663e01c8b3a48897fdb3a4675 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-options "-I. -Winvalid-pch -fexceptions" } */
-
+/* { dg-require-effective-target exceptions } */
 #include "valid-2.h" /* { dg-warning "settings for -fexceptions do not match" } */
 /* { dg-error "No such file" "no such file" { target *-*-* } 0 } */
 /* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */
index 7ef008615239c626c1318f06e1c0addac94b3614..7374facea0ff5c640cda4621c48c6d19d27a0270 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-fexceptions" } */
 /* { dg-require-effective-target alloca } */
+/* { dg-require-effective-target exceptions } */
 
 void cf (void *);
 
index cb43dd2affba209cb0c77d4455ee8210cf2fe9dd..cb290fea3f19da28725cf90c599ed3164fb1cf65 100644 (file)
@@ -2,6 +2,7 @@
 /* { dg-options "-O2 -fexceptions -fnon-call-exceptions -fpeel-loops" } */
 /* { dg-add-options c99_runtime } */
 /* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target exceptions } */
 
 #include <complex.h>
 
index 8058261f850fa68571e410cf589bd32ec39d3175..37f75f16f999297c7061942348ee4e273cad8282 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 void
 DrawChunk(int *tabSize, int x) 
 {
index 71743fe4fe5cdf9c6a4d4ac31cdbb02a8a82a223..473e802bc1f7a3bcfc60a0bdc52d4945a2f37c1f 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv" } */
+/* { dg-require-effective-target exceptions } */
 
 void
 foo ()
index d883d475cfcfabb5018d7a3fae8ce874e934c8d8..a35f8f3875103b1e9874231a34b5b7bc56f2fba6 100644 (file)
@@ -1,6 +1,7 @@
 /* PR tree-optimization/51481 */
 /* { dg-do compile } */
 /* { dg-options "-O -fexceptions -fipa-cp -fipa-cp-clone" } */
+/* { dg-require-effective-target exceptions } */
 
 extern const unsigned short int **foo (void)
   __attribute__ ((__nothrow__, __const__));
index 2038a0c4b930481a3fa980aac3ec9363e064bc73..e23c02f9fd6aed6bb13c61ca0955182254992c3b 100644 (file)
@@ -1,6 +1,7 @@
 /* PR middle-end/51644 */
 /* { dg-do compile } */
 /* { dg-options "-Wall -fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 #include <stdarg.h>
 
index e72061f9908e2a5550b9ff99f5ae4823bd11d23c..f0873e2008ff1344368b8823fef094b71418b783 100644 (file)
@@ -1,6 +1,7 @@
 /* PR tree-optimization/52046 */
 /* { dg-do compile } */
 /* { dg-options "-O3 -fexceptions -fnon-call-exceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 extern float a[], b[], c[], d[];
 extern int k[];
index b68c0476a4953d20b07b5d8f21eda6aaee2269dd..48967ed5da2a9f7a523c02781b991a9bd89a1c19 100644 (file)
@@ -3,6 +3,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-O2 -fexceptions -fnon-call-exceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 int a[10];
 
index a724c640e993a0e1aabcb3a35426c39d72297ac7..7f28f044710fe64b839ba3c41a0913dcd84f8002 100644 (file)
@@ -2,6 +2,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-O2 -fexceptions -fnon-call-exceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 extern long double cosl (long double);
 extern long double sinl (long double);
index acfa952b00c2e9c5d800c7fb0944922ff6a93170..d1d17493acc95aa7aac3caa214956eaf38d98e6a 100644 (file)
@@ -1,6 +1,7 @@
 /* PR tree-optimization/64465 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 extern int foo (int *);
 extern int bar (int, int);
index fcec234dc0b84aba380b7f194257a7fbc6c48b48..0721ca81bf654803a020247fe3c91df2b569ec04 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O0 -fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 #include <stdarg.h>
 
index 34a78a23a939511eed0d60e871f4d4ca768ecb64..5a727b832fb4ef25a2d532691f601edaf752e449 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 static void
 emit_package (int p1)
index 6be7cd965575b225746cdd97bf688d27b6228ccf..eb8e1f2551622d3ef8eadae2c9ec7207faa1e13d 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fexceptions -fdump-tree-optimized" } */
+/* { dg-require-effective-target exceptions } */
 
 void af (void *a);
 
index d35377ba96b7360935ea8136abeee46a807acb96..d3a1bbc5ce53231d62b7fa60beebb2b33a715168 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-dse-details -fexceptions -fnon-call-exceptions -fno-isolate-erroneous-paths-dereference" } */
+/* { dg-require-effective-target exceptions } */
 
 
 int foo (int *p, int b)
index 457ceae6a5776d15343ad083f58793f1b947910b..c2e56bb253a75aa97052c7dbd0500a44720ba30b 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-additional-options "-O -fexceptions" } */
+/* { dg-require-effective-target exceptions } */
 
 typedef __attribute__ ((const)) int (*bart) (void);
 
index 88fbc8d7fe4c430ea273783ec83a1f9e102e1f40..cc6e2bb4c3777fd3cd04246d71f8f5676c180f39 100644 (file)
@@ -8510,6 +8510,16 @@ proc check_effective_target_fenv_exceptions {} {
     } [add_options_for_ieee "-std=gnu99"]]
 }
 
+# Return 1 if -fexceptions is supported.
+
+proc check_effective_target_exceptions {} {
+    if { [istarget amdgcn*-*-*] } {
+       return 0
+    }
+    return 1
+}
+
+
 proc check_effective_target_tiny {} {
     return [check_cached_effective_target tiny {
       if { [istarget aarch64*-*-*]