From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0C511385802D; Tue, 5 Oct 2021 19:37:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C511385802D From: "vsevolod.livinskij at frtk dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102622] New: Wrong code with -O3 for skylake-avx512 and icelake-server Date: Tue, 05 Oct 2021 19:37:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vsevolod.livinskij at frtk dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2021 19:37:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102622 Bug ID: 102622 Summary: Wrong code with -O3 for skylake-avx512 and icelake-server Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vsevolod.livinskij at frtk dot ru Target Milestone: --- Reproducer: // func.cpp #include extern int var_20, var_22; extern short arr_32[]; extern char arr_45[]; void test(int a, unsigned b, long long *c) { for (short d =3D 0; d < 13; d++) { for (int e =3D 0; e < a; e +=3D 3) var_20 =3D 0; if (std::max(b, unsigned((short)b))) { arr_32[d] =3D 0; var_22 =3D *c; } for (unsigned f =3D 0; f < 69; f +=3D 4) arr_45[f] =3D 0; } } driver.cpp #include unsigned long long int a =3D 10693271954245845448ULL; unsigned int b =3D 1144022456U; long long int c =3D 42; int var_20 =3D 0; long long int var_22 =3D 0; unsigned short arr_32 [13]; unsigned char arr_45 [69]; void test(int a, unsigned int b, long long int* c); int main() { test(a, b, &c); printf("%llu\n", var_22); } Error: >$ g++ -O3 -march=3Dskylake-avx512 func.cpp driver.cpp && sde -skx -- ./a.o= ut=20 0 >$ g++ -O2 -march=3Dskylake-avx512 func.cpp driver.cpp && sde -skx -- ./a.o= ut=20 42 GCC version: Using built-in specs. COLLECT_GCC=3Dg++ COLLECT_LTO_WRAPPER=3D/testing/gcc/bin/libexec/gcc/x86_64-pc-linux-gnu/12.0= .0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /testing/gcc/gcc_src/configure --enable-multilib --prefix=3D/testing/gcc/bin --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20211004 (154fd0896ef22fcf5235e35e2b795394dddd7a33) (GCC= )=