[cfe-dev] GNU extensions to C99 designated initializers gnu99-init-1.c test case

SENTHIL KUMAR THANGAVELU senthil.t at samsung.com
Tue Oct 9 23:04:37 PDT 2012


I just wanted to know if someone knew about this issue or had some thoughts about it already. I am adding some more description to the problem

I was able to see there is an extra IntegerLiteral node added in the AST dump (truncated version shown below)

        (InitListExpr 0xbaa7888 <col:40, col:52> 'int [3]'
          (IntegerLiteral 0xbaa7680 <col:52> 'int' 4)
          (IntegerLiteral 0xbaa7680 <col:52> 'int' 4)
          (IntegerLiteral 0xbaa7730 <col:55> 'int' 5)))                      <============= extra init node

There is a call to InitListExpr::updateInit with Init subscript as "2" that connects these 2 nodes in the above hierarchy. The call that was leading to this was  CheckArrayType(...); done almost at the end of CheckDesignatedInitializer. If I comment out  this CheckArrayType call (just for testing) that additional IntegerLiteral 0xbaa7730 node is not created, but other side effects will be added as expected. Any comments based on above data? 

Regards
Senthil Kumar

------- Original Message -------
Sender : Eli Friedman<eli.friedman at gmail.com>
Date : Oct 10, 2012 07:55 (GMT+09:00)
Title : Re: [cfe-dev] GNU extensions to C99 designated initializers gnu99-init-1.c test case

On Tue, Oct 9, 2012 at 7:49 AM, SENTHIL KUMAR THANGAVELU
wrote:
> Hi all,
>     I have the following test program and the output if I print n in gdb is also added, used llvm 3.1 release. Looking into InitListChecker::CheckDesignatedInitializer in SemaInit.cpp. Any comments or insights are welcome from clang parser experts. This test case is a reduced version of gcc regression test case gnu99-init-1.c .

What comment specifically are you looking for?  It looks like you
analysis is in the right direction: we're not performing the relevant
recursion in InitListChecker::CheckDesignatedInitializer correctly.

-Eli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: astdump1.txt
Type: application/octet-stream
Size: 2229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121010/fdcd206b/attachment.obj>


More information about the cfe-dev mailing list