Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353611 - ArrayType does not correctly compute byteSize
Summary: ArrayType does not correctly compute byteSize
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-edc (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ken Ryall CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-02 11:48 EDT by Daniel Thomas CLA
Modified: 2012-05-22 20:36 EDT (History)
2 users (show)

See Also:


Attachments
Fixes behaviour so that getByteSize is consistent with API and other implementations (5.09 KB, patch)
2011-08-02 11:48 EDT, Daniel Thomas CLA
cdtdoug: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Thomas CLA 2011-08-02 11:48:06 EDT
Build Identifier: 

According to the definition of getByteSize() in IType:
/**
 * Get size of data type in bytes
 * 
 * @return size in bytes of the effective type (e.g. skipping qualifiers, typedefs, etc.)
 */
ArrayType should return the size of the array it represents not the size of on element of the array.
i.e. int[10] should have a byteSize of 40 not of 4.

I have a patch that fixes this behavior and the couple of locations where this incorrect behavior was used.

Reproducible: Always
Comment 1 Daniel Thomas CLA 2011-08-02 11:48:48 EDT
Created attachment 200736 [details]
Fixes behaviour so that getByteSize is consistent with API and other implementations
Comment 2 Daniel Thomas CLA 2011-08-05 07:01:49 EDT
Tests on this behavior are in: https://bugs.eclipse.org/bugs/attachment.cgi?id=200968
Comment 3 Kirk Beitz CLA 2011-08-06 03:59:35 EDT
(In reply to comment #2)
> Tests on this behavior are in:
> https://bugs.eclipse.org/bugs/attachment.cgi?id=200968

sorry to make you find these same fixes on your own; our local source base (in the process of being merged to the eclipse edc git repository) contains similar code to the patch you supplied, and passes the tests in the attachment mentioned.

the test in the attachment mentioned has been added, though in org.eclipse.cdt.debug.edc.tests rather than in the .symbols package of the original patch, and a merge with the rest is pending/in progress.