aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/lex.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc
index 25aaeb7..6add84e 100644
--- a/gcc/go/gofrontend/lex.cc
+++ b/gcc/go/gofrontend/lex.cc
@@ -1312,6 +1312,12 @@ Lex::append_char(unsigned int v, bool is_character, std::string* str,
// Turn it into the "replacement character".
v = 0xfffd;
}
+ if (v >= 0xd800 && v < 0xe000)
+ {
+ warning_at(location, 0,
+ "unicode code point 0x%x is invalid surrogate pair", v);
+ v = 0xfffd;
+ }
if (v <= 0xffff)
{
buf[0] = 0xe0 + (v >> 12);