https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78879
Yuan Pengfei <coolypf at qq dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |--- --- Comment #10 from Yuan Pengfei <coolypf at qq dot com> --- (In reply to Jeffrey A. Law from comment #9) > The posted patch is just papering over the problem by changing the iteration > order of jump threads we examine. Since realization of some jump threads > will cause others to not be realized, changing the iteration order can cause > different jump threads to be realized. > > As discussed PR72785, this is a kernel bug in that the kernel code assumes > that paths leading to a __builtin_object_size will not be > duplicated/isolated. The case in PR72785 is that a non-constant b_c_p argument turns into a constant argument, which is a kernel bug as you have discussed. But the case here is that a constant, non-zero b_c_p argument (sector_size) turns into a constant, maybe-zero argument. Therefore, I think this is a compiler bug. I don't know much about how jump threading interacts with profile instrumentation. But keeping the original iteration order does fix this particular bug.