<html><head></head><body><strong>From:
</strong>
"Smith, Barry F." <bsmith@mcs.anl.gov>
<br><div>
<strong>
To:
</strong>
Martin Diehl <m.diehl@mpie.de>
<br>
<strong>
Cc:
</strong>
Adrian Croucher <a.croucher@auckland.ac.nz>, For users of the development version of PETSc <petsc-dev@mcs.anl.gov>
<br>
<strong>
Sent:
</strong>
10/20/2018 6:22 PM
<br>
<strong>
Subject:
</strong>
Re: [petsc-dev] Fortran interface problem in v.3.10.2
<br><br><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;">
<br>
<br>> On Oct 20, 2018, at 6:13 AM, Martin Diehl <m.diehl@mpie.de> wrote:
<br>>
<br>> Barry, Adrian,
<br>>
<br>> I looked into this and found the following on type(*) from IBM
<br>>
<br>> https://www.ibm.com/support/knowledgecenter/SSAT4T_15.1.4/com.ibm.xlf1514.lelinux.doc/language_ref/assumedtypeobj.html
<br>>
<br>> To summarize, type(*) is exactly meant for C interfaces with void*
<br>> dummy arguments (sorry for the Fortran speak, I don't know if dummy
<br>> argument is a term common in C programming).
<br>>
<br>> The last statement is
<br>> "An assumed-type dummy argument cannot correspond to an actual argument
<br>> of a derived type that has type parameters, type-bound procedures, or
<br>> final subroutines."
<br>> which seems to be the reason why the code does not compile.
<br>
<br> I am now concerned that our use of type(*) in PETSc Fortran interfaces is just wrong and I see no good solution except to not have interface definitions for any Fortran stub routines that have void *arguments.</blockquote></div><div>To my understanding, it is fine. type(*) was meant for interfacing *void and that's what you use it for. However, it imposes some restrictions on the actual argument. For that reason, Intel Fortran does not compile the example code, with or without explicit interface. GNU fortran compiles the code without interface, presumably because it cannot detect that the code is not standard conforming.</div><div><br></div><div>I propose to further clarify the situation I'll present the problem at the Intel Developer Zone forum.<br></div><div><blockquote class="mori" style="margin:0 0 0 .8ex;border-left:1px solid #CCC;padding-left:1ex;"><br>>
<br>>
<br>> Then, I tried the following things:
<br>>
<br>> 1) Compiling your code with the current PETSc master and gfortran 8.2
<br>> to check whether this issue has been fixed by the GCC developers.
<br>>
<br>> It still gives the same error
<br>>
<br>>
<br>> 2) Compiling your code with the Intel Fortran compiler (18.0.1) an the
<br>> current PETSc master.
<br>>
<br>> It gives a very cryptic error
<br>> /usr/bin/x86_64-linux-gnu-ld: test_snes.o: undefined reference to
<br>> symbol 'for_set_reentrancy'
<br>> /opt/intel/compilers_and_libraries_2018/linux/lib/intel64/libifcoremt.s
<br>> o.5: error adding symbols: DSO missing from command line
<br>> See also https://software.intel.com/en-us/node/679295
<br>>
<br>>
<br>> 3) Compiling your code with the Intel Fortran compiler and either PETSc
<br>> 3.10.0 or the PETSc master without the Fortran interface for
<br>> SNESsetConvergenceTest
<br>>
<br>> It still gives the same error as for 2)
<br>>
<br>>
<br>> Do you have access to any other compilers to check whether they can
<br>> compile your application/test_example?
<br>>
<br>> best regards
<br>> Martin
<br>>
<br>>
<br>>
<br>>
<br>> On Fri, 2018-10-19 at 19:52 +0000, Smith, Barry F. wrote:
<br>>>
<br>>> Adrian,
<br>>>
<br>>> I goggled a bit but couldn't understand anything I found. My guess
<br>>> is that
<br>>>
<br>>> type(*)
<br>>>
<br>>> doesn't work for certain derived types (why not?) perhaps those that
<br>>> contain procedures. If I remove the procedure from the
<br>>> routine it all compiles, thus producing some evidence my theory is
<br>>> correct.
<br>>>
<br>>> So we have a problem. The type checking one user wants is causing
<br>>> another users code to not build.
<br>>>
<br>>> Here is a short term fix you can do. After you run ./configure
<br>>> edit $PETSC_ARCH/include/petscconf.h locate
<br>>>
<br>>> #ifndef PETSC_HAVE_FORTRAN_TYPE_STAR
<br>>> #define PETSC_HAVE_FORTRAN_TYPE_STAR 1
<br>>> #endif
<br>>>
<br>>> then run make. This will turn off the type checking for all routines
<br>>> that have type(*) arguments which includes SNESSetConvergenceTest
<br>>>
<br>>> I don't have a good long term solution at the moment. Maybe a
<br>>> Fortran expert has some idea.
<br>>>
<br>>> Barry
<br>>>
<br>>>
<br>>>
<br>>>
<br>>>
<br>>>
<br>>>
<br>>>> On Oct 18, 2018, at 10:14 PM, Adrian Croucher <
<br>>> a.croucher@auckland.ac.nz> wrote:
<br>>>>
<br>>>> hi Barry,
<br>>>>
<br>>>> On 18/10/18 11:34 AM, Smith, Barry F. wrote:
<br>>>>> Sorry about this problem. I think the change was only
<br>>> introduced in master and should not affect 3.10.x Please confirm that
<br>>> master is where the failed compile is?
<br>>>>
<br>>>> Yes, it's on master. I have tracked down the commit at which it
<br>>> started to fail: 6f222c9d1e, "type checking for Fortran" (Fri Sep
<br>>> 28).
<br>>>>
<br>>>>> Please send us the calling sequence of your routine that won't
<br>>> compile (cut and paste).
<br>>>>
<br>>>> I've attached a minimal example program which fails with the
<br>>> following error:
<br>>>>
<br>>>> call SNESSetConvergenceTest(snes, convergence, context, &
<br>>>> 1
<br>>>> Error: Actual argument at (1) to assumed-type dummy is of derived
<br>>> type with type-bound or FINAL procedures
<br>>>>
<br>>>> Cheers, Adrian
<br>>>>
<br>>>>>> On Oct 17, 2018, at 5:21 PM, Adrian Croucher <
<br>>> a.croucher@auckland.ac.nz> wrote:
<br>>>>>>
<br>>>>>> hi
<br>>>>>>
<br>>>>>> A colleague has just reported that my code no longer builds with
<br>>> PETSc 3.10.2, though it builds OK with 3.10.1.
<br>>>>>>
<br>>>>>> The problem appears to be the Fortran interface to
<br>>> SNESSetConvergenceTest(), which was changed at commit f9a1a4d.
<br>>>>>>
<br>>>>>> It now complains about the context argument we are passing in to
<br>>> this function ('cctx' in the interface, which is declared there as
<br>>> type(*)). The error is:
<br>>>>>>
<br>>>>>> "Error: Actual argument at (1) to assumed-type dummy is of
<br>>> derived type with type-bound or FINAL procedures"
<br>>>>>>
<br>>>>>> This is true, the argument being passed in is of derived type
<br>>> with type-bound procedures. Previously this didn't bother it, but it
<br>>> looks like it does now.
<br>>>>>>
<br>>>>>> Is its complaint legitimate? or perhaps a compiler bug? (this is
<br>>> using gcc 6.3.0)
<br>>>>>>
<br>>>>>> - Adrian
<br>>>>>>
<br>>>> --
<br>>>> Dr Adrian Croucher
<br>>>> Senior Research Fellow
<br>>>> Department of Engineering Science
<br>>>> University of Auckland, New Zealand
<br>>>> email: a.croucher@auckland.ac.nz
<br>>>> tel: +64 (0)9 923 4611
<br>>>>
<br>>>> <test_snes.F90>
<br>>>
<br>> --
<br>> -----------------------------------------------
<br>> Max-Planck-Institut für Eisenforschung GmbH
<br>> Max-Planck-Straße 1
<br>> D-40237 Düsseldorf
<br>>
<br>> Handelsregister B 2533
<br>> Amtsgericht Düsseldorf
<br>>
<br>> Geschäftsführung
<br>> Prof. Dr. Gerhard Dehm
<br>> Prof. Dr. Jörg Neugebauer
<br>> Prof. Dr. Dierk Raabe
<br>> Dr. Kai de Weldige
<br>>
<br>> Ust.-Id.-Nr.: DE 11 93 58 514
<br>> Steuernummer: 105 5891 1000
<br>> -------------------------------------------------
<br>> Please consider that invitations and e-mails of our institute are
<br>> only valid if they end with …@mpie.de.
<br>> If you are not sure of the validity please contact rco@mpie.de
<br>>
<br>> Bitte beachten Sie, dass Einladungen zu Veranstaltungen und E-Mails
<br>> aus unserem Haus nur mit der Endung …@mpie.de gültig sind.
<br>> In Zweifelsfällen wenden Sie sich bitte an rco@mpie.de
<br>>
<br>>
<br>>
<br>> -------------------------------------------------
<br>> Max-Planck-Institut für Eisenforschung GmbH
<br>> Max-Planck-Straße 1
<br>> D-40237 Düsseldorf
<br>>
<br>> Handelsregister B 2533
<br>> Amtsgericht Düsseldorf
<br>>
<br>> Geschäftsführung
<br>> Prof. Dr. Gerhard Dehm
<br>> Prof. Dr. Jörg Neugebauer
<br>> Prof. Dr. Dierk Raabe
<br>> Dr. Kai de Weldige
<br>>
<br>> Ust.-Id.-Nr.: DE 11 93 58 514
<br>> Steuernummer: 105 5891 1000
<br>>
<br>>
<br>> Please consider that invitations and e-mails of our institute are
<br>> only valid if they end with …@mpie.de.
<br>> If you are not sure of the validity please contact rco@mpie.de
<br>>
<br>> Bitte beachten Sie, dass Einladungen zu Veranstaltungen und E-Mails
<br>> aus unserem Haus nur mit der Endung …@mpie.de gültig sind.
<br>> In Zweifelsfällen wenden Sie sich bitte an rco@mpie.de
<br>> -------------------------------------------------
<br>
<br></blockquote></div><BR />
<BR />
<HR />
-------------------------------------------------<BR />
Max-Planck-Institut für Eisenforschung GmbH<BR />
Max-Planck-Straße 1<BR />
D-40237 Düsseldorf<BR />
<BR />
Handelsregister B 2533 <BR />
Amtsgericht Düsseldorf<BR />
<BR />
Geschäftsführung<BR />
Prof. Dr. Gerhard Dehm<BR />
Prof. Dr. Jörg Neugebauer<BR />
Prof. Dr. Dierk Raabe<BR />
Dr. Kai de Weldige<BR />
<BR />
Ust.-Id.-Nr.: DE 11 93 58 514 <BR />
Steuernummer: 105 5891 1000<BR />
<BR />
<BR />
Please consider that invitations and e-mails of our institute are <BR />
only valid if they end with …@mpie.de. <BR />
If you are not sure of the validity please contact rco@mpie.de<BR />
<BR />
Bitte beachten Sie, dass Einladungen zu Veranstaltungen und E-Mails<BR />
aus unserem Haus nur mit der Endung …@mpie.de gültig sind. <BR />
In Zweifelsfällen wenden Sie sich bitte an rco@mpie.de<BR />
-------------------------------------------------<BR />
</body></html>