Closed ztdwu closed 8 years ago
EDIT: Nevermind, unsigned overflow is not undefined behaviour in the C++ standard. Not sure why ASAN is reporting it.
=== Original Comment: === The overflow error:
./docopt_util.h:96:46: runtime error: unsigned integer overflow: 15755298069831242297 + 3304135864781666520 cannot be represented in type 'unsigned long' ./docopt_util.h:96:34: runtime error: unsigned integer overflow: 13828916662110822956 + 17646836532054932864 cannot be represented in type 'unsigned long'
Compiled with clang 3.7 and ASAN:
clang++ docopt.cpp -c -o docopt.o -std=c++11 -Wall -Wextra -pedantic -Wcast-align -Wconversion -Wformat=2 -Wformat-nonliteral -Wlogical-op -Wmissing-format-attribute -Wnon-virtual-dtor -Wsign-conversion -fsanitize=undefined -fsanitize=integer clang++ docopt-test.cpp docopt.o -std=c++11 -fsanitize=undefined -fsanitize=integer
The driver program:
#include "docopt.h" static auto USAGE = R"( Usage: prog --version Options: -h --help Show this screen. )"; int main(const int argc, const char *const argv[]) { const auto args = docopt::docopt(USAGE, { argv + 1, argv + argc }, true, "Bake 0.1"); }
EDIT: Nevermind, unsigned overflow is not undefined behaviour in the C++ standard. Not sure why ASAN is reporting it.
=== Original Comment: === The overflow error:
Compiled with clang 3.7 and ASAN:
The driver program: