[C++ PATCH] Fix switch handling in C++ FE (PR c++/39371)

Mark Mitchell mark@codesourcery.com
Mon Mar 9 15:45:00 GMT 2009


Jakub Jelinek wrote:

> 2009-03-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR c++/39371
> 	* semantics.c (finish_switch_cond): Don't call get_unwidened.
> 	* decl.c (finish_case_label): Pass SWITCH_STMT_TYPE as 3rd argument
> 	instead of TREE_TYPE (cond).
> 
> 	* g++.dg/opt/switch2.C: Add -w to dg-options.
> 	* g++.dg/warn/Wswitch-1.C: Adjust expected warnings.
> 	* g++.dg/warn/switch1.C: New test.
> 	* g++.dg/other/switch3.C: New test.

I've always been suspicious of this code.  I agree that the FE shouldn't
be modifying the types of expressions in this way.  I suspect that it
used to be profitable in some situation, but it really shouldn't be anymore.

But, Jason might have more context.  So, I'll approve this, assuming
that Jason doesn't object within 24 hours.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list