public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/43841]  New: Missing temporary for ELEMENTAL function call
Date: Wed, 21 Apr 2010 19:54:00 -0000	[thread overview]
Message-ID: <bug-43841-6318@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2010-04-21 19:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 19:54 anlauf at gmx dot de [this message]
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

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-43841-6318@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).