public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/88518] Function call defeats -Wuninitialized
Date: Tue, 06 Apr 2021 19:59:29 +0000	[thread overview]
Message-ID: <bug-88518-4-4Lzs1UIc6W@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-88518-4@http.gcc.gnu.org/bugzilla/>

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Last reconfirmed|                            |2021-4-6
         Resolution|---                         |DUPLICATE
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed as a duplicate of pr60488 (which itself is likely a duplicate of some
older bug).  A variable whose address escapes is not considered by the warning.
 It sees the following IL:

;; Function f (f, funcdef_no=0, decl_uid=1947, cgraph_uid=1, symbol_order=0)

void f ()
{
  long unsigned int i;
  long unsigned int i.0_1;
  long unsigned int _2;

  <bb 2> [local count: 1073741824]:
  # .MEM_4 = VDEF <.MEM_3(D)>
  h ();
  # VUSE <.MEM_4>
  i.0_1 = i;                    <<< i loaded from memory and not considered
  _2 = i.0_1 + 1;               <<< missing -Wuninitialized
  # .MEM_5 = VDEF <.MEM_4>
  i = _2;
  # .MEM_6 = VDEF <.MEM_5>
  g (&i);
  # .MEM_7 = VDEF <.MEM_6>
  i ={v} {CLOBBER};
  # VUSE <.MEM_7>
  return;

}

The pointless load persists until the assembly:

f:
.LFB0:
        .cfi_startproc
        subq    $24, %rsp
        .cfi_def_cfa_offset 32
        call    h
        leaq    8(%rsp), %rdi   <<< i loaded from memory
        addq    $1, 8(%rsp)     <<< i++
        call    g
        addq    $24, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc

*** This bug has been marked as a duplicate of bug 60488 ***

           reply	other threads:[~2021-04-06 19:59 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <bug-88518-4@http.gcc.gnu.org/bugzilla/>]

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-88518-4-4Lzs1UIc6W@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).