public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106775] [10/11/12/13 regression] Subscipt operator with array rvalue inside brackets returns lvalue Date: Tue, 30 Aug 2022 17:02:26 +0000 [thread overview] Message-ID: <bug-106775-4-ty1RMVLoFz@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106775-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106775 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, perhaps either we need to in the 556 if (swapped 557 && flag_strong_eval_order == 2 558 && (TREE_SIDE_EFFECTS (array_expr) || TREE_SIDE_EFFECTS (index_exp))) 559 expr = build_array_ref (input_location, index_exp, array_expr); 560 else 561 expr = build_array_ref (input_location, array_expr, index_exp); spot if array_expr has ARRAY_TYPE and is xvalue rather than lvalue choose some different representation which will ensure the side-effects are evaluated in the right order, perhaps by using save_expr around index_exp and using COMPOUND_EXPR for that save_expr and array_expr, or need to adjust lvalue_kind so that it is able to recognize even what we lower the array ref to in the line 559 case as array ref with ARRAY_TYPE xvalue base. We actually lower it as *(x + y) instead of x[y] with ensuring the side-effects being evaluated in the right order.
next prev parent reply other threads:[~2022-08-30 17:02 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-30 2:49 [Bug c++/106775] New: [11/12 " leduyquang753 at gmail dot com 2022-08-30 7:11 ` [Bug c++/106775] [11/12/13 " rguenth at gcc dot gnu.org 2022-08-30 12:59 ` [Bug c++/106775] [10/11/12/13 " mpolacek at gcc dot gnu.org 2022-08-30 13:10 ` mpolacek at gcc dot gnu.org 2022-08-30 17:02 ` jakub at gcc dot gnu.org [this message] 2022-10-19 7:05 ` rguenth at gcc dot gnu.org 2023-05-29 10:07 ` [Bug c++/106775] [10/11/12/13/14 " 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-106775-4-ty1RMVLoFz@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).