public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114552] [13 Regression] wrong code at -O1 and above on x86_64-linux-gnu since r13-990 Date: Sun, 21 Apr 2024 04:08:37 +0000 [thread overview] Message-ID: <bug-114552-4-EmAKOhkqhk@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114552-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114552 --- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:ba6fd407891fd83648ad803c85b607dc09e23be4 commit r13-8624-gba6fd407891fd83648ad803c85b607dc09e23be4 Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Apr 3 09:59:45 2024 +0200 expr: Fix up emit_push_insn [PR114552] r13-990 added optimizations in multiple spots to optimize during expansion storing of constant initializers into targets. In the load_register_parameters and expand_expr_real_1 cases, it checks it has a tree as the source and so knows we are reading that whole decl's value, so the code is fine as is, but in the emit_push_insn case it checks for a MEM from which something is pushed and checks for SYMBOL_REF as the MEM's address, but still assumes the whole object is copied, which as the following testcase shows might not always be the case. In the testcase, k is 6 bytes, then 2 bytes of padding, then another 4 bytes, while the emit_push_insn wants to store just the 6 bytes. The following patch simply verifies it is the whole initializer that is being stored, I think that is best thing to do so late in GCC 14 cycle as well for backporting. For GCC 15, perhaps the code could stop requiring it must be at offset zero, nor that the size is equal, but could use get_symbol_constant_value/fold_ctor_reference gimple-fold APIs to actually extract just part of the initializer if we e.g. push just some subset (of course, still verify that it is a subset). For sizes which are power of two bytes and we have some integer modes, we could use as type for fold_ctor_reference corresponding integral types, otherwise dunno, punt or use some structure (e.g. try to find one in the initializer?), whatever. But even in the other spots it could perhaps handle loading of COMPONENT_REFs or MEM_REFs from the .rodata vars. 2024-04-03 Jakub Jelinek <jakub@redhat.com> PR middle-end/114552 * expr.cc (emit_push_insn): Only use store_constructor for immediate_const_ctor_p if int_expr_size matches size. * gcc.c-torture/execute/pr114552.c: New test. (cherry picked from commit 03039744f368a24a452e4ea8d946e9c2cedaf1aa)
next prev parent reply other threads:[~2024-04-21 4:08 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-01 19:34 [Bug tree-optimization/114552] New: wrong code at -O1 and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch 2024-04-01 19:38 ` [Bug tree-optimization/114552] " pinskia at gcc dot gnu.org 2024-04-01 20:36 ` [Bug middle-end/114552] [13/14 Regression] " pinskia at gcc dot gnu.org 2024-04-02 11:33 ` rguenth at gcc dot gnu.org 2024-04-02 13:29 ` [Bug middle-end/114552] [13/14 Regression] wrong code at -O1 and above on x86_64-linux-gnu since r13-990 jakub at gcc dot gnu.org 2024-04-02 13:46 ` jakub at gcc dot gnu.org 2024-04-02 14:18 ` jakub at gcc dot gnu.org 2024-04-02 14:49 ` roger at nextmovesoftware dot com 2024-04-03 8:01 ` cvs-commit at gcc dot gnu.org 2024-04-03 14:32 ` [Bug middle-end/114552] [13 " jakub at gcc dot gnu.org 2024-04-21 4:08 ` cvs-commit at gcc dot gnu.org [this message] 2024-04-23 6:45 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114552-4-EmAKOhkqhk@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).