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

sammy at ariana-dsl dot utu dot fi gcc-bugzilla@gcc.gnu.org
Fri Oct 10 17:34:00 GMT 2003


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.



More information about the Gcc-bugs mailing list