Exception behavior with errno

Hello. Does anybody know the GNAT behavior during exception raise or catch with respect to errno global variable? I assume that it might call some C function that might set it and trash previous C function errno state?

Exceptions don’t do anything with errno. Why would you expect them to? Exceptions and errno are entirely unrelated concepts (from different languages no less).

GNAT might inject some C library call that could change it.

It does use C because it uses GCC’s exception machinery, however I can’t imagine any possible implementation that would make use of errno. At most you’d hit it as a side effect if there’s a malloc somewhere in there that fails, though I’d expect a crash at that point anyway. If you’d like to trace through how it works then you probably want to start from System.Exceptions.Machine.