This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/22529] [3.4/4.0/4.1 Regression] Rejects valid C99 address of C99 struct in static variable in function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]