https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93940
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-02-26 CC| |marxin at gcc dot gnu.org Component|middle-end |ipa Target Milestone|--- |8.4 Summary|crazy codegen bug on Og |[8/9/10 Regression] crazy |with builtin_constant_p, |codegen bug on Og with |coverage, and pthread |builtin_constant_p, | |coverage, and pthread Ever confirmed|0 |1 --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Take: using uint16_t = unsigned short; struct a { uint16_t b = 0; }; struct c { short d; }; class e { public: void f(); void init_session(c); }; auto htons = [](uint16_t s) { if (__builtin_constant_p(s)) { return uint16_t(uint16_t(s >> 8) | uint16_t(s << 8)); } return uint16_t(uint16_t(s >> 8) | uint16_t(s << 8)); }; struct g { e h; void i(a k) { h.f(); auto j = c(); j.d = htons(k.b); h.init_session(j); } }; void test() { g().i({}); } ---- CUT ---- This is to remove __builtin_unreachable being emitted from the front-end. __builtin_unreachable is only added by the inliner. I have not looked into why though.