Raised PROGRAM_ERROR : finalize/adjust raised exception

After updating to GNAT 15.1.1 20250626 I get an exception in connection with controlled types. I have a function that returns a controlled type. Before the return statement I get the above mentioned exception.

So before providing more details, my question is whether anyone here is experiencing the same trouble ?

This one of the most common bugs Ada programmer faces. Controlled types are all OK, you need to check your implementations of Finalize and Adjust for unhandled exceptions.

See also GNAT.Exception_Actions for tracing exceptions. Program_Error just an indication of some chain of exceptions prior to it.

Also keep in mind that GNAT itself has some bugs with that specific scenario. I’ve had standard Ada containers raise that exception (with no overrides from me). Recently I had to wrap an indefinite holder instance in a separate controlled type and catch the exception in a custom finalize operation to avoid it.

I haven’t tried v15 yet though, this is all pre 15 experience on my part.