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

* Re: Can't turn off overflow_warning?
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2005-07-16  2:33 UTC (permalink / raw)
  To: Bradley Lucier; +Cc: gcc


On Jul 15, 2005, at 10:27 PM, Bradley Lucier wrote:

> 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,

IIRC the C standard requires that a warning here but I could be wrong.

-- Pinski

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

* Re: Can't turn off overflow_warning?
  2005-07-16  2:27 Can't turn off overflow_warning? Bradley Lucier
  2005-07-16  2:33 ` Andrew Pinski
@ 2005-07-16  2:35 ` DJ Delorie
  1 sibling, 0 replies; 4+ messages in thread
From: DJ Delorie @ 2005-07-16  2:35 UTC (permalink / raw)
  To: lucier; +Cc: gcc


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

Why not check out my recently posted -Wpragmas patch on gcc-patches?
It takes a set of existing non-optional warnings, and gives them an
option that can be used to disable them, which defaults to on
(i.e. -Wno-pragmas is the useful option).

That way, you get control but the default action stays the same.

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

* Re: Can't turn off overflow_warning?
  2005-07-16  2:33 ` Andrew Pinski
@ 2005-07-16  2:59   ` Gabriel Dos Reis
  0 siblings, 0 replies; 4+ messages in thread
From: Gabriel Dos Reis @ 2005-07-16  2:59 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Bradley Lucier, gcc

Andrew Pinski <pinskia@physics.uc.edu> writes:

| On Jul 15, 2005, at 10:27 PM, Bradley Lucier wrote:
| 
| > 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,
| 
| IIRC the C standard requires that a warning here but I could be wrong.

Please not again.  
The C standard knows nothing about warning.  There is a notion of
diagnostic but I don't think it makes any sense in the particular case
Brad describes.  

| 
| -- Pinski

-- 
                                                       Gabriel Dos Reis 
                                           gdr@integrable-solutions.net

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