Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/c-c++-common/ubsan/pr63802.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
/* Limit this to known non-strict alignment targets. */ /* { dg-do run { target { i?86-*-linux* x86_64-*-linux* } } } */ /* { dg-options "-fsanitize=alignment" } */ #define __round_mask(x, y) ((__typeof__(x))((y)-1)) #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) struct test_struct { unsigned long a; int b; } __attribute__((__aligned__(64))); char a[200]; int main () { volatile int x = ((struct test_struct*)(round_up((unsigned long)a, 64) + 16))->b; volatile int y = ((struct test_struct*)(round_up((unsigned long)a, 64) + 15))->b; return 0; } /* { dg-output "\.c:18:\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct test_struct', which requires 64 byte alignment" } */