* [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
2012-05-24 17:08 [Bug fortran/53478] New: gfortran segfaults when module name clashes with C binding name of procedure solomon.gibbs.lists at gmail dot com
@ 2012-05-24 17:45 ` kargl at gcc dot gnu.org
2012-05-24 18:06 ` sgk at troutmask dot apl.washington.edu
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-05-24 17:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-24
CC| |kargl at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from kargl at gcc dot gnu.org 2012-05-24 17:23:50 UTC ---
Confirmed.
(gdb) bt
#0 0x0000000202c0103c in strcmp () from /lib/libc.so.7
#1 0x000000000050aa91 in gfc_verify_binding_labels (sym=0x203cd1280)
at ../../gcc4x/gcc/fortran/resolve.c:9847
#2 0x000000000052cf40 in do_traverse_symtree (st=0x203c183a0, st_func=0,
sym_func=0x50a840 <gfc_verify_binding_labels>)
at ../../gcc4x/gcc/fortran/symbol.c:3386
#3 0x000000000051c030 in resolve_types (ns=0x203c63600)
at ../../gcc4x/gcc/fortran/resolve.c:13984
#4 0x000000000051bef8 in resolve_types (ns=0x203c62c00)
at ../../gcc4x/gcc/fortran/resolve.c:13965
#5 0x000000000050feec in gfc_resolve (ns=0xfffffffffffffff8)
at ../../gcc4x/gcc/fortran/resolve.c:14054
#6 0x0000000000502a48 in gfc_parse_file ()
at ../../gcc4x/gcc/fortran/parse.c:4594
#7 0x000000000053c90e in gfc_be_parse_file ()
at ../../gcc4x/gcc/fortran/f95-lang.c:191
#8 0x00000000008f57f0 in compile_file () at ../../gcc4x/gcc/toplev.c:552
#9 do_compile () at ../../gcc4x/gcc/toplev.c:1874
#10 0x00000000008f5e4c in toplev_main (argc=2, argv=0x7fffffffd4e0)
at ../../gcc4x/gcc/toplev.c:1950
#11 0x0000000000499a6d in _start ()
(gdb) up 1
#1 0x000000000050aa91 in gfc_verify_binding_labels (sym=0x203cd1280)
at ../../gcc4x/gcc/fortran/resolve.c:9847
9847 if (sym->attr.if_source == IFSRC_DECL
(gdb) list
9842
9843 bind_c_sym = gfc_find_gsymbol (gfc_gsym_root,
sym->binding_label);
9844 if (bind_c_sym != NULL
9845 && strcmp (bind_c_sym->name, sym->binding_label) == 0)
9846 {
9847 if (sym->attr.if_source == IFSRC_DECL
9848 && (bind_c_sym->type != GSYM_SUBROUTINE
9849 && bind_c_sym->type != GSYM_FUNCTION)
9850 && ((sym->attr.contained == 1
9851 && strcmp (bind_c_sym->sym_name, sym->name) != 0)
(gdb) print *bind_c_sym
$1 = {priority = 41101, left = 0x0, right = 0x0, name = 0x20400bf80 "exports",
sym_name = 0x0, mod_name = 0x0, binding_label = 0x0, type = GSYM_MODULE,
defined = 1, used = 0, where = {nextc = 0x203ca61f8, lb = 0x203ca61a0},
ns = 0x203c62c00}
Note, sym->binding_label is 0x0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
2012-05-24 17:08 [Bug fortran/53478] New: gfortran segfaults when module name clashes with C binding name of procedure solomon.gibbs.lists at gmail dot com
2012-05-24 17:45 ` [Bug fortran/53478] " kargl at gcc dot gnu.org
@ 2012-05-24 18:06 ` sgk at troutmask dot apl.washington.edu
2012-05-24 18:53 ` sgk at troutmask dot apl.washington.edu
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2012-05-24 18:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478
--- Comment #2 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2012-05-24 17:57:26 UTC ---
On Thu, May 24, 2012 at 05:23:50PM +0000, kargl at gcc dot gnu.org wrote:
> #1 0x000000000050aa91 in gfc_verify_binding_labels (sym=0x203cd1280)
> at ../../gcc4x/gcc/fortran/resolve.c:9847
> 9847 if (sym->attr.if_source == IFSRC_DECL
> (gdb) list
> 9842
> 9843 bind_c_sym = gfc_find_gsymbol (gfc_gsym_root,
> sym->binding_label);
> 9844 if (bind_c_sym != NULL
> 9845 && strcmp (bind_c_sym->name, sym->binding_label) == 0)
> 9846 {
> 9847 if (sym->attr.if_source == IFSRC_DECL
> 9848 && (bind_c_sym->type != GSYM_SUBROUTINE
> 9849 && bind_c_sym->type != GSYM_FUNCTION)
> 9850 && ((sym->attr.contained == 1
> 9851 && strcmp (bind_c_sym->sym_name, sym->name) != 0)
> (gdb) print *bind_c_sym
> $1 = {priority = 41101, left = 0x0, right = 0x0, name = 0x20400bf80 "exports",
> sym_name = 0x0, mod_name = 0x0, binding_label = 0x0, type = GSYM_MODULE,
> defined = 1, used = 0, where = {nextc = 0x203ca61f8, lb = 0x203ca61a0},
> ns = 0x203c62c00}
>
> Note, sym->binding_label is 0x0
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.
Index: resolve.c
===================================================================
--- resolve.c (revision 187464)
+++ resolve.c (working copy)
@@ -9848,6 +9848,8 @@ gfc_verify_binding_labels (gfc_symbol *s
&& (bind_c_sym->type != GSYM_SUBROUTINE
&& bind_c_sym->type != GSYM_FUNCTION)
&& ((sym->attr.contained == 1
+ && bind_c_sym->sym_name != NULL
+ && sym->name != NULL
&& strcmp (bind_c_sym->sym_name, sym->name) != 0)
|| (sym->attr.use_assoc == 1
&& (strcmp (bind_c_sym->mod_name, sym->module) != 0))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
2012-05-24 17:08 [Bug fortran/53478] New: gfortran segfaults when module name clashes with C binding name of procedure solomon.gibbs.lists at gmail dot com
2012-05-24 17:45 ` [Bug fortran/53478] " kargl at gcc dot gnu.org
2012-05-24 18:06 ` sgk at troutmask dot apl.washington.edu
@ 2012-05-24 18:53 ` sgk at troutmask dot apl.washington.edu
2012-06-25 12:06 ` dominiq at lps dot ens.fr
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2012-05-24 18:53 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
2012-05-24 17:08 [Bug fortran/53478] New: gfortran segfaults when module name clashes with C binding name of procedure solomon.gibbs.lists at gmail dot com
` (2 preceding siblings ...)
2012-05-24 18:53 ` sgk at troutmask dot apl.washington.edu
@ 2012-06-25 12:06 ` dominiq at lps dot ens.fr
2013-04-15 10:06 ` aron at ahmadia dot net
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-06-25 12:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-06-25 12:05:24 UTC ---
I have the patch in comment #2 in my tree since some time now and it works as
advertised without regression. However, If I have understood Ian Harvey's
answer in comp.lang.fortran
https://groups.google.com/forum/?fromgroups#!topic/comp.lang.fortran/o_hapvMHxIE
the test in comment #3 is invalid. Is this correct?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
2012-05-24 17:08 [Bug fortran/53478] New: gfortran segfaults when module name clashes with C binding name of procedure solomon.gibbs.lists at gmail dot com
` (3 preceding siblings ...)
2012-06-25 12:06 ` dominiq at lps dot ens.fr
@ 2013-04-15 10:06 ` aron at ahmadia dot net
2013-04-15 11:01 ` burnus at gcc dot gnu.org
2013-05-20 20:14 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: aron at ahmadia dot net @ 2013-04-15 10:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478
Aron Ahmadia <aron at ahmadia dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aron at ahmadia dot net
--- Comment #5 from Aron Ahmadia <aron at ahmadia dot net> 2013-04-15 10:06:20 UTC ---
I was able to reproduce this on 4.7.2 using Solomon's code snippet. Is there
anything else I do to help out here?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
2012-05-24 17:08 [Bug fortran/53478] New: gfortran segfaults when module name clashes with C binding name of procedure solomon.gibbs.lists at gmail dot com
` (4 preceding siblings ...)
2013-04-15 10:06 ` aron at ahmadia dot net
@ 2013-04-15 11:01 ` burnus at gcc dot gnu.org
2013-05-20 20:14 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-15 11:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-15 11:01:10 UTC ---
(In reply to comment #4)
> I have the patch in comment #2 in my tree since some time now and it works as
> advertised without regression. However, If I have understood Ian Harvey's
> answer in comp.lang.fortran
> https://groups.google.com/forum/?fromgroups#!topic/comp.lang.fortran/o_hapvMHxIE
> the test in comment #3 is invalid. Is this correct?
The test case in comment 0 and comment 3 are invalid in Fortran 2003; I think
they are valid in Fortran 2008 (cf. PR 48858 comment 9). However, I need a
quiet moment to disentangle the standard speak and to create a patch.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/53478] gfortran segfaults when module name clashes with C binding name of procedure
2012-05-24 17:08 [Bug fortran/53478] New: gfortran segfaults when module name clashes with C binding name of procedure solomon.gibbs.lists at gmail dot com
` (5 preceding siblings ...)
2013-04-15 11:01 ` burnus at gcc dot gnu.org
@ 2013-05-20 20:14 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-05-20 20:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53478
Bug 53478 depends on bug 48858, which changed state.
Bug 48858 Summary: Incorrect error for same binding label on two generic interface specifics
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48858
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 8+ messages in thread