This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] PR fortran/37992 ICE while resolving charlen for rejected statements


:ADDPATCH fortran:


Hi all,

With code like this:
character(len=len(x)) :: x

an error was correctly emitted, but the compiler was failing badly
afterwards when trying to resolve len(x) because the symtree struct for
len was freed on statement reject.

This patch backs up the charlen list and restores it in case the
statement is rejected. My previous attempt in that direction was wrong
because I was resetting the backup list to NULL after restore.
But reject_statement can be called more than one time before the
next_statement.

regression tested on x86_64-unknown-linux-gnu.

Not sure whether this is a regression or not, and whether this could go
to trunk.
I'm awaiting your comments in any case.

Mikael


2008-11-05  Mikael Morin  <mikael.morin@tele2.fr>

	PR fortran/37992
	* gfortran.h (gfc_namespace): Added member old_cl_list, backup of cl_list.
	(gfc_free_charlen): Added prototype.
	* symbol.c (gfc_free_charlen): New function.
	(gfc_free_namespace): Use gfc_free_charlen.
	* parse.c (next_statement): Backup gfc_current_ns->cl_list.
	(reject_statement): Restore gfc_current_ns->cl_list.
	Free cl_list's elements before dropping them.
	

2008-11-05  Mikael Morin  <mikael.morin@tele2.fr>

	PR fortran/37992
	* gfotran.dg/charlen_free_1.f90: New test.

Attachment: pr37992_06.diff
Description: Text document


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