Hello. va_arg seems to take the value from unexpected location on x86_64, in a case where a variable argument function returns a struct that is larger than 16 bytes. I tested on plain x86 (32 bit) via JSLinux (https://bellard.org/jslinux/vm.html?url=alpine-x86-xwin.cfg&mem=256&graphic=1) and the issue does not seem to occur there. Can anyone reproduce? Code listed below, which erroneously prints '3' instead of '17':
#include <stdarg.h> #include <stdio.h> struct s { char a[17]; } s; struct s f( int a, ... ) { va_list args; va_start( args, a ); printf( "%d\n", va_arg( args, int ) ); va_end(args); return (struct s){0}; } int main() { f( 3, 17 ); return 0; } _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel