[llvm] [Flang-rt][build] fixes building warnings under gcc: (PR #173955)
liao jun via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 29 22:48:32 PST 2025
================
@@ -67,7 +67,7 @@ struct MaxOrMinIdentity<TypeCategory::Real, 16, IS_MAXVAL,
// Create a buffer to store binary representation of __float128 constant.
constexpr std::size_t alignment =
std::max(alignof(Type), alignof(std::uint64_t));
- alignas(alignment) char data[sizeof(Type)];
+ alignas(alignment) char data[sizeof(Type)]{};
----------------
zjlcd wrote:
When the GCC-11 analyzes the statement "*reinterpret_cast<Type *>(data) = ...", it may find difficult to be completely sure that this is equivalent to initializing every byte of the data array (especially when strict aliasing rules are involved).
Explicit initialization helps the compiler with static analysis, thereby eliminating any warnings about 'maybe uninitialized'.
https://github.com/llvm/llvm-project/pull/173955
More information about the llvm-commits
mailing list