Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.2.0
-
None
-
All
-
Incorrect Behavior
Description
The 0.printf test runs successfully on 32-bit MSVC, but fails on 64-bit MSVC. The failed assertions listed below:
# Assertion failed on line 419: rw_sprintf("%s", ...) == "(invalid address 0x0000000000000020)", got "(invalid address 0x00000020:00000000)" # Assertion failed on line 429: rw_sprintf("%ls", ...) == "(invalid address 0x0000000000000020)", got "(invalid address 0x00000020:00000000)" # Assertion failed on line 432: rw_sprintf("%ls", ...) == "(misaligned address 0x000000014011e6e9)", got "(misaligned address 0x4011e6e9:00000001)" # Assertion failed on line 507: rw_sprintf("%{#ls}", ...) == "(invalid address 0x0000000000000020)", got "(invalid address 0x00000020:00000000)" # Assertion failed on line 510: rw_sprintf("%{#ls}", ...) == "(misaligned address 0x000000014011e6e9)", got "(misaligned address 0x4011e6e9:00000001)" # Assertion failed on line 1994: rw_printf("%p", 0, 0, 0) == "0000000000000000", got "00000000:00000000" # Assertion failed on line 1995: rw_printf("%p", 1, 0, 0) == "0000000000000001", got "00000001:00000000" # Assertion failed on line 1996: rw_printf("%p", -1, 0, 0) == "00000000ffffffff", got "ffffffff:00000000" # Assertion failed on line 1998: rw_printf("%#p", 0, 0, 0) == "0x0000000000000000", got "0x00000000:00000000" # Assertion failed on line 1999: rw_printf("%#p", 291, 0, 0) == "0x0000000000000123", got "0x00000123:00000000" # Assertion failed on line 2000: rw_printf("%#p", -1, 0, 0) == "0x00000000ffffffff", got "0xffffffff:00000000" # Assertion failed on line 2047: rw_sprintf("%{f}", ...) == "0000000000000000", got "00000000:00000000" # Assertion failed on line 2048: rw_sprintf("%{f}", ...) == "0000000000000001", got "00000001:00000000" # Assertion failed on line 2049: rw_sprintf("%{f}", ...) == "00000000ffffffff", got "ffffffff:00000000" # Assertion failed on line 2051: rw_sprintf("%{#f}", ...) == "0x0000000000000000", got "0x00000000:00000000" # Assertion failed on line 2052: rw_sprintf("%{#f}", ...) == "0x0000000000000123", got "0x00000123:00000000" # Assertion failed on line 2053: rw_sprintf("%{#f}", ...) == "0x00000000ffffffff", got "0xffffffff:00000000" # Assertion failed on line 2614: rw_sprintf("[%{.3P}]", ...) == "[12345]", got "[123]" # Assertion failed on line 2615: rw_sprintf("[%{10.3P}]", ...) == "[ 12345]", got "[ 123]" # Assertion failed on line 2616: rw_sprintf("[%{+10.3P}]", ...) == "[ 12345]", got "[ 123]" # Assertion failed on line 2617: rw_sprintf("[%{-10.3P}]", ...) == "[12345 ]", got "[123 ]" # Assertion failed on line 2702: rw_sprintf("%{t}", ...) == "(invalid address 0x0000000000000020)", got "(invalid address 0x00000020:00000000)" # Assertion failed on line 2705: rw_sprintf("%{t}", ...) == "(misaligned address 0x000000014011e6e9)", got "(misaligned address 0x4011e6e9:00000001)" Failed 23 out of 1743 assertions.
The first problem is difference between implementations of the format_bad_address() in 0.printf.cpp file and _rw_fmtbadaddr() in rwtest library. The _rw_fmtbadaddr() uses _rw_fmtpointer() to format the pointer value (the pointer divided to parts with size = sizeof (long) and these parts are separated with colon ':') while format_bad_address() formats the pointer as integer by casting it to size_t. The same problem when "%p" and "%
{f}" formats are tested: the expected value hardcoded in the test is a string with 16 numerals
I'm not sure what should be corrected: the format_bad_address() and expected results for pointer formatting in 0.printf test of the _rw_fmtpointer() in test driver?
The second problem is difference between implementations of the _rw_fmtlong() and _rw_fmtllong(). I think they should be implemented the same way.