public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Can't turn off overflow_warning?
@ 2005-07-16  2:27 Bradley Lucier
  2005-07-16  2:33 ` Andrew Pinski
  2005-07-16  2:35 ` DJ Delorie
  0 siblings, 2 replies; 4+ messages in thread
From: Bradley Lucier @ 2005-07-16  2:27 UTC (permalink / raw)
  To: gcc; +Cc: Bradley Lucier

After examining the source and documentation, it appears to me that in 
4.0.* and on mainline one cannot turn off the warning generated by 
overflow_warning, in, for example,

[descartes:~] lucier% cat test.c
#include <stdio.h>

int main() {
   if (1048256 * 1048256 < 0)
     printf("1");
   else
     printf("2");

return 0;
}
[descartes:~] lucier% /pkgs/gcc-4.0.0/bin/gcc -v
Using built-in specs.
Target: powerpc-apple-darwin8.1.0
Configured with: ../configure --prefix=/pkgs/gcc-4.0.0 
--with-gmp=/pkgs/gmp-4.1.3 --with-mpfr=/pkgs/gmp-4.1.3
Thread model: posix
gcc version 4.0.0
[descartes:~] lucier% /pkgs/gcc-4.0.0/bin/gcc -O1 -Wall -W -Wextra 
-fwrapv test.c
test.c: In function 'main':
test.c:4: warning: integer overflow in expression
[descartes:~] lucier% ./a.out
1[descartes:~] lucier%

I'd like to be able to do this, since I'm auto-generating code that 
explicitly uses overflow tests that assume that signed ints overflow 
using twos-complement arithmetic and I don't want to be distracted by 
extraneous warnings when constant propagation in the Scheme system puts 
constants into this C code.

Personally, I'd like overflow_warning to be turned off for signed ints 
if -fwrapv is passed as a flag.  I suppose an explicit 
-Wno-overflow-warning would be OK, too.

If I were to propose a patch, which way should I go?

Brad

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

end of thread, other threads:[~2005-07-16  2:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-16  2:27 Can't turn off overflow_warning? Bradley Lucier
2005-07-16  2:33 ` Andrew Pinski
2005-07-16  2:59   ` Gabriel Dos Reis
2005-07-16  2:35 ` DJ Delorie

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