[flang-commits] [flang] [llvm] [flang][flang-rt] Add support for non-standard TIMEF intrinsic (PR #185377)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Fri Apr 24 12:58:58 PDT 2026
================
@@ -31,6 +31,26 @@ TEST(TimeIntrinsics, CpuTime) {
}
}
+TEST(TimeIntrinsics, Timef) {
+ // We can't really test that we get the "right" result for Timef, but we
+ // can have a smoke test to see that we get something reasonable on the
+ // platforms where we expect to support it.
+ double start{RTNAME(Timef)()}, end{0.0};
+ ASSERT_GE(start, 0.0);
+
+ // Loop until we get a different value from CpuTime. If we don't get one
+ // before we time out, then we should probably look into an implementation
+ // for CpuTime with a better timer resolution.
+ // By default, this loop should burn for 1 second.
+ for (double end = start; end == start; end = RTNAME(Timef)()) {
----------------
eugeneepshteyn wrote:
Because `end` is declared here via `double end = start`, it shadows the outer `end`. I think you want to use outer `end` here, not declare a new one.
https://github.com/llvm/llvm-project/pull/185377
More information about the flang-commits
mailing list