public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2 not in 4.8.3); switch statement versus &
       [not found] <bug-64614-4@http.gcc.gnu.org/bugzilla/>
@ 2015-01-15 16:27 ` mpolacek at gcc dot gnu.org
  2015-01-16 10:31 ` [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-15 16:27 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
          Component|c                           |middle-end

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We have tons of these -W*uninitialized bugs, so there's likely a dup.


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

* [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); switch statement versus &
       [not found] <bug-64614-4@http.gcc.gnu.org/bugzilla/>
  2015-01-15 16:27 ` [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2 not in 4.8.3); switch statement versus & mpolacek at gcc dot gnu.org
@ 2015-01-16 10:31 ` rguenth at gcc dot gnu.org
  2015-01-16 13:12 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-16 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 34461
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34461&action=edit
preliminary patch

I think the uninit pass doesn't even try to handle switch case input conditions
(convert_control_dep_chain_into_preds).  Nor does predicate handling deal with
bar & 3 predicates.

Preliminary patch attached - still needs to handle the default case - but
it seems we don't warn about the return value with the patch.

With the patch:

[CHECK] Found def edge 1 in tmp_1 = PHI <tmp_6(D)(3), baz_7(D)(8)>
[BEFORE SIMPLICATION -- [USE]:
MEM[(char *)tmp_1 + 11B] = 15;
is guarded by :

bar_4(D) == 2

[BEFORE SIMPLICATION -- [DEF]:
tmp_1 = PHI <tmp_6(D)(3), baz_7(D)(8)>
is guarded by :

_5 != 0

[AFTER NORMALIZATION -- [DEF]:
tmp_1 = PHI <tmp_6(D)(3), baz_7(D)(8)>
is guarded by :

bar_4(D) & 3


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

* [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); switch statement versus &
       [not found] <bug-64614-4@http.gcc.gnu.org/bugzilla/>
  2015-01-15 16:27 ` [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2 not in 4.8.3); switch statement versus & mpolacek at gcc dot gnu.org
  2015-01-16 10:31 ` [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); " rguenth at gcc dot gnu.org
@ 2015-01-16 13:12 ` rguenth at gcc dot gnu.org
  2015-01-16 13:26 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-16 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |2.95.2, 3.4.6, 4.1.2

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fails for all versions I tested btw, so nowhere near a regression.


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

* [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); switch statement versus &
       [not found] <bug-64614-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-01-16 13:12 ` rguenth at gcc dot gnu.org
@ 2015-01-16 13:26 ` rguenth at gcc dot gnu.org
  2015-01-16 18:05 ` dgilbert at redhat dot com
  2015-01-19  9:41 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-16 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Jan 16 13:26:10 2015
New Revision: 219739

URL: https://gcc.gnu.org/viewcvs?rev=219739&root=gcc&view=rev
Log:
2015-01-16  Richard Biener  <rguenther@suse.de>

    PR middle-end/64614
    * tree-ssa-uninit.c: Include tree-cfg.h.
    (MAX_SWITCH_CASES): New define.
    (convert_control_dep_chain_into_preds): Handle switch statements.
    (is_pred_expr_subset_of): Handle x == CST vs. (x & CST) != 0.
    (normalize_one_pred_1): Do not split bit-manipulations.
    Record (x & CST).

    * gcc.dg/uninit-18.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/uninit-18.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-uninit.c


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

* [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); switch statement versus &
       [not found] <bug-64614-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2015-01-16 13:26 ` rguenth at gcc dot gnu.org
@ 2015-01-16 18:05 ` dgilbert at redhat dot com
  2015-01-19  9:41 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: dgilbert at redhat dot com @ 2015-01-16 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Dr. David Alan Gilbert <dgilbert at redhat dot com> ---
Richard: Thanks for the fix, and apologies again for my screwed up regression
test.


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

* [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); switch statement versus &
       [not found] <bug-64614-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2015-01-16 18:05 ` dgilbert at redhat dot com
@ 2015-01-19  9:41 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-01-19  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |5.0
         Resolution|---                         |FIXED
      Known to fail|                            |4.9.2

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk.


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

end of thread, other threads:[~2015-01-19  9:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-64614-4@http.gcc.gnu.org/bugzilla/>
2015-01-15 16:27 ` [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2 not in 4.8.3); switch statement versus & mpolacek at gcc dot gnu.org
2015-01-16 10:31 ` [Bug middle-end/64614] bogus used initialized warning (in gcc 4.9.2); " rguenth at gcc dot gnu.org
2015-01-16 13:12 ` rguenth at gcc dot gnu.org
2015-01-16 13:26 ` rguenth at gcc dot gnu.org
2015-01-16 18:05 ` dgilbert at redhat dot com
2015-01-19  9:41 ` rguenth 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).