[patch, libfortran] PR34427 namelist input of inf-nan

Jerry DeLisle jvdelisle@verizon.net
Sun Dec 16 03:32:00 GMT 2007


Hi folks,   HJL will you please test this patch on SPEC?

This patch is a follow-up patch to Tobias patch for this PR.

This patch addresses a failure we got when no delimiter other than a line end 
was given between a value and a subsequent object name.

This was caused by reading the line end '\n' and saving it as part of the object 
name string.  I check for this in get_name and don't do that. (A latent bug sort of)

To handle multiple intervening lines and spaces, I added code to eat all the 
preceding line ends and spaces before checking for an "=" when trying to see if 
we are reading a value "Infinity" or an object name "Infinity".  With this patch 
we can have practically unlimited spaces and line ends since we just skip them.

Note: F95 Standard 10.9: "The end of a record has the same effect as a blank 
character, unless it is within a character constant."

We don't need to count the characters in the object name because as soon as we 
have a non separator after "infinity" we unwind. The get_name code will then 
takeover.  Likewise when looking for the "=", since we know we already have a 
separator at that point if the next character is "=" it must be an object name 
or a misplaced "=".

(side note: This is a quite different situation from read_logical where any 
value starting with a 't' or 'f' is interpreted as .true. or .false. value 
unless it is an object name.  The only way to know in that case is to read up to 
64 characters in the name and not hit a '='.)

I revised namelist_42.f90 and added namelist_43.f90 to illustrate some of the 
issues.  I have not gone through some of the other data type reads to see what 
happens for them in the intervening spaces and lines situations.  I will do that 
later.

Regression tested on x86-64.

OK for trunk?

Jerry

2007-12-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/34427
	* io/list_read.c (read_real): Handle intervening line ends and spaces.
	(get_name): Don't push separators to saved_string.
	(eat_separator): If in namelist mode eat spaces and line ends as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: namelist_42.f90
Type: text/x-fortran
Size: 823 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071216/9e5a5601/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: namelist_43.f90
Type: text/x-fortran
Size: 1062 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071216/9e5a5601/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr34427-2.diff
Type: text/x-patch
Size: 1407 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071216/9e5a5601/attachment-0002.bin>


More information about the Gcc-patches mailing list