gfortran -fdump-parse-tree crashes for the following program as
ts->cl == NULL for dump-parse-tree.c's gfc_show_typespec

    case BT_CHARACTER:
      gfc_show_expr (ts->cl->length);
      break;

After disabling the gfc_show_expr if ts->cl == NULL, there is an internal error
shown unless one adds:

--- misc.c      (revision 130347)
+++ misc.c      (working copy)
@@ -141,0 +142,3 @@ gfc_basic_typename (bt type)
+    case BT_VOID:
+      p = "VOID";
+      break;

Additionally, we need to check for missing attributes etc. in the dumps, which
were not added for BIND(C); e.g. the following is missing:

--- dump-parse-tree.c   (revision 130347)
+++ dump-parse-tree.c   (working copy)
@@ -584,0 +588,2 @@ gfc_show_attr (symbol_attribute *attr)
+  if (attr->is_bind_c)
+    gfc_status (" BIND(C)");


Test case:

function func0(x) result(result_func0) bind(c)
  use, intrinsic :: iso_c_binding
  real(c_double) :: result_func0
  real(c_double), value, intent(in) :: x
  result_func0 = 1.0_c_double
end function func0


-- 
           Summary: dump-parse-tree: ICE for ts->cl->length, if ts->cl ==
                    NULL
           Product: gcc
           Version: 4.3.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=34186

Reply via email to