1 // REQUIRES: system-windows
2 //
3 // RUN: %clang_cl /Z7 /Zi %s -o %t
4 // RUN: %dexter --fail-lt 1.0 -w --binary %t --debugger 'dbgeng' -- %s
5
6 // From https://llvm.org/pr38857, where we had issues with stack realignment.
7
8 struct Foo {
9 int x = 42;
10 int __declspec(noinline) foo();
11 void __declspec(noinline) bar(int *a, int *b, double *c);
12 };
foo()13 int Foo::foo() {
14 int a = 1;
15 int b = 2;
16 double __declspec(align(32)) force_alignment = 0.42;
17 bar(&a, &b, &force_alignment); // DexLabel('in_foo')
18 x += (int)force_alignment;
19 return x;
20 }
bar(int * a,int * b,double * c)21 void Foo::bar(int *a, int *b, double *c) {
22 *c += *a + *b; // DexLabel('in_bar')
23 }
main()24 int main() {
25 Foo o;
26 o.foo();
27 }
28 /*
29 DexExpectProgramState({'frames':[
30 {'function': 'Foo::bar', 'location' : {'lineno' : ref('in_bar')} },
31 {'function': 'Foo::foo',
32 'watches' : {
33 'a' : '1',
34 'b' : '2',
35 'force_alignment' : '0.42'
36 }
37 }
38 ]})
39 */
40