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]

Re: [PATCH, libgfortran] PR24794 namelist input of character array


:REVIEWPATCH fortran:

Jerry DeLisle wrote:
As a follow-on I will check that all other types are handled correctly in this situation, not just character types.


After studying the F95 standard and trying some more test cases I have found
that I need to revise this patch to return a "NULL". I was thrown off track because I was comparing results with ifort which initializes variables that are "undefined". gfortran does not do that.


The attached is the corrected patch which gives the correct behavior and a corrected test case. The other two test cases (namelist_14.f90 and namelist_15.f90) remain the same as my previous submission. I have also looked at integer, real, and logical cases and those are working OK.

Sorry for the iteration. Regression tested again and NIST tested OK.

OK for trunk? OK for 4.0-branch?

Regards,

Jerry
Index: io/list_read.c
===================================================================
--- io/list_read.c	(revision 107242)
+++ io/list_read.c	(working copy)
@@ -700,9 +700,10 @@ read_integer (int length)
 /* Read a character variable.  */
 
 static void
-read_character (int length __attribute__ ((unused)))
+read_character (int length)
 {
   char c, quote, message[100];
+  int i;
 
   quote = ' ';			/* Space means no quote character.  */
 
@@ -724,6 +725,11 @@ read_character (int length __attribute__
       goto get_string;
 
     default:
+      if (namelist_mode && comma_flag)
+	{
+	  unget_char (c);
+	  return;
+	}
       push_char (c);
       goto get_string;
     }

Attachment: namelist_21.f90
Description: application/extension-f90


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