[PATCH 1/2 v2] c++: Implement P1494 and P3641 Partial program correctness [PR119060].

Jakub Jelinek jakub@redhat.com
Mon Sep 8 13:15:54 GMT 2025


On Mon, Sep 08, 2025 at 03:05:58PM +0200, Richard Biener wrote:
> is reduced to __builtin_abort () (for C++).  That's because it's
> __builtin_unreachable () at the end.  I am not aware of any
> other "UB" than missed return that we turn into unreachable(),
> even
> 
> unsigned int foo (unsigned int i)
> {
>   if (i < 33)
>     __builtin_abort ();
>   return i << i;
> }
> 
> isn't handled this way.  But sure we could, in the future.
> std::... before the return would help in case it is considered
> a barrier that might not continue to the UB.

What is gimple-ssa-isolate-paths.cc doing then?
I thought it is about obvious UBs like null pointer dereferences etc.
and the whole paths can be turned into e.g. __builtin_trap() with it
and for anything dominated by the UB that is just fine from the POV of this
C++ paper and it only a question if we don't propagate it also backwards
across calls (or other statements if std::observable_checkpoint would be
e.g. inline function with nothing in it and no special attributes).

	Jakub



More information about the Libstdc++ mailing list