Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311614 - Recast to array adds start indices
Summary: Recast to array adds start indices
Status: RESOLVED INVALID
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-cdi-gdb (show other bugs)
Version: 0 DD 1.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-04 15:45 EDT by Axel Mueller CLA
Modified: 2010-05-04 17:36 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Axel Mueller CLA 2010-05-04 15:45:26 EDT
Build Identifier: Eclipse SDK  Version: 3.6.0 Build id: I20100312-1448, CDT 7.0, CVS version 20100504 from HEAD

When I cast a pointer to an array in the Variables View twice the start indices of the two casts are added.



Reproducible: Always

Steps to Reproduce:
Consider the following code snippet:
float * f = new float[10];
for (int i = 0; i < 10; ++i)
  f[i] = i;

In the Variables View cast f to an array with start index 3 and length 3.
You will see f[3],f[4],f[5] with the correct values 3.0,4.0 and 5.0
The select f again and cast it to an array with start index 2 and length 3.
Expected:
f[2],f[3],f[4] with the correct values 2,0,3.0 and 4.0
But you will see:
f[5],f[6],f[7] with the values 5,0,6.0 and 7.0
Comment 1 Elena Laskavaia CLA 2010-05-04 16:15:44 EDT
Casts are always accumulated (which I don't think a good idea anyway).
You have to clean the casts first to cast to something new.
Comment 2 Nobody - feel free to take it CLA 2010-05-04 17:18:28 EDT
As Alena rightly mentioned (even though she didn't like it) it is the expected behavior. You cast to type the current not the original type.
Comment 3 Axel Mueller CLA 2010-05-04 17:35:17 EDT
(In reply to comment #2)
> As Alena rightly mentioned (even though she didn't like it) it is the expected
> behavior. You cast to type the current not the original type.
This behavior is then different for EDC and the DSF-GDB implementation I am working currently on (see bug #06555). Cast to type and cast to array can be combined but cast to array is always a recast (new length and start index).
Comment 4 Axel Mueller CLA 2010-05-04 17:36:17 EDT
(In reply to comment #3)
> working currently on (see bug #06555). Cast to type and cast to array can be
That should be bug #306555