[Nasm-bugs] [Bug 3392368] "exponent 32 is too large" undefined behavior at float.c line 559.

no-reply at bugzilla-nasm.gorcunov.org no-reply at bugzilla-nasm.gorcunov.org
Wed Apr 26 17:48:55 PDT 2017


https://bugzilla.nasm.us/show_bug.cgi?id=3392368

--- Comment #3 from Brooks Moses <bmoses at google.com> ---
Here's how I'm reproducing this:

First, this was compiled with a trunk version of Clang, for x86_64 target, with
the command-line option "-fsanitize=shift-exponent" in order to catch the
undefined behavior.  (Otherwise it will silently succeed.)

Then, I simply ran it as "./nasm sources/test/radix.asm" where "source" is the
directory with the NASM 2.12.02 sources.


However, there's a less compiler-dependent way to reproduce this: Add an
"abort" call to float.c around line 559, here:

            if (seendigit) {
                if (ms <= 0) {
                    *mp |= v >> -ms;
                    mp++;
                    if (mp > &mult[MANT_LIMBS])
                        mp = &mult[MANT_LIMBS]; /* Guard slot */
                    ms += LIMB_BITS;
                }
                if (ms == 32) abort();
                *mp |= v << ms;
                ms -= bits;


I have confirmed that this aborts with both Clang and GCC.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list