This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/12571] New: Function parameter and variable are allocated at the same address


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12571

           Summary: Function parameter and variable are allocated at the
                    same address
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sammy at ariana-dsl dot utu dot fi
                CC: gcc-bugs at gcc dot gnu dot org

void append_exp(char *text) {
    if (!text) return;
    int orig_len = (v->expression) ? strlen(v->expression) : 0;
    int dest_len = orig_len + strlen(text);

    char *buf = NULL;

    ...
    ...



Parameter "text" and variable "buf" seems to be at the same (stack) address. So,
when buf is set to NULL the text also becomes NULL.

Target architecture is i386. Compiler parameters -g -O2 -Wall were used.

When compiling with gcc 3.2 the problem does not occur.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]