From 13c5c4cc4c4a82c25a24dd43d8929c87682e808e Mon Sep 17 00:00:00 2001 From: Cary Phillips Date: Tue, 8 Aug 2023 16:19:25 -0700 Subject: [PATCH] Initialize regs[] to 0 in check_for_x86_simd gcc warns of a potentially uninitialized memory reference, in the case where ``__get_cpuid()`` fails to assign values to all its parameters. Signed-off-by: Cary Phillips --- src/lib/OpenEXRCore/internal_cpuid.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/OpenEXRCore/internal_cpuid.h b/src/lib/OpenEXRCore/internal_cpuid.h index 8a2573b8b6..b839665f9f 100644 --- a/src/lib/OpenEXRCore/internal_cpuid.h +++ b/src/lib/OpenEXRCore/internal_cpuid.h @@ -49,14 +49,14 @@ check_for_x86_simd (int* f16c, int* avx, int* sse2) #elif OPENEXR_ENABLE_X86_SIMD_CHECK # if defined(_MSC_VER) && defined(_WIN32) - int regs[4], osxsave; + int regs[4]={0}, osxsave; __cpuid (regs, 0); if (regs[0] >= 1) { __cpuidex (regs, 1, 0); } else regs[2] = 0; # else - unsigned int regs[4], osxsave; + unsigned int regs[4]={0}, osxsave; __get_cpuid (0, ®s[0], ®s[1], ®s[2], ®s[3]); if (regs[0] >= 1) {