Commit 9f30dff0 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/67338 (fold-const sanitizer runtime error in roundup_loc)

	PR c/67338
	* fold-const.c (round_up_loc): Negate divisor in unsigned type to
	avoid UB.

	* gcc.dg/pr67338.c: New test.

From-SVN: r246305
parent 9da12bea
2017-03-21 Jakub Jelinek <jakub@redhat.com>
PR c/67338
* fold-const.c (round_up_loc): Negate divisor in unsigned type to
avoid UB.
2017-03-20 Segher Boessenkool <segher@kernel.crashing.org> 2017-03-20 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/79910 PR rtl-optimization/79910
......
...@@ -14250,7 +14250,7 @@ round_up_loc (location_t loc, tree value, unsigned int divisor) ...@@ -14250,7 +14250,7 @@ round_up_loc (location_t loc, tree value, unsigned int divisor)
overflow_p = TREE_OVERFLOW (value); overflow_p = TREE_OVERFLOW (value);
val += divisor - 1; val += divisor - 1;
val &= - (int) divisor; val &= (int) -divisor;
if (val == 0) if (val == 0)
overflow_p = true; overflow_p = true;
......
2017-03-21 Jakub Jelinek <jakub@redhat.com> 2017-03-21 Jakub Jelinek <jakub@redhat.com>
PR c/67338
* gcc.dg/pr67338.c: New test.
PR c++/35878 PR c++/35878
* g++.dg/init/pr35878_1.C: Rewrite directives to scan optimized * g++.dg/init/pr35878_1.C: Rewrite directives to scan optimized
dump instead of assembler. dump instead of assembler.
......
/* PR c/67338 */
/* { dg-do compile { target *-*-linux* *-*-gnu* } } */
struct S { __attribute__((aligned (1 << 28))) double a; };
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