[cfe-commits] [PATCH] CallExprs returning references can be lvalues

Ted Kremenek kremenek at apple.com
Wed Jun 2 20:40:32 PDT 2010


Hi Jordy,

Overall this patch looks great.  You are indeed correct that the left-hand-side expression in an assignment should always be treated as an lvalue, as that's how it is treated in GRExprEngine.  The handling of the references in LiveVariables also looks spot on.

Zhongxing: What do you think? 

Ted

On Jun 2, 2010, at 3:20 PM, Jordy Rose wrote:

> Revised patch without the section that was completely commented out. Oops.
> 
> On Wed, 02 Jun 2010 15:19:25 -0700, Jordy Rose <jediknil at belkadan.com>
> wrote:
>> Fixes a crasher, by allowing CallExprs to be lvalues, and making sure
>> assignment LHSes are treated as lvalues.
>> 
>> char& ref();
>> void t5 () {
>>  ref() = 'c';
>> }
>> 
>> And an incorrect "undefined dereference" warning, by noting that
> assigning
>> to a reference variable does not kill its value.
>> 
>> char t1 () {
>>  char& r = ref();
>>  r = 'c'; // no-warning
>>  if (r) return r;
>>  return *(char*)0; // no-warning
>> }
> <references.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list