public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rakdver at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/33498] [4.2/4.3 Regression] Optimizer (-O2) may convert a normal loop to infinite
Date: Wed, 19 Sep 2007 16:56:00 -0000	[thread overview]
Message-ID: <20070919165637.3418.qmail@sourceware.org> (raw)
In-Reply-To: <bug-33498-15115@http.gcc.gnu.org/bugzilla/>



------- Comment #8 from rakdver at gcc dot gnu dot org  2007-09-19 16:56 -------
t #2)
> Technically the testcase invokes undefined behavior because 'val' overflows
> during loop execution.  Practically from a QOI point of view the undefinedness
> should not propagate to the loop exit test (though GCCs behavior is certainly
> standard conforming here).  A nice example for what undefined behavior can
> cause though ;)
> 
> So, not sure if invalid or not.

What happens is that ivopts decide to use val as the variable to use in the
exit compare; they compute what its final value will be (67305984), and replace
the exit test by val != 67305984.

There is not much I can do with that in ivopts.  I could make ivopts avoid
preserving signed variables appearing in the source code that provably
overflow; but I do not think we want to introduce this kind of hacks to handle
code with undefined behavior.


-- 


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


  parent reply	other threads:[~2007-09-19 16:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-19 15:02 [Bug c/33498] New: " dada1 at cosmosbay dot com
2007-09-19 15:53 ` [Bug tree-optimization/33498] [4.2/4.3 Regression] " rguenth at gcc dot gnu dot org
2007-09-19 15:59 ` rguenth at gcc dot gnu dot org
2007-09-19 16:12 ` rask at gcc dot gnu dot org
2007-09-19 16:35 ` pinskia at gcc dot gnu dot org
2007-09-19 16:39 ` rask at gcc dot gnu dot org
2007-09-19 16:45 ` rakdver at gcc dot gnu dot org
2007-09-19 16:50 ` pinskia at gcc dot gnu dot org
2007-09-19 16:56 ` rakdver at gcc dot gnu dot org [this message]
2007-09-19 17:33 ` ebotcazou at gcc dot gnu dot org
2007-09-20  8:17 ` dada1 at cosmosbay dot com
2007-09-20  8:44 ` rguenther at suse dot de
2007-09-20  9:23 ` [Bug tree-optimization/33498] " pinskia at gcc dot gnu dot org
2007-09-20  9:55 ` rask at gcc dot gnu dot org
2007-09-20 15:30 ` pinskia at gcc dot gnu dot org
2007-09-20 18:47 ` rakdver 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=20070919165637.3418.qmail@sourceware.org \
    --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).