On Wed, Jun 29, 2011 at 12:17 AM, Eric Botcazou <ebotca...@adacore.com> wrote: > Hi, > > this is an ICE building the gnattools on ARM, a regression present on the > mainline (and reproducible on x86/Linux by switching to SJLJ exceptions). > > For the reduced testcase compiled at -O: > > Unable to coalesce ssa_names 2 and 174 which are marked as MUST COALESCE. > comp_last_2(ab) and comp_last_174(ab) > +===========================GNAT BUG DETECTED==============================+ > | 4.7.0 20110626 (experimental) [trunk revision 175408] (i586-suse-linux-gnu) > GCC error:| > | SSA corruption | > | Error detected around p.adb:3:4 > > The SSA names (or rather 2 related ones) have overlapping lifetimes. The > problem is created by forwprop1. Before: > > <bb 23>: > # comp_last_1(ab) = PHI <comp_last_159(ab)(20), comp_last_2(ab)(22)> > > [...] > > comp_last_174(ab) = comp_last_1(ab) + 1; > D.2425_175 = args.P_BOUNDS; > D.2426_176 = D.2425_175->LB0; > if (D.2426_176 > comp_last_174(ab)) > goto <bb 39>; > else > goto <bb 38>; > > <bb 38>: > D.2425_177 = args.P_BOUNDS; > D.2427_178 = D.2425_177->UB0; > if (D.2427_178 < comp_last_174(ab)) > goto <bb 39>; > else > goto <bb 40>; > > [...] > > comp_last_185(ab) = comp_last_174(ab) + 1; > D.2425_186 = args.P_BOUNDS; > D.2426_187 = D.2425_186->LB0; > if (D.2426_187 > comp_last_185(ab)) > goto <bb 43>; > else > goto <bb 42>; > > > After: > > comp_last_185(ab) = comp_last_1(ab) + 2; > D.2425_186 = args.P_BOUNDS; > D.2426_187 = D.2425_186->LB0; > if (D.2426_187 > comp_last_185(ab)) > goto <bb 43>; > else > goto <bb 42>; > > > The pass already contains a check for this situation in can_propagate_from but > it isn't applied in this case. > > Tested on x86_64-suse-linux, OK for the mainline?
Ok. This is also latent on the 4.6 branch, so feel free to backport it. Thanks, Richard. > > 2011-06-28 Eric Botcazou <ebotca...@adacore.com> > > PR tree-optimization/49539 > * tree-ssa-forwprop.c (can_propagate_from): Check for abnormal SSA > by means of stmt_references_abnormal_ssa_name. > (associate_plusminus): Call can_propagate_from before propagating > from definition statements. > (ssa_forward_propagate_and_combine): Remove superfluous newline. > > > -- > Eric Botcazou >