public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Koning <paulkoning@comcast.net>
To: Richard Biener <richard.guenther@gmail.com>
Cc: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: Target control of Fortran options
Date: Thu, 04 Oct 2018 14:04:00 -0000	[thread overview]
Message-ID: <01899EC4-4F6C-4592-AFB6-D29DA79F1BCB@comcast.net> (raw)
In-Reply-To: <CAFiYyc2fnoxLWwkBEE0Zyr1ic1KPO3O+GObtyiVfQZMyb9T-oQ@mail.gmail.com>



> On Oct 4, 2018, at 4:06 AM, Richard Biener <richard.guenther@gmail.com> wrote:
> 
> On Wed, Oct 3, 2018 at 11:04 PM Paul Koning <paulkoning@comcast.net> wrote:
>> 
>> In the C and C++ parts of GCC, the target has some ways to adjust the compiler options depending on target settings.  I'm looking for a way to do that with gfortran.
>> 
>> The specific issue is in pdp11, which has an option to specify that "float" is 8 bytes (same as "double") rather than 4 bytes.  And the 8 byte choice is the default.
>> 
>> As a result, if I invoke gfortran for that target, I get an ICE because real*4 can't be found.  If I say -fdefault-real-8 it works.
>> 
>> So what I'm hoping to do is to have the target switch processing code (for the TARGET_HANDLE_OPTION hook) react to the -mfloat32 and -mfloat64 switches by passing appropriate -fdefault-real-* switches to Fortran.  Is that possible?
> 
> I think Fortran has to do it the same way the C family does.
> float/double get assigned
> by looking at FLOAT_TYPE_SIZE / [LONG_]DOUBLE_TYPE_SIZE.  Iff that's not good
> for the Fortran FE we'd have to define additional target hooks the FE can use.

It appears that Fortran has a different approach.  Fortran has syntax like "REAL*8" to request a float of a specific size.  And what gfortran does is assume that "REAL" without  a size specifier means "REAL*n" for a well known fixed n.  Without switches, n is 4, which is indeed the common answer.  But in my case, there isn't any 4-byte float type unless you say -mfloat32.

Maybe the answer is "that's a wrong thing to do".  If so, I suppose I could change it -- it was done before I got involved and I don't know for what reason.

	paul


  reply	other threads:[~2018-10-04 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 21:04 Paul Koning
2018-10-04  8:06 ` Richard Biener
2018-10-04 14:04   ` Paul Koning [this message]
2018-10-04 15:41     ` N.M. Maclaren
2018-10-04 15:48       ` Paul Koning
2018-10-04 16:20         ` N.M. Maclaren
     [not found]     ` <CAO9iq9F0oW35Ke3PjHM1hgZ_vjyq5H_gLYy=zLyUB5x1xBxrrg@mail.gmail.com>
2018-10-04 18:51       ` Paul Koning
2018-10-05  8:44         ` N.M. Maclaren

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=01899EC4-4F6C-4592-AFB6-D29DA79F1BCB@comcast.net \
    --to=paulkoning@comcast.net \
    --cc=fortran@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).