This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
.size directives and flexible array members
- From: Marcin 'Qrczak' Kowalczyk <qrczak at knm dot org dot pl>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 27 Aug 2006 18:06:45 +0200
- Subject: .size directives and flexible array members
gcc-4.1.0-0.20051206r108118 emits wrong .size directives for
statically initialized objects with a flexible array member,
e.g.:
struct {int x; int y[];} obj = {1, {2, 3}};
.globl obj
.data
.align 4
.type obj, @object
.size obj, 4
obj:
.long 1
.long 2
.long 3
Can this have serious effects (like overlapped or split objects),
or is .size used only for e.g. debugging?
I observe very strange effects when a particular complex program
is changed from explicitly sized arrays to flexible array members:
variables change values spontaneously, inserting printfs affects
places where they change values. I wonder whether this can be the
cause (the assembler output differs in more places than mere .size
directives because of changed types).
--
__("< Marcin Kowalczyk
\__/ qrczak@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/