From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CDD373858C2C; Tue, 4 Jan 2022 17:27:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CDD373858C2C From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute Date: Tue, 04 Jan 2022 17:27:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: deferred, opt-attribute X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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, 04 Jan 2022 17:27:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D92860 --- Comment #85 from Martin Li=C5=A1ka --- Ok, so the options-save.c is really miscompiled. I reduced that down to: $ cat options-save2.ii struct cl_optimization { /* All have value 0. */ char x_flag_keep_gc_roots_live; char x_flag_lifetime_dse; char x_flag_limit_function_alignment; char x_flag_live_range_shrinkage; char x_flag_loop_interchange; char x_flag_loop_nest_optimize; char x_flag_loop_parallelize_all; char x_flag_unroll_jam; char x_flag_lra_remat; char x_flag_errno_math; char x_flag_modulo_sched; char x_flag_modulo_sched_allow_regmoves; char x_flag_move_loop_invariants; char x_flag_move_loop_stores; char x_flag_non_call_exceptions; /* Value 1. */ char x_flag_nothrow_opt; } cl_optimization_save_ptr; int val0, val1; void cl_optimization_save() { cl_optimization_save_ptr.x_flag_keep_gc_roots_live =3D val0; cl_optimization_save_ptr.x_flag_lifetime_dse =3D val0; cl_optimization_save_ptr.x_flag_limit_function_alignment =3D val0; cl_optimization_save_ptr.x_flag_live_range_shrinkage =3D val0; cl_optimization_save_ptr.x_flag_loop_interchange =3D val0; cl_optimization_save_ptr.x_flag_loop_nest_optimize =3D val0; cl_optimization_save_ptr.x_flag_loop_parallelize_all =3D val0; cl_optimization_save_ptr.x_flag_unroll_jam =3D val0; cl_optimization_save_ptr.x_flag_lra_remat =3D val0; cl_optimization_save_ptr.x_flag_errno_math =3D val0; cl_optimization_save_ptr.x_flag_modulo_sched =3D val0; cl_optimization_save_ptr.x_flag_modulo_sched_allow_regmoves =3D val0; cl_optimization_save_ptr.x_flag_move_loop_invariants =3D val0; cl_optimization_save_ptr.x_flag_move_loop_stores =3D val0; cl_optimization_save_ptr.x_flag_non_call_exceptions =3D val0; cl_optimization_save_ptr.x_flag_nothrow_opt =3D val1; } $ /tmp/gcc/objdir2/./gcc/xg++ -B/tmp/gcc/objdir2/./gcc/ -O2 options-save2.i= i -S -O3 -march=3Dcore2 -o good.s -fno-checking -fdump-rtl-final=3Dgood.txt $ /tmp/gcc/objdir/./prev-gcc/xg++ -B/tmp/gcc/objdir/./prev-gcc/ -O2 options-save2.ii -S -O3 -march=3Dcore2 -o good.s -fno-checking -fdump-rtl-final=3Dbad.txt diff good.txt bad.txt prints: (insn:TI 12 5 39 2 (set (reg:V16QI 23 xmm3 [94]) (mem/u/c:V16QI (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [0 S16 A12= 8])) "options-save2.ii":25:54 1652 {movv16qi_internal} (expr_list:REG_EQUIV (const_vector:V16QI [ (const_int -128 [0xffffffffffffff80]) repeated x8 (const_int 0 [0]) (const_int 1 [0x1]) (const_int 4 [0x4]) (const_int 5 [0x5]) - (const_int 8 [0x8]) - (const_int 9 [0x9]) - (const_int 12 [0xc]) - (const_int 13 [0xd]) + (const_int -128 [0xffffffffffffff80]) repeated x4 ]) (nil))) So as seen, different vector constants are saved to xmm3.=