From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19407 invoked by alias); 6 Feb 2014 19:32:44 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19305 invoked by uid 48); 6 Feb 2014 19:32:31 -0000 From: "lavr at ncbi dot nlm.nih.gov" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/60100] New: warning disappears when preprocessed source is compiled Date: Thu, 06 Feb 2014 19:32:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lavr at ncbi dot nlm.nih.gov X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: 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-02/txt/msg00647.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60100 Bug ID: 60100 Summary: warning disappears when preprocessed source is compiled Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: lavr at ncbi dot nlm.nih.gov Created attachment 32070 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32070&action=edit GCC specs are attached Hello, When compiling the attached C code with GCC 4.8.1, I see a warning (which is correct) that the callback signature mismatches what's expected in the argument of BUF_PeekAtCB() call. If however, the source is first preprocessed then compiled, there is no warning! Since distcc uses precompiled source, the disappearing warning is a bad thing because it hides potential (and real, such as this case) bugs. $ cat qq.h #include typedef struct SBUF* BUF; extern size_t BUF_PeekAtCB (BUF buf, size_t pos, size_t (*callback)(void* cbdata, const void* buf, size_t size), void* cbdata, size_t size ); $ cat qq.c #include #include "qq.h" size_t cb(void* a, void* b, size_t c, int d) { return c; } int main() { BUF b = 0; size_t n = BUF_PeekAtCB(b, 0, cb, 0, 512); printf("%u\n", (unsigned int) n); return 0; } $ gcc -Wall -c qq.c -o qq.o qq.c: In function 'main': qq.c:14:5: warning: passing argument 3 of 'BUF_PeekAtCB' from incompatible pointer type [enabled by default] size_t n = BUF_PeekAtCB(b, 0, cb, 0, 512); ^ In file included from qq.c:2:0: qq.h:7:15: note: expected 'size_t (*)(void *, const void *, size_t)' but argument is of type 'size_t (*)(void *, void *, size_t, int)' extern size_t BUF_PeekAtCB ^ $ gcc -Wall -E qq.c -o qq.e $ gcc -Wall -c qq.e -o qq.o gcc: warning: qq.e: linker input file unused because linking not done Also, I'm not sure why there is a bogus warning about linking here (and not when compiling right from the source file, above). Any insight that you may have provide will be highly appreciated. Thanks, Anton Lavrentiev