This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/88467] Silently accepts wrong array constructor
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Dec 2018 23:15:27 +0000
- Subject: [Bug fortran/88467] Silently accepts wrong array constructor
- Auto-submitted: auto-generated
- References: <bug-88467-4@http.gcc.gnu.org/bugzilla/>
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.