This is an archive of the discontinued LLVM Phabricator instance.

[clang][ExprConstant] Fix assertion failure in constant expression folding
AbandonedPublic

Authored by antmo on Jul 31 2023, 9:23 AM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

Since D140059, clang asserts on constant calls of string functions
(memchr, strncmp, memcmp, ...) when the last argument (length) does not
fit in an UInt63:

strncmp("11", "12", -1);

Fix this by directly calling getZExtValue, as an unsigned value is
needed here

Diff Detail

Event Timeline

antmo created this revision.Jul 31 2023, 9:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 9:23 AM
antmo requested review of this revision.Jul 31 2023, 9:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 31 2023, 9:23 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder added a reviewer: Restricted Project.Aug 3 2023, 12:41 AM
antmo updated this revision to Diff 551525.Aug 18 2023, 8:29 AM

rebase & ping ; )

antmo abandoned this revision.Sep 25 2023, 6:42 AM

yes indeed you fixed this @shafik. thanks for the update. abandoning this revision