Bug 284248 - Parameters declared as typedef'd arrays should have pointer type
Summary: Parameters declared as typedef'd arrays should have pointer type
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 6.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 6.0.1   Edit
Assignee: Markus Schorn CLA
QA Contact: Mike Kucera CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2009-07-22 07:58 EDT by Richard Miskin CLA
Modified: 2009-07-22 11:08 EDT (History)
0 users

See Also:


Attachments
Fix for bug and junit test (3.20 KB, patch)
2009-07-22 08:02 EDT, Richard Miskin CLA
mschorn.eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Miskin CLA 2009-07-22 07:58:49 EDT
Build ID: I20090611-1540

Steps To Reproduce:
Section 6.7.5.3-7 of the C99 standard says "a declaration of a parameter as "array of type" shall be adjusted to "qualified pointer to type", where the type qualifiers (if any) are those specified within the[and] of the array type derivation"

CVisitor.createType() has code that that does this processing, however it does not work if the parameter is declared as a typedef of an array.
e.g.
typedef int my_buf[16];
void goo(my_buf in); // The IType for in is an ITypedef of an IArrayType




More information:
CPPVisitor correctly removes the typedef before converting the type.
Comment 1 Richard Miskin CLA 2009-07-22 08:02:12 EDT
Created attachment 142252 [details]
Fix for bug and junit test
Comment 2 Markus Schorn CLA 2009-07-22 11:08:03 EDT
Thanks Richard, I have slightly adapted your patch to deal with the fact that the index (incorrectly) provides IArrayTypes instead of ICArrayTypes.

Fixed in 6.0.1 and HEAD > 20090722.