aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-04-04 11:54:59 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:28:43 +0100
commit9d8da7d12642440de699fb744ba6f493194da741 (patch)
treeb8eef5475bddcdd21ef7e10cb3d4475f5ce63fa8 /gcc
parent1dcc60c25c29a1e35067dc89d1be7fae7d06da5a (diff)
downloadgcc-9d8da7d12642440de699fb744ba6f493194da741.zip
gcc-9d8da7d12642440de699fb744ba6f493194da741.tar.gz
gcc-9d8da7d12642440de699fb744ba6f493194da741.tar.bz2
gccrs: 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)));