https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119183

            Bug ID: 119183
           Summary: Compilation Timeout Issue
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xieym3 at zohomail dot com
  Target Milestone: ---

The following code snippet fails to complete compilation within a reasonable
timeframe using GCC versions 11.4.0, 14.2.0, and current trunk.
$ timeout 300 gcc -x c -std=c2x file.c
$ cat file.c
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
int test()
{
    int a = rand();
    if(a >= 0 )
        return a*a + rand() + rand();
    else
        return rand() - 1;
}
void main(int argc,  char** argv){
    float sum = 0.0;
    sum -= ( ((( (12.0f)*( (1.0f)*( (1.0f)*( (1.0f)*( (1024.0f)*( (1024.0f)*(
(1.0f)*( (1.0f)*( (1.0f)*( (rand())*( (rand())*( (1024.0f)*( (1024.0f)*(
(12.0f)*( (1.0f)*( (1.0f)*( (1.0f)*( (test())*( (test())*( (1024.0f)*(
(1024.0f)*( (1.0f)*( (1.0f)*( (1.0f)*( (test())*( (test())*( (1024.0f)*(
(1024.0f)*( (12.0f)*( (1.0f)*( (1.0f)*( (1.0f)*( (1.0f)*( (test())*( (test())*(
(1024.0f)*( (1024.0f)*( (rand())-1.0*((3)*((4.0f)*(1024.0f)*(
(rand())-1.0*((3)*((4.0f)*(1024.0f)*(
(rand())-1.0*((3)*((4.0f)*(1024.0f)*(rand()*(-1)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
}
$ gcc -v
Using built-in specs.
COLLECT_GCC=/data/xieym/llm/install/gcc-14.2.0/bin/gcc
COLLECT_LTO_WRAPPER=/data/xieym/llm/install/gcc-14.2.0/libexec/gcc/x86_64-pc-linux-gnu/14.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /data/xieym/llm/src/gcc-14.2.0/configure --enable-coverage
--enable-checking --disable-multilib --disable-shared --disable-bootstrap
--enable-languages=c,c++ --prefix=/data/xieym/llm/install/gcc-14.2.0
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (GCC)

Clang trunk successfully finish compilation the code within seconds.
Reproduction link: https://godbolt.org/z/1P96fhcT3.
Could this possibly be a bug?

Reply via email to