public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "absoler at smail dot nju.edu.cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/107047] load introduced of struct/union fields after assigning it to a local variable
Date: Wed, 26 Oct 2022 08:31:55 +0000	[thread overview]
Message-ID: <bug-107047-4-hWld3wF4jt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107047-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107047

--- Comment #3 from absoler at smail dot nju.edu.cn ---
and for union there's similar behavior:

union U2 {
    long long  f0;
    unsigned short  f2;
    int  f4;
};

void  func_17(union U2  p_20);
void  func_1() {
    func_17(g_39[0]);
}

void func_17(union U2 e) {
  int *f = &g_30;
  if (e.f0 || e.f2)
    *f = e.f2;
}

are compiled with gcc-12.1 -O1 to:

0000000000402020 <func_1>:
func_17():
/home/csmith-2.3.0/test/output2.c:87
  402020:       48 83 3d 68 3e 00 00    cmpq   $0x0,0x3e68(%rip)        #
405e90 <g_39>
  402027:       00 
  402028:       74 0d                   je     402037 <func_1+0x17>
/home/csmith-2.3.0/test/output2.c:88
  40202a:       0f b7 05 5f 3e 00 00    movzwl 0x3e5f(%rip),%eax        #
405e90 <g_39>
  402031:       89 05 71 3e 00 00       mov    %eax,0x3e71(%rip)        #
405ea8 <g_30>

uses of e.f0 and e.f2 are replaced by g_39[0]

      parent reply	other threads:[~2022-10-26  8:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  7:25 [Bug rtl-optimization/107047] New: load introduced of struct " absoler at smail dot nju.edu.cn
2022-09-27  9:10 ` [Bug middle-end/107047] " rguenth at gcc dot gnu.org
2022-10-05 20:02 ` pinskia at gcc dot gnu.org
2022-10-26  8:31 ` absoler at smail dot nju.edu.cn [this message]

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-107047-4-hWld3wF4jt@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: link
Be 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).