mirror of git://gcc.gnu.org/git/gcc.git
Add tests for -fcf-protection option and nocf_check attribute.
* c-c++-common/fcf-protection-1.c: New test. * c-c++-common/fcf-protection-2.c: Likewise. * c-c++-common/fcf-protection-3.c: Likewise. * c-c++-common/fcf-protection-4.c: Likewise. * c-c++-common/fcf-protection-5.c: Likewise. * c-c++-common/attr-nocf-check-1.c: Likewise. * c-c++-common/attr-nocf-check-2.c: Likewise. * c-c++-common/attr-nocf-check-3.c: Likewise. From-SVN: r253949
This commit is contained in:
parent
c840bf9bc9
commit
b0926447b5
|
|
@ -1,3 +1,14 @@
|
||||||
|
2017-10-20 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
|
||||||
|
|
||||||
|
* c-c++-common/fcf-protection-1.c: New test.
|
||||||
|
* c-c++-common/fcf-protection-2.c: Likewise.
|
||||||
|
* c-c++-common/fcf-protection-3.c: Likewise.
|
||||||
|
* c-c++-common/fcf-protection-4.c: Likewise.
|
||||||
|
* c-c++-common/fcf-protection-5.c: Likewise.
|
||||||
|
* c-c++-common/attr-nocf-check-1.c: Likewise.
|
||||||
|
* c-c++-common/attr-nocf-check-2.c: Likewise.
|
||||||
|
* c-c++-common/attr-nocf-check-3.c: Likewise.
|
||||||
|
|
||||||
2017-10-20 Ed Schonberg <schonberg@adacore.com>
|
2017-10-20 Ed Schonberg <schonberg@adacore.com>
|
||||||
|
|
||||||
* gnat.dg/sync_iface_call.adb, gnat.dg/sync_iface_call_pkg.ads,
|
* gnat.dg/sync_iface_call.adb, gnat.dg/sync_iface_call_pkg.ads,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
int func (int) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use -fcf-protection option to enable it" } */
|
||||||
|
int (*fptr) (int) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use -fcf-protection option to enable it" } */
|
||||||
|
typedef void (*nocf_check_t) (void) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use -fcf-protection option to enable it" } */
|
||||||
|
|
||||||
|
int
|
||||||
|
foo1 (int arg)
|
||||||
|
{
|
||||||
|
return func (arg) + fptr (arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
foo2 (void (*foo) (void))
|
||||||
|
{
|
||||||
|
void (*func) (void) __attribute__((nocf_check)) = foo; /* { dg-warning "'nocf_check' attribute ignored. Use -fcf-protection option to enable it" } */
|
||||||
|
func ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
foo3 (nocf_check_t foo)
|
||||||
|
{
|
||||||
|
foo ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
foo4 (void (*foo) (void) __attribute__((nocf_check))) /* { dg-warning "'nocf_check' attribute ignored. Use -fcf-protection option to enable it" } */
|
||||||
|
{
|
||||||
|
foo ();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
int var1 __attribute__((nocf_check)); /* { dg-warning "'nocf_check' attribute only applies to function types" } */
|
||||||
|
int *var2 __attribute__((nocf_check)); /* { dg-warning "'nocf_check' attribute only applies to function types" } */
|
||||||
|
void (**var3) (void) __attribute__((nocf_check)); /* { dg-warning "'nocf_check' attribute only applies to function types" } */
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
int foo (void) __attribute__ ((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use -fcf-protection option to enable it" } */
|
||||||
|
void (*foo1) (void) __attribute__((nocf_check)); /* { dg-warning "'nocf_check' attribute ignored. Use -fcf-protection option to enable it" } */
|
||||||
|
void (*foo2) (void);
|
||||||
|
|
||||||
|
int
|
||||||
|
foo (void) /* The function's address is not tracked. */
|
||||||
|
{
|
||||||
|
/* This call site is not tracked for
|
||||||
|
control-flow instrumentation. */
|
||||||
|
(*foo1)();
|
||||||
|
|
||||||
|
foo1 = foo2;
|
||||||
|
/* This call site is still not tracked for
|
||||||
|
control-flow instrumentation. */
|
||||||
|
(*foo1)();
|
||||||
|
|
||||||
|
/* This call site is tracked for
|
||||||
|
control-flow instrumentation. */
|
||||||
|
(*foo2)();
|
||||||
|
|
||||||
|
foo2 = foo1;
|
||||||
|
/* This call site is still tracked for
|
||||||
|
control-flow instrumentation. */
|
||||||
|
(*foo2)();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-fcf-protection=full" } */
|
||||||
|
/* { dg-error "'-fcf-protection=full' is not supported for this target" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
|
/* { dg-error "'-fcf-protection=full' is not supported for this target" "" { target { ! "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-fcf-protection=branch" } */
|
||||||
|
/* { dg-error "'-fcf-protection=branch' is not supported for this target" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
|
/* { dg-error "'-fcf-protection=branch' is not supported for this target" "" { target { ! "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-fcf-protection=return" } */
|
||||||
|
/* { dg-error "'-fcf-protection=return' is not supported for this target" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
|
/* { dg-error "'-fcf-protection=return' is not supported for this target" "" { target { ! "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-fcf-protection=none" } */
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-fcf-protection" } */
|
||||||
|
/* { dg-error "'-fcf-protection=full' is not supported for this target" "" { target { "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
|
/* { dg-error "'-fcf-protection=full' is not supported for this target" "" { target { ! "i?86-*-* x86_64-*-*" } } 0 } */
|
||||||
Loading…
Reference in New Issue