------- Comment #26 from ian dot bolton at arm dot com  2010-08-03 17:09 -------
(In reply to comment #25)
> (In reply to comment #24)
> > (In reply to comment #23)
> > > I can confirm this fails with GCC 4.4.4 and that GCC 4.3.2 works.
> > > 
> > 
> > I get no warning and correct code in latest 4.4 branch (4.4.5 - 20100727), 
> > but
> > I do get the warning and incorrect code in latest 4.5 branch (4.5.1 -
> > 20100727).
> > 
> 
> And trunk, as of 20100727 (4.6.0), is also OK (no warning and correct code).
> 
> I am configuring with:
> 
> --target=arm-unknown-eabi --with-cpu=cortex-a9 --enable-languages=c,c++
> 
> And building with:
> 
> -c -O2 -mcpu=arm926ej-s -x c++ ~/pr44328.cpp -Wextra -save-temps -S
> 

My mistake.  I had incorrectly invoked the linux target compiler when doing my
4.4 testing. :-(

I actually DO get the warning and incorrect code with latest 4.4 branch and 4.5
branch.

Trunk does work correctly though, because the gimple pass keeps the default
case and the case 0 distinct nowadays (unless you specify -fstrict-enums),
whereas 4.4 and 4.5 both merge the default case in with the case 0 due to the
fact that the switch enumerates all possible values of the OpenMode.

Here is key line from the 004t.gimple dump for 4.4 and 4.5 (and 4.6 with
-fstrict-enums):

  switch (D.1763) <default: <D.1759>, case 0: <D.1759>, case 1: <D.1758>, case
2: <D.1760>, case 3: <D.1761>>

See how default and case 0 both go to the same place.

Here is the equivalent line from 004t.gimple from 4.6 (without -fstrict-enums):

  switch (D.1766) <default: <D.1767>, case 0: <D.1759>, case 1: <D.1758>, case
2: <D.1760>, case 3: <D.1761>>

See how default and case 0 go to different places.

This therefore explains why 4.6 works with the reporter's commandline args.

I am fairly sure the actual bug is in tree-switch-conversion.c, and I feel a
bug fix is imminent.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44328

Reply via email to