https://gcc.gnu.org/g:e6d26a21e0369081491941552900ab3cbfdd18a4
commit r15-5662-ge6d26a21e0369081491941552900ab3cbfdd18a4 Author: Gaius Mulley <gaiusm...@gmail.com> Date: Mon Nov 25 22:46:16 2024 +0000 PR modula2/117777: m2 does not allow single const string in asm volatile gm2 does not allow single const string in ASM VOLATILE. The bugfix is to modify AsmOperands in all passes except P3Build.bnf (which is correct). The remaining passes need to make the term following the ConstExpression optional. gcc/m2/ChangeLog: PR modula2/117777 * gm2-compiler/P0SyntaxCheck.bnf (AsmOperands): Allow term after ConstExpression to be optional. * gm2-compiler/P1Build.bnf (AsmOperands): Ditto. * gm2-compiler/P2Build.bnf (AsmOperands): Ditto. * gm2-compiler/PCBuild.bnf (AsmOperands): Ditto. * gm2-compiler/PHBuild.bnf (AsmOperands): Ditto. gcc/testsuite/ChangeLog: PR modula2/117777 * gm2/extensions/asm/pass/conststr.mod: New test. Signed-off-by: Gaius Mulley <gaiusm...@gmail.com> Diff: --- gcc/m2/gm2-compiler/P0SyntaxCheck.bnf | 2 +- gcc/m2/gm2-compiler/P1Build.bnf | 2 +- gcc/m2/gm2-compiler/P2Build.bnf | 2 +- gcc/m2/gm2-compiler/PCBuild.bnf | 2 +- gcc/m2/gm2-compiler/PHBuild.bnf | 2 +- gcc/testsuite/gm2/extensions/asm/pass/conststr.mod | 5 +++++ 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf b/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf index 868484c9b622..4e468bdae571 100644 --- a/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf +++ b/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf @@ -968,7 +968,7 @@ NamedOperand := '[' Ident ']' =: AsmOperandName := [ NamedOperand ] =: -AsmOperands := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ] +AsmOperands := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ] =: AsmList := [ AsmElement ] { ',' AsmElement } =: diff --git a/gcc/m2/gm2-compiler/P1Build.bnf b/gcc/m2/gm2-compiler/P1Build.bnf index ac96ddb383f1..42d034dffe7e 100644 --- a/gcc/m2/gm2-compiler/P1Build.bnf +++ b/gcc/m2/gm2-compiler/P1Build.bnf @@ -1048,7 +1048,7 @@ NamedOperand := '[' Ident ']' =: AsmOperandName := [ NamedOperand ] =: -AsmOperands := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ] +AsmOperands := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ] =: AsmList := [ AsmElement ] { ',' AsmElement } =: diff --git a/gcc/m2/gm2-compiler/P2Build.bnf b/gcc/m2/gm2-compiler/P2Build.bnf index e3db5f077dc6..86fbe1565f10 100644 --- a/gcc/m2/gm2-compiler/P2Build.bnf +++ b/gcc/m2/gm2-compiler/P2Build.bnf @@ -1257,7 +1257,7 @@ NamedOperand := '[' Ident ']' =: AsmOperandName := [ NamedOperand ] =: -AsmOperands := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ] +AsmOperands := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ] =: AsmList := [ AsmElement ] { ',' AsmElement } =: diff --git a/gcc/m2/gm2-compiler/PCBuild.bnf b/gcc/m2/gm2-compiler/PCBuild.bnf index 263ac9b40316..2731e8940e6a 100644 --- a/gcc/m2/gm2-compiler/PCBuild.bnf +++ b/gcc/m2/gm2-compiler/PCBuild.bnf @@ -1292,7 +1292,7 @@ NamedOperand := '[' Ident ']' =: AsmOperandName := [ NamedOperand ] =: -AsmOperands := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ] +AsmOperands := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ] =: AsmList := [ AsmElement ] { ',' AsmElement } =: diff --git a/gcc/m2/gm2-compiler/PHBuild.bnf b/gcc/m2/gm2-compiler/PHBuild.bnf index 55f4e9008f31..589385277768 100644 --- a/gcc/m2/gm2-compiler/PHBuild.bnf +++ b/gcc/m2/gm2-compiler/PHBuild.bnf @@ -1246,7 +1246,7 @@ NamedOperand := '[' Ident ']' =: AsmOperandName := [ NamedOperand ] =: -AsmOperands := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ] +AsmOperands := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ] =: AsmList := [ AsmElement ] { ',' AsmElement } =: diff --git a/gcc/testsuite/gm2/extensions/asm/pass/conststr.mod b/gcc/testsuite/gm2/extensions/asm/pass/conststr.mod new file mode 100644 index 000000000000..bbe69394f0ea --- /dev/null +++ b/gcc/testsuite/gm2/extensions/asm/pass/conststr.mod @@ -0,0 +1,5 @@ +MODULE conststr ; + +BEGIN + ASM VOLATILE ("") +END conststr.