[Bug c/39383] sizeof object with zero-length array ignores initializer
ebotcazou at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Mar 5 13:06:00 GMT 2009
------- Comment #1 from ebotcazou at gcc dot gnu dot org 2009-03-05 13:06 -------
> Currently sizeof(f1) == sizeof(int) rather than 4*sizeof(int), i.e.
> sizeof the object is determined by the type only, not the actual object
> size taking into account its initializer.
That's C. 6.5.3.4 (2) reads:
2 The sizeof operator yields the size (in bytes) of its operand, which may be
an expression or the parenthesized name of a type. The size is determined from
the type of the operand. The result is an integer. If the type of the operand
is a variable length array type, the operand is evaluated; otherwise, the
operand is not evaluated and the result is an integer constant.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39383
More information about the Gcc-bugs
mailing list