Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317995 - Refactoring problem converting data array to parameter array
Summary: Refactoring problem converting data array to parameter array
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: Photran.Refactoring Engine (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P5 normal (vote)
Target Milestone: 6.0.2   Edit
Assignee: Matthew Fotzler CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-25 10:07 EDT by Cyril Georgy CLA
Modified: 2011-03-18 11:51 EDT (History)
2 users (show)

See Also:


Attachments
Screenshot illustrating the problem. (114.51 KB, image/jpeg)
2010-06-25 10:09 EDT, Cyril Georgy CLA
no flags Details
Example code (320 bytes, application/octet-stream)
2010-06-25 10:24 EDT, Jeffrey Overbey CLA
no flags Details
Example code - expected result (440 bytes, application/octet-stream)
2010-06-25 10:27 EDT, Jeffrey Overbey CLA
no flags Details
patch (10.60 KB, patch)
2010-07-08 13:03 EDT, Matthew Fotzler CLA
com-eclipse-dot-org: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cyril Georgy CLA 2010-06-25 10:07:34 EDT
Build Identifier: I20100608-0911

When trying to convert a data array to a parameter array using the refactoring tool, the result is NOT creating a parameter array, but a simgle variable containing the value of the first cell of the array. The other cells are not converted and disappear.

Reproducible: Always

Steps to Reproduce:
1.Declare a data array
2.Try to convert it to a parameter array using "Refactor --> Data to Parameter".
Comment 1 Cyril Georgy CLA 2010-06-25 10:09:01 EDT
Created attachment 172756 [details]
Screenshot illustrating the problem.
Comment 2 Jeffrey Overbey CLA 2010-06-25 10:24:30 EDT
Created attachment 172759 [details]
Example code
Comment 3 Jeffrey Overbey CLA 2010-06-25 10:27:32 EDT
Created attachment 172760 [details]
Example code - expected result
Comment 4 Matthew Fotzler CLA 2010-07-08 13:03:47 EDT
Created attachment 173791 [details]
patch
Comment 5 Matthew Fotzler CLA 2010-07-08 13:06:44 EDT
The patch addresses this bug by not allowing the refactoring to occur on any arrays, data implied do loops, or pointers.  When it encounters a data statement with one of the previous mentioned constructs, it will convert up to that construct and leave the rest of that particular data statement alone (to avoid the bug occurring).

note: This should be an editor refactoring rather than a resource refactoring, as it is not likely the user wants to convert all data statements to parameters.
Comment 6 Jeffrey Overbey CLA 2010-07-08 15:00:36 EDT
Thanks, Matt.  Sometime we should look at making this an editor refactoring and dealing correctly with constant-size arrays.

Regarding your patch, can you please confirm that

1. you wrote 100% of the code without incorporating content from elsewhere or relying on the intellectual property of others,

2. you have the right to contribute the code to Eclipse, and

3. you have included the EPL license header in all source files?
Comment 7 Matthew Fotzler CLA 2010-07-08 15:03:43 EDT
Yes, I wrote 100% of the code without incorporating content from elsewhere or relying on the intellectual property of others, I have the right to contribute the code to Eclipse, and I have included the EPL license header in all source files.
Comment 8 Jeffrey Overbey CLA 2010-07-14 14:05:22 EDT
This is a small contribution, so I can commit it without filing a CQ.
Comment 9 Jeffrey Overbey CLA 2010-07-14 16:05:25 EDT
The patch is committed to CVS for 6.0.2 and 7.0.

We still need to address the following issues:

- This should be an editor refactoring rather than a resource refactoring,
as it is not likely the user wants to convert all data statements to
parameters.

- This fix is not optimal.  In simple cases (e.g., the array has known bounds), we should still be able to do the conversion to a PARAMETER statement.
Comment 10 Jeffrey Overbey CLA 2011-03-18 11:50:48 EDT
Closing since the fix was applied for 6.0.2