Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313369 - Length of character variable is not transferred to dummy argument when Extracting Procedure
Summary: Length of character variable is not transferred to dummy argument when Extrac...
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: Photran.Refactoring Engine (show other bugs)
Version: 6.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 6.0.7   Edit
Assignee: Jeffrey Overbey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-18 10:43 EDT by Erik Toussaint CLA
Modified: 2011-05-14 06:44 EDT (History)
1 user (show)

See Also:


Attachments
ExtarctProcedure character length bug fixed (4.58 KB, patch)
2010-07-13 13:31 EDT, Abhi23 CLA
no flags Details | Diff
Patch to correct ExtractProcedure (4.14 KB, patch)
2010-07-13 15:39 EDT, Abhi23 CLA
no flags Details | Diff
Modified patch - added unit test, copied in entire char selector (4.40 KB, patch)
2010-09-21 15:00 EDT, Jeffrey Overbey CLA
g.watson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Toussaint CLA 2010-05-18 10:43:43 EDT
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.
Comment 1 Abhi23 CLA 2010-07-13 13:31:51 EDT
Created attachment 174178 [details]
ExtarctProcedure character length bug fixed
Comment 2 Abhi23 CLA 2010-07-13 15:39:07 EDT
Created attachment 174224 [details]
Patch to correct ExtractProcedure
Comment 3 Jeffrey Overbey CLA 2010-09-21 15:00:24 EDT
Created attachment 179336 [details]
Modified patch - added unit test, copied in entire char selector
Comment 4 Jeffrey Overbey CLA 2010-09-21 15:02:17 EDT
Patch committed to HEAD for 7.0.  Still need to commit to PTP_4_0 for 6.0.4.
Comment 5 Jeffrey Overbey CLA 2011-03-17 09:24:04 EDT
This didn't make 6.0.4, but it will be in 6.0.7.

Patch committed to ptp_4_0 branch.