public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more
@ 2014-10-27 18:32 ed0.88.prez at gmail dot com
  2014-10-28  9:04 ` [Bug tree-optimization/63660] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ed0.88.prez at gmail dot com @ 2014-10-27 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63660
           Summary: [4.8-4.9+] -Wmaybe-uninitialized false positive with
                    -O1 and more
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed0.88.prez at gmail dot com

Here, this code:

cat bug.i
typedef struct
{
 int a;
 int b;
 int c;
 int d;
 int e;
 int f;
 int g;
 int h;
 int i;
 int j;
} X;

X *XX(int);

int G();

static void F()
{
 X *x;
 int m, n;
 int xa, xb, xc, xd, xe, xf, xg, xh, xi, xj;

 m = G();
 n = G();
 if ( n & 1 ) xa = G();
 if ( n & 2 ) xb = G();
 if ( n & 4 ) xc = G();
 if ( n & 32 ) xd = G();
 if ( n & 16 ) xe = G();
 if ( n & 64 ) xf = G();
 if ( n & 256 ) xg = G();
 if ( n & 512 ) xh = G();
 if ( n & 1024 ) xi = G();
 if ( n & 2048 ) xj = G();

 if ( m >= 64 ) return;
 x = XX(m);
 if ( n & 1 ) x->a = xa;
 if ( n & 2 ) x->b = xb;
 if ( n & 4 ) x->c = xc;
 if ( n & 32 ) x->d = xd;
 if ( n & 16 ) x->e = xe;
 if ( n & 64 ) x->f = xf;
 if ( n & 256 ) x->g = xg;
 if ( n & 512 ) x->h = xh;
 if ( n & 1024 ) x->i = xi;
 if ( n & 2048 ) x->j = xj;
}

void H()
{
 F();
}
EOF

Compiled with -O1 -Wmaybe-uninitialized (implied by -Wall), reports this
message:

bug.i: In function ‘H’:
bug.i:49:23: warning: ‘xj’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
  if ( n & 2048 ) x->j = xj;
                       ^
bug.i:23:42: note: ‘xj’ was declared here
  int xa, xb, xc, xd, xe, xf, xg, xh, xi, xj;
                                          ^
This code is a very reduced testcase from a large program.
>From gcc-bugs-return-465081-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Oct 27 18:32:48 2014
Return-Path: <gcc-bugs-return-465081-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 4938 invoked by alias); 27 Oct 2014 18:32:48 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 4890 invoked by uid 48); 27 Oct 2014 18:32:44 -0000
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/63620] RELOAD lost SET_GOT dependency on Darwin
Date: Mon, 27 Oct 2014 18:34:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: ra
X-Bugzilla-Severity: normal
X-Bugzilla-Who: law at redhat dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-63620-4-0Ih33qX9Lc@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63620-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63620-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-10/txt/msg02102.txt.bz2
Content-length: 811

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc620

--- Comment #12 from Jeffrey A. Law <law at redhat dot com> ---
The more I watch the %ebx PIC problems, the more this reminds me of secondary
reloads and I wonder if we defined those properly if the right things would
happen.

This kind of thing has shown up on other architectures.  For example, on the
PA, if you try to load a symbolic constant into an FP register while generating
PIC code, you have to generate a secondary reload using %r1 as a scratch.

It's not a perfect match in that we don't need a scratch, but instead the PIC
register to be live, but it's pretty damn close.

I haven't looked at LRA's handling of secondary reloads, but it may be worth
someone's time to do so to see if it can be used to show %ebx as being needed
in these cases.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive with -O1 and more
  2014-10-27 18:32 [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more ed0.88.prez at gmail dot com
@ 2014-10-28  9:04 ` rguenth at gcc dot gnu.org
  2014-12-03 14:15 ` [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive (uninit pass limits) ed0.88.prez at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-10-28  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-28
          Component|driver                      |tree-optimization
            Summary|[4.8-4.9+]                  |-Wmaybe-uninitialized false
                   |-Wmaybe-uninitialized false |positive with -O1 and more
                   |positive with -O1 and more  |
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.3, 4.9.2, 5.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think you hit one of the limits to avoid excessive compile-time for the
uninit analysis:

#define MAX_NUM_CHAINS 8
#define MAX_CHAIN_LEN 5
#define MAX_POSTDOM_CHECK 8

I suppose it's the MAX_POSTDOM_CHECK value.  Sadly those are not parameters
controllable by any --param.

There is --param uninit-control-dep-attempts though (but its default is 1000
which the testcase probably doesn't hit).

Confirmed with 4.8, 4.9 and 5.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive (uninit pass limits)
  2014-10-27 18:32 [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more ed0.88.prez at gmail dot com
  2014-10-28  9:04 ` [Bug tree-optimization/63660] " rguenth at gcc dot gnu.org
@ 2014-12-03 14:15 ` ed0.88.prez at gmail dot com
  2014-12-03 14:52 ` manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ed0.88.prez at gmail dot com @ 2014-12-03 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Edward-san <ed0.88.prez at gmail dot com> ---
