[Patch, fortran] PR20880 - Failure to detect procedures encompassing own interface
Tobias Burnus
burnus@net-b.de
Wed Nov 22 18:01:00 GMT 2006
Hi,
François-Xavier Coudert wrote:
> Take care that there is no reason for the backtrace of a sefault to
> actually point to the first corruption of memory. It is more often
> accurate to report the backtrace while running the programming with
> ElectricFence.
No ElectricFence run, but valgrind:
==16621== Invalid read of size 8
==16621== at 0x459FDE: gfc_add_explicit_interface (symbol.c:1207)
==16621== by 0x413B2E: gfc_match_formal_arglist (decl.c:2693)
==16621== by 0x435C05: gfc_match_st_function (match.c:2937)
==16621== by 0x441082: match_word (parse.c:65)
==16621== by 0x441605: decode_statement (parse.c:132)
==16621== by 0x44207A: next_statement (parse.c:499)
==16621== by 0x443D70: parse_spec (parse.c:1536)
==16621== by 0x444A99: gfc_parse_file (parse.c:3071)
==16621== by 0x461CFD: gfc_be_parse_file (f95-lang.c:305)
==16621== by 0x76A0E2: toplev_main (toplev.c:1033)
==16621== by 0x52BAAE3: (below main) (in /lib64/libc-2.5.so)
This is symbol.c:
1206
1207 if (current_interface.ns)
1208 {
1209 if (current_interface.ns->proc_name) {
1210 if (current_interface.ns->proc_name->name) {
1211 if (sym->name) {
1212 if (strcmp (current_interface.ns->proc_name->name,
sym->name) == 0) {
1213 gfc_error ("'%s' at %L is the name of the enclosing
procedure",
1214 sym->name, where);
1215 /* Return success so that redundant knock-on errors do not
occur. */
1216 return SUCCESS;
1217 }}}}
1218 }
1219
Seemingly, current_interface.ns can be uninitialized and non zero.
"gfc_interface_info current_interface;" is defined in interface.c (and
as external in gfortran.h)
with gfc_namespace *ns.
It is set in "parse_interface()". The lines above from symbol.c are part
of gfc_add_explicit_interface(),
which is called in decl.c and parse.c.
As one can see from valgrind, it fails in gfc_match_formal_arglist
Tobias
More information about the Gcc-patches
mailing list