public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57199] [4.8/4.9 Regression] Bogus warning: iteration NNNN invokes undefined behavior -Waggressive-loop-optimizations
Date: Mon, 20 May 2013 08:12:00 -0000	[thread overview]
Message-ID: <bug-57199-4-8eJOs0CtrQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57199-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't think the warning is bogus.
At phiprop we have:
  long unsigned int _3;
  size_t _6;
  size_t _7;
  long unsigned int _8;

  <bb 2>:
  _6 = MEM[(const struct InlinedVector *)this_1(D)].size_;
  _3 = _6 + 1;
...
  _7 = MEM[(const struct InlinedVector *)this_1(D)].size_;
  if (_3 < _7)
    goto <bb 3>;
  else
    goto <bb 6>;

  <bb 3>:
  _8 = _7 - _3;

and fre2 turns this into:

  _6 = MEM[(const struct InlinedVector *)this_1(D)].size_;
  _3 = _6 + 1;
...
  _7 = _6;
  if (_3 < _7)
    goto <bb 3>;
  else
    goto <bb 6>;

  <bb 3>:
  _8 = 18446744073709551615;

i.e. it can't prove the following loop that uses _8 as upper bound is dead, but
the loop has at that point constant bounds and triggers undefined behavior in
it if executed.  The loop can be only executed if foo_.size() is (size_t) -1,
but if you call it with this value, you'll surely hit the undefined behavior
the warning is complaining about.


  parent reply	other threads:[~2013-05-20  8:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07 22:09 [Bug c++/57199] New: [4.8, 4.9] " ppluzhnikov at google dot com
2013-05-07 23:01 ` [Bug c++/57199] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-05-08  8:58 ` [Bug tree-optimization/57199] " rguenth at gcc dot gnu.org
2013-05-08 12:55 ` ppluzhnikov at google dot com
2013-05-15 13:29 ` rguenth at gcc dot gnu.org
2013-05-20  8:12 ` jakub at gcc dot gnu.org [this message]
2013-05-20 14:10 ` ppluzhnikov at google dot com
2013-05-20 14:26 ` jakub at gcc dot gnu.org
2013-05-20 15:19 ` ppluzhnikov at google dot com
2014-03-26 20:39 ` dichlofos-mv at yandex dot ru
2014-03-26 20:56 ` ppluzhnikov at google dot com

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-57199-4-8eJOs0CtrQ@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).