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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-06-15
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-15 
16:18:36 UTC ---
Confirmed.

The size is determined via target-memory.c's gfc_target_expr_size. There seems
to be two issues:

(a) A minor one that in the second case, the length of "record_type" is
"e->ts->u.cl->length == NULL" instead of 4 (as one could be simply calculated).

b) And the missing error handling for gfc_target_expr_size in
gfc_calculate_transfer_sizes: There, the result size is error checked, namely:
  if (result_elt_size == 0)
    return FAILURE;
But a similar line for source_size is lacking.


Regarding (a): The question is whether one shouldn't set expr->ts.u.cl->length
to expr->ref->next->...->u.ss.length for substrings. I don't know whether that
messes with the CL cleanup or other issues, but it'd make handling substrings
easier than checking whether there is a last_ref(expr)->u.ss.length.


Patch for the second issue.

--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -4003,2 +4003,4 @@ gfc_calculate_transfer_sizes (gfc_expr *source, gfc_expr
*mold, gfc_expr *size,
   *source_size = gfc_target_expr_size (source);
+  if (source_size == 0)
+    return FAILURE;

Reply via email to