Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/cet-notrack-1.C @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
line wrap: on
line source
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-fcf-protection" } */ /* { dg-final { scan-assembler "endbr32|endbr64" } } */ /* { dg-final { scan-assembler-times "\tcall\[ \t]+_?puts" 2 } } */ /* { dg-final { scan-assembler-times "notrack call\[ \t]+" 1 } } */ #include <stdio.h> struct A { virtual int foo() __attribute__((nocf_check)) { return 42; } }; struct B : A { int foo() __attribute__((nocf_check)) { return 73; } }; int main() { B b; A& a = b; int (A::*amem) () __attribute__((nocf_check)) = &A::foo; // take address if ((a.*amem)() == 73) // use the address printf("pass\n"); else printf("fail\n"); return 0; }