------- Comment #2 from burnus at gcc dot gnu dot org 2010-08-28 15:40 ------- The error message is generated in gfc_conv_array_ref it's called via gfc_trans_where_3 -> gfc_conv_loop_setup -> gfc_add_loop_ss_code -> gfc_conv_variable
Thus, the condition (mask) ends up at gfc_add_ss_to_loop (&loop, css); and the bounds check is added via gfc_conv_loop_setup (&loop, &tdst->where); Thus, it ends up at loop->pre which comes before the actual loop. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45425