This is the mail archive of the 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: [gfortran,committed] Fix half or PR31251: segfault in real charlen

François-Xavier Coudert wrote:
Index: simplify.c
--- simplify.c  (revision 124412)
+++ simplify.c  (working copy)
@@ -2136,14 +2136,15 @@ gfc_simplify_len (gfc_expr *e)

  if (e-> != NULL && e->>length != NULL
-      && e->>length->expr_type == EXPR_CONSTANT)
+      && e->>length->expr_type == EXPR_CONSTANT
+      && e->>length->ts.type == BT_INTEGER)
      result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
      mpz_set (result->value.integer, e->>length->value.integer);
      return range_check (result, "LEN");

IIUC this shouldn't ever happen. If there's an erroneous character length specified, it shouldn't be kept in place, and then worked around down the line. Instead the charlen pointer should be set to NULL. This may also be the solution to the double error, if, as I suppose, one error is emitted during parsing, and one during resolution.

- Tobi
(who speaks w/o having the code around to check himself)

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