[cfe-dev] Repeated expression in AST

Tom Honermann thonermann at coverity.com
Fri Jan 6 08:05:50 PST 2012

On 1/6/2012 7:38 AM, Abramo Bagnara wrote:
> Il 05/01/2012 14:40, Enea Zaffanella ha scritto:
>> Please find attached a patch for review that, among other things, should
>> fix the issue reported by Abramo in the mail below:
>> Il 11/12/2011 11:13, Abramo Bagnara ha scritto:
>>> The typescript above shows that clang put *two* references to the same
>>> expr in the AST (one as TypeOfExprType argument and another as
>>> CompoundStmt child).
>>> This leads to shown wrong warning and (I guess) to other problems.
>>> Is it expected?
>>> $ cat bug.c
>>> int f(int);
>>> void h() {
>>>    __typeof(*(int (*)[f(1)]) 0) x;
>>> }
> I believe that the patch does the right thing with TypeOfExpr and indeed
> fix the wrong code generation (while it fixes also the reported
> duplicated presence of expr in AST and the bogus warning).
> If there are no objections I will commit it.

Looks good to me.  I applied the change to Clang 2.9 and it appears to 
resolve the problem there as well.  The patch did not apply cleanly 
against 2.9 due to changes in VLA handling following the 2.9 release. 
If anyone is interested in the changes for Clang 2.9, let me know and 
I'll make them available.


More information about the cfe-dev mailing list