https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125571
Bug ID: 125571
Summary: compiling with gcc 380 times slower than clang (19
minutes vs 3 seconds)
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: hubert.garavel at inria dot fr
Target Milestone: ---
Created attachment 64607
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64607&action=edit
A compressed C program to evaluate expressions at run-time
Executing the command:
time gcc -c a-446931.i
gives
1162.39user 0.55system 19:23.03elapsed 99%CPU ...
In comparison
time clang -I/home/cadp/Cadp/incl -c 446931.c
gives
3.04user 0.18system 0:03.23elapsed 99%CPU ...
The same discrepancy was observed by different persons using different compiler
versions:
- gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0 vs Ubuntu clang version
14.0.0-1ubuntu1.1
- gcc (Debian 12.2.0-14+deb12u1) 12.2.0 vs Debian clang version 14.0.6
- gcc (Debian 14.2.0-19) 14.2.0 vs Debian clang version 19.1.7 (3+b1)
- gcc (OpenIndiana 14.3.0-oi-1) 14.3.0 vs clang version 20.1.8 (OpenIndiana)
Notice that the C program was not designed to create problems to Gcc. It is a
meaningful C program generated automatically (by a higher-level language
compiler)
to check whether different expressions are equal or not. Some of these
expressions
might raise exceptions ("raise (15)") which need to be caught using setjmp().
We have other examples of such C programs. The program chosen for the
attachment
is the one where the largest time discrepancy (x380) was observed.