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:58 -------
Subject: Re:  [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:

> That is interesting as if we move the variable declaration out of the 
> function, it works in GCC.

That's because of 6.5.2.5#6 which defines the storage duration of compound 
literals to depend on whether they are inside a function:

       [#6] The value of the compound literal is that of an unnamed
       object initialized by the initializer list.  If the compound
       literal occurs outside the body of a  function,  the  object
       has  static  storage  duration;  otherwise, it has automatic
       storage duration associated with the enclosing block.



-- 


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]