www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18704] New: std/datetime/stopwatch.d(452) assertion failure

https://issues.dlang.org/show_bug.cgi?id=18704

          Issue ID: 18704
           Summary: std/datetime/stopwatch.d(452) assertion failure on
                    auto-tester
           Product: D
           Version: D2
          Hardware: x86
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

I see the following failure on auto-tester:

---
****** FAIL debug32 std.datetime.stopwatch
core.exception.AssertError std/datetime/stopwatch.d(452): unittest failure
----------------
gmake[1]: *** [posix.mak:380: unittest/std/datetime/stopwatch.run] Error 1
gmake[1]: *** Waiting for unfinished jobs....
---

https://auto-tester.puremagic.com/show-run.ghtml?projectid=1&runid=3102407&isPull=true


```
void f0() nothrow {}
void f1() nothrow { auto b = to!string(a); }
auto r = benchmark!(f0, f1)(1000);
assert(r[0] >= Duration.zero);
assert(r[1] > Duration.zero);
assert(r[1] > r[0]);
```

It looks like we need to disable optimization of f1.

--
Apr 01 2018