$ cpuctl identify 0 Cannot bind to target CPU. Output may not accurately describe the target. Run as root to allow binding. cpu0: highest basic info 0000000d cpu0: highest extended info 80000008 cpu0: "Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz" cpu0: Intel Xeon E3-1200v2 and 3rd gen core, Ivy Bridge (686-class), 3392.53 MHz cpu0: family 0x6 model 0x3a stepping 0x9 (id 0x306a9) cpu0: features 0xbfebfbff cpu0: features 0xbfebfbff cpu0: features 0xbfebfbff cpu0: features1 0x7fbae3ff cpu0: features1 0x7fbae3ff cpu0: features1 0x7fbae3ff cpu0: features2 0x28100800 cpu0: features3 0x1 cpu0: features5 0x281 cpu0: xsave features 0x7 cpu0: xsave instructions 0x1 cpu0: xsave area size: current 832, maximum 832, xgetbv enabled cpu0: enabled xsave 0x7 cpu0: I-cache 32KB 64B/line 8-way, D-cache 32KB 64B/line 8-way cpu0: L2 cache 256KB 64B/line 8-way cpu0: L3 cache 8MB 64B/line 16-way cpu0: 64B prefetching cpu0: ITLB 64 4KB entries 4-way, 2M/4M: 8 entries cpu0: DTLB 64 4KB entries 4-way, 2M/4M: 32 entries (L0) cpu0: L2 STLB 512 4KB entries 4-way cpu0: Initial APIC ID 6 cpu0: Cluster/Package ID 0 cpu0: Core ID 3 cpu0: SMT ID 0 cpu0: MONITOR/MWAIT extensions 0x3 cpu0: monitor-line size 64 cpu0: C1 substates 2 cpu0: C2 substates 1 cpu0: C3 substates 1 cpu0: DSPM-eax 0x77 cpu0: DSPM-ecx 0x9 cpu0: SEF highest subleaf 00000000 cpu0: Perfmon-eax 0x7300403 cpu0: Perfmon-eax 0x7300403 cpu0: Perfmon-edx 0x603 cpu0: microcode version 0x15, platform ID 1 $ uname -a NetBSD chieftec 8.99.37 NetBSD 8.99.37 (GENERIC) #3: Thu Apr 25 03:33:44 CEST 2019 root@chieftec:/public/netbsd-root/sys/arch/amd64/compile/GENERIC amd64 $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper Target: x86_64--netbsd Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=x86_64--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb3 20190319' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-tune=nocona --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/x86_64 --enable-tls --disable-multilib --disable-libstdcxx-pch --build=x86_64--netbsd --host=x86_64--netbsd --with-sysroot=/var/obj/mknative/amd64-x86_64/usr/src/destdir.amd64 Thread model: posix gcc version 7.4.0 (nb3 20190319) # Test 1 $ cat fileno.c #include // patched #include int main(int argc, char **argv) { size_t i, j, k; volatile int a; for (i = 0; i < 1000; i++) { for (j = 0; j < 1000; j++) { for (k = 0; k < 1000; k++) { a = fileno(stdout); if (a == -1) return EXIT_FAILURE; } } } return EXIT_SUCCESS; } $ gcc fileno.c # Test 2 $ cat fileno.c #include // patched #include int main(int argc, char **argv) { size_t i, j, k; volatile int a; for (i = 0; i < 1000; i++) { for (j = 0; j < 1000; j++) { for (k = 0; k < 1000; k++) { a = fileno_unlocked(stdout); if (a == -1) return EXIT_FAILURE; } } } return EXIT_SUCCESS; } $ gcc fileno.c # Test 3 $ cat fileno.c #include // patched #include int main(int argc, char **argv) { size_t i, j, k; volatile int a; for (i = 0; i < 1000; i++) { for (j = 0; j < 1000; j++) { for (k = 0; k < 1000; k++) { a = fileno(stdout); if (a == -1) return EXIT_FAILURE; } } } return EXIT_SUCCESS; } $ gcc fileno.c -pthread # Test 4 $ cat fileno.c #include // original #include int main(int argc, char **argv) { size_t i, j, k; volatile int a; for (i = 0; i < 1000; i++) { for (j = 0; j < 1000; j++) { for (k = 0; k < 1000; k++) { a = fileno(stdout); if (a == -1) return EXIT_FAILURE; } } } return EXIT_SUCCESS; } $ gcc fileno.c