public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64138] gfortran interface issue Date: Tue, 02 Dec 2014 16:05:00 -0000 [thread overview] Message-ID: <bug-64138-4-KsBMHfQOMp@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-64138-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64138 --- Comment #6 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Tue, Dec 02, 2014 at 03:37:19PM +0000, wong.david-c at epa dot gov wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64138 > > What is your fix? > I meant I fixed the code you posted. It was missing a CONTAINS statement before c_sub_cc, and there is an extra 'j' on the end of one of the 'end function c_sub_??' lines. > In the original code, c_sub_cr and c_sub_rc are distinct because the > sequence of argument type are different. Other compilers have no problem to > distinguish them. Please advise. You can get the code to compile if you change the dummy argument names in c_sub_cr and c_sub_rc to unique entities. For example, (and yes I changed the function and variable names while debugging) type(complex_number) function f2(z1, num) type (complex_number), intent(in) :: z1 real(kind=dp), intent(in) :: num f2%re = z1%re - num f2%im = z1%im end function f2 type(complex_number) function f3(num, z2) type (complex_number), intent(in) :: z2 real(kind=dp), intent(in) :: num f3%re = num - z2%re f3%im = - z2%im end function f3 The only problem with this workaround is that you cannot use keyword argument association. For example, type(complex_number) :: z=complex_number(1.,2.) real x = 3. z = c_sub(num=x, z) The above is ambiguous because the reduced argument list for f2 and f3 are identical, so the generic c_sub can be mapped to either. Fortunately, gfortran tries to help in this situation % gfortran -o z -fmax-errors=1 a.f90 a.f90:53.18: b = c_sub(num=x, a); print '(A,2F5.1)', '(x-a)? = ', b%re, b%im 1 Error: Missing keyword name in actual argument list at (1) Fatal Error: Error count reached limit of 1. Note, however, AFAIK, a keyword is not necessary and is not required. IHMO, issuing this error message could in fact be considered a bug. In fact, if you change the order of arguments to b = c_sub(a, num=x); print '(A,2F5.1)', '(x-a)? = ', b%re, b%im This will compile without error. If the former line producing an error about a missing keyword shouldn't the latter?
next prev parent reply other threads:[~2014-12-02 16:05 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-12-01 15:03 [Bug fortran/64138] New: " wong.david-c at epa dot gov 2014-12-01 17:24 ` [Bug fortran/64138] " kargl at gcc dot gnu.org 2014-12-01 20:11 ` wong.david-c at epa dot gov 2014-12-01 20:13 ` wong.david-c at epa dot gov 2014-12-01 20:17 ` kargl at gcc dot gnu.org 2014-12-02 15:37 ` wong.david-c at epa dot gov 2014-12-02 16:05 ` sgk at troutmask dot apl.washington.edu [this message] 2014-12-02 17:13 ` dominiq at lps dot ens.fr 2014-12-02 17:29 ` sgk at troutmask dot apl.washington.edu 2014-12-02 17:36 ` dominiq at lps dot ens.fr 2014-12-06 15:03 ` dominiq at lps dot ens.fr
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-64138-4-KsBMHfQOMp@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: linkBe 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).