This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix VRP register_edge_assert_for_1 (PR tree-optimization/59014)


On 11/26/13 13:33, Jakub Jelinek wrote:
Hi!

Given:
   _6 = (_Bool) a.1_5;
   _7 = _4 | _6;
   if (_7 != 0)
     goto <bb 5>;
   else
     goto <bb 6>;
where a.1_5 has int type and _6/_4/_7 are _Bool, register_edge_assert_for_1
happily inserts:
   <bb 6>:
   a.1_14 = ASSERT_EXPR <a.1_5, a.1_5 == 0>;
assertion, which is wrong, the fact that _6 is known to be 0 doesn't
imply that a.1_5 is zero, as there is a narrowing conversion.
We can only safely look through integer->integer conversions which
are widening or preserve precision.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

I'll try to create a testcase for 4.8 branch tomorrow.

2013-11-26  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/59014
	* tree-vrp.c (register_edge_assert_for_1): Don't look
	through conversions from non-integral types or through
	narrowing conversions.

	* gcc.c-torture/execute/pr59014.c: New test.
OK.
jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]