http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53732
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code,
| |wrong-code
CC| |burnus at gcc dot gnu.org
Target Milestone|--- |4.7.2
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-20
16:40:05 UTC ---
The problem is the following code in trans-array.c's gfc_add_loop_ss_code:
switch (ss_info->type)
{
case GFC_SS_SCALAR:
...
gfc_conv_expr (&se, expr);
Here, expr is "0.0d0", which is properly converted. However:
if (expr->ts.type != BT_CHARACTER)
{
/* Move the evaluation of scalar expressions outside the
scalarization loop, except for WHERE assignments. */
if (subscript)
se.expr = convert(gfc_array_index_type, se.expr);
As subscript is true, the "0.0d0" gets converted to the integer "0".