public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/43841]  New: Missing temporary for ELEMENTAL function call
@ 2010-04-21 19:54 anlauf at gmx dot de
  2010-04-21 20:49 ` [Bug fortran/43841] " dominiq at lps dot ens dot fr
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: anlauf at gmx dot de @ 2010-04-21 19:54 UTC (permalink / raw)
  To: gcc-bugs

As reported in

http://gcc.gnu.org/ml/fortran/2010-04/msg00215.html

gfortran does not always produce a temporary when it deems necessary.

Reduce testcase:

program main
  implicit none

  type::polar_t
     real :: l
  end type polar_t

  call test_member
contains

  subroutine test_member
    type(polar_t),dimension(2)::b

    b    = polar_t(2.0)
    b(:) = div_pp (b(:), b(1))
    write(*,*) b
    if (b(2)%l /= 1) call abort ()
  end subroutine test_member

  elemental function div_pp(u,v) result(o)
    type(polar_t),intent(in)::u,v
    type(polar_t)           ::o
    o%l  = u%l / v%l
  end function div_pp

end program main

Result with gfortran:
% ./a.out
   1.0000000       2.0000000
Aborted

Expected result:
   1.000000       1.000000


-- 
           Summary: Missing temporary for ELEMENTAL function call
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43841


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

end of thread, other threads:[~2010-06-27 16:24 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21 19:54 [Bug fortran/43841] New: Missing temporary for ELEMENTAL function call anlauf at gmx dot de
2010-04-21 20:49 ` [Bug fortran/43841] " dominiq at lps dot ens dot fr
2010-04-21 21:52 ` dominiq at lps dot ens dot fr
2010-04-22  7:28 ` anlauf at gmx dot de
2010-04-22  8:25 ` dfranke at gcc dot gnu dot org
2010-04-22  8:28 ` burnus at gcc dot gnu dot org
2010-04-22 20:01 ` pault at gcc dot gnu dot org
2010-04-23  8:13 ` pault at gcc dot gnu dot org
2010-04-24  7:44 ` pault at gcc dot gnu dot org
2010-04-24  9:29 ` pault at gcc dot gnu dot org
2010-05-25 21:02 ` mikael at gcc dot gnu dot org
2010-06-24 15:44 ` pault at gcc dot gnu dot org
2010-06-27 16:15 ` pault at gcc dot gnu dot org
2010-06-27 16:22 ` pault at gcc dot gnu dot org
2010-06-27 16:24 ` pault at gcc dot gnu dot org

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