Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353611

Summary: ArrayType does not correctly compute byteSize
Product: [Tools] CDT Reporter: Daniel Thomas <daniel.thomas>
Component: cdt-debug-edcAssignee: Ken Ryall <ken.ryall>
Status: RESOLVED FIXED QA Contact: Ken Ryall <ken.ryall>
Severity: normal    
Priority: P3 CC: cdtdoug, kirk.beitz
Version: 8.0   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=353599
Whiteboard:
Attachments:
Description Flags
Fixes behaviour so that getByteSize is consistent with API and other implementations cdtdoug: iplog+

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.