[LLVMbugs] [Bug 115] New: llvm-gcc fails to infer a constant expr involving static ptr is also constant

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Sat Nov 15 19:54:49 PST 2003


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

           Summary: llvm-gcc fails to infer a constant expr involving static
                    ptr is also constant
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: sabre at nondot.org
        ReportedBy: gaeke+bugs at uiuc.edu


I think both "xend"s, below, should compile to the same thing (except, of
course, for the fact that they refer to different "x"s), which is what happens
in native gcc 3.3.  Instead, the 2nd one, in "bar", gives us an error, as shown.
bar() is reduced from a function in f2c.

194 gally>
/home/vadve/lattner/local/x86/llvm-gcc/libexec/gcc/i686-pc-linux-gnu/3.4-llvm/cc1
-quiet foo.i 
foo.i: In function `bar':

foo.i:8: error: initializer element is not constant
195 gally> cat foo.i
void foo () {
 static char x[10];
 static char *xend = &x[10];
}

void bar () {
 static char x[10];
 static char *xend = x + 10;
}



------- 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