33// test1: Expect no diagnostics
44int test1 (int x) {
55 int y;
6- asm goto (" nop " : " =r" (y) : " r" (x) : : err);
6+ asm goto (" " : " =r" (y) : " r" (x) : : err);
77 return y;
88 err:
99 return -1 ;
1010}
1111
1212int test2 (int x) {
13- int y; // expected-warning {{variable 'y' is used uninitialized whenever its declaration is reached}} \
14- // expected-note {{initialize the variable}}
13+ int y; // expected-warning {{variable 'y' is used uninitialized whenever its declaration is reached}}
14+ // expected-note@-1 {{initialize the variable}}
1515 if (x < 42 )
16- asm volatile goto (" testl %0, %0; testl %1, %2; jne %l3 " : " +S" (x), " +D" (y) : " r" (x) :: indirect_1, indirect_2);
16+ asm goto (" " : " +S" (x), " +D" (y) : " r" (x) :: indirect_1, indirect_2);
1717 else
18- asm volatile goto (" testl %0, %1; testl %2, %3; jne %l5 " : " +S" (x), " +D" (y) : " r" (x), " r" (y) :: indirect_1, indirect_2);
18+ asm goto (" " : " +S" (x), " +D" (y) : " r" (x), " r" (y) :: indirect_1, indirect_2);
1919 return x + y;
2020indirect_1:
2121 return -42 ;
@@ -24,9 +24,9 @@ int test2(int x) {
2424}
2525
2626int test3 (int x) {
27- int y; // expected-warning {{variable 'y' is used uninitialized whenever its declaration is reached}} \
28- // expected-note {{initialize the variable}}
29- asm goto (" xorl %1, %0; jmp %l2 " : " =&r" (y) : " r" (x) : : fail);
27+ int y; // expected-warning {{variable 'y' is used uninitialized whenever its declaration is reached}}
28+ // expected-note@-1 {{initialize the variable}}
29+ asm goto (" " : " =&r" (y) : " r" (x) : : fail);
3030normal:
3131 y += x;
3232 return y;
@@ -38,20 +38,20 @@ int test3(int x) {
3838}
3939
4040int test4 (int x) {
41- int y; // expected-warning {{variable 'y' is used uninitialized whenever its declaration is reached}} \
42- // expected-note {{initialize the variable}}
41+ int y; // expected-warning {{variable 'y' is used uninitialized whenever its declaration is reached}}
42+ // expected-note@-1 {{initialize the variable}}
4343 goto forward;
4444backward:
4545 return y; // expected-note {{uninitialized use occurs here}}
4646forward:
47- asm goto (" # %0 %1 %2 " : " =r" (y) : " r" (x) : : backward);
47+ asm goto (" " : " =r" (y) : " r" (x) : : backward);
4848 return y;
4949}
5050
5151// test5: Expect no diagnostics
5252int test5 (int x) {
5353 int y;
54- asm volatile goto (" testl %0, %0; testl %1, %2; jne %l3 " : " +S" (x), " +D" (y) : " r" (x) :: indirect, fallthrough);
54+ asm goto (" " : " +S" (x), " +D" (y) : " r" (x) :: indirect, fallthrough);
5555fallthrough:
5656 return y;
5757indirect:
@@ -63,9 +63,30 @@ int test6(unsigned int *x) {
6363 unsigned int val;
6464
6565 // See through casts and unary operators.
66- asm goto (" nop " : " =r" (*(unsigned int *)(&val)) ::: indirect);
66+ asm goto (" " : " =r" (*(unsigned int *)(&val)) ::: indirect);
6767 *x = val;
6868 return 0 ;
6969indirect:
7070 return -1 ;
7171}
72+
73+ int test7 (int z) {
74+ int x; // expected-warning {{variable 'x' is used uninitialized whenever its declaration is reached}}
75+ // expected-note@-1 {{initialize the variable 'x' to silence this warning}}
76+ if (z)
77+ asm goto (" " :" =r" (x):::A1,A2);
78+ return 0 ;
79+ A1:
80+ A2:
81+ return x; // expected-note {{uninitialized use occurs here}}
82+ }
83+
84+ int test8 () {
85+ int x = 0 ; // expected-warning {{variable 'x' is used uninitialized whenever its declaration is reached}}
86+ // expected-note@-1 {{variable 'x' is declared here}}
87+ asm goto (" " :" =r" (x):::A1,A2);
88+ return 0 ;
89+ A1:
90+ A2:
91+ return x; // expected-note {{uninitialized use occurs here}}
92+ }
0 commit comments