Opened 8 years ago

Closed 4 years ago

#3753 closed defect (fixed)

TestCppformat runtime check failures in Windows debug build

Reported by: historic_bruno Owned by:
Priority: Nice to Have Milestone: Alpha 24
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by Itms)

Some tests in TestCppformat trigger runtime check failures in Windows debug build:

Run-Time Check Failure #1 - A cast to a smaller data type has caused a loss of data. If this was intentional, you should mask the source of the cast with the appropriate bitmask. For example:

char c = (i & 0xFF);

Changing the code in this way will not affect the quality of the resulting optimized code.

I'm not sure that the code can be modified to comply with that check, so instead I've attached a patch for cppformat to disable it.

Call stack:

>	test_dbg.exe!`anonymous namespace'::ArgConverter<int>::visit_any_int<unsigned __int64>(unsigned __int64 value) Line 260	C++
 	test_dbg.exe!fmt::internal::ArgVisitor<`anonymous namespace'::ArgConverter<int>,void>::visit_ulong_long(unsigned __int64 value) Line 760	C++
 	test_dbg.exe!fmt::internal::ArgVisitor<`anonymous namespace'::ArgConverter<int>,void>::visit(const fmt::internal::Arg & arg) Line 805	C++
 	test_dbg.exe!fmt::internal::PrintfFormatter<char>::format(fmt::BasicWriter<char> & writer, fmt::BasicStringRef<char> format, const fmt::ArgList & args) Line 991	C++
 	test_dbg.exe!fmt::printf<char>(fmt::BasicWriter<char> & w, fmt::BasicStringRef<char> format, const fmt::ArgList & args) Line 1816	C++
 	test_dbg.exe!fmt::sprintf(fmt::BasicStringRef<char> format, const fmt::ArgList & args) Line 1829	C++
 	test_dbg.exe!fmt::sprintf<unsigned __int64>(fmt::BasicStringRef<char> arg0, const unsigned __int64 & v0) Line 2067	C++
 	test_dbg.exe!TestCppformat::test_basic() Line 39	C++
 	test_dbg.exe!TestDescription_suite_TestCppformat_test_basic::runTest() Line 27	C++
 	test_dbg.exe!CxxTest::RealTestDescription::run() Line 121	C++
 	test_dbg.exe!CxxTest::TestRunner::runTest(CxxTest::TestDescription & td) Line 105	C++
 	test_dbg.exe!CxxTest::TestRunner::runSuite(CxxTest::SuiteDescription & sd) Line 91	C++
 	test_dbg.exe!CxxTest::TestRunner::runWorld() Line 71	C++
 	test_dbg.exe!CxxTest::TestRunner::runAllTests(CxxTest::TestListener & listener) Line 42	C++
 	test_dbg.exe!CxxTest::ErrorFormatter::run() Line 63	C++
 	test_dbg.exe!CxxTest::Main<CxxTest::ErrorPrinter>(CxxTest::ErrorPrinter & tmp, int argc, char * * argv) Line 148	C++
 	test_dbg.exe!SDL_main(int argc, char * * argv) Line 21	C++
 	test_dbg.exe!main_utf8(int argc, char * * argv) Line 126	C
 	test_dbg.exe!main(int argc, char * * argv) Line 134	C
 	test_dbg.exe!__tmainCRTStartup() Line 626	C
 	test_dbg.exe!mainCRTStartup() Line 466	C

Attachments (1)

format.cpp.patch (646 bytes ) - added by historic_bruno 8 years ago.

Download all attachments as: .zip

Change History (7)

by historic_bruno, 8 years ago

Attachment: format.cpp.patch added

comment:1 by Itms, 8 years ago

The patch looks good to me, and and don't think it's possible to change that cast to something else either.

comment:2 by Itms, 8 years ago

Keywords: review removed
Milestone: Alpha 20Alpha 21

It would probably better to take a look at #3190 before. Maybe recent changes fix this behavior.

comment:3 by historic_bruno, 8 years ago

Unfortunately, the errors still occur with the patches on #3190. This patch applies cleanly and still silences the error.

comment:4 by elexis, 8 years ago

Milestone: Alpha 21Alpha 22

Feature freeze in 2 days.

comment:5 by elexis, 7 years ago

Milestone: Alpha 22Backlog

Backlogging due to lack of progress

comment:6 by Itms, 4 years ago

Description: modified (diff)
Keywords: patch removed
Milestone: BacklogAlpha 24
Resolution: fixed
Status: newclosed
Summary: [PATCH] TestCppformat runtime check failures in Windows debug buildTestCppformat runtime check failures in Windows debug build

This does not happen anymore. I assume it was fixed either by upgrading to MSVC 14 (see #3439, #5379), or by the minor fmtlib upgrade (#3190).

Note: See TracTickets for help on using tickets.