Subject: Re: compiling -std=c99 on cobalt fails with alloca
To: None <kristaps@gradient-enterprises.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-cobalt
Date: 08/30/2006 04:41:11
kristaps@gradient-enterprises.com wrote:

> If NetBSD/cobalt (same with pmax - maybe all mipsel?) doesn't compile
> 
> $ gcc -std=c99 foo.c
> 
> (with the aforementioned alloca() call in foo.c)
> 
> ...while NetBSD/i386 (and OpenBSD/i386, etc) does, then somebody has an 
> error. I see that you've commented on this in the past; would you call 
> this a bug on the other systems viz. conformance to c99?

Not all archs have alloca(3) in libc:
---
% find /usr/src/lib/libc -name alloca\* -print
/usr/src/lib/libc/arch/i386/gen/alloca.S
/usr/src/lib/libc/arch/m68k/gen/alloca.S
/usr/src/lib/libc/arch/ns32k/gen/alloca.S
/usr/src/lib/libc/arch/arm/gen/alloca.S
/usr/src/lib/libc/arch/vax/gen/alloca.S
/usr/src/lib/libc/arch/x86_64/gen/alloca.S
/usr/src/lib/libc/arch/sh5/gen/alloca.S
/usr/src/lib/libc/stdlib/alloca.3
%
---
and alloca(3) says:
>>     The alloca() function is machine dependent; its use is discouraged.

> On a related note, shouldn't this bail on compilation, and not on linking?

You could still prepare your own alloca() (like gcc's builtin) for mips.
---
Izumi Tsutsui