https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71194
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code Status|UNCONFIRMED |NEW Last reconfirmed| |2016-06-20 CC| |burnus at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> --- The problem on GCC source level is in gfc_trans_pointer_assignment (trans-expr.c): 7936 tmp = gfc_create_var (tmp, "ptrtemp"); 7937 lse.descriptor_only = 0; 7938 lse.expr = tmp; 7939 lse.direct_byref = 1; 7940 gfc_conv_expr_descriptor (&lse, expr2); where lse.expr == NULL_TREE after that call. Looking at the dump (and the source below), w/o bound checking, a "ptrtemp" is generated and passed to the function: conv2real (&ptrtemp.12, D.3483); If one traces the -fcheck=bound case, the gfc_conv_expr_descriptor call leads to a call to gfc_conv_procedure_call, which does: if (byref) ... /* Add the function call to the pre chain. There is no expression. */ gfc_add_expr_to_block (&se->pre, se->expr); se->expr = NULL_TREE; Hence, lse.expr == NULL_TREE, which fails later on. [Side note: If one sets lse.direct_byref to 0, it compiles as code following immediately after the NULL_TREE sets se->expr and, hence, lse.expr again, but as "conv2real" is called with "atmp", looking at "ptrtemp" will lead to randomly wrong results.]