This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22529] [3.4/4.0/4.1 Regression] Rejects valid C99 address of C99 struct in static variable in function
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jul 2005 20:13:55 -0000
- Subject: [Bug c/22529] [3.4/4.0/4.1 Regression] Rejects valid C99 address of C99 struct in static variable in function
- References: <20050717190953.22529.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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