From e6d26a21e0369081491941552900ab3cbfdd18a4 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Mon, 25 Nov 2024 22:46:16 +0000 Subject: 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 --- 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(-) create mode 100644 gcc/testsuite/gm2/extensions/asm/pass/conststr.mod (limited to 'gcc') diff --git a/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf b/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf index 868484c..4e468bd 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 ac96ddb..42d034d 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 e3db5f0..86fbe15 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 263ac9b..2731e89 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 55f4e90..5893852 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 0000000..bbe6939 --- /dev/null +++ b/gcc/testsuite/gm2/extensions/asm/pass/conststr.mod @@ -0,0 +1,5 @@ +MODULE conststr ; + +BEGIN + ASM VOLATILE ("") +END conststr. -- cgit v1.1