public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rimvydas.jas at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/101918] LTO type mismatches for runtime library functions in mixed -fdefault-real-8 projects
Date: Mon, 30 Aug 2021 15:23:59 +0000	[thread overview]
Message-ID: <bug-101918-4-Ckqk3ofDBf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101918-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from Rimvydas (RJ) <rimvydas.jas at gmail dot com> ---
(In reply to kargl from comment #11)
> One of these is no like the others. Yes, the behavior is documented,
> and the unlike other result is likely the result that is no desired
> unless the user enjoys chancing numerical precision issues.
$ cat foo.f90 
program foo
   implicit none
   real(kind=4) :: a, b
   real :: x, y
   x = 1.
   y = 3.14159
   a = 1._4
   b = 3.14159_4
   print *, a / b
   print *, x/ y
end program foo
$ gfortran foo.f90 && ./a.out
  0.318310142    
  0.318310142    
$ gfortran foo.f90 -fdefault-real-8 && ./a.out
  0.318310142    
  0.31831015504887655     
$ gfortran foo.f90 -freal-4-real-8 && ./a.out
  0.31831015504887655     
  0.31831015504887655

Looks pretty consistent for me if proper types are used to match the kinds used
in constants like 3.14159_4. The same would apply for plain DOUBLE PRECISION
and 3.14159D numerical constants. Is this the only catch for -fdefault-* family
of options?

> You need to use -fdefault-real-8 -fdefault-double-8 when compiling both
> files.  How is the 2nd invocation of gfortran to know that your first
> invocation of gfortran used incompatible options?
Incompatible how?  As far as executable linking is concerned the final link
could be performed by plain ld(1) on both foo.o and bar.o (or foo.o libbar.a)
provided that user links in the libgfortran.so too.  The -fdump-tree-original
-c outputs on both sources indicate that dump trees are identical (including
calls to _gfortran_reshape_r8() in libgfortran.so).

  parent reply	other threads:[~2021-08-30 15:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15  8:41 [Bug fortran/101918] New: " rimvydas.jas at gmail dot com
2021-08-15  8:42 ` [Bug fortran/101918] " rimvydas.jas at gmail dot com
2021-08-15 15:36 ` kargl at gcc dot gnu.org
2021-08-16  9:15 ` rguenth at gcc dot gnu.org
2021-08-16 14:57 ` sgk at troutmask dot apl.washington.edu
2021-08-16 18:49 ` anlauf at gcc dot gnu.org
2021-08-16 21:34 ` sgk at troutmask dot apl.washington.edu
2021-08-30 10:26 ` rimvydas.jas at gmail dot com
2021-08-30 10:28 ` rimvydas.jas at gmail dot com
2021-08-30 14:34 ` sgk at troutmask dot apl.washington.edu
2021-08-30 14:39 ` kargl at gcc dot gnu.org
2021-08-30 14:48 ` kargl at gcc dot gnu.org
2021-08-30 15:23 ` rimvydas.jas at gmail dot com [this message]
2021-08-30 16:16 ` sgk at troutmask dot apl.washington.edu
2021-08-30 17:11 ` rimvydas.jas at gmail dot com
2021-08-30 18:26 ` sgk at troutmask dot apl.washington.edu
2021-08-30 19:08 ` rimvydas.jas at gmail dot com
2021-08-30 20:54 ` sgk at troutmask dot apl.washington.edu
2021-08-30 21:23 ` rimvydas.jas at gmail dot com
2021-08-30 22:18 ` sgk at troutmask dot apl.washington.edu
2021-08-30 22:26 ` rimvydas.jas at gmail dot com
2021-09-02 11:01 ` rimvydas.jas at gmail dot com
2021-09-02 11:02 ` rimvydas.jas at gmail dot com
2021-09-02 11:05 ` rimvydas.jas at gmail dot com
2021-09-02 11:06 ` rimvydas.jas at gmail dot com
2021-09-02 11:08 ` rimvydas.jas at gmail dot com
2021-09-12 19:12 ` rimvydas.jas 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-101918-4-Ckqk3ofDBf@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).