From: Matt Harren <matth@cs...> - 2006-02-16 02:13:51
> -----Original Message-----
> From: cil-users-admin@...
> [mailto:cil-users-admin@...] On Behalf Of
> Sent: Tuesday, February 14, 2006 5:12 AM
> To: cil-users@...
> Subject: [CIL users] alloca and heapify
> I see that CIL transforms variable sized local arrays to a
> call to alloca.
> This is not useable for us, because our code base is compiled
> with -fno-builtin
-fno-builtin allows programs to call __builtin_alloca, but not alloca.
I've put a fix for cil/src/frontc/cabs2cil below.
> Would it be an option to somehow leave the variable sized
> array declarations untouched?
> Some other workaround?
If for some reason you don't want to use __builtin_alloca, you could try
editting cabs2cil to not make this transformation. But I don't know
whether that would break other parts of CIL.
--- src/frontc/cabs2cil.ml 6 Feb 2006 16:54:08 -0000 1.456
+++ src/frontc/cabs2cil.ml 16 Feb 2006 02:08:12 -0000
@@ -1011,7 +1011,13 @@
(** ALLOCA ***)
let allocaFun () =
- let fdec = emptyFunction "alloca" in
+ let name =
+ if !msvcMode then "alloca"
+ (* Use __builtin_alloca where possible, because this can be used
+ even when gcc is invoked with -fno-builtin *)
+ else "__builtin_alloca"
+ let fdec = emptyFunction name in
TFun(voidPtrType, Some [ ("len", !typeOfSizeOf, ) ], false, );