On Wed, Jul 18, 2012 at 4:05 PM, Eric Botcazou <ebotca...@adacore.com> wrote: > 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?
Hmm, the point is of couse to not allow transitions that could form a cycle, which is why the reverse transition is not allowed. Let me have a closer look here. Richard. > 2012-07-18 Eric Botcazou <ebotca...@adacore.com> > > * tree-ssa-ccp.c (valid_lattice_transition): Allow transitioning from > as well as to INTEGER_CST. > > > 2012-07-18 Eric Botcazou <ebotca...@adacore.com> > > * gnat.dg/loop_optimization11.adb: New test. > * gnat.dg/loop_optimization11_pkg.ads: New helper. > > > -- > Eric Botcazou