public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gccbugs at dima dot secretsauce.net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/63178] New: Missed "incorrect-type-passed-to-function warning"
Date: Thu, 04 Sep 2014 18:07:00 -0000	[thread overview]
Message-ID: <bug-63178-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 63178
           Summary: Missed "incorrect-type-passed-to-function warning"
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gccbugs at dima dot secretsauce.net

Hi. I'm seeing that under particular conditions I can pass a wrong type into a
function, and no warning results. I'm attaching a minimized test case to show
this. There are two files: bugreport.c and bugreport.h. The .c includes the .h.
The issue only happens when the .h file is placed into /usr/include, and
included using <> instead of "".

bugreport.c has this snippet:


typedef ... sss_t;
int fff( sss_t* ctx, ... )
...
    sss_t* sss = NULL;
    fff(&sss,0,0);

So fff() expects a sss_t* as its first argument, but we're giving it a sss_t**
instead. This should generate a warning. However:

dima@shorty:/tmp$ gcc-4.9 -Wall -Wextra -c -o/dev/null bugreport.c
<no output>

So gcc thinks this is fine. Tweaking the test case even a little bit makes the
warning come back. For instance, including the header in the local directory,
instead of in /usr/include makes it work, as does simply putting the header the
contents into the .c and including nothing. Removing the F() call makes it
work. Changing the whitespace in the F() call makes it work.

I'm using gcc 4.9.1 as shipped on Debian/sid:

dima@shorty:/tmp$ dpkg -l gcc-4.9
ii  gcc-4.9                           4.9.1-1


dima@shorty:/tmp$ gcc-4.9 -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.9
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.1-1'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--disable-vtable-verify --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.1 (Debian 4.9.1-1) 


Thanks


             reply	other threads:[~2014-09-04 18:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 18:07 gccbugs at dima dot secretsauce.net [this message]
2014-09-04 18:07 ` [Bug c/63178] " gccbugs at dima dot secretsauce.net
2014-09-04 18:08 ` gccbugs at dima dot secretsauce.net
2014-09-04 18:14 ` mpolacek at gcc dot gnu.org
2014-09-04 19:29 ` gccbugs at dima dot secretsauce.net
2014-09-08 21:09 ` gccbugs at dima dot secretsauce.net
2014-09-17 19:26 ` mpolacek at gcc dot gnu.org
2014-09-17 19:51 ` gccbugs at dima dot secretsauce.net
2014-09-17 19:55 ` mpolacek at gcc dot gnu.org
2014-09-17 20:03 ` gccbugs at dima dot secretsauce.net
2014-09-19 19:26 ` gccbugs at dima dot secretsauce.net
2014-09-19 19:48 ` schwab@linux-m68k.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-63178-4@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).