This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
- From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 24 May 2012 18:44:54 +0000
- Subject: [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
- Auto-submitted: auto-generated
- References: <bug-53478-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2012-05-24 18:44:54 UTC ---
On Thu, May 24, 2012 at 05:57:26PM +0000, sgk at troutmask dot
apl.washington.edu wrote:
>
> This patch allows the code to compile. I haven't
> tried to construct a longer example that may show
> that the module name may collide with the C binding
> name.
>
I've now constructed a simple test and needed to
revise the patch.
troutmask:sgk[263] cat a.f90
module exports
implicit none
contains
subroutine f_exports() bind(C, name='exports')
print *, 'Exported'
end subroutine
end module exports
troutmask:sgk[264] cat e.c
#include <stdio.h>
void exports(void);
int
main(void)
{
exports();
return 0;
}
troutmask:sgk[265] gfc4x -c a.f90
troutmask:sgk[266] cc -o z e.c a.o -L$HOME/work/4x/lib -lgfortran
troutmask:sgk[267] ./z
Exported
The patch is attached.