Not quite sure if this CP2K derived testcase is really a bug, but for the testcase below, I get the following warning and later an error (this might be different issues?) :
> gfortran -flto test_c.c test.f90 test_c.c:3:8: warning: type of build_eri does not match original declaration [enabled by default] test.f90:3:0: note: previously declared here > cat test_c.c #include<stdio.h> void (*build_eri)(); void foo() { printf("foo\n"); }; void init() { build_eri=foo; }; > cat test.f90 MODULE M1 USE ISO_C_BINDING TYPE(C_FUNPTR), BIND(C) :: build_eri INTERFACE SUBROUTINE foo() BIND(C) END SUBROUTINE foo END INTERFACE INTERFACE SUBROUTINE init() BIND(C) END SUBROUTINE init END INTERFACE CONTAINS SUBROUTINE test PROCEDURE(foo), POINTER :: foo_ptr CALL init() CALL C_F_PROCPOINTER(build_eri,foo_ptr) CALL foo_ptr() END SUBROUTINE END MODULE USE M1 CALL test END this can now be turned in an error using : > gcc -c -flto test_c.c > gfortran -c -flto test.f90 > ar -r all.a test_c.o test.o > gfortran -fuse-linker-plugin -flto -O3 all.a /data03/vondele/binutils-2.20.1/build/bin/ld: error: all.a: multiple definition of 'build_eri' /data03/vondele/binutils-2.20.1/build/bin/ld: all.a: previous definition here test.f90:3:0: warning: type of build_eri does not match original declaration [enabled by default] test_c.c:3:8: note: previously declared here collect2: ld returned 1 exit status -- Summary: LTO / function pointers with iso_c_binding Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Joost dot VandeVondele at pci dot uzh dot ch http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45659