public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58143] wrong code at -O3 on x86_64-linux-gnu
Date: Tue, 20 Aug 2013 00:21:00 -0000	[thread overview]
Message-ID: <bug-58143-4-8xMnH8F8Bj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58143-4@http.gcc.gnu.org/bugzilla/>

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

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot de

--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Created attachment 30674
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30674&action=edit
slightly simplified test case

attached is a slightly simplified test case.
The problem seems to start in the optimizer pass 097t.lim1
where the following expression is identified as loop-invariant of loop 3.

Moving statement
_23 = -2147483648 - c.1_22;
(cost 1) out of loop 3.

unfortunatley it is executed unconditionally now.

later the optimizer pass 110t.ivcanon uses the possible overflow
in this statement as an argument, why the loop must be executed exactly once.

Induction variable (int) 2147483647 + 1 * iteration does not wrap in statement
_23 = -2147483648 - prephitmp_8;
 in loop 2.
Statement _23 = -2147483648 - prephitmp_8;
 is executed at most 0 (bounded by 0) + 1 times in loop 2.

and shortly after that an apparently pointless loop-exit is removed.

Removed pointless exit: if (prephitmp_8 != 0)

however that is based on a worng assumption, and causes worng code.


  parent reply	other threads:[~2013-08-20  0:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13  0:05 [Bug middle-end/58143] New: " su at cs dot ucdavis.edu
2013-08-13  0:08 ` [Bug middle-end/58143] " pinskia at gcc dot gnu.org
2013-08-13  0:24 ` su at cs dot ucdavis.edu
2013-08-14 21:11 ` mikpe at it dot uu.se
2013-08-20  0:21 ` bernd.edlinger at hotmail dot de [this message]
2013-08-20  0:59 ` bernd.edlinger at hotmail dot de
2013-08-20 22:25 ` bernd.edlinger at hotmail dot de
2013-08-21  8:53 ` bernd.edlinger at hotmail dot de
2013-08-21 17:41 ` [Bug tree-optimization/58143] [4.8/4.9 regression] wrong code at -O3 ebotcazou at gcc dot gnu.org
2013-08-21 18:02 ` jakub at gcc dot gnu.org
2013-08-21 21:50 ` bernd.edlinger at hotmail dot de
2013-08-23  9:15 ` bernd.edlinger at hotmail dot de
2013-08-23  9:16 ` jakub at gcc dot gnu.org
2013-08-23 12:08 ` bernd.edlinger at hotmail dot de
2013-08-23 12:59 ` jakub at gcc dot gnu.org
2013-08-25 22:08 ` bernd.edlinger at hotmail dot de
2013-08-28 21:30 ` bernd.edlinger at hotmail dot de
2013-10-15  8:15 ` rguenth at gcc dot gnu.org
2013-10-15  8:17 ` rguenth at gcc dot gnu.org
2013-10-15  8:39 ` bernd.edlinger at hotmail dot de
2013-10-15  9:05 ` rguenth at gcc dot gnu.org
2013-10-15  9:41 ` rguenth at gcc dot gnu.org
2013-10-15 11:03 ` rguenth at gcc dot gnu.org
2013-10-15 11:45 ` bernd.edlinger at hotmail dot de
2013-10-15 11:54 ` rguenth at gcc dot gnu.org
2013-10-15 11:54 ` rguenther at suse dot de
2013-10-15 13:21 ` bernd.edlinger at hotmail dot de
2013-10-15 13:27 ` rguenther at suse dot de
2013-10-15 13:36 ` mikpelinux at gmail dot com
2013-10-15 13:38 ` bernd.edlinger at hotmail dot de
2013-10-15 13:40 ` rguenther at suse dot de
2013-10-16  9:51 ` jakub at gcc dot gnu.org
2013-10-17  9:59 ` rguenth at gcc dot gnu.org
2013-10-17 10:08 ` [Bug tree-optimization/58143] [4.8 " rguenth at gcc dot gnu.org
2013-11-18 15:14 ` rguenth at gcc dot gnu.org
2013-11-18 15:15 ` rguenth at gcc dot gnu.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=bug-58143-4-8xMnH8F8Bj@http.gcc.gnu.org/bugzilla/ \
    --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).