C++ Logo

sg15

Advanced search

Re: [isocpp-sg15] [isocpp-sg21] P3835 -- Different contract checking for different libraries

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 21 Oct 2025 11:40:58 +0300
On Tue, 21 Oct 2025 at 11:23, Peter Bindels <dascandy_at_[hidden]> wrote:
>
> On Tue, Oct 21, 2025 at 10:16 AM Ville Voutilainen <ville.voutilainen_at_[hidden]> wrote:
>>
>> On Tue, 21 Oct 2025 at 11:03, Ville Voutilainen
>> <ville.voutilainen_at_[hidden]> wrote:
>> >
>> > On Tue, 21 Oct 2025 at 11:01, Peter Bindels <dascandy_at_[hidden]> wrote:
>> > >
>> > > On Tue, Oct 21, 2025 at 9:55 AM Ville Voutilainen via SG15 <sg15_at_[hidden]> wrote:
>> > >>
>> > >> You're jumping into a conjecture a bit there. :) I'm not saying that
>> > >> we would want those unsound optimizations to be conforming. But as far
>> > >> as I understand,
>> > >> they are not conforming anyway. Clang doesn't perform them, and didn't
>> > >> need P2900 to avoid them. GCC's optimizer has a bug, with or without
>> > >> P2900.
>> > >> The GCC contracts implementation performs a dirty hack to work around
>> > >> that problem by hoodwinking the optimizer to not see the terminate()
>> > >> call,
>> > >> by wrapping it in a wrapper function attributed with [[gnu::noipa]],
>> > >> because none of the developers of that implementation have the
>> > >> expertise to fix the optimizer bug.
>> > >
>> > >
>> > > Don't make personal attacks. This is uncalled for.
>> >
>> > What the hell are you talking about? :-O I am *ONE* of those
>> > developers, and I'm describing the situation accurately.
>> > We have talked about this among said developers, and every single one
>> > of us three quite soundly agrees
>> > that we do not have said expertise.
>>
>> ..and in case it's unclear, I designed that dirty hack. Who am I
>> attacking personally? Myself?
>
>
> Apologies; reading "none of the developers of that implementation have the expertise to fix the optimizer bug" looks like a personal attack to me. I was not expecting a public self-flagellation without that context.

There's no attacks nor any self-flagellation in any of it. Wrapping
the terminate call into that noipa-wrapper hides the knowledge
that there is a CFG edge leading to termination from *everything*,
including the optimization of the rest of the function body where
a pre/contract_assert appears, not just the surrounding code using
such a function.
It's also, temporarily, made to apply to/in all functions, as opposed
to just inline functions. All that can quite reasonably and fairly
be described as a dirty hack.

Received on 2025-10-21 08:41:15