[LLVMbugs] [Bug 657] NEW: [llvm-gcc] Spurious "warning: function returns address of local variable"

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Nov 9 00:10:23 PST 2005


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=657

           Summary: [llvm-gcc] Spurious "warning: function returns address
                    of local variable"
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kharriman at greenplum.com


llvm-gcc incorrectly gives a warning...

llvm-gcc -o llvmbug05.bc -c -save-temps llvmbug05.c
llvmbug05.c: In function `f':
llvmbug05.c:7: warning: function returns address of local variable

... when compiling this ...

# 1 "llvmbug05.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "llvmbug05.c"
char*
f(char *buf)
{
    char* tbuf = buf;

    if (*tbuf)
        return tbuf + 1;

    return 0;
}

The generated bytecode looks ok though.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list