[cfe-users] Clang9 UBSan and GMP

Hans Åberg via cfe-users cfe-users at lists.llvm.org
Wed Oct 30 14:29:00 PDT 2019


Indeed, very hard to figure out. If it is some hidden undefined behavior causing it, the UBSan should have caught it, but it does not. The link that Matthew gave says that the GMP developers experienced a number of such issues with Clang. One can though turn off the optimizer, and the tests pass.


> On 30 Oct 2019, at 22:17, David Blaikie <dblaikie at gmail.com> wrote:
> 
> I ran the test & understand it a bit better now - so the abort is part of the code, when the test fails, the test harness uses abort to fail.
> 
> So this isn't "clang causes abort" (it didn't select a bad instruction, etc) this is "clang causes test failure" - this could be any number of things in terms of compiler optimizations due to overly dependent code (or due to miscompiles, to be sure). It's possible the test relies on specific numeric results that the C++ programming language doesn't guarantee (either overly high precision, or overly low precision - C++ allows extra precision in computations which can break numerical code that's relying on certain precision, for instance).
> 
> So, yeah, really hard to say where the fault lies without further investigation.
> 
> On Fri, Oct 25, 2019 at 4:13 PM Hans Åberg <haberg-1 at telia.com> wrote:
> The GMP developers felt it was a compiler bug, so I think I will leave it at that. But thanks for the tips.
> 
> 
> > On 26 Oct 2019, at 00:32, David Blaikie <dblaikie at gmail.com> wrote:
> > 
> > UBSan doesn't catch everything - you could also try ASan and/or valgrind, etc. (MSan if you want, but that's a bit fussier/more work to use)
> 




More information about the cfe-users mailing list