This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question on variable_size and function-at-a-time
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 12 Apr 2004 13:27:39 -0700
- Subject: Re: Question on variable_size and function-at-a-time
- References: <10404111203.AA08845@vlsi1.ultra.nyu.edu>
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~