[cfe-dev] Differences between linux and macosx

Eli Friedman eli.friedman at gmail.com
Sun Jun 15 15:18:11 PDT 2008


On Sun, Jun 15, 2008 at 2:50 PM, Filipe Cabecinhas <filcab at gmail.com> wrote:
> Hi,
>
> I'm getting a weird error in Linux (gentoo) that doesn't happen in
> MacOS X:
>
> filcab at escher ~ $ cat b.c
> #include <alloca.h>
> int main ()
> {
>   char *p = (char *) alloca (2 * sizeof (int));
>   if (p) return 0;
>   return 0;
> }
>
> filcab at escher ~ $ gcc b.c
> filcab at escher ~ $ ccc b.c
> b.c
> clang -emit-llvm-bc -o b.o b.c
> clang: Instructions.cpp:713: llvm::Value* getAISize(llvm::Value*):
> Assertion `Amt->getType() == Type::Int32Ty && "Malloc/Allocation array
> size is not a 32-bit integer!"' failed.

Is you Linux install x86-64?  CodeGen is mostly untested outside of
regular x86.  (You can override the target triple on the commandline.)

That said, it should be easy to always truncate the size argument to
the LLVM alloca to 32 bits.

-Eli



More information about the cfe-dev mailing list