tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] va_list bug on x86_64, version 0.9.27


From: avih
Subject: Re: [Tinycc-devel] va_list bug on x86_64, version 0.9.27
Date: Thu, 13 Feb 2025 14:38:14 +0000 (UTC)

On Windows, with current tcc mob, both tcc-32 and tcc-64
print 17, as do mingw gcc 32 and 64 on Windows.

On linux (Ubuntu 64), tcc-mob also prints 17 for me, as does gcc.

FYI,

avih



On Thursday, February 13, 2025 at 04:11:18 PM GMT+2, DFP via Tinycc-devel 
<tinycc-devel@nongnu.org> wrote: 





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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]