]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR modula2/117777: m2 does not allow single const string in asm volatile
authorGaius Mulley <gaiusmod2@gmail.com>
Mon, 25 Nov 2024 22:46:16 +0000 (22:46 +0000)
committerGaius Mulley <gaiusmod2@gmail.com>
Mon, 25 Nov 2024 22:46:16 +0000 (22:46 +0000)
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 <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/P0SyntaxCheck.bnf
gcc/m2/gm2-compiler/P1Build.bnf
gcc/m2/gm2-compiler/P2Build.bnf
gcc/m2/gm2-compiler/PCBuild.bnf
gcc/m2/gm2-compiler/PHBuild.bnf
gcc/testsuite/gm2/extensions/asm/pass/conststr.mod [new file with mode: 0644]

index 868484c9b62293a762598396446e924c3e0c4bb4..4e468bdae571bc031821b27f17d0fbf9060d121e 100644 (file)
@@ -968,7 +968,7 @@ NamedOperand := '[' Ident ']' =:
 
 AsmOperandName := [ NamedOperand ] =:
 
-AsmOperands  := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ]
+AsmOperands  := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ]
               =:
 
 AsmList      := [ AsmElement ] { ',' AsmElement } =:
index ac96ddb383f1794a89e956b8a81dd1f1a780c717..42d034dffe7ea35fc1f6722f90093ca1ac6a4826 100644 (file)
@@ -1048,7 +1048,7 @@ NamedOperand := '[' Ident ']' =:
 
 AsmOperandName := [ NamedOperand ] =:
 
-AsmOperands  := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ]
+AsmOperands  := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ]
               =:
 
 AsmList      := [ AsmElement ] { ',' AsmElement } =:
index e3db5f077dc65650b1083081f4f88e42a1ad267f..86fbe1565f10e8be2393e6ff09ec41074cc2b38e 100644 (file)
@@ -1257,7 +1257,7 @@ NamedOperand := '[' Ident ']' =:
 
 AsmOperandName := [ NamedOperand ] =:
 
-AsmOperands  := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ]
+AsmOperands  := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ]
               =:
 
 AsmList      := [ AsmElement ] { ',' AsmElement } =:
index 263ac9b4031605183928622f69d50043b276fa9b..2731e8940e6a6969504ffd594c7f05e55f9988ee 100644 (file)
@@ -1292,7 +1292,7 @@ NamedOperand := '[' Ident ']' =:
 
 AsmOperandName := [ NamedOperand ] =:
 
-AsmOperands  := ConstExpression ':' AsmList [ ':' AsmList [ ':' TrashList ] ]
+AsmOperands  := ConstExpression [ ':' AsmList [ ':' AsmList [ ':' TrashList ] ] ]
               =:
 
 AsmList      := [ AsmElement ] { ',' AsmElement } =:
index 55f4e9008f315c3069f6228f3ada08550d587ec0..58938527776871aacfb8e24c96dc3d19a322d141 100644 (file)
@@ -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 (file)
index 0000000..bbe6939
--- /dev/null
@@ -0,0 +1,5 @@
+MODULE conststr ;
+
+BEGIN
+   ASM VOLATILE ("")
+END conststr.