public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Janus Weil <janus@gcc.gnu.org>
To: Thomas Koenig <tkoenig@netcologne.de>
Cc: Fritz Reese <fritzoreese@gmail.com>,
	Adam Hirst <adam@aphirst.karoo.co.uk>,
		fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch, Fortran] PR 57160: short-circuit IF only with -ffrontend-optimize
Date: Tue, 24 Jul 2018 20:14:00 -0000	[thread overview]
Message-ID: <CAKwh3qh28XEDHxL6u7W0Z_4=qekWRLgVMz5Qw9A6BfSmZPUBkA@mail.gmail.com> (raw)
In-Reply-To: <b70c1f2d-f3cc-3512-4285-b4cdec1b2f1c@netcologne.de>

2018-07-24 21:49 GMT+02:00 Thomas Koenig <tkoenig@netcologne.de>:
> Am 24.07.2018 um 20:46 schrieb Janus Weil:
>>
>> Good, since we all seem to agree on that, I'm including it in the
>> patch (new version in the attachment).
>
> Sorry for chiming in so late, but I don't (and Dominique doesn't
> either).

Dominique has not commented on the question whether -Og should imply
-ffrontend-optimization, therefore I don't know his opinion on that
matter.


> If you want to enforce either short-circuit evaluation or
> forced evaluation, please use a dedicated option.

I don't want to enforce any of that. gfortran is enforcing
short-circuiting right now (with any option), and I want to change
that.


> I don't think it is a good idea to have
>
> if (allocated(x) .and. any(x>0))
>
> crash on -O0 and not crash on -O.

I actually do. The code is invalid. Crashing it is good, because it
draws the user's attention to that fact.

You can find lots of invalid programs that change their behavior with
different optimization flags.


> -O should not change the semantics of a program in
> such a way.

You should thank the authors of the Fortran standard for not fixing
the semantics of and/or operands.

Note that -O will not change the results of valid code (except if
impure functions are involved, and those trigger a warning since
recently).

Cheers,
Janus

  reply	other threads:[~2018-07-24 20:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20 21:38 Janus Weil
2018-07-23  7:40 ` Adam Hirst
2018-07-23 17:11   ` Janus Weil
2018-07-23 21:06     ` Fritz Reese
2018-07-24 18:46       ` Janus Weil
2018-07-24 19:49         ` Janus Weil
2018-07-24 19:50         ` Thomas Koenig
2018-07-24 20:14           ` Janus Weil [this message]
2018-07-25 20:05             ` Janus Weil
2018-07-25 20:59               ` Nicolas Koenig
2018-07-25 21:01                 ` Thomas Koenig
2018-07-25 21:31                 ` Janus Weil
2018-07-24  9:12 Dominique d'Humières
2018-07-24 13:46 ` Janus Weil
2018-07-24 15:42   ` Janne Blomqvist
2018-07-24 16:18     ` Janus Weil
2018-07-27 16:42 Dominique d'Humières
2018-07-28  8:03 ` Janus Weil
2018-08-01 20:46   ` Janus Weil
2018-08-06 20:59     ` Janus Weil
2018-08-07 10:11       ` Dominique d'Humières
2018-08-07 17:14         ` Janus Weil
2018-08-07 22:21           ` Thomas König
2018-08-08  0:17             ` William Clodius
2018-08-08  5:41             ` Janus Weil
2018-08-08  8:35           ` Manfred Schwarb
2018-08-08 11:23             ` Janus Weil
2018-08-08 11:29               ` Arjen Markus
2018-08-08 18:21                 ` Janus Weil
2018-08-08 20:48                   ` Janus Weil
2018-08-09  1:05                     ` Jerry DeLisle
2018-08-09 21:14                       ` Janus Weil
2018-08-10  0:38                         ` Jerry DeLisle
2018-08-10 14:14                           ` Janus Weil
2018-08-08 19:50             ` Janus Weil

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='CAKwh3qh28XEDHxL6u7W0Z_4=qekWRLgVMz5Qw9A6BfSmZPUBkA@mail.gmail.com' \
    --to=janus@gcc.gnu.org \
    --cc=adam@aphirst.karoo.co.uk \
    --cc=fortran@gcc.gnu.org \
    --cc=fritzoreese@gmail.com \
    --cc=tkoenig@netcologne.de \
    /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).