https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96348
Bug ID: 96348 Summary: The same "C" program runtime is 50 times longer on Win10 than on Linux. Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: brianoh9999 at gmail dot com Target Milestone: --- I belive that I have found what appears to be a major bug somewhere in the compilation of an "C" program for Win10. GCC --version shows: gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0 The PC is an i7-8550U. The windows version is Win10 Pro, V2004-19041.388. Compiler Command for initial run: gcc primes.c -o primes.exe -O3 No console output from compiler. Compiler Command for .i creation: gcc primes.c -o primes.exe -O3 -save-temps No console output from compiler. This problem surfaced in a fairly simple benchmark that I wrote for various languages including C++, Rust, Go, Dart, Java, and JS. The algorithm used is exactly the same for all languages. The run-time on all of these languages on Win10 ranges from 6 seconds to 15 seconds. Using GCC compiling "C", it takes over 50 times longer than C++ (650 seconds or more vs 12.5 seconds). Assuming it was my fault, I could see no obvious problem, so I installed WSL2 on Win10 and compiled it on Ubuntu using GCC and ran it. The result was 12.5 seconds - the exact same code. I ran it on another Win10 i7 PC and it took 675 seconds. I had someone (experienced in C) independently verify this, and they had the same result both on Win10 and Linux (c. 650 seconds and 12 seconds). I compiled it with various optimization flags including "-O", "-O3", etc. I also compiled it using Code:Blocks (on Windows) and got the same result (runtime). The person who verified this for me is an experienced "C" programmer. I am an experienced programmer and have spent a lot of time researching this, and I would therefore like to report it as a bug. Please note. The issue is not whether the algorithm is good or bad. The issue is that the runtime on Win10 (for 10 million) takes 50 times longer than on Linux, and also 50 times longer than other major languages including C++. I was unsure about your requirements as to what you do not want in regards to the source file. You do not want: "A source file that #includes header files that are left out of the bug report (see above)" "That source file and a collection of header files." It was therefore unclear to me whether you want the actual source file, so I have attached it. Well, I tried to, but it appears that you only want one attachment. Please note as I'm sure you will realize, this is not a question as to how good or not the algorithm is or whether I could use the sqrt function. It is solely about the vast discrepancy in the runtime. I'm unsure if I selected the correct component to file this under, because the description is "A problem with the C compiler front end". I presume it is actually "A problem with the C compiler tool chain" or similar, but I could not identify a more suitable component. Please inform me as to the result of this submission. Regards, Brian