va_list ARM changes

Johannes Pfau nospam at example.com
Fri Aug 31 03:28:18 PDT 2012


I tested the changes as in revision
59f52c69d79b10c81913e837ecb14dad0c5fe264:

I wasn't sure what exactly should be tested, this is the test case I
used: http://dpaste.dzfl.pl/c362e632
(not sure why it doesn't compile on dpaste, it works with my local dmd
and gdc installation)
This was the output:
--------
foo
Test test 42
-0.481002 
42 Hello [10, 0, 0, 0, 200, 69, 246, 190, 0, 1]
--------

* Formatting the struct works, the vprintf example works as well.

* Test2 fails, the float is not read correctly. Could be related to the
  hardfloat API? (it does work on x86 dmd, can't text x86 gdc right
  now). More complicated examples with floats usually lead to
  segmentation faults.

* Test3 does not work either. Seems passing static arrays doesn't work.
  However, this also doesn't work on x86/dmd so maybe I'm doing
  something wrong?
  It seems this is alignment related though: I guess va_arg always
  expects the arguments to be aligned, but ubyte[10] isn't aligned?
  If the value passed to the function is a ulong, but read as a ubyte[8]
  everything is fine (on arm and on x86/dmd), if the value is passed
  as a ubyte[8] and read as a ubyte[8] it doesn't work:
--------
    ubyte[8] c = cast(ubyte[8])[0,1,2,3,4,5,6,7];
    test3("", 42, "Hello", *(cast(ulong*)&c)); //WORKS
--------


More information about the D.gnu mailing list