This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Undefined behavior in genautomata.c?
On Mon, Sep 19, 2005 at 12:07:45PM +0200, Sebastian Pop wrote:
> By the way, how is this different than detecting a bound on:
...
> int foo[1335];
...
> some_struct{ int foo[1335];} s;
Because here the variables are *known* to have a specific size.
Similarly with static and global variables, though you must be
careful for
struct S { struct B b; int x[]; };
struct T { struct S s; int x2[10]; } t;
where (&t.s) is used as an S in places that expect it, with 10
data elements allocated for the flexible array member.
In the case of the (fake) flexible array member, you do not know
how large the object allocated from malloc was unless you can
track down the actual malloc call.
r~