[PATCH] Fix fallout of CFG scanning patch
Eric Botcazou
ebotcazou@adacore.com
Sun May 6 19:40:00 GMT 2007
Hi,
This is another fallout of Zdenek's CFG scanning patch, this time for the Ada
compiler on the attached testcase:
eric@linux:~/build/gcc/native32> gcc/xgcc -Bgcc -S -O p.adb -I gcc/ada/rts
p.adb:11:07: warning: variable "Tmp_Res" is read but never assigned
+===========================GNAT BUG DETECTED==============================+
| 4.3.0 20070501 (experimental) (i586-suse-linux-gnu) GCC error: |
| in iterate_fix_dominators, at dominance.c:1044 |
| Error detected at p.adb:26:1
The ICE occurs at the end of the DOM pass, when EH edges are purged:
/* Removal of statements may make some EH edges dead. Purge
such edges from the CFG as needed. */
if (!bitmap_empty_p (need_eh_cleanup))
{
cfg_altered |= tree_purge_all_dead_eh_edges (need_eh_cleanup);
bitmap_zero (need_eh_cleanup);
}
if (cfg_altered)
free_dominance_info (CDI_DOMINATORS);
The pass has already modified the CFG (threaded a jump) so my understanding is
that the dominance info are outdated. Before Zdenek's patch, purging EH edges
would automatically invalidate the info; after Zdenek's patch, the compiler
will try to incrementally (and locally) update them. The problem is that it
now starts from wrong info so it cannot compute a consistent result.
Hence the proposed patch, which moves up the calls to free_dominance_info.
It also occured to me that cfg_altered is never reset throughout the code!
Bootstrapped/regtested on i586-suse-linux, OK for mainline?
2007-05-06 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Reset cfg_altered.
Free dominance info before purging EH edges as well as after.
(eliminate_degenerate_phis): Likewise.
(propagate_rhs_into_lhs): Set cfg_altered to true instead of 1.
2007-05-06 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt1.ad[sb]: New testcase.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.ads
Type: text/x-adasrc
Size: 304 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070506/817e19f2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.adb
Type: text/x-adasrc
Size: 638 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070506/817e19f2/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: g503-018.diff
Type: text/x-diff
Size: 2851 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070506/817e19f2/attachment-0002.bin>
More information about the Gcc-patches
mailing list