aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-04-04 11:54:59 +0200
committerCohenArthur <arthur.cohen@embecosm.com>2023-04-05 08:09:09 +0000
commit68ee667852b38a907ded42d36465c5ab9a32e8db (patch)
tree8c35a70f170dfbe24abcc85813defa04a7d8ba8f /gcc
parent28f445767e8dbeb9899319d7b5cc91f1db6e6a7e (diff)
downloadgcc-68ee667852b38a907ded42d36465c5ab9a32e8db.zip
gcc-68ee667852b38a907ded42d36465c5ab9a32e8db.tar.gz
gcc-68ee667852b38a907ded42d36465c5ab9a32e8db.tar.bz2
ast: Fix char literal ICE
The code was attempting to convert a char to an integer by parsing it instead of taking it's raw value. gcc/rust/ChangeLog: * ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix ICE. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-tokenstream.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc
index b248aee..4a7107f 100644
--- a/gcc/rust/ast/rust-ast-tokenstream.cc
+++ b/gcc/rust/ast/rust-ast-tokenstream.cc
@@ -789,8 +789,10 @@ TokenStream::visit (Literal &lit, Location locus)
switch (lit.get_lit_type ())
{
case Literal::LitType::CHAR:
- tokens.push_back (Rust::Token::make_char (
- locus, Codepoint (static_cast<uint32_t> (std::stoul (value)))));
+ tokens.push_back (
+ Rust::Token::make_char (locus,
+ // TODO: Change this to support utf-8 properly
+ Codepoint (static_cast<uint32_t> (value[0]))));
break;
case Literal::LitType::STRING:
tokens.push_back (Rust::Token::make_string (locus, std::move (value)));