From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1C36C3858D39; Thu, 30 Jun 2022 23:55:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C36C3858D39 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106153] Generated arm64 code writing below stack pointer without updating SP Date: Thu, 30 Jun 2022 23:55:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.3.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org 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: everconfirmed bug_status 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: Thu, 30 Jun 2022 23:55:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106153 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|1 |0 Status|WAITING |UNCONFIRMED --- Comment #4 from Andrew Pinski --- saved_stack.50_2 =3D __builtin_stack_save (); _ll_buf.24_379 =3D __builtin_alloca_with_align (/*size=3D*/32, /*align(bits)=3D*/64); _pbuf_381 =3D &MEM[(struct log_msg *)_ll_buf.24_379].data; MEM[(const void * *)_ll_buf.24_379 + 24B] =3D "Error message example."; MEM[(union cbprintf_package_hdr *)&hdr] =3D 4; MEM[(union cbprintf_package_hdr *)_ll_buf.24_379 + 16B] =3D hdr; hdr =3D{v} {CLOBBER}; MEM[(struct log_msg_desc *)&_desc] =3D 8256; z_log_msg_static_create (&log_const_syst, _desc, _pbuf_381, 0B); __builtin_stack_restore (saved_stack.50_2); The alloca gets expanded as: (insn 15 14 16 (set (reg/f:DI 31 sp) (plus:DI (reg/f:DI 31 sp) (const_int -32 [0xffffffffffffffe0]))) "/home/andyross/z/zephyr/samples/subsys/logging/syst/src/main.c":47:49 -1 (nil)) (insn 16 15 17 (set (reg:DI 214) (reg/f:DI 88 virtual-stack-dynamic)) "/home/andyross/z/zephyr/samples/subsys/logging/syst/src/main.c":47:49 -1 (nil)) (insn 17 16 18 (set (reg:DI 215) (plus:DI (reg:DI 214) (const_int 7 [0x7]))) "/home/andyross/z/zephyr/samples/subsys/logging/syst/src/main.c":47:49 -1 (nil)) (insn 18 17 19 (set (reg:DI 216) (lshiftrt:DI (reg:DI 215) (const_int 3 [0x3]))) "/home/andyross/z/zephyr/samples/subsys/logging/syst/src/main.c":47:49 -1 (expr_list:REG_EQUAL (udiv:DI (reg:DI 215) (const_int 8 [0x8])) (nil))) (insn 19 18 20 (set (reg/f:DI 217) (ashift:DI (reg:DI 216) (const_int 3 [0x3]))) "/home/andyross/z/zephyr/samples/subsys/logging/syst/src/main.c":47:49 -1 (nil)) (insn 20 19 0 (set (reg/f:DI 117 [ _ll_buf.24 ]) (reg/f:DI 217)) "/home/andyross/z/zephyr/samples/subsys/logging/syst/src/main.c":47:49 -1 (nil)) Which looks correct (64 bit aligned is 8 byte aligned).=