This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_expect (setjmp (buf) == 0, 1)) generates broken code
Geoff Keating <geoffk at geoffk dot org> writes:
>> The question is, what's broken here. Is this combination of setjmp
>> with __builtin_expect valid in the first place? If so, how could
>> this be fixed?
>
> Yes, it's invalid. The C standard is pretty clear on the places that
> you can put setjmp, and this isn't one of them (see C99 7.13.1.1
> paragraph 4), for exactly this sort of reason.
I don't agree -- __builtin_expect is a special case, it should have no
effect on code generation other than to tag the surrounding if
construct with a probability estimate. Wherever we fail to achieve
that, it's a bug.
zw