From: "Ankur Arora" <terminus@gmail.com>
To: gcc-help@gnu.org
Subject: No warning on type truncation
Date: Sun, 03 Aug 2008 19:04:00 -0000 [thread overview]
Message-ID: <dae824200808031203o1e233cfv25619c085e261533@mail.gmail.com> (raw)
Hi,
In the following program I am truncating a value from long to int (on
a 64 bit machine):
$ cat trunc.c
int main() {
int t2;
long t1 = 0xfeed00000000;
t2 = t1;
return 0;
}
That, however doesn't result in any warnings even though -Wall and
-Wextra are enabled:
$ gcc -Wextra -Wall trunc.c
$ gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu
--disable-altivec --enable-nls --without-included-gettext
--with-system-zlib --disable-checking --disable-werror
--enable-secureplt --enable-multilib --enable-libmudflap
--disable-libssp --disable-libgcj
--enable-languages=c,c++,d,objc,obj-c++,treelang,fortran
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu
Thread model: posix
gcc version 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.1)
I cannot find any relevant option in the manual which enables
truncation warnings.
What am I missing?
Thanks,
Ankur
--
667:
The neighbor of the beast.
next reply other threads:[~2008-08-03 19:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-03 19:04 Ankur Arora [this message]
2008-08-03 19:18 ` Brian Dessent
2008-08-03 19:49 ` Ankur Arora
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=dae824200808031203o1e233cfv25619c085e261533@mail.gmail.com \
--to=terminus@gmail.com \
--cc=gcc-help@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).