Isn't it possible to bailout if the limit is reached?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive (uninit pass limits)
  2014-10-27 18:32 [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more ed0.88.prez at gmail dot com
  2014-10-28  9:04 ` [Bug tree-optimization/63660] " rguenth at gcc dot gnu.org
  2014-12-03 14:15 ` [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive (uninit pass limits) ed0.88.prez at gmail dot com
@ 2014-12-03 14:52 ` manu at gcc dot gnu.org
  2021-03-31  2:17 ` msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu.org @ 2014-12-03 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Edward-san from comment #2)
> Isn't it possible to bailout if the limit is reached?

I guess the analysis is trying to prove that the variable is indeed initialized
(or that it is never used uninitialized). It bails out trying to prove that,
thus the warning. The warning code could be conservative and never warn if the
limit is reached, but then we will have the other problem: false-negatives.

A way to advance with this (if you want to help) is to check which limit is
actually hit by your code. Then see by how much you would need to change the
limit to warn (by for example adding a --param to control it). Then, with this
information at hand, the GCC maintainers can decide whether to increase the
limit a bit or perhaps to never warn if the limit is hit (people that want all
potential warnings not matter the compile-time cost can use the --param for a
deeper analysis).
>From gcc-bugs-return-469363-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Dec 03 14:55:19 2014
Return-Path: <gcc-bugs-return-469363-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7847 invoked by alias); 3 Dec 2014 14:55:19 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7774 invoked by uid 48); 3 Dec 2014 14:55:15 -0000
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug jit/64166] New: JIT does not provide a way for verifying dumpfiles from testcases
Date: Wed, 03 Dec 2014 14:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: jit
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dmalcolm at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter blocked
Message-ID: <bug-64166-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg00370.txt.bz2
Content-length: 768

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd166

            Bug ID: 64166
           Summary: JIT does not provide a way for verifying dumpfiles
                    from testcases
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
            Blocks: 64020

In PR jit/64020 I found that there isn't currently a good way for a jit
testcase to get at a specific dumpfile and to assert properties about it (e.g.
that a particular string or regex is found).

I'm opening this bug to track this.

I'm not yet sure to what extent to expose this in the API to end-users.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive (uninit pass limits)
  2014-10-27 18:32 [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more ed0.88.prez at gmail dot com
                   ` (2 preceding siblings ...)
  2014-12-03 14:52 ` manu at gcc dot gnu.org
@ 2021-03-31  2:17 ` msebor at gcc dot gnu.org
  2022-08-30  8:01 ` [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive on many repeated bitwise tests rguenth at gcc dot gnu.org
  2022-08-30  8:05 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-03-31  2:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|4.8.3, 4.9.2, 5.0           |10.2.0, 11.0, 4.8.4, 4.9.4,
                   |                            |5.5.0, 6.4.0, 7.2.0, 8.3.0,
                   |                            |9.1.0
   Last reconfirmed|2014-10-28 00:00:00         |2021-3-30

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Reconfirmed with GCC 11.  The limits don't come into play here.  There is an
uninitialized use in a PHI in the IL:

  <bb 22> [local count: 1073741824]:
  # xj_35 = PHI <xj_45(D)(53), xj_24(21)>
  # .MEM_55 = PHI <.MEM_54(53), .MEM_77(21)>
  if (m_3 > 63)
    goto <bb 54>; [51.12%]
  else
    goto <bb 23>; [48.88%]
  ...
  <bb 42> [local count: 262422500]:
  # .MEM_88 = VDEF <.MEM_64>
  x_25->j = xj_35;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive on many repeated bitwise tests
  2014-10-27 18:32 [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more ed0.88.prez at gmail dot com
                   ` (3 preceding siblings ...)
  2021-03-31  2:17 ` msebor at gcc dot gnu.org
@ 2022-08-30  8:01 ` rguenth at gcc dot gnu.org
  2022-08-30  8:05 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-30  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.0
             Status|NEW                         |RESOLVED
      Known to fail|                            |12.2.0
         Resolution|---                         |FIXED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed with GCC 12 but it's been fixed on trunk.  We do run into the
MAX_POSTDOM_CHECK limit but r13-2155-gbaa3ffb19c54fa (and its dependence)
solves this on trunk.  I'm going to add the testcase.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive on many repeated bitwise tests
  2014-10-27 18:32 [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more ed0.88.prez at gmail dot com
                   ` (4 preceding siblings ...)
  2022-08-30  8:01 ` [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive on many repeated bitwise tests rguenth at gcc dot gnu.org
@ 2022-08-30  8:05 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-30  8:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:bfaa6807defb18874e4c4b6b8608fe0afee7d7b8

commit r13-2262-gbfaa6807defb18874e4c4b6b8608fe0afee7d7b8
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Aug 30 10:04:15 2022 +0200

    tree-optimization/63660 - testcase for fixed PR

    This adds a testcase for the PR which was fixed with
r13-2155-gbaa3ffb19c54fa

            PR tree-optimization/63660
            * gcc.dg/uninit-pr63660.c: New testcase.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-30  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-27 18:32 [Bug driver/63660] New: [4.8-4.9+] -Wmaybe-uninitialized false positive with -O1 and more ed0.88.prez at gmail dot com
2014-10-28  9:04 ` [Bug tree-optimization/63660] " rguenth at gcc dot gnu.org
2014-12-03 14:15 ` [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive (uninit pass limits) ed0.88.prez at gmail dot com
2014-12-03 14:52 ` manu at gcc dot gnu.org
2021-03-31  2:17 ` msebor at gcc dot gnu.org
2022-08-30  8:01 ` [Bug tree-optimization/63660] -Wmaybe-uninitialized false positive on many repeated bitwise tests rguenth at gcc dot gnu.org
2022-08-30  8:05 ` cvs-commit at gcc dot gnu.org

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).