#include <stdio.h>typedef unsigned __int64 size_type;typedef unsigned int uint32;struct Foo { Foo() : strategy_(B), invert_(false) {} enum { A, B }; int strategy_; bool invert_; bool test(uint32 a) { bool conflict = isTrue(a); if (strategy_ == A) { invert_ = conflict || strategy_ == B; } else if (conflict) { size_type capacity = 0; size_type minCap = 1; if (capacity > minCap) return true; minCap = minCap < 4 ? 4 : minCap; size_type cap = static_cast<size_type>(capacity * 1.5); if (cap > minCap) minCap = cap; CHECK_EQUAL(minCap, 4); return false; } return !conflict; } void CHECK_EQUAL(size_type n, size_type x) { if (n != x) throw n; } bool isTrue(uint32 x) { int bla; sscanf("1", "%d", &bla); return bla; }}; int main() { Foo f; try { f.test(10864); printf("OK\n"); } catch (size_type n) { printf("ERROR: n == %llu but should be 4!\n", n); }}Note: The first part of the generated code for the else if (conflict) branch is:pxor xmm0,xmm0 cvtsi2sd xmm0,rdx addsd xmm0,mmword ptr [__real@43f0000000000000 (13FA42220h)] mulsd xmm0,mmword ptr [__real@3ff8000000000000 (13FA42218h)] [...]I think, there is a test/jns missing, i.e. the __real@43f0000000000000 should not be addedunconditionally.
Product Language
Version
Operating System
Operating System Language
Steps to Reproduce
Actual Results
Expected Results
Please wait...