https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66193
--- Comment #7 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Tue, May 19, 2015 at 06:30:57PM +0000, tkoenig at gcc dot gnu.org wrote: > The problem manifests itself in reduce_binary_ca. This function > gets handed an array constructor of type real whose elements are > integer. This makes no sense. > > (gdb) p *op1 > $6 = {expr_type = EXPR_CONSTANT, ts = {type = BT_REAL, kind = 4, > ... > > (gdb) p *op2 > $7 = {expr_type = EXPR_ARRAY, ts = {type = BT_REAL, kind = 4, u = {derived = > 0x0, cl = 0x0, pad = 0}, > > ... > > (gdb) p *(c->expr) > $9 = {expr_type = EXPR_CONSTANT, ts = {type = BT_INTEGER, kind = 4, u = > {derived = 0x0, cl = 0x0, > > So the real error is somewhere else. > I suspect that we are missing an explicit type conversion step. In array.c(gfc_match_array_constructor), we have code starting at line 1141 /* Size must be calculated at resolution time. */ if (seen_ts) { expr = gfc_get_array_expr (ts.type, ts.kind, &where); expr->ts = ts; } else expr = gfc_get_array_expr (BT_UNKNOWN, 0, &where); I wonder if we should walk the array and do a conversion after setting 'expr->ts = ts'.