Skip to content

llvm-gcc fails to infer a constant expr involving static ptr is also constant #487

@llvmbot

Description

@llvmbot
Bugzilla Link 115
Resolution FIXED
Resolved on Feb 22, 2010 12:50
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor

Extended Description

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions