The following gives an ICE:

==18935== Invalid read of size 1
==18935==    at 0x4C25D82: strlen (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==18935==    by 0x438ABE: compare_to_allowed_values (io.c:1404)
==18935==    by 0x43A892: match_io (io.c:2883)
==18935==    by 0x451BA9: match_word (parse.c:64)


write(10,*, asynchronous="Y"//"E"//trim("S  "))
end

However, it is a valid initialization expression. I tried the following, but it
did not help. (It still fails at "len = strlen (value)".)


--- io.c        (Revision 133959)
+++ io.c        (Arbeitskopie)
@@ -1389,11 +1389,17 @@ gfc_resolve_open (gfc_open *open)
 static int
 compare_to_allowed_values (const char *specifier, const char *allowed[],
                           const char *allowed_f2003[],
-                          const char *allowed_gnu[], char *value,
+                          const char *allowed_gnu[], gfc_expr *expr,
                           const char *statement, bool warn)
 {
   int i;
   unsigned int len;
+  const char *value;
+
+  if (gfc_simplify_expr (expr, 0) == 0)
+    return 1;
+
+  value = expr->value.character.string;

   len = strlen (value);
   if (len > 0)


-- 
           Summary: ICE for character expression in I/O specifier
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35840

Reply via email to