| Summary: | Length of character variable is not transferred to dummy argument when Extracting Procedure | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] PTP | Reporter: | Erik Toussaint <eh.toussaint> | ||||||||
| Component: | Photran.Refactoring Engine | Assignee: | Jeffrey Overbey <com-eclipse-dot-org> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | com-eclipse-dot-org | ||||||||
| Version: | 6.0 | ||||||||||
| Target Milestone: | 6.0.7 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows 7 | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 174178 [details]
ExtarctProcedure character length bug fixed
Created attachment 174224 [details]
Patch to correct ExtractProcedure
Created attachment 179336 [details]
Modified patch - added unit test, copied in entire char selector
Patch committed to HEAD for 7.0. Still need to commit to PTP_4_0 for 6.0.4. This didn't make 6.0.4, but it will be in 6.0.7. Patch committed to ptp_4_0 branch. |
When refactoring, the Extract Procedure action omits a length specifier for character dummy arguments of the new procedure, giving them an implicit length of one. Consider the following example code: program refactor implicit none character(3) :: charvar charvar = 'abc' print *, charvar end program refactor This prints the string 'abc'. Now select the line with the print statement and click 'Refactor > Extract Procedure...'. Complete the dialog and you'll end up with the following: program refactor implicit none character(3) :: charvar charvar = 'abc' call printcharvar(charvar) contains subroutine printcharvar(charvar) implicit none character :: charvar print *, charvar end subroutine end program refactor As you can see, the subroutine has a dummy character argument with length one. So it only prints the first character, instead of all three.