aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/x86_64/test-1648.c
blob: fd0644a8ce25b2a45ab5112bbbf3bd40fb4ad9a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* See https://gitlab.com/qemu-project/qemu/-/issues/1648 */

#include <signal.h>

__attribute__((noinline))
void bar(void)
{
    /* Success! Continue through sigreturn. */
}

/*
 * Because of the change of ABI between foo and bar, the compiler is
 * required to save XMM6-XMM15.  The compiler will use MOVAPS or MOVDQA,
 * which will trap if the stack frame is not 16 byte aligned.
 */
__attribute__((noinline, ms_abi))
void foo(void)
{
    bar();
}

void sighandler(int num)
{
    foo();
}

int main(void)
{
    signal(SIGUSR1, sighandler);
    raise(SIGUSR1);
    return 0;
}