re PR sanitizer/87837 (-O2 -fsanitize=signed-integer-overflow misses overflows on x86-64)
PR sanitizer/87837 * match.pd (X + Y < X): Don't optimize if TYPE_OVERFLOW_SANITIZED. * c-c++-common/ubsan/pr87837.c: New test. From-SVN: r265793
This commit is contained in:
parent
6db6445e1b
commit
cbd429001f
@ -1,3 +1,8 @@
|
||||
2018-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR sanitizer/87837
|
||||
* match.pd (X + Y < X): Don't optimize if TYPE_OVERFLOW_SANITIZED.
|
||||
|
||||
2018-11-05 Xuepeng Guo <xuepeng.guo@intel.com>
|
||||
|
||||
PR target/87853
|
||||
|
@ -1572,6 +1572,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
|
||||
(op:c (plus:c@2 @0 @1) @1)
|
||||
(if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))
|
||||
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))
|
||||
&& !TYPE_OVERFLOW_SANITIZED (TREE_TYPE (@0))
|
||||
&& (CONSTANT_CLASS_P (@0) || single_use (@2)))
|
||||
(op @0 { build_zero_cst (TREE_TYPE (@0)); }))))
|
||||
/* For equality, this is also true with wrapping overflow. */
|
||||
|
@ -1,3 +1,8 @@
|
||||
2018-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR sanitizer/87837
|
||||
* c-c++-common/ubsan/pr87837.c: New test.
|
||||
|
||||
2018-11-05 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR c/87811
|
||||
|
18
gcc/testsuite/c-c++-common/ubsan/pr87837.c
Normal file
18
gcc/testsuite/c-c++-common/ubsan/pr87837.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* PR sanitizer/87837 */
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable" } */
|
||||
|
||||
int
|
||||
foo (int n)
|
||||
{
|
||||
return n + __INT_MAX__ < n;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
volatile int a = foo (1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* { dg-output "signed integer overflow: 1 \\+ 2147483647 cannot be represented in type 'int'" } */
|
Loading…
Reference in New Issue
Block a user