Commit cbd42900 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 6db6445e
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> 2018-11-05 Xuepeng Guo <xuepeng.guo@intel.com>
PR target/87853 PR target/87853
...@@ -1572,6 +1572,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -1572,6 +1572,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(op:c (plus:c@2 @0 @1) @1) (op:c (plus:c@2 @0 @1) @1)
(if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0))
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0)) && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))
&& !TYPE_OVERFLOW_SANITIZED (TREE_TYPE (@0))
&& (CONSTANT_CLASS_P (@0) || single_use (@2))) && (CONSTANT_CLASS_P (@0) || single_use (@2)))
(op @0 { build_zero_cst (TREE_TYPE (@0)); })))) (op @0 { build_zero_cst (TREE_TYPE (@0)); }))))
/* For equality, this is also true with wrapping overflow. */ /* For equality, this is also true with wrapping overflow. */
......
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> 2018-11-05 Martin Liska <mliska@suse.cz>
PR c/87811 PR c/87811
......
/* 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'" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment