This is the mail archive of the
mailing list for the GCC project.
Re: Further observations regarding alloca on i586-pc-linux-gnu
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: Further observations regarding alloca on i586-pc-linux-gnu
- From: Joerg Pommnitz <pommnitz at darmstadt dot gmd dot de>
- Date: Mon, 24 Aug 1998 17:38:38 +0200
- CC: Carlo Wood <carlo at runaway dot xs4all dot nl>, egcs-bugs at cygnus dot com, "egcs at cygnus dot com" <egcs at cygnus dot com>
- References: <email@example.com> <199808221724.TAA14230@jolan.ppro> <19980823043600.A4080@dot.cygnus.com>
I just tried the test on MS Visual C++ 5.0 with SP3 installed.
It crashes the compiler (fatal error C1001: INTERNAL COMPILER ERROR).
So, egcs just silently generates bad code while VC++ crashes. Both
not exactly the right thing, but I actually prefer the VC++ crash.
I really think the test is valid. There are no documented constraints
on the usage of alloca. An option "-fno-inline-alloca" and the generic
alloca emulation included in glibc would provide a useable work around.
Richard Henderson wrote:
> On Sat, Aug 22, 1998 at 07:24:11PM +0200, Carlo Wood wrote:
> > ??? pushl $10 # put '\n' on the stack
> > addl $-20,%esp # allocate 20 bytes on the stack
> > In other words: This is a bug.
> This is well known. What is not clear to me though, is whether
> it is a bug in the compiler or in the test.
> The test is effectively relying on the order in which arguments
> are evaluated, which is wrong. Note that the exact same effect
> would happen if alloca was not a builtin. Note that if you mind
> sequence points like you ought, you get correct results.
GMD-IPSI, Dolivostr. 15, Zimmer 120, D-64293 Darmstadt
+49-6151-869-786 (Phone), -818 (FAX)