public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Gcc silently transforms a finite loop to an infinite one
       [not found] <1322566691.2994.43.camel@ab02>
@ 2011-11-29 14:55 ` Michael Matz
  2011-11-29 16:15   ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Matz @ 2011-11-29 14:55 UTC (permalink / raw)
  To: Nadezhda Ivanоvna Vyukova; +Cc: gcc, gcc-help

[-- Attachment #1: Type: TEXT/PLAIN, Size: 893 bytes --]

Hi,

please use gcc-help@ for this type of questions.

On Tue, 29 Nov 2011, Nadezhda Ivanоvna Vyukova wrote:

> I've explained the customer that by default char is treated
> as signed char on our platform and therefore this program 
> does not conform ISO C90, as it causes the integer overflow
> (undefined behavior).

That is correct.

> But he was not satisfied.
> He argued that the program compiled with gcc-3.4.6 behaves 
> "correctly" and now the compiler silently produces an 
> incomprehensible code.

There is no "correct" with undefined code.  He simply was lucky with 3.4.

> IMHO it would be better to issue a warning when a finite loop is 
> transformed to an infinite one (as a result of -ftree-vrp).

-Wstrict-overflow gives a warning in this program.  This warning isn't 
active by default.  4.1 didn't yet have this warning IIRC.


Ciao,
Michael.

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

* Re: Gcc silently transforms a finite loop to an infinite one
  2011-11-29 14:55 ` Gcc silently transforms a finite loop to an infinite one Michael Matz
@ 2011-11-29 16:15   ` Robert Dewar
  2011-11-29 19:20     ` Michael Matz
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Dewar @ 2011-11-29 16:15 UTC (permalink / raw)
  To: Michael Matz; +Cc: Nadezhda Ivanоvna Vyukova, gcc, gcc-help

On 11/29/2011 8:29 AM, Michael Matz wrote:

>> IMHO it would be better to issue a warning when a finite loop is
>> transformed to an infinite one (as a result of -ftree-vrp).
>
> -Wstrict-overflow gives a warning in this program.  This warning isn't
> active by default.  4.1 didn't yet have this warning IIRC.

I would tend to agree that when this transformation is applied, an
unconditional warning is appropriate. It's almost certainly indicative
of a bug, and indeed the character case of this report is such a common
case that I would look for it specifically and diagnose it (and
preferably make it "work").
>
>
> Ciao,
> Michael.

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

* Re: Gcc silently transforms a finite loop to an infinite one
  2011-11-29 16:15   ` Robert Dewar
@ 2011-11-29 19:20     ` Michael Matz
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Matz @ 2011-11-29 19:20 UTC (permalink / raw)
  To: Robert Dewar; +Cc: Nadezhda Ivanоvna Vyukova, gcc, gcc-help

Hi,

On Tue, 29 Nov 2011, Robert Dewar wrote:

> > > IMHO it would be better to issue a warning when a finite loop is 
> > > transformed to an infinite one (as a result of -ftree-vrp).
> >
> > -Wstrict-overflow gives a warning in this program.  This warning isn't 
> > active by default.  4.1 didn't yet have this warning IIRC.
> 
> I would tend to agree that when this transformation is applied, an 
> unconditional warning is appropriate. It's almost certainly indicative 
> of a bug,

Yes, well.  The problem is, this particular warning is in fairly generic 
code that triggers often in harmless situations, i.e. generates quite a 
number false positives :-/

> and indeed the character case of this report is such a common case that 
> I would look for it specifically and diagnose it (and preferably make it 
> "work").


Ciao,
Michael.

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

end of thread, other threads:[~2011-11-29 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1322566691.2994.43.camel@ab02>
2011-11-29 14:55 ` Gcc silently transforms a finite loop to an infinite one Michael Matz
2011-11-29 16:15   ` Robert Dewar
2011-11-29 19:20     ` Michael Matz

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