<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Oct 20, 2008 at 6:31 PM, Zhongxing Xu <span dir="ltr"><<a href="mailto:xuzhongxing@gmail.com">xuzhongxing@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">Some more comments:<div class="Ih2E3d"><br><br>int a[10];<br>int (*p)[10];<br><br></div>Per C99 6.3.2p3, 'a' and '*p' is not lvalue when they are placed in a[1] or (*p)[1]. So in fact we cannot do lvalue evaluation of them. But this is inconsistent with the usual case in VisitDeclRefExpr and VisitUnaryExpr. But 'a' and '*p' do have lvalue sometimes. And special handling of these non-lvalue cases in the GRExprEngine is ugly.<br>

<br>On the other hand, a simple trick in the Store will do us the favor. If we are passed loc::MemRegionVal(some array's region) in the store, we do not go through the binding, but simply return loc::MemRegionVal(some array's region) as the loaded value. Then we can do the usual thing for all cases in GRExprEngine's Visitors: get the lvalue of the Decl, ask Store what its rvalue is.<div>
<div></div><div class="Wj3C7c"><br>
</div></div></div></blockquote><div><br>Another thought: Maybe we should keep these special handling in GRExprEngine, since these are what C99 requires to do. But this will require to add "if (..->isArrayType()) at more than one place in GRExprEngine, at least in VisitDeclRefExpr and VisitUnaryOperator. The root reason is that the rvalue evaluation of expressions of array type is different from other types. They do not need to go through the store bindings. The rvalue of expressions of array type cannot change.<br>
</div></div><br></div>