Bug 425428 - Changing behavior when renaming parameter to a pointer
Summary: Changing behavior when renaming parameter to a pointer
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: Next   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-10 12:08 EST by Gustavo Wagner CLA
Modified: 2020-09-04 15:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo Wagner CLA 2014-01-10 12:08:21 EST
Eclipse IDE for C/C++ Developers
Version: Kepler Service Release 1
Build id: 20130919-0819


Reproducing the bug:


Consider the following code:
======== Original Version ========
int x(int a) { // Parameter to be renamed
    return a;
}
int main(int a, char** argv) {
    return x(a);
}

==================================

The refactoring tool is allowing to rename the parameter "a" (first function) to a pointer, changing the code behavior:

========== Refactored ===========
int x(int *a) { // Now, parameter "a" is a pointer
    return *a;
}
int main(int a, char** argv) {
    return x(a);
}

=================================

Notice that when compiling the resulting program (Refactored), the compiler issues a warning (since I'm passing an integer instead a pointer now). When attempting to execute the refactored version, a Segmentation Fault is thrown.


Thanks in advance.