[PATCH v2] LangRef: clarify that va_arg doesn't work on x86_64

Tim Northover t.p.northover at gmail.com
Wed Oct 29 15:30:03 PDT 2014


Hi,

> You mean the *current* LangRef example? I'm on OS X, running LLVM
> 3.4.2. I tried adding:
>
>   target triple = "x86_64-apple-darwin"
>
> to the .ll, but it still segfaults when run with lli.

Ah, I see. I didn't try running the examples, I get a segfault too.
That's not good, even if you would normally have to use something else
anyway.

> In any case, I think the segfault is a bug that should be fixed with
> an assert or similar. We should do _something_ to make sure that the
> example actually works atleast on x86_64.

I agree that the segfault is a bug and it'd be good to see it fixed
(probably crept in because no-one uses va_arg on x86_64), but still
don't think making the example executable on any one particular target
is important.

> From what I understood from what Reid said in a previous email, va_arg
> only works on integers, floats, pointers etc, but not on a struct on
> x86_64.

Very likely.

>> x86_64 is a struct but appears to pretend
>> to be an i8** (in reality it probably doesn't matter).
>
> Can you point me to the LLVM code that reads the i8** or struct?

I'm afraid I don't know what you mean here. I think the code you just
posted is the main block that deals with this, and since it's in the
backend they're both just "pointer type" and it can load from whatever
offset from that base pointer it likes.

Cheers.

Tim.



More information about the llvm-commits mailing list