[gcc r14-9647] PR modula2/114443 missing quote cause ICE
Gaius Mulley
gaius@gcc.gnu.org
Sat Mar 23 15:50:09 GMT 2024
https://gcc.gnu.org/g:c8a343f9f8602f4e6c1b385ddbeb58572234d447
commit r14-9647-gc8a343f9f8602f4e6c1b385ddbeb58572234d447
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date: Sat Mar 23 15:49:23 2024 +0000
PR modula2/114443 missing quote cause ICE
This patch inserts a missing quotation at the end of a line
if required (after an appropiate error message is generated).
gcc/m2/ChangeLog:
PR modula2/114443
* m2.flex: Call AddTokCharStar with a stringtok if
end of line is reached without a closing quote.
gcc/testsuite/ChangeLog:
PR modula2/114443
* gm2/pim/fail/missingquote.mod: New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diff:
---
gcc/m2/m2.flex | 2 ++
gcc/testsuite/gm2/pim/fail/missingquote.mod | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/gcc/m2/m2.flex b/gcc/m2/m2.flex
index f8f5ce64ad3..e8ee383878e 100644
--- a/gcc/m2/m2.flex
+++ b/gcc/m2/m2.flex
@@ -188,12 +188,14 @@ extern void yylex (void);
\"[^\"\n]*\" { updatepos(); M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext); return; }
\"[^\"\n]*$ { updatepos();
m2flex_M2Error("missing terminating quote, \"");
+ M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext);
resetpos(); return;
}
'[^'\n]*' { updatepos(); M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext); return; }
'[^'\n]*$ { updatepos();
m2flex_M2Error("missing terminating quote, '");
+ M2LexBuf_AddTokCharStar(M2Reserved_stringtok, yytext);
resetpos(); return;
}
diff --git a/gcc/testsuite/gm2/pim/fail/missingquote.mod b/gcc/testsuite/gm2/pim/fail/missingquote.mod
new file mode 100644
index 00000000000..e78f0e339ac
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/fail/missingquote.mod
@@ -0,0 +1,8 @@
+MODULE missingquote ;
+
+CONST
+ MyConst = 'foobar
+
+BEGIN
+
+END missingquote.
More information about the Gcc-cvs
mailing list