diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common/ubsan/save-expr-4.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/ubsan/save-expr-4.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/ubsan/save-expr-4.c b/gcc/testsuite/c-c++-common/ubsan/save-expr-4.c new file mode 100644 index 00000000000..aa34a70ede7 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/save-expr-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=shift -Wall -Werror -O" } */ + +int x; + +int +foo (int i, unsigned int u) +{ + return (i % u) << (x / u); +} + +int +bar (int i, unsigned int u) +{ + return (((x % u) << (u / i)) >> x); +} |