[Bug c/22529] [3.4/4.0/4.1 Regression] Rejects valid C99 address of C99 struct in static variable in function
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 17 20:18:00 GMT 2005
------- Additional Comments From joseph at codesourcery dot com 2005-07-17 20:13 -------
Subject: Re: New: [3.4/4.0/4.1 Regression] Rejects valid C99
address of C99 struct in static variable in function
On Sun, 17 Jul 2005, pinskia at gcc dot gnu dot org wrote:
> Take the following code:
> struct f1
> {
> int i;
> };
> void f(void)
> {
> static struct f1 *f2 = &(struct f1){1};
> }
>
> This is valid C99 at least according to both ICC and Comeau.
So report it as a bug in ICC and Comeau. It is exactly as valid as
struct f1
{
int i;
};
void f(void)
{
struct f1 tmp = { 1 };
static struct f1 *f2 = &tmp;
}
i.e. not at all. The address of an object of automatic storage duration
is not a constant.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22529
More information about the Gcc-bugs
mailing list