https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98503
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> --- So at the point we diagnose we see the following IL for cont_dump: <bb 2> [local count: 1073741824]: __mptr_5 = MEM[(struct ref *)&head].list.n; goto <bb 8>; [100.00%] that's because the testcase has static 'last_dumped' which means it is NULL and we start restart_dump with if (!last) last = get_initial_step(); which does static inline struct ref *get_initial_step() { return container_of(&head, struct ref, list); } that means next_step will do the bad access of 'head' using the struct ref type.