[PATCH] D91625: [clang] Do not crash on pointer wchar_t pointer assignment.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 17 12:13:48 PST 2020
hokein added inline comments.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:8726
+ else if (!lhptee->isWideCharType() &&
+ lhptee->hasSignedIntegerRepresentation())
ltrans = S.Context.getCorrespondingUnsignedType(ltrans);
----------------
I'm wondering whether the fix is in `ASTContext::getCorrespondingUnsignedType()`
if my reading of the standard is right:
- there exists a corresponding standard (or extended) unsigned integer type for each of standard (or extended) signed integer types, http://eel.is/c++draft/basic.fundamental#2
- wchar_t is an integer type, http://eel.is/c++draft/basic.fundamental#11, and has an implementation-defined signed or unsigned integer type as its underlying type, http://eel.is/c++draft/basic.fundamental#8
I think the rule also applies on `wchar_t`, the fix seems to handle `WChar_S` case (return `ASTContext::getUnsignedWCharType()`) in `ASTContext::getCorrespondingUnsignedType()`. What do you think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91625/new/
https://reviews.llvm.org/D91625
More information about the cfe-commits
mailing list