This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Re: ICE in 920624-1.c with -O3 -funroll-loops on vax-dec-ultrix4.3
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: rth at redhat dot com (Richard Henderson)
- Cc: gcc-bugs at gcc dot gnu dot org, jh at suse dot cz, gcc-patches at gcc dot gnu dot org
- Date: Tue, 15 Jan 2002 23:22:54 -0500 (EST)
- Subject: Re: PATCH: Re: ICE in 920624-1.c with -O3 -funroll-loops on vax-dec-ultrix4.3
> On Tue, Jan 15, 2002 at 06:16:14PM -0500, John David Anglin wrote:
> > This patch fixes the problem by deleting the jump table data when a
> > conditional or computed jump is converted to an unconditional jump.
> > I have verified that the patch fixes the original problem observed
> > under vax-dec-ultrix4.3. A new vax bootstrap is underway but it
> > won't finish until sometime next month.
>
> This is extremely delicate. It is not uncommon for there to
> be references remaining to the jump table that won't be deleted
> until later dead code elimination.
>
> I'm therefore uncomfortable with simply removing it like this.
> I'm not sure what to suggest as an alternative though...
I suspect the problem is specific to the VAX. The VAX is the only
port that defines CASE_DROPS_THROUGH. When the VAX casesi jump is
folded, the PC's value in the casesi insn is replaced by a LABEL_REF
pointing to the CODE_LABEL before the jump table which unfortunately
is in the current block. Then, at a later point, the barrier is added
in cse_insn creating the invalid configuration.
I tried moving delete_trivially_dead_insns up before cleanup_cfg in
toplev.c but that didn't remove the jump table. I tried removing the
jump insn. That failed at a different point in verify_flow_info.
It might be possible to make that approach work but I suspect that
you would have the same misgivings.
I could wrap the code to delete the jump table in an #ifdef
CASE_DROPS_THROUGH if that would make you more comfortable.
The other options that I can see are: changing verify_flow_info
to allow the barrier in this situation if CASE_DROPS_THROUGH,
or not emitting the barrier in cse_main.
As an aside, I noticed that gcc can't simplify a switch statement
when its expression evaluates to a value in the range of the switch.
This is because a MEM is used to access the jump table. Probably
not a big deal, but the HP compiler can do it.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)