On Tue, May 3, 2011 at 8:34 PM, Jason Merrill <ja...@redhat.com> wrote: > On 04/28/2011 03:50 PM, Diego Novillo wrote: >> >> This patch from Silvius Rus adds a new flag (-fstrict-enum-precision). >> While porting the patch to 4.6, I noticed that the C++ FE now has a >> similar flag that seems to have similar semantics (-fstrict-enums). >> >> Silvius's patch is used to disable some switch() optimizations that >> assume enum types can *only* take values within that enum (Silvius, >> please correct me if I got this wrong). >> >> Jason, your -fstrict-enums only applies to the C++ front end. >> Silvius's variant affects VRP and gimplification of switches. Would >> it be better if we simply moved -fstrict-enums to common options and >> used that to decide whether to optimize switches in VRP and the >> gimplifier? >> >> We use it internally to disable this optimization for code that >> generates values outside of enum ranges. > > It seems that to me that this patch changes optimizations to not believe the > lies of the C++ front end, whereas my patch changes the front end to not lie > in the first place, making this patch unnecessary.
Correct. Richard.