public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Janne Blomqvist <blomqvist.janne@gmail.com>
Cc: Fortran List <fortran@gcc.gnu.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, fortran, PR 82869] Introduce default_logical_type_node and logical_type_node
Date: Tue, 07 Nov 2017 22:27:00 -0000	[thread overview]
Message-ID: <20171107222701.GA47818@troutmask.apl.washington.edu> (raw)
In-Reply-To: <CAO9iq9EFunoQH3fyMzfor8Y4vXTWqEeG-sDgZyt2ucdqCrpFaw@mail.gmail.com>

On Tue, Nov 07, 2017 at 10:38:43PM +0200, Janne Blomqvist wrote:
> On Tue, Nov 7, 2017 at 10:06 PM, Steve Kargl
> <sgk@troutmask.apl.washington.edu> wrote:
> > On Tue, Nov 07, 2017 at 08:26:15PM +0200, Janne Blomqvist wrote:
> >> +
> >> +  logical_type_node = gfc_get_logical_type (4);
> >
> > Can you add a comment to note that the 4 is purposely chosen?
> > A year or so from now, someone might change this to gfc_default_logical_kind
> > without understand/recalling why 4 is used.
> 
> The patch contains a comment explaining that in trans-types.h.

Well, did say I scanned the patch ;-)

> However, a bit of further experimenting with my patch revealed that
> one can cause these latent bugs I feared to appear by playing with
> -fdefault-integer-8 / -finteger-4-integer-8 with the example from
> bugzilla (so we end up passing a pointer to a logical(kind=4) variable
> but we tell libgfortran it's kind=8). I did fix the most obvious ones
> in the attached patch (on top of the previous one), but I'm not
> convinced it's exhaustive.
> 
> So I wonder, do we actually care enough about -fdefault-integer-8 /
> -finteger-4-integer-8 to do this kind of micro-optimization (i.e. use
> 4 byte logical temporary variables if we can even when we use
> -fdefault-integer-8 / -finteger-4-integer-8), or should we play it
> safe and just use default_logical_type_node everywhere?

I certainly don't care about fallout when one uses -fdefault-*
options.  I've stated more than once I think these should
be removed, because these options break storage association
(among other things).  I a little surprise that -finteger-4-integer-8
have an effect, but I admit I haven't looked closely at the
internal representation of a Fortran logical and its relationship
to INTEGER(4).

-- 
steve

  reply	other threads:[~2017-11-07 22:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 18:26 Janne Blomqvist
2017-11-07 20:06 ` Steve Kargl
2017-11-07 20:38   ` Janne Blomqvist
2017-11-07 22:27     ` Steve Kargl [this message]
2017-11-08 11:57       ` Janne Blomqvist
2017-11-13 20:04         ` Janne Blomqvist

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=20171107222701.GA47818@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=blomqvist.janne@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).