[Bug fortran/88467] Silently accepts wrong array constructor

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 12 23:15:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88467

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #3)
> See pr88116 for a description of what appears to be happening.

So, in array.c (gfc_match_array_constructor), we have this 
bit of code


      /* Walk the constructor and ensure type conversion for numeric types.  */
      if (gfc_numeric_ts (&ts))
        {
          c = gfc_constructor_first (head);
          for (; c; c = gfc_constructor_next (c))
            gfc_convert_type (c->expr, &ts, 1);
        }

For a failing example of "[integer :: 1, [integer(8) :: '3', 4]]",
ts is integer.  The first constructor element is 1 and it has
an EXPR_CONSTANT type and integer type.  The next constructor has
EXPR_ARRAY and the type for the array is integer(8).  A conversion 
is applied to array.  What I haven't determined yet is why
gfc_match_array_constructor is called recursively or does reach 
the walk.


More information about the Gcc-bugs mailing list