[all-commits] [llvm/llvm-project] dc087d: Avoid undefined behavior in shift operators during...
Tom Honermann via All-commits
all-commits at lists.llvm.org
Mon Nov 18 15:32:42 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dc087d1a338ca07b77c28522abb063e712b3877d
https://github.com/llvm/llvm-project/commit/dc087d1a338ca07b77c28522abb063e712b3877d
Author: Tom Honermann <tom.honermann at intel.com>
Date: 2024-11-18 (Mon, 18 Nov 2024)
Changed paths:
M llvm/lib/IR/DIExpressionOptimizer.cpp
M llvm/unittests/IR/MetadataTest.cpp
Log Message:
-----------
Avoid undefined behavior in shift operators during constant folding of DIExpressions. (#116466)
Bit shift operations with a shift operand greater than or equal to the bit width
of the (promoted) value type result in undefined behavior according to C++
[expr.shift]p1. This change adds checking for this situation and avoids attempts
to constant fold DIExpressions that would otherwise provoke such behavior.
An existing test that presumably intended to exercise shifts at the UB boundary
has been updated; it now checks for shifts of 64 bits instead of 65. This issue
was reported by a static analysis tool; no actual cases of shift operations that
would result in undefined behavior in practice have been identified.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list