Skip to content

[X86_64] va_arg with SSE type get error #86371

@CoTinker

Description

@CoTinker

demo.c

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

struct S271 { union{}a; double b;} ;
struct S271 s271;
void check271va (int z, ...) {
    struct S271 arg;
    va_list ap;
    __builtin_va_start(ap, z);
    arg = __builtin_va_arg(ap, struct S271);
    long double a = __builtin_va_arg(ap, long double);
    printf("%Lf\n", a);
    if (a != 2.0L)
       printf("Fail\n");
    __builtin_va_end(ap);
}
int main (void) {
    printf("%lu\n", sizeof(s271));
    check271va (2, s271, 2.0L);
}

clang

16
0.000000
Fail

gcc

16
2.000000

https://godbolt.org/z/o6v318vWM

Metadata

Metadata

Assignees

No one assigned

    Labels

    ABIApplication Binary Interfacebackend:X86

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions