public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67386] New: missing diagnostic on a use of an undeclared function
@ 2015-08-28 16:21 msebor at gcc dot gnu.org
  2015-08-28 17:55 ` [Bug c/67386] " joseph at codesourcery dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2015-08-28 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67386
           Summary: missing diagnostic on a use of an undeclared function
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC isn't completely consistent in diagnosing references to undeclared
functions.  In the test case below, it issues an error for only the last three
out of the four definitions of foo.  It issues a warning for the first one,
even though it too references an undeclared identifier.

Versions prior to 5.1 diagnosed only the second and fourth forms.

$ (set -x && cat t.c && for i in 1 2 3 4; do ~/bin/gcc-5.1.0/bin/gcc -DFOO=$i
-c t.c; done)
+ cat t.c
#if FOO == 1
void* foo (int i) {
    return i ? foobar (i) : foobar;
}
#elif FOO == 2
void* foo (int i) {
    return i ? 0 : foobar;
}
#elif FOO == 3
void* foo (int i) {
    if (i)
        return foobar (i);
    else
        return foobar;
}
#else
void* foo (int i) {
    if (i)
        return 0;
    else
        return foobar;
}
#endif
+ for i in 1 2 3 4
+ /home/msebor/bin/gcc-5.1.0/bin/gcc -DFOO=1 -c t.c
t.c: In function ‘foo’:
t.c:3:16: warning: implicit declaration of function ‘foobar’
[-Wimplicit-function-declaration]
     return i ? foobar (i) : foobar;
                ^
t.c:3:27: warning: pointer/integer type mismatch in conditional expression
     return i ? foobar (i) : foobar;
                           ^
+ for i in 1 2 3 4
+ /home/msebor/bin/gcc-5.1.0/bin/gcc -DFOO=2 -c t.c
t.c: In function ‘foo’:
t.c:7:20: error: ‘foobar’ undeclared (first use in this function)
     return i ? 0 : foobar;
                    ^
t.c:7:20: note: each undeclared identifier is reported only once for each
function it appears in
+ for i in 1 2 3 4
+ /home/msebor/bin/gcc-5.1.0/bin/gcc -DFOO=3 -c t.c
t.c: In function ‘foo’:
t.c:12:16: warning: implicit declaration of function ‘foobar’
[-Wimplicit-function-declaration]
         return foobar (i);
                ^
t.c:12:16: warning: return makes pointer from integer without a cast
[-Wint-conversion]
t.c:14:16: error: ‘foobar’ undeclared (first use in this function)
         return foobar;
                ^
t.c:14:16: note: each undeclared identifier is reported only once for each
function it appears in
+ for i in 1 2 3 4
+ /home/msebor/bin/gcc-5.1.0/bin/gcc -DFOO=4 -c t.c
t.c: In function ‘foo’:
t.c:21:16: error: ‘foobar’ undeclared (first use in this function)
         return foobar;
                ^
t.c:21:16: note: each undeclared identifier is reported only once for each
function it appears in
>From gcc-bugs-return-495815-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Aug 28 16:23:50 2015
Return-Path: <gcc-bugs-return-495815-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 89777 invoked by alias); 28 Aug 2015 16:23:50 -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 89686 invoked by uid 55); 28 Aug 2015 16:23:46 -0000
From: "law at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/66752] spec2000 255.vortex performance compiled with GCC is ~20% lower than with CLANG
Date: Fri, 28 Aug 2015 16:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords: missed-optimization
X-Bugzilla-Severity: normal
X-Bugzilla-Who: law at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66752-4-KrFJXyKz58@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66752-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66752-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-08/txt/msg01957.txt.bz2
Content-length: 1284

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

--- Comment #18 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Author: law
Date: Fri Aug 28 16:23:12 2015
New Revision: 227307

URL: https://gcc.gnu.org/viewcvs?rev"7307&root=gcc&view=rev
Log:
[PATCH][lto/66752] Fix missed FSM jump thread

        PR lto/66752
        * tree-ssa-threadedge.c (simplify_conrol_stmt_condition): If we are
        unable to find X NE 0 in the tables, return X as the simplified
        condition.
        (fsm_find_control_statement_thread_paths): If nodes in NEXT_PATH are
        in VISISTED_BBS, then return failure.  Else add nodes from NEXT_PATH
        to VISISTED_BBS.
        * tree-ssa-threadupdate.c (duplicate_thread_path): Fix up edge flags
        after removing the control flow statement and unnecessary edges.

        PR lto/66752
        * gcc.dg/tree-ssa/pr66752-2.c: New test.
        * gcc.dg/torture/pr66752-1.c: New test
        * g++.dg/torture/pr66752-2.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr66752-2.C
    trunk/gcc/testsuite/gcc.dg/torture/pr66752-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-threadedge.c
    trunk/gcc/tree-ssa-threadupdate.c


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

end of thread, other threads:[~2015-08-31 10:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-28 16:21 [Bug c/67386] New: missing diagnostic on a use of an undeclared function msebor at gcc dot gnu.org
2015-08-28 17:55 ` [Bug c/67386] " joseph at codesourcery dot com
2015-08-28 23:04 ` msebor at gcc dot gnu.org
2015-08-30 16:50 ` msebor at gcc dot gnu.org
2015-08-31 10:59 ` joseph at codesourcery dot com

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