This is the mail archive of the gcc@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]

Re: Question on variable_size and function-at-a-time


On Sun, Apr 11, 2004 at 08:03:48AM -0400, Richard Kenner wrote:
> It looks to me that the SAVE_EXPR for the size of C is computed inside the
> "if (j == 2)" context so that if J is not 2, it will return undefined junk.

Yep.  Or worse, if the sizeof is only evaluated within a nested
function.  We will currently ICE on tree-ssa branch for that case.

> How is this supposed to work?

I have no idea.  I don't even know what it *means*.

In particular, at what point is the size of the type fixed?  At the
location of the typedef?  At the first use?  At the beginning of the
function?

I think the first alternative makes the most sense, but frankly, I
think there are lots of dumb corner cases that make no sense at all.
I wouldn't be terribly unhappy if all this stupid dynamicly sized
type stuff was dropped as a C extension.  C99 style VLAs handle what
people actually need; dynamicly sized structures are just too poorly
specified to be useful.

As for Ada, you'll just have to insert something somewhere appropriate
that gets the SAVE_EXPR evaluated.  Or, gasp, insert a temp variable
yourself rather than rely on broken SAVE_EXPR semantics.


r~


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