From: Igor Tsimbalist Date: Sun, 22 Oct 2017 16:32:08 +0000 (+0200) Subject: Move 2 tests from c-c++-common/ to gcc.target/i386/ directory. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00c378a954da643639e9e311fb713f908b0b0cc2;p=gcc.git Move 2 tests from c-c++-common/ to gcc.target/i386/ directory. * c-c++-common/attr-nocf-check-1a.c: Remove test. * c-c++-common/attr-nocf-check-3a.c: Likewise. * gcc.target/i386/attr-nocf-check-1a.c: Add test. * gcc.target/i386/attr-nocf-check-3a.c: Likewise. From-SVN: r253984 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e14725979c2..a69c8518c36 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-10-22 Igor Tsimbalist + + * c-c++-common/attr-nocf-check-1a.c: Remove test. + * c-c++-common/attr-nocf-check-3a.c: Likewise. + * gcc.target/i386/attr-nocf-check-1a.c: Add test. + * gcc.target/i386/attr-nocf-check-3a.c: Likewise. + 2017-10-21 Igor Tsimbalist * c-c++-common/attr-nocf-check-1.c: Shorten a cheking message. diff --git a/gcc/testsuite/c-c++-common/attr-nocf-check-1a.c b/gcc/testsuite/c-c++-common/attr-nocf-check-1a.c deleted file mode 100644 index 9549e697658..00000000000 --- a/gcc/testsuite/c-c++-common/attr-nocf-check-1a.c +++ /dev/null @@ -1,32 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-fcf-protection -mcet" } */ - -int func (int) __attribute__ ((nocf_check)); -int (*fptr) (int) __attribute__ ((nocf_check)); -typedef void (*nocf_check_t) (void) __attribute__ ((nocf_check)); - -int -foo1 (int arg) -{ - return func (arg) + fptr (arg); -} - -void -foo2 (void (*foo) (void)) -{ - void (*func) (void) __attribute__((nocf_check)) = foo; /* { dg-warning "incompatible pointer type" "" { target c } } */ - /* { dg-error "invalid conversion" "" { target c++ } .-1 } */ - func (); -} - -void -foo3 (nocf_check_t foo) -{ - foo (); -} - -void -foo4 (void (*foo) (void) __attribute__((nocf_check))) -{ - foo (); -} diff --git a/gcc/testsuite/c-c++-common/attr-nocf-check-3a.c b/gcc/testsuite/c-c++-common/attr-nocf-check-3a.c deleted file mode 100644 index 1a833012409..00000000000 --- a/gcc/testsuite/c-c++-common/attr-nocf-check-3a.c +++ /dev/null @@ -1,32 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-fcf-protection -mcet" } */ - -int foo (void) __attribute__ ((nocf_check)); -void (*foo1) (void) __attribute__((nocf_check)); -void (*foo2) (void); - -int __attribute__ ((nocf_check)) -foo (void) /* The function's address is not tracked. */ -{ - /* This call site is not tracked for - control-flow instrumentation. */ - (*foo1)(); - - foo1 = foo2; /* { dg-warning "incompatible pointer type" "" { target c } } */ - /* { dg-error "invalid conversion" "" { target c++ } .-1 } */ - /* This call site is still not tracked for - control-flow instrumentation. */ - (*foo1)(); - - /* This call site is tracked for - control-flow instrumentation. */ - (*foo2)(); - - foo2 = foo1; /* { dg-warning "incompatible pointer type" "" { target c } } */ - /* { dg-error "invalid conversion" "" { target c++ } .-1 } */ - /* This call site is still tracked for - control-flow instrumentation. */ - (*foo2)(); - - return 0; -} diff --git a/gcc/testsuite/gcc.target/i386/attr-nocf-check-1a.c b/gcc/testsuite/gcc.target/i386/attr-nocf-check-1a.c new file mode 100644 index 00000000000..9549e697658 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/attr-nocf-check-1a.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-fcf-protection -mcet" } */ + +int func (int) __attribute__ ((nocf_check)); +int (*fptr) (int) __attribute__ ((nocf_check)); +typedef void (*nocf_check_t) (void) __attribute__ ((nocf_check)); + +int +foo1 (int arg) +{ + return func (arg) + fptr (arg); +} + +void +foo2 (void (*foo) (void)) +{ + void (*func) (void) __attribute__((nocf_check)) = foo; /* { dg-warning "incompatible pointer type" "" { target c } } */ + /* { dg-error "invalid conversion" "" { target c++ } .-1 } */ + func (); +} + +void +foo3 (nocf_check_t foo) +{ + foo (); +} + +void +foo4 (void (*foo) (void) __attribute__((nocf_check))) +{ + foo (); +} diff --git a/gcc/testsuite/gcc.target/i386/attr-nocf-check-3a.c b/gcc/testsuite/gcc.target/i386/attr-nocf-check-3a.c new file mode 100644 index 00000000000..1a833012409 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/attr-nocf-check-3a.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-fcf-protection -mcet" } */ + +int foo (void) __attribute__ ((nocf_check)); +void (*foo1) (void) __attribute__((nocf_check)); +void (*foo2) (void); + +int __attribute__ ((nocf_check)) +foo (void) /* The function's address is not tracked. */ +{ + /* This call site is not tracked for + control-flow instrumentation. */ + (*foo1)(); + + foo1 = foo2; /* { dg-warning "incompatible pointer type" "" { target c } } */ + /* { dg-error "invalid conversion" "" { target c++ } .-1 } */ + /* This call site is still not tracked for + control-flow instrumentation. */ + (*foo1)(); + + /* This call site is tracked for + control-flow instrumentation. */ + (*foo2)(); + + foo2 = foo1; /* { dg-warning "incompatible pointer type" "" { target c } } */ + /* { dg-error "invalid conversion" "" { target c++ } .-1 } */ + /* This call site is still tracked for + control-flow instrumentation. */ + (*foo2)(); + + return 0; +}