public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "0xe2.0x9a.0x9b at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/95971] [10 regression] Optimizer converts a false boolean value into a true boolean value
Date: Mon, 29 Jun 2020 19:15:33 +0000	[thread overview]
Message-ID: <bug-95971-4-rMxTRyWpVu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95971-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95971

--- Comment #9 from Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0x9b at gmail dot com> ---
(In reply to Martin Liška from comment #8)
> Or you can use -fno-finite-loops option.

I am sorry, but I cannot trust this compiler not to force me again spending
several hours of time just to learn that -O2 is semantically different from -O1
and -O3.

The meaning of "semantically equivalent" in my mind is different from the
meaning of "semantically equivalent" in your mind. Infinite loopiness is in my
opinion semantically significant, so the compiler should have printed a warning
that would inform me about the fact that the compiler is changing the semantics
of the code in question.

With -O3, the assembly code is:

Dump of assembler code for function main:
   <+0>:        sub    $0x8,%rsp
   <+4>:        xor    %edi,%edi
   <+6>:        callq  xbool(bool)
   <+11>:       jmp    main+11

"11: jmp 11" is a prime example of what -ffinite-loops is supposed to prevent
from being generated.

Assuming that -O3 actually does include -ffinite-loops, which I am unable to
verify because "g++ --help=optimizers -Q" doesn't accept the -std=gnu++11
option.

  parent reply	other threads:[~2020-06-29 19:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 16:19 [Bug other/95971] New: " 0xe2.0x9a.0x9b at gmail dot com
2020-06-29 16:20 ` [Bug other/95971] " 0xe2.0x9a.0x9b at gmail dot com
2020-06-29 16:20 ` 0xe2.0x9a.0x9b at gmail dot com
2020-06-29 16:20 ` 0xe2.0x9a.0x9b at gmail dot com
2020-06-29 17:43 ` marxin at gcc dot gnu.org
2020-06-29 18:05 ` 0xe2.0x9a.0x9b at gmail dot com
2020-06-29 18:27 ` marxin at gcc dot gnu.org
2020-06-29 18:44 ` 0xe2.0x9a.0x9b at gmail dot com
2020-06-29 18:50 ` marxin at gcc dot gnu.org
2020-06-29 19:15 ` 0xe2.0x9a.0x9b at gmail dot com [this message]
2020-06-29 20:50 ` 0xe2.0x9a.0x9b at gmail dot com
2020-06-29 21:30 ` glisse at gcc dot gnu.org
2020-06-29 21:43 ` 0xe2.0x9a.0x9b at gmail 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-95971-4-rMxTRyWpVu@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).