From 998bffecc25dd735175d296303d18ed0df1f9651 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 6 Sep 2024 16:53:23 +0200 Subject: [PATCH] Fix warning/crash for MSVC ARM64 mode Initialize the variables outside the loop to avoid repeating it on every iteration. Fixes: QTBUG-128667 Change-Id: I8e2ed0e40bdc4d687060df72f1d45e940e56df98 Reviewed-by: Eirik Aavitsland (cherry picked from commit 0819f128c5206d5712acce2e86e9eb5d9ba13182) Reviewed-by: Qt Cherry-pick Bot --- src/gui/painting/qdrawhelper.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index aaf57e19d1f..62032a48690 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1581,9 +1581,10 @@ static void QT_FASTCALL fetchTransformedBilinearARGB32PM_downscale_helper(uint * const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff); const int32x4_t v_fx_r = vdupq_n_s32(0x0800); + // Pre-initialize to work-around code-analysis warnings/crashes in MSVC: + uint32x4x2_t v_top = {}; + uint32x4x2_t v_bot = {}; while (b < boundedEnd - 3) { - uint32x4x2_t v_top, v_bot; - int x1 = (fx >> 16); fx += fdx; v_top = vld2q_lane_u32(s1 + x1, v_top, 0); @@ -1797,9 +1798,10 @@ static void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper(uint const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff); const int32x4_t v_round = vdupq_n_s32(0x0800); + // Pre-initialize to work-around code-analysis warnings/crashes in MSVC: + uint32x4x2_t v_top = {}; + uint32x4x2_t v_bot = {}; while (b < boundedEnd - 3) { - uint32x4x2_t v_top, v_bot; - int x1 = (fx >> 16); int y1 = (fy >> 16); fx += fdx; fy += fdy;