public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/61409] [4.9/5 regression] -Wmaybe-uninitialized false-positive with -O2
Date: Mon, 02 Mar 2015 19:25:00 -0000 [thread overview]
Message-ID: <bug-61409-4-DS4Sp1Fb2p@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61409-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61409
--- Comment #14 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
And even simpler testcase:
void *init(void);
struct window
{
int line_height;
int pixel_width;
int pixel_height;
int column_width;
int text_cols;
int internal_border_width;
int left_fringe_width, right_fringe_width;
} *rw;
void bar() __attribute__((noreturn));
void f(int i, int j) {
void *ptr;
if (i)
{
if (j)
return; /* bar(); */
ptr = init();
}
rw->pixel_width = ((rw->text_cols * (rw->column_width))
+ (rw->left_fringe_width + (rw->right_fringe_width)) + 2
* (rw->internal_border_width));
rw->pixel_height = ((rw->text_cols * (rw->line_height)));
if (i)
{
rw=ptr;
}
}
And the dump:
f (intD.6 iD.1843, intD.6 jD.1844)
{
voidD.41 * ptrD.1847;
struct window * rw.0_10;
intD.6 _11;
intD.6 _12;
intD.6 _13;
intD.6 _14;
intD.6 _15;
intD.6 _16;
intD.6 _17;
intD.6 _18;
intD.6 _19;
intD.6 _20;
intD.6 _22;
intD.6 _23;
;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot
;; prev block 0, next block 9, flags: (NEW, REACHABLE)
;; pred: ENTRY [100.0%] (FALLTHRU,EXECUTABLE)
;; starting at line 17
[test.c:17:8] if (i_4(D) != 0)
goto <bb 3>;
else
goto <bb 9>;
;; succ: 3 [50.0%] (TRUE_VALUE,EXECUTABLE)
;; 9 [50.0%] (FALSE_VALUE,EXECUTABLE)
;; basic block 9, loop depth 0, count 0, freq 5000, maybe hot
;; prev block 2, next block 3, flags: (NEW)
;; pred: 2 [50.0%] (FALSE_VALUE,EXECUTABLE)
;;
goto <bb 6>;
;; succ: 6 [100.0%] (FALLTHRU)
;; basic block 3, loop depth 0, count 0, freq 5000, maybe hot
;; prev block 9, next block 10, flags: (NEW, REACHABLE)
;; pred: 2 [50.0%] (TRUE_VALUE,EXECUTABLE)
;; starting at line 19
[test.c:19:5] if (j_7(D) != 0)
goto <bb 10>;
else
goto <bb 5>;
;; succ: 10 [61.0%] (TRUE_VALUE,EXECUTABLE)
;; 5 [39.0%] (FALSE_VALUE,EXECUTABLE)
;; basic block 10, loop depth 0, count 0, freq 3051, maybe hot
;; prev block 3, next block 4, flags: (NEW)
;; pred: 3 [61.0%] (TRUE_VALUE,EXECUTABLE)
;;
;; succ: 4 [100.0%] (FALLTHRU)
;; basic block 4, loop depth 0, count 0, freq 5761, maybe hot
;; prev block 10, next block 5, flags: (NEW)
;; pred: 10 [100.0%] (FALLTHRU)
;; 11 [100.0%] (FALLTHRU)
;;
# .MEM_47 = PHI <.MEM_6(D)(10), .MEM_24(11)>
goto <bb 8>;
;; succ: 8 [100.0%] (FALLTHRU,EXECUTABLE)
;; basic block 5, loop depth 0, count 0, freq 1949, maybe hot
;; prev block 4, next block 6, flags: (NEW, REACHABLE)
;; pred: 3 [39.0%] (FALSE_VALUE,EXECUTABLE)
;; starting at line 21
[test.c:21:6] # .MEM_8 = VDEF <.MEM_6(D)>
# PT = nonlocal escaped
# USE = nonlocal
# CLB = nonlocal
ptr_9 = initD.1831 ();
;; succ: 6 [100.0%] (FALLTHRU,EXECUTABLE)
;; basic block 6, loop depth 0, count 0, freq 6949, maybe hot
;; prev block 5, next block 11, flags: (NEW, REACHABLE)
;; pred: 9 [100.0%] (FALLTHRU)
;; 5 [100.0%] (FALLTHRU,EXECUTABLE)
;; starting at line 23
# PT = nonlocal escaped
# ptr_1 = PHI <ptr_5(D)(9), [test.c:21:6] ptr_9(5)>
# .MEM_2 = PHI <.MEM_6(D)(9), .MEM_8(5)>
[test.c:23:27] # VUSE <.MEM_2>
# PT = nonlocal escaped
rw.0_10 = rwD.1841;
[test.c:23:27] # VUSE <.MEM_2>
_11 = [test.c:23:27] rw.0_10->text_colsD.1837;
[test.c:23:44] # VUSE <.MEM_2>
_12 = [test.c:23:44] rw.0_10->column_widthD.1836;
[test.c:23:39] _13 = _11 * _12;
[test.c:24:15] # VUSE <.MEM_2>
_14 = [test.c:24:15] rw.0_10->left_fringe_widthD.1839;
[test.c:24:40] # VUSE <.MEM_2>
_15 = [test.c:24:40] rw.0_10->right_fringe_widthD.1840;
[test.c:24:35] _16 = _14 + _15;
[test.c:24:10] _17 = _13 + _16;
[test.c:24:72] # VUSE <.MEM_2>
_18 = [test.c:24:72] rw.0_10->internal_border_widthD.1838;
[test.c:24:67] # RANGE [-2147483648, 2147483647] NONZERO 4294967294
_19 = _18 * 2;
[test.c:24:63] _20 = _17 + _19;
[test.c:23:21] # .MEM_21 = VDEF <.MEM_2>
[test.c:23:7] rw.0_10->pixel_widthD.1834 = _20;
[test.c:25:43] # VUSE <.MEM_21>
_22 = [test.c:25:43] rw.0_10->line_heightD.1833;
[test.c:25:38] _23 = _11 * _22;
[test.c:25:20] # .MEM_24 = VDEF <.MEM_21>
[test.c:25:5] rw.0_10->pixel_heightD.1835 = _23;
[test.c:26:6] if (i_4(D) != 0)
goto <bb 7>;
else
goto <bb 11>;
;; succ: 7 [61.0%] (TRUE_VALUE,EXECUTABLE)
;; 11 [39.0%] (FALSE_VALUE,EXECUTABLE)
;; basic block 11, loop depth 0, count 0, freq 2710, maybe hot
;; prev block 6, next block 7, flags: (NEW)
;; pred: 6 [39.0%] (FALSE_VALUE,EXECUTABLE)
;;
goto <bb 4>;
;; succ: 4 [100.0%] (FALLTHRU)
;; basic block 7, loop depth 0, count 0, freq 4239, maybe hot
;; prev block 11, next block 8, flags: (NEW, REACHABLE)
;; pred: 6 [61.0%] (TRUE_VALUE,EXECUTABLE)
;; starting at line 28
[test.c:28:9] # .MEM_25 = VDEF <.MEM_24>
rwD.1841 = ptr_1;
;; succ: 8 [100.0%] (FALLTHRU,EXECUTABLE)
;; basic block 8, loop depth 0, count 0, freq 10000, maybe hot
;; prev block 7, next block 1, flags: (NEW, REACHABLE)
;; pred: 4 [100.0%] (FALLTHRU,EXECUTABLE)
;; 7 [100.0%] (FALLTHRU,EXECUTABLE)
;; starting at line -1, discriminator 1
# .MEM_3 = PHI <.MEM_47(4), .MEM_25(7)>
# VUSE <.MEM_3>
return;
;; succ: EXIT [100.0%]
}
I don't really understand how the uninit pass computes the predicates, but when
replacing the "return" with "bar()", it is able to see that "j != 0" is not
part of the predicate guarding the def of ptr. Thus, somehow the analysis that
works for a noreturn function fails for a normal return.
>From gcc-bugs-return-479045-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Mar 02 19:36:49 2015
Return-Path: <gcc-bugs-return-479045-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 59828 invoked by alias); 2 Mar 2015 19:36:49 -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 59517 invoked by uid 48); 2 Mar 2015 19:36:45 -0000
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/65256] [5 regression] Undefined symbols linking f951
Date: Mon, 02 Mar 2015 19:36:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: law at redhat dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-65256-4-8C9RjkdjPr@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65256-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65256-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: 2015-03/txt/msg00189.txt.bz2
Content-length: 585
https://gcc.gnu.org/bugzilla/show_bug.cgi?ide256
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at redhat dot com
--- Comment #1 from Jeffrey A. Law <law at redhat dot com> ---
John, is this with SOM or ELF? If the former, it looks like something might be
missing its .import/.export statement. What do the underlying symbols look
like for the reference and the definition of those symbols?
next prev parent reply other threads:[~2015-03-02 19:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 7:40 [Bug c/61409] New: [4.9 " eggert at gnu dot org
2014-06-04 9:29 ` [Bug c/61409] " manu at gcc dot gnu.org
2014-06-04 9:59 ` manu at gcc dot gnu.org
2014-06-04 10:31 ` [Bug middle-end/61409] [4.9/4.10 " rguenth at gcc dot gnu.org
2014-06-04 15:28 ` eggert at gnu dot org
2014-06-04 15:57 ` manu at gcc dot gnu.org
2014-06-25 13:26 ` jakub at gcc dot gnu.org
2014-06-25 13:30 ` jakub at gcc dot gnu.org
2014-06-26 12:45 ` rguenth at gcc dot gnu.org
2014-07-16 13:31 ` jakub at gcc dot gnu.org
2014-10-30 10:43 ` [Bug middle-end/61409] [4.9/5 " jakub at gcc dot gnu.org
2015-02-12 23:04 ` law at redhat dot com
2015-02-12 23:54 ` law at redhat dot com
2015-02-13 2:39 ` law at redhat dot com
2015-02-13 3:34 ` law at redhat dot com
2015-03-02 19:25 ` manu at gcc dot gnu.org [this message]
2015-06-26 20:09 ` [Bug middle-end/61409] [4.9/5/6 " jakub at gcc dot gnu.org
2015-06-26 20:35 ` jakub 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-61409-4-DS4Sp1Fb2p@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).