public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101918] New: LTO type mismatches for runtime library functions in mixed -fdefault-real-8 projects
@ 2021-08-15  8:41 rimvydas.jas at gmail dot com
  2021-08-15  8:42 ` [Bug fortran/101918] " rimvydas.jas at gmail dot com
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: rimvydas.jas at gmail dot com @ 2021-08-15  8:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101918
           Summary: LTO type mismatches for runtime library functions in
                    mixed -fdefault-real-8 projects
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rimvydas.jas at gmail dot com
  Target Milestone: ---

$ cat bar.f90
program bar
implicit none
logical :: mask(2,3)
integer :: ai(2,3), vi(5)
real :: ar(2,3), vr(2)
double precision :: ad(2,3), vd(2)
ai = 0
ai(1,1:2) = (/ 1, 2 /)
ar = ai
ad = ai
mask = ai .ne. 0
vi = PACK(ai, ai .gt. 0, vector=(/1,2,3,4,5/))
vd = PACK(ad, mask)
vr = PACK(ar, mask)
call foo()
end program

$ cat foo.f90
subroutine foo
implicit none
real :: ar(2,3), v(1)
ar = 0.
ar(1,1) = 1.
v = PACK(ar, ar > 0.)
end subroutine

$ gfortran -Wall -Wextra -flto -fdefault-real-8 -c foo.f90
$ gfortran -flto -Wall -Wextra foo.o bar.f90
bar.f90:14:19: warning: type of '_gfortran_pack' does not match original
declaration [-Wlto-type-mismatch]
   14 | vr = PACK(ar, mask)
      |                   ^
bar.f90:13:19: warning: type of '_gfortran_pack' does not match original
declaration [-Wlto-type-mismatch]
   13 | vd = PACK(ad, mask)
      |                   ^
bar.f90:12:46: warning: type of '_gfortran_pack' does not match original
declaration [-Wlto-type-mismatch]
   12 | vi = PACK(ai, ai .gt. 0, vector=(/1,2,3,4,5/))
      |                                              ^
foo.f90:6:21: note: '_gfortran_pack' was previously declared here
    6 | v = PACK(ar, ar > 0.)
      |                     ^
foo.f90:6:21: note: code may be misoptimized unless '-fno-strict-aliasing' is
used

In medium sized mixed C/Fortran codebase there are more instances for:
 _gfortran_matmul_r8
 _gfortran_pack
 _gfortran_reshape_r8
 _gfortran_set_convert
 _gfortran_shape_4
 _gfortran_unpack0
 _gfortran_unpack1

Does this mean -flto cannot be used in mixed -fdefault-real-8 and usual modes?

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2021-09-12 19:12 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-15  8:41 [Bug fortran/101918] New: LTO type mismatches for runtime library functions in mixed -fdefault-real-8 projects 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
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

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).