This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Switch case ordering
- From: Richard Henderson <rth at redhat dot com>
- To: "Paulo J. Matos" <pocmatos at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 08 Sep 2010 07:47:14 -0700
- Subject: Re: Switch case ordering
- References: <yay39tkz5hx.fsf@alma.europe.root.pri>
On 09/08/2010 07:15 AM, Paulo J. Matos wrote:
> Hello,
>
> I have noticed that at least in GCC4.3 the switch cases are ordered
> somewhere in a pass, since they arrive at expand pass ordered in
> increasing order.
>
> Can anyone tell me if I can assume this always to happen and where this
> is happening? I couldn't find any reference to this in the internal
> docs.
Yes, you can assume this.
It happens in sort_case_labels, initially called by gimplify_switch_expr.
r~