[Patch, Fortran] PR34186 -fdump-parse-tree fixes
Tobias Burnus
burnus@net-b.de
Fri Nov 30 22:42:00 GMT 2007
Hi Dominique,
Dominique Dhumieres wrote:
> (gdb) print ts
> $1 = (gfc_typespec *) 0x40e0bb60
> (gdb) print ts->cl
> $2 = (gfc_charlen *) 0x0
> (gdb) print ts->cl->length
> Cannot access memory at address 0x0
>
> This probably explain the crash.
>
I think the minimal test case is:
subroutine foo()
use iso_c_binding, only: c_alert
end subroutine foo
But I do not understand why ts->cl of c_alert can be a NULL pointer as I
used:
tmp_sym->value->ts.cl = gfc_get_charlen ();
...
OK. I can now reproduce it (why?) and the solution is to use instead:
tmp_sym->ts.cl = gfc_get_charlen ();
Does anyone see ad hoc whether tmp_sym->value->ts.cl also needs to be
set? And if yes, whether
tmp_sym->value->ts.cl = tmp_sym->ts.cl
can be used?
Using only tmp_sym->ts.cl (i.e. the following patch) fixes the problem
for me, but I won't be able to commit it until Monday. Feel free to
commit it before.
Tobias
Index: symbol.c
===================================================================
--- symbol.c (Revision 130537)
+++ symbol.c (Arbeitskopie)
@@ -3810,8 +3810,8 @@
tmp_sym->value->value.character.string[0]
= (char) c_interop_kinds_table[s].value;
tmp_sym->value->value.character.string[1] = '\0';
- tmp_sym->value->ts.cl = gfc_get_charlen ();
- tmp_sym->value->ts.cl->length = gfc_int_expr (1);
+ tmp_sym->ts.cl = gfc_get_charlen ();
+ tmp_sym->ts.cl->length = gfc_int_expr (1);
/* May not need this in both attr and ts, but do need in
attr for writing module file. */
More information about the Fortran
mailing list