This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] diagnosing switch errors
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Paul Brook <paul at nowt dot org>
- Cc: Richard Henderson <rth at twiddle dot net>, <fortran at gcc dot gnu dot org>, <gcc at gcc dot gnu dot org>
- Date: Thu, 30 Oct 2003 17:30:58 -0500 (EST)
- Subject: Re: [tree-ssa] diagnosing switch errors
On Thu, 30 Oct 2003, Paul Brook wrote:
> On Thursday 30 October 2003 6:05 pm, Richard Henderson wrote:
> > So I went looking to see what Java and Fortran do. And I can't
> > see that we check for duplicate case labels at all. Am I correct
> > in this, or have I missed something?
>
> This is done much earlier on by gfortran. See fortran/resolve.c
> (resolve_select/check_case_overlap). By the time we generate trees for the
> switch we already know all the cases are valid. Fortran needs to be able to
> do switch statements for character (ie. string) variables, so checking at
> the GENERIC/GIMPLE level probably wouldn't gain us much.
Similarly, Java needs to handle duplicate case labels before emitting
bytecode, so any checking done in gimplify is redundant.
Jeff