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/96564] [11 Regression] New maybe use of uninitialized variable warning since r11-959
Date: Tue, 11 Aug 2020 17:10:10 +0000	[thread overview]
Message-ID: <bug-96564-4-dRlaTr71p0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96564-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=87313
           Keywords|                            |alias, diagnostic,
                   |                            |missed-optimization

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
r11-959 enabled -Wuninitialized for allocated objects (alloca/VLA and malloc). 
The underlying problem is the failure to take advantage of the non-aliasing
guarantee of the return value of these functions.  One report that describes
this limitation is pr87313.  A slightly simpler but even more obvious test case
is:

$ cat pr96564.c && gcc -O2 -S -Wall -Wextra -fdump-tree-optimized=/dev/stdout
pr96564.c
void f (int *x)
{
  int a[*x];

  if (a != x)
    *a = 0;

  *x = *a;
}

pr96564.c: In function ‘f’:
pr96564.c:8:6: warning: ‘*(<unknown>)[0]’ may be used uninitialized
[-Wmaybe-uninitialized]
    8 |   *x = *a;
      |   ~~~^~~~

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

Removing basic block 5
f (int * x)
{
  int[0:D.1936] * a.0;
  sizetype _2;
  int _8;
  sizetype _9;
  int prephitmp_18;
  int pretmp_20;

  <bb 2> [local count: 1073741824]:
  _8 = *x_1(D);
  _2 = (sizetype) _8;
  _9 = _2 * 4;
  a.0_11 = __builtin_alloca_with_align (_9, 32);
  if (x_1(D) != a.0_11)
    goto <bb 4>; [70.00%]
  else
    goto <bb 3>; [30.00%]

  <bb 3> [local count: 322122544]:
  pretmp_20 = (*a.0_11)[0];

  <bb 4> [local count: 1073741824]:
  # prephitmp_18 = PHI <pretmp_20(3), 0(2)>
  *x_1(D) = prephitmp_18;
  return;

}

  parent reply	other threads:[~2020-08-11 17:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11  7:30 [Bug middle-end/96564] New: New maybe use of uninitialized variable warning since GCC >10 stefansf at linux dot ibm.com
2020-08-11  9:27 ` [Bug middle-end/96564] " glisse at gcc dot gnu.org
2020-08-11  9:47 ` [Bug middle-end/96564] [11 Regression] New maybe use of uninitialized variable warning since r11-959 jakub at gcc dot gnu.org
2020-08-11 17:10 ` msebor at gcc dot gnu.org [this message]
2020-08-11 17:24 ` msebor at gcc dot gnu.org
2020-08-25  8:20 ` rguenth at gcc dot gnu.org
2021-01-14  9:19 ` rguenth at gcc dot gnu.org
2021-02-11 10:48 ` jakub at gcc dot gnu.org
2021-04-27 11:39 ` [Bug middle-end/96564] [11/12 " jakub at gcc dot gnu.org
2021-07-28  7:05 ` rguenth at gcc dot gnu.org
2022-04-21  7:48 ` rguenth at gcc dot gnu.org
2023-03-14  5:00 ` [Bug middle-end/96564] [11/12/13 " pinskia at gcc dot gnu.org
2023-05-29 10:03 ` [Bug middle-end/96564] [11/12/13/14 " jakub at gcc dot gnu.org
2024-03-10 22:49 ` law at gcc dot gnu.org
2024-03-11 10:23 ` rguenth at gcc dot gnu.org
2024-03-11 13:26 ` rguenth at gcc dot gnu.org
2024-03-11 15:20 ` amacleod at redhat dot com
2024-03-12  7:37 ` rguenth at gcc dot gnu.org
2024-05-16 11:23 ` [Bug middle-end/96564] [11/12/13/14/15 " rguenth at gcc dot gnu.org
2024-05-16 12:44 ` cvs-commit at gcc dot gnu.org
2024-05-16 14:27 ` aldyh 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-96564-4-dRlaTr71p0@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).