compiler-explorer
compiler-explorer copied to clipboard
[BUG]: Calling `clock()` SIGSEGVs on armv8
Describe the bug
The following C++ code compiles but fails when executed on any armv8 (clang/gcc any version) server.
Also gettimeofday, timespec_get, clock_gettime return junk values. No problem on x86-64.
#include <cstdio>
#include <time.h>
int main () { return std::printf("now: %ld\n", long(clock())); }
Output is usually Program returned: 139
Program terminated with signal: SIGSEGV
though sometimes result is 135.
[Similar C code fails the same.]
Steps to reproduce
- Visit godbolt.org
- Select armv8-a clang (trunk), C++
- Select Output… ✓ Execute the code
- Enter above program
Expected behavior
Something like the following in the Output panel:
ASM generation compiler returned: 0
Execution build compiler returned: 0
Program returned: 10
now: 3603
Reproduction link
https://godbolt.org/z/z3hEv85e7
Screenshots
Not applicable
Operating System
No response
Browser version
No response