Skip to content
Snippets Groups Projects
Commit 38bff3ec authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[parser] accept adjacent string literal tokens in extended GNU asm clauses

Apparently things like that exist in untamed code bases. Fixes #615
parent e35ef29b
No related branches found
No related tags found
No related merge requests found
......@@ -736,10 +736,7 @@ string_constant:
back to a string for easy viewing. */
string_list { intlist_to_string (fst $1), snd $1 }
;
one_string_constant:
/* Don't concat multiple strings. For asm templates. */
CST_STRING { intlist_to_string (fst $1) }
;
string_list:
one_string { fst $1, snd $1 }
| string_list one_string { merge_string $1 $2 }
......@@ -1674,8 +1671,8 @@ asmattr:
| CONST asmattr { ("const", []) :: $2 }
;
asmtemplate:
one_string_constant { [$1] }
| one_string_constant asmtemplate { $1 :: $2 }
one_string { [intlist_to_string (fst $1)] }
| one_string asmtemplate { intlist_to_string (fst $1) :: $2 }
;
asmoutputs:
/* empty */ { None }
......@@ -1711,8 +1708,8 @@ asmclobber:
| COLON asmcloberlst_ne asmlabels { $2,$3 }
;
asmcloberlst_ne:
one_string_constant { [$1] }
| one_string_constant COMMA asmcloberlst_ne { $1 :: $3 }
string_constant { [fst $1] }
| string_constant COMMA asmcloberlst_ne { fst $1 :: $3 }
;
asmlabels:
| /* empty */ { [] }
......
......@@ -191,4 +191,7 @@ asm("sidt %0\n" : :"m"(loc));
asm ("movq $36, (%0)": : "r"(pulValue));
int a = 2, b = 3;
__asm__("mov %1, %0" : "=r"(a) :"r"(b): "%""eax");
}
......@@ -140,6 +140,11 @@ void f(void)
\from (indirect: pulValue), *(pulValue + (..));
*/
__asm__ ("movq $36, (%0)" : : "r" (pulValue));
int a = 2;
int b = 3;
/*@ assigns a;
assigns a \from b; */
__asm__ ("mov %1, %0" : "=r" (a) : "r" (b) : "%eax");
return;
}
......
......@@ -123,6 +123,11 @@ void f(void)
\from (indirect: pulValue), *(pulValue + (..));
*/
__asm__ ("movq $36, (%0)" : : "r" (pulValue));
int a = 2;
int b = 3;
/*@ assigns a;
assigns a \from b; */
__asm__ ("mov %1, %0" : "=r" (a) : "r" (b) : "%eax");
return;
}
......
......@@ -122,6 +122,11 @@ void f(void)
\from (indirect: pulValue), *(pulValue + (..));
*/
__asm__ ("movq $36, (%0)" : : "r" (pulValue));
int a = 2;
int b = 3;
/*@ assigns a;
assigns a \from b; */
__asm__ ("mov %1, %0" : "=r" (a) : "r" (b) : "%eax");
return;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment