------- Comment #3 from paul dot richard dot thomas at cea dot fr  2006-09-18 
15:29 -------
This is still better and even regtests!

Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c       (révision 116697)
--- gcc/fortran/resolve.c       (copie de travail)
*************** resolve_structure_cons (gfc_expr * expr)
*** 583,588 ****
--- 593,599 ----
    gfc_constructor *cons;
    gfc_component *comp;
    try t;
+   symbol_attribute a;

    t = SUCCESS;
    cons = expr->value.constructor;
*************** resolve_structure_cons (gfc_expr * expr)
*** 597,606 ****
    for (; comp; comp = comp->next, cons = cons->next)
      {
        if (! cons->expr)
!       {
!         t = FAILURE;
!         continue;
!       }

        if (gfc_resolve_expr (cons->expr) == FAILURE)
        {
--- 608,614 ----
    for (; comp; comp = comp->next, cons = cons->next)
      {
        if (! cons->expr)
!       continue;

        if (gfc_resolve_expr (cons->expr) == FAILURE)
        {
*************** resolve_structure_cons (gfc_expr * expr)
*** 622,627 ****
--- 630,648 ----
          else
            t = gfc_convert_type (cons->expr, &comp->ts, 1);
        }
+ 
+       if (!comp->pointer || cons->expr->expr_type == EXPR_NULL)
+       continue;
+ 
+       a = gfc_expr_attr (cons->expr);
+ 
+       if (!a.pointer && !a.target)
+       {
+         t = FAILURE;
+         gfc_error ("The element in the derived type constructor at %L, "
+                    "for pointer component '%s' should be a POINTER or "
+                    "a TARGET", &cons->expr->where, comp->name);
+       }
      }

    return t;


-- 


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

Reply via email to