Bug#225935: gcc-3.3: function static variable initialization allowed with pure functions only when -O is used

2004-01-05 Thread Falk Hueffner
Britton <[EMAIL PROTECTED]> writes: > > > Replaceing the strlen call with a call of an impure function > > > (commented out above) results in the above error whether or not -O is > > > used. It seems to me that pure function should either always be > > > usable in this way regardless of -O (and C

Bug#225935: gcc-3.3: function static variable initialization allowed with pure functions only when -O is used

2004-01-05 Thread Britton
> > It can only do that because it knows strlen is pure, thats the point > > of pureness. > > That alone wouldn't suffice, the value has to be known at compile > time. > > > If the standard says constant only, gcc should choke on strlen() > > with or without optimization. > > Correct. Currently, i

Bug#225935: gcc-3.3: function static variable initialization allowed with pure functions only when -O is used

2004-01-05 Thread Britton
On 3 Jan 2004, Falk Hueffner wrote: > Britton Leo Kerin <[EMAIL PROTECTED]> writes: > > > static char *const foo = "baz"; > > static int foo_len = strlen(foo); > > /* static int foo_len = an_impure_function(); */ > > > greenwood$ gcc test_const.c > > test_const.c: In function `main': > > te

Bug#225935: gcc-3.3: function static variable initialization allowed with pure functions only when -O is used

2004-01-03 Thread Falk Hueffner
Britton Leo Kerin <[EMAIL PROTECTED]> writes: > static char *const foo = "baz"; > static int foo_len = strlen(foo); > /* static int foo_len = an_impure_function(); */ > greenwood$ gcc test_const.c > test_const.c: In function `main': > test_const.c:14: error: initializer element is not const

Bug#225935: gcc-3.3: function static variable initialization allowed with pure functions only when -O is used

2004-01-02 Thread Britton Leo Kerin
Package: gcc-3.3 Version: 1:3.3.3-0pre1 Severity: normal This program: #include #include #include int an_impure_function(void) { return rand(); } int main(void) { static char *const foo = "baz"; static int foo_len = strlen(foo); /* static int foo_len = an_impure_function(); */ pr