Commit 3f21b8e3 by Andrew Stubbs Committed by Andrew Stubbs

Add dg-require-effective-target exceptions

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
parent 7431c1a1
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
Kwok Cheung Yeung <kcy@codesourcery.com> Kwok Cheung Yeung <kcy@codesourcery.com>
Julian Brown <julian@codesourcery.com> Julian Brown <julian@codesourcery.com>
Tom de Vries <tom@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>
Tom de Vries <tom@codesourcery.com>
Jan Hubicka <hubicka@ucw.cz> Jan Hubicka <hubicka@ucw.cz>
Martin Jambor <mjambor@suse.cz> Martin Jambor <mjambor@suse.cz>
......
...@@ -2228,6 +2228,9 @@ Target uses @code{__cxa_atexit}. ...@@ -2228,6 +2228,9 @@ Target uses @code{__cxa_atexit}.
@item default_packed @item default_packed
Target has packed layout of structure members by default. Target has packed layout of structure members by default.
@item exceptions
Target supports exceptions.
@item fgraphite @item fgraphite
Target supports Graphite optimizations. Target supports Graphite optimizations.
......
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> 2019-01-17 Tamar Christina <tamar.christina@arm.com>
PR target/88851 PR target/88851
......
/* PR c/71512 */ /* PR c/71512 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions -fsanitize=undefined" } */ /* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions -fsanitize=undefined" } */
/* { dg-require-effective-target exceptions } */
#include "../../gcc.dg/pr44545.c" #include "../../gcc.dg/pr44545.c"
/* PR c/71512 */ /* PR c/71512 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv -fsanitize=undefined" } */ /* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv -fsanitize=undefined" } */
/* { dg-require-effective-target exceptions } */
#include "../../gcc.dg/pr47086.c" #include "../../gcc.dg/pr47086.c"
/* PR tree-optimization/34648 */ /* PR tree-optimization/34648 */
/* { dg-options "-fexceptions" } */ /* { dg-options "-fexceptions" } */
/* { dg-require-effective-target exceptions } */
extern const unsigned short int **bar (void) __attribute__ ((const)); extern const unsigned short int **bar (void) __attribute__ ((const));
const char *a; const char *a;
......
/* { dg-options "-fexceptions" } */ /* { dg-options "-fexceptions" } */
/* { dg-skip-if "requires alloca" { ! alloca } { "-O0" } { "" } } */ /* { dg-skip-if "requires alloca" { ! alloca } { "-O0" } { "" } } */
/* { dg-require-effective-target exceptions } */
void void
af (void *a) af (void *a)
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -fexceptions -fnon-call-exceptions" } */ /* { dg-options "-O -fexceptions -fnon-call-exceptions" } */
/* { dg-require-effective-target exceptions } */
extern void f2 () __attribute__ ((noreturn)); extern void f2 () __attribute__ ((noreturn));
void void
......
/* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */ /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */ /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* { dg-require-effective-target exceptions } */
/* Verify that cleanups work with exception handling through signal frames /* Verify that cleanups work with exception handling through signal frames
on alternate stack. */ on alternate stack. */
......
/* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */ /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */ /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* { dg-require-effective-target exceptions } */
/* Verify that cleanups work with exception handling through realtime signal /* Verify that cleanups work with exception handling through realtime signal
frames on alternate stack. */ frames on alternate stack. */
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
/* { dg-options "-O2 -fexceptions" } */ /* { dg-options "-O2 -fexceptions" } */
/* { dg-skip-if "" { "ia64-*-hpux11.*" } } */ /* { dg-skip-if "" { "ia64-*-hpux11.*" } } */
/* { dg-skip-if "" { ! nonlocal_goto } } */ /* { dg-skip-if "" { ! nonlocal_goto } } */
/* { dg-require-effective-target exceptions } */
/* Verify unwind info in presence of alloca. */ /* Verify unwind info in presence of alloca. */
#include <unwind.h> #include <unwind.h>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/* { dg-options "-fexceptions" } */ /* { dg-options "-fexceptions" } */
/* { dg-skip-if "" { "ia64-*-hpux11.*" } } */ /* { dg-skip-if "" { "ia64-*-hpux11.*" } } */
/* { dg-skip-if "" { ! nonlocal_goto } } */ /* { dg-skip-if "" { ! nonlocal_goto } } */
/* { dg-require-effective-target exceptions } */
/* Verify DW_OP_* handling in the unwinder. */ /* Verify DW_OP_* handling in the unwinder. */
#include <unwind.h> #include <unwind.h>
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/* { dg-options "-fexceptions" } */ /* { dg-options "-fexceptions" } */
/* { dg-skip-if "" { "ia64-*-hpux11.*" } } */ /* { dg-skip-if "" { "ia64-*-hpux11.*" } } */
/* { dg-skip-if "" { ! nonlocal_goto } } */ /* { dg-skip-if "" { ! nonlocal_goto } } */
/* { dg-require-effective-target exceptions } */
/* Verify that cleanups work with exception handling. */ /* Verify that cleanups work with exception handling. */
#include <unwind.h> #include <unwind.h>
......
/* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */ /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */ /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* { dg-require-effective-target exceptions } */
/* Verify that cleanups work with exception handling through signal /* Verify that cleanups work with exception handling through signal
frames. */ frames. */
......
/* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */ /* { dg-do run { target hppa*-*-hpux* *-*-linux* *-*-gnu* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */ /* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* { dg-require-effective-target exceptions } */
/* Verify that cleanups work with exception handling through realtime /* Verify that cleanups work with exception handling through realtime
signal frames. */ signal frames. */
......
/* PR c/29955 */ /* PR c/29955 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fopenmp -fexceptions" } */ /* { dg-options "-O2 -fopenmp -fexceptions" } */
/* { dg-require-effective-target exceptions } */
extern void bar (int); extern void bar (int);
......
/* { dg-lto-do link } */ /* { dg-lto-do link } */
/* { dg-lto-options { { -O -flto -fexceptions -fnon-call-exceptions --param allow-store-data-races=0 } } } */ /* { 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; } s1;
typedef struct { unsigned int e0 : 16; } s2; typedef struct { unsigned int e0 : 16; } s2;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* { dg-options "-fexceptions" } */ /* { dg-options "-fexceptions" } */
/* PR28516: ICE generating ARM unwind directives for nested functions. */ /* PR28516: ICE generating ARM unwind directives for nested functions. */
/* { dg-require-effective-target trampolines } */ /* { dg-require-effective-target trampolines } */
/* { dg-require-effective-target exceptions } */
void ex(int (*)(void)); void ex(int (*)(void));
void foo(int i) void foo(int i)
......
/* { dg-options "-fexceptions -I." } */ /* { dg-options "-fexceptions -I." } */
/* { dg-require-effective-target exceptions } */
#include "except-1.h" #include "except-1.h"
int main(void) int main(void)
......
/* { dg-options "-I. -Winvalid-pch -fexceptions" } */ /* { dg-options "-I. -Winvalid-pch -fexceptions" } */
/* { dg-require-effective-target exceptions } */
#include "valid-2.h" /* { dg-warning "settings for -fexceptions do not match" } */ #include "valid-2.h" /* { dg-warning "settings for -fexceptions do not match" } */
/* { dg-error "No such file" "no such file" { target *-*-* } 0 } */ /* { dg-error "No such file" "no such file" { target *-*-* } 0 } */
/* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */ /* { dg-error "they were invalid" "invalid files" { target *-*-* } 0 } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-fexceptions" } */ /* { dg-options "-fexceptions" } */
/* { dg-require-effective-target alloca } */ /* { dg-require-effective-target alloca } */
/* { dg-require-effective-target exceptions } */
void cf (void *); void cf (void *);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* { dg-options "-O2 -fexceptions -fnon-call-exceptions -fpeel-loops" } */ /* { dg-options "-O2 -fexceptions -fnon-call-exceptions -fpeel-loops" } */
/* { dg-add-options c99_runtime } */ /* { dg-add-options c99_runtime } */
/* { dg-require-effective-target ilp32 } */ /* { dg-require-effective-target ilp32 } */
/* { dg-require-effective-target exceptions } */
#include <complex.h> #include <complex.h>
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions" } */ /* { dg-options "-O2 -fnon-call-exceptions -ftrapv -fexceptions" } */
/* { dg-require-effective-target exceptions } */
void void
DrawChunk(int *tabSize, int x) DrawChunk(int *tabSize, int x)
{ {
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv" } */ /* { dg-options "-O -fexceptions -fnon-call-exceptions -ftrapv" } */
/* { dg-require-effective-target exceptions } */
void void
foo () foo ()
......
/* PR tree-optimization/51481 */ /* PR tree-optimization/51481 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O -fexceptions -fipa-cp -fipa-cp-clone" } */ /* { dg-options "-O -fexceptions -fipa-cp -fipa-cp-clone" } */
/* { dg-require-effective-target exceptions } */
extern const unsigned short int **foo (void) extern const unsigned short int **foo (void)
__attribute__ ((__nothrow__, __const__)); __attribute__ ((__nothrow__, __const__));
......
/* PR middle-end/51644 */ /* PR middle-end/51644 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Wall -fexceptions" } */ /* { dg-options "-Wall -fexceptions" } */
/* { dg-require-effective-target exceptions } */
#include <stdarg.h> #include <stdarg.h>
......
/* PR tree-optimization/52046 */ /* PR tree-optimization/52046 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3 -fexceptions -fnon-call-exceptions" } */ /* { dg-options "-O3 -fexceptions -fnon-call-exceptions" } */
/* { dg-require-effective-target exceptions } */
extern float a[], b[], c[], d[]; extern float a[], b[], c[], d[];
extern int k[]; extern int k[];
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fexceptions -fnon-call-exceptions" } */ /* { dg-options "-O2 -fexceptions -fnon-call-exceptions" } */
/* { dg-require-effective-target exceptions } */
int a[10]; int a[10];
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fexceptions -fnon-call-exceptions" } */ /* { dg-options "-O2 -fexceptions -fnon-call-exceptions" } */
/* { dg-require-effective-target exceptions } */
extern long double cosl (long double); extern long double cosl (long double);
extern long double sinl (long double); extern long double sinl (long double);
......
/* PR tree-optimization/64465 */ /* PR tree-optimization/64465 */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fexceptions" } */ /* { dg-options "-O2 -fexceptions" } */
/* { dg-require-effective-target exceptions } */
extern int foo (int *); extern int foo (int *);
extern int bar (int, int); extern int bar (int, int);
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O0 -fexceptions" } */ /* { dg-options "-O0 -fexceptions" } */
/* { dg-require-effective-target exceptions } */
#include <stdarg.h> #include <stdarg.h>
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fexceptions" } */ /* { dg-options "-O2 -fexceptions" } */
/* { dg-require-effective-target exceptions } */
static void static void
emit_package (int p1) emit_package (int p1)
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fexceptions -fdump-tree-optimized" } */ /* { dg-options "-O2 -fexceptions -fdump-tree-optimized" } */
/* { dg-require-effective-target exceptions } */
void af (void *a); void af (void *a);
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dse-details -fexceptions -fnon-call-exceptions -fno-isolate-erroneous-paths-dereference" } */ /* { 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) int foo (int *p, int b)
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-additional-options "-O -fexceptions" } */ /* { dg-additional-options "-O -fexceptions" } */
/* { dg-require-effective-target exceptions } */
typedef __attribute__ ((const)) int (*bart) (void); typedef __attribute__ ((const)) int (*bart) (void);
......
...@@ -8510,6 +8510,16 @@ proc check_effective_target_fenv_exceptions {} { ...@@ -8510,6 +8510,16 @@ proc check_effective_target_fenv_exceptions {} {
} [add_options_for_ieee "-std=gnu99"]] } [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 {} { proc check_effective_target_tiny {} {
return [check_cached_effective_target tiny { return [check_cached_effective_target tiny {
if { [istarget aarch64*-*-*] if { [istarget aarch64*-*-*]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment