public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kristian dot hermansen at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/26167]  New: -Wconversion fails to detect signedness conversion from int to unsigned int in fuction call
Date: Wed, 08 Feb 2006 01:10:00 -0000	[thread overview]
Message-ID: <bug-26167-12152@http.gcc.gnu.org/bugzilla/> (raw)

gcc reports the signedness probelm correctly, but g++ does not. See below for a
demonstration:

$ cat signedness.cpp
#include <iostream>
using namespace std;

void foo (unsigned int a){
cout << a << endl;
}

int main(){
int b = -1;
foo (b);
return 0;
}

$ g++ -Wall -Wconversion -o signedness signedness.cpp

### NO WARNINGS ARE OUTPUT HERE FROM g++ ###

$ g++ -v -save-temps -Wall -Wconversion -o signedness signedness.cpp Using
built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-shared
--with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
 /usr/lib/gcc/i486-linux-gnu/4.0.2/cc1plus -E -quiet -v -D_GNU_SOURCE
signedness.cpp -mtune=i486 -Wall -Wconversion -fpch-preprocess -o signedness.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu" ignoring
nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.0.2
 /usr/include/c++/4.0.2/i486-linux-gnu
 /usr/include/c++/4.0.2/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.0.2/include
 /usr/include
End of search list.
 /usr/lib/gcc/i486-linux-gnu/4.0.2/cc1plus -fpreprocessed signedness.ii -quiet
-dumpbase signedness.cpp -mtune=i486 -auxbase signedness -Wall -Wconversion
-version -o signedness.s
GNU C++ version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
(i486-linux-gnu)
        compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu
4.0.1-4ubuntu9).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128479
 as -V -Qy --32 -o signedness.o signedness.s
GNU assembler version 2.16.1 (i486-linux-gnu) using BFD version 2.16.1 Debian
GNU/Linux
 /usr/lib/gcc/i486-linux-gnu/4.0.2/collect2 --eh-frame-hdr -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 -o signedness
/usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../lib/crt1.o
/usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../lib/crti.o
/usr/lib/gcc/i486-linux-gnu/4.0.2/crtbegin.o
-L/usr/lib/gcc/i486-linux-gnu/4.0.2 -L/usr/lib/gcc/i486-linux-gnu/4.0.2
-L/usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../lib
-L/usr/lib/gcc/i486-linux-gnu/4.0.2/../../.. -L/lib/../lib -L/usr/lib/../lib
signedness.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/i486-linux-gnu/4.0.2/crtend.o
/usr/lib/gcc/i486-linux-gnu/4.0.2/../../../../lib/crtn.o
--
Kristian Hermansen


-- 
           Summary: -Wconversion fails to detect signedness conversion from
                    int to unsigned int in fuction call
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kristian dot hermansen at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26167


             reply	other threads:[~2006-02-08  1:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08  1:10 kristian dot hermansen at gmail dot com [this message]
2006-02-08 11:36 ` [Bug c++/26167] " rguenth at gcc dot gnu dot org
2006-02-08 14:46 ` mueller at gcc dot gnu dot org
2006-02-08 15:32 ` gdr at integrable-solutions dot net
2006-02-26  6:40 ` kristian dot hermansen at gmail dot com
2006-08-21  5:41 ` pinskia at gcc dot gnu dot org
2006-09-16  1:08 ` lopezibanez at gmail dot com
2006-09-17 18:37 ` kristian dot hermansen at gmail dot com
2006-09-17 18:39 ` kristian dot hermansen at gmail dot com
2006-09-17 20:31 ` tbm at cyrius dot com
2006-09-18  8:16 ` lopezibanez at gmail dot com
2006-09-18 12:11 ` mueller at gcc dot gnu dot org
2006-09-18 12:22 ` lopezibanez at gmail dot com
2006-09-18 12:45 ` lopezibanez at gmail dot com
2006-10-16 15:37 ` mueller at gcc dot gnu dot org
2006-11-24  1:51 ` manu at gcc dot gnu dot org
2006-11-24  1:56 ` manu at gcc dot gnu dot 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-26167-12152@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).