https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
--- Comment #42 from Niels Möller <nisse at lysator dot liu.se> --- Created attachment 48678 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48678&action=edit Add a new pass for emitting the warning (not working) Since adding a new pass seems to be the right way, I've given that a try. See patch. By my printf debugging I can see that the pass is instantiated and the execute method is invoked twice (same example program): unsigned shift_dead (unsigned x) { if (0) return x >> 32; else return x >> 1; } unsigned shift_invalid (unsigned x) { return x >> 32; } But no further printouts, it seems my loop +void +do_warn_shift_count_range (gimple_seq seq) +{ + gimple_stmt_iterator i; + for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) exits before a single iteration. My intention was that it should iterate over the body of the current function (i.e., fun->gimple_body), which I expect to be a single return statement after the cfg pass has removed dead code. I'm probably misunderstanding the data structures. And what's the easiest way to run the the right compiler process (I guess that's cc1) under gdb?