On Sun, Mar 29, 2020 at 12:24 PM Bruno Haible <br...@clisp.org> wrote: > > Jeffrey Walton wrote: > > This showed up during acosf testing with UBsan: > > > > test-math.c:89:3: runtime error: division by zero > > The code performs a division 1.0 / 0.0. This is a valid operation in > IEEE 854. It must produce a HUGE_VAL. > > Surely you can tell the sanitizer to ignore this?
Well, my first reaction is, that sucks. I don't recall a situation where undefined behavior was conforming like that. Let's see what the GCC folks recommend: "GCC and division by 0 under sanitizers", https://gcc.gnu.org/pipermail/gcc-help/2020-March/138746.html. I tend to do what the GCC devs say. They write the compilers that remove the code with undefined behavior and produce unexpected results. It is wise to keep the compiler happy. Jeff