https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66335
Bug ID: 66335 Summary: a dump bug related to loop invariant in before_dom_children Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhongyunde at huawei dot com Target Milestone: --- in function invariantness_dom_walker::before_dom_children based on gcc 4.9.2 , we can see the following code: if (!determine_max_movement (stmt, pos == MOVE_PRESERVE_EXECUTION)) { lim_data->max_loop = NULL; continue; } if (dump_file && (dump_flags & TDF_DETAILS)) { print_gimple_stmt (dump_file, stmt, 2, 0); fprintf (dump_file, " invariant up to level %d, cost %d.\n\n", loop_depth (lim_data->max_loop), lim_data->cost); } if (lim_data->cost >= LIM_EXPENSIVE) set_profitable_level (stmt); } } as we can't always make sure that the condition 'lim_data->cost >= LIM_EXPENSIVE' is true, so some issue may entry into the branch '(dump_file && (dump_flags & TDF_DETAILS))' but not the above. then, some wrong dump info may generated.