[patch, libfortran] PR33253 Namelist problems

Jerry DeLisle jvdelisle@verizon.net
Thu Oct 4 03:51:00 GMT 2007


The attached patch I believe is a solid fix now.  I borrowed code from what I 
wrote for read_logical some time ago once I realized it was a similar problem.

We have to know when the next string read is an object name or a string to 
decide whether to do an extended read, more values read then are asked for.

To do this, I use the line_buffer to save characters and look ahead for a '=' or 
'(' that indicate an object name.  Realize that this is non-standard reading we 
are enabling as an extension.  If a string does not have a delimiter of ' or " 
we have to do this read ahead.  It won't work if the non-delimited string has an 
intentional = or ( in it.  So be it, its already bad practice that we are 
supporting for older code.  It will work for typical cases.

If someone runs into a situation that does not work, they need to use delimiters.

Regression tested on x86-64 twice.  Updated namelist_39.f90 to exercise the look 
ahead.

OK for trunk?

Jerry

2007-10-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/33253
	* io/list_read.c (read_character): Use line_buffer to scan ahead for
	object name or string when no delimiter is found.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr33253-3.diff
Type: text/x-patch
Size: 1917 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071004/f50fa7d1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: namelist_39.f90
Type: text/x-fortran
Size: 1321 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20071004/f50fa7d1/attachment-0001.bin>


More information about the Fortran mailing list