[patch] Fix ICE in set_lattice_value

Eric Botcazou ebotcazou@adacore.com
Wed Jul 18 14:06:00 GMT 2012


This is a regression present on mainline and 4.7 branch for targets using SJLJ 
exceptions by default in Ada (e.g. ARM).  The error message is:

+===========================GNAT BUG DETECTED==============================+
| 4.8.0 20120716 (experimental) [trunk revision 189525] (x86_64-suse-linux) GCC 
error:|
| in set_lattice_value, at tree-ssa-ccp.c:452                              |
| Error detected around p.adb:16:4  

It's valid_lattice_transition returning false on a transition from INTEGER_CST 
to a constant &x.  It occurs for an array reference with non-constant index: on 
the first round, &x + i is non-constant so the algorithm computes an alignment 
factor which is an INTEGER_CST; on the second round, i is 0 so the new value is 
the constant &x.

valid_lattice_transition accepts the reverse transition.  The attached patch 
makes the function accept this transition as well.

Tested on x86_64-suse-linux, OK for the mainline and 4.7 branch?


2012-07-18  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-ccp.c (valid_lattice_transition): Allow transitioning from
	as well as to INTEGER_CST.


2012-07-18  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/loop_optimization11.adb: New test.
	* gnat.dg/loop_optimization11_pkg.ads: New helper.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 675 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120718/9cece22f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop_optimization11.adb
Type: text/x-adasrc
Size: 468 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120718/9cece22f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop_optimization11_pkg.ads
Type: text/x-adasrc
Size: 276 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120718/9cece22f/attachment-0002.bin>


More information about the Gcc-patches mailing list