This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] PR18737 - ICE on incorrect code


At present,

program test
implicit none
external bug
print *, bug()
end program test

causes gfortran to emit:
pr18737.f90: In function ‘MAIN__’:
pr18737.f90:4: internal compiler error: in gfc_typenode_for_spec, at fortran/trans-types.c:629


The proposed patch makes for a more harmonious:

mytests]# /gcc-4.1/bin/gfortran pr18737.f90
Error: Symbol bug is external and must have a type

It has been regtested on RH9/Athlon 1700

OK for mainline and 4.0?

Paul T

PS F-X, I only saw who the reporter was minutes after our off-list exchange!

I have attached the patch in the form of the few additional lines extracted from the source; cvs has gone awol and I want to go to bed.

2005-08-04 Paul Thomas <pault@gcc.gnu.org>

PR fortran/18737
* resolve.c(resolve_symbol): Trap external symbols whose
type has not been declared with implicit none.

/* Trap external symbols that have not been given a type. */
if (sym->ts.type == BT_UNKNOWN
&& sym->attr.external
&& (sym->attr.function
|| sym->attr.flavor == FL_UNKNOWN
|| sym->attr.flavor == FL_VARIABLE)
&& gfc_current_ns->seen_implicit_none)
gfc_error ("Symbol %s is external and must have a type", sym->name);





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]