Skip to content

Commit 4578fa8

Browse files
committed
[demangler] PPC and S390: Fix parsing of e-prefixed long double literals
Summary: This patch is to fix the parsing of long double literals encoded with the e prefix on PowerPC and S390. For both PowerPC and S390, type code e is used for 64-bit long double literals and g is used for 128-bit long double literals. libcxxabi test case test_demangle.pass.cpp fails without the fix. Authored by: xingxue-ibm Reviewers: hubert.reinterpretcast, jasonliu, erik.pilkington, uweigand, mclow.li sts, libc++abi Reviewed by: hubert.reinterpretcast, erik.pilkington Differential Revision: https://reviews.llvm.org/D74163
1 parent 1242018 commit 4578fa8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

libcxxabi/src/demangle/ItaniumDemangle.h

+6
Original file line numberDiff line numberDiff line change
@@ -4225,7 +4225,13 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() {
42254225
return getDerived().template parseFloatingLiteral<double>();
42264226
case 'e':
42274227
++First;
4228+
#if defined(__powerpc__) || defined(__s390__)
4229+
// Handle cases where long doubles encoded with e have the same size
4230+
// and representation as doubles.
4231+
return getDerived().template parseFloatingLiteral<double>();
4232+
#else
42284233
return getDerived().template parseFloatingLiteral<long double>();
4234+
#endif
42294235
case '_':
42304236
if (consumeIf("_Z")) {
42314237
Node *R = getDerived().parseEncoding();

llvm/include/llvm/Demangle/ItaniumDemangle.h

+6
Original file line numberDiff line numberDiff line change
@@ -4225,7 +4225,13 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() {
42254225
return getDerived().template parseFloatingLiteral<double>();
42264226
case 'e':
42274227
++First;
4228+
#if defined(__powerpc__) || defined(__s390__)
4229+
// Handle cases where long doubles encoded with e have the same size
4230+
// and representation as doubles.
4231+
return getDerived().template parseFloatingLiteral<double>();
4232+
#else
42284233
return getDerived().template parseFloatingLiteral<long double>();
4234+
#endif
42294235
case '_':
42304236
if (consumeIf("_Z")) {
42314237
Node *R = getDerived().parseEncoding();

0 commit comments

Comments
 (0)