[Nasm-bugs] [Bug 3392368] New: "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
Sun Oct 23 00:09:33 PDT 2016


            Bug ID: 3392368
           Summary: "exponent 32 is too large" undefined behavior at
                    float.c line 559.
           Product: NASM
           Version: 2.12.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: bmoses at google.com
                CC: gorcunov at gmail.com, hpa at zytor.com, nasm-bugs at nasm.us

I recently imported the NASM 2.12.02 sources into our build system, and
compiled and ran the tests with Clang's undefined-behavior sanitizer (which
adds runtime checking for a number of possible undefined-behavior situations;
see http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html for more info).

This found a problem when running the radix.asm test -- at some point in the
execution, the shift statement on line 559 of float.c gets an exponent of 32,
which is too large -- the shift amount must be less than the number of bits in
the operand, not equal to it.

The detailed traceback from the error message is:

float.c:559:26: runtime error: shift exponent 32 is too large for 32-bit type
'fp_limb' (aka 'unsigned int')
    #0 0x50856a in ieee_flconvert_bin float.c:553:30
    #1 0x5071e0 in to_float float.c:774:22
    #2 0x563816 in parse_line parser.c:648:22
    #3 0x511209 in assemble_file nasm.c:1589:17
    #4 0x50eec3 in main nasm.c:479:9

FWIW, everything else in the testsuite came out clean, and I also ran things
with the address and memory sanitizers, with no issues found.

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