On Wed, 29 Jan 2020, Jeff Law wrote: > In the last major change in this code was ~5 years ago and twiddled the > handling of the switch expression to call convert_lvalue_to_rvalue. > > The last argument to that function indicates whether or not we should > mark the switch expression as a use of the object. We're currently > passing in "false" so the object doesn't get marked and we get the > bogus warning. > > The obvious fix is to pass in "true", which is what the proposed patch > does. If there's a reason we can't/shouldn't do that in this case we > could call mark_exp_read on the switch expression at some point other > point. > > Bootstrapped and regression tested on x86_64. OK for the trunk?
I think the code passes false simply because it was a straight conversion from previous code that (probably erroneously) didn't call mark_exp_read. The patch is OK. -- Joseph S. Myers jos...@codesourcery.com