public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102356] New: compile-time explosion at -O3
@ 2021-09-16  4:40 haoxintu at gmail dot com
  2021-09-16  6:45 ` [Bug rtl-optimization/102356] compile-time explosion at -O3 -g in var-tracking rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: haoxintu at gmail dot com @ 2021-09-16  4:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102356
           Summary: compile-time explosion at -O3
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: compile-time-hog
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi all.

It's quite weird that the following small valid program makes GCC spend too
much time on compiling at -O3 with the "-g" enabled. It seems GCC-11.x onwards
versions all suffer this issue.

$cat s.c
#include <stdint.h>
int8_t c_5 = 0x0;
uint8_t uc_9 = 0x09;
uint64_t uli_10 = 0xF1FBFC17225F7A57;
int32_t i_12 = 0x3A6667C6;
uint8_t func( uint32_t ui_14) {
    uint32_t *ptr_16 = &ui_14;
    if((uli_10 /= ((0 * (*ptr_16 *= uc_9)) <= 0))) 
        ;
    i_12 = 9;
    for ( ;i_12 > 2; i_12 -= 2 ) {
        uli_10 = -2;
        do      
            if ((*ptr_16 *= *ptr_16)){        
                c_5 = 4;        
                do{        
                    c_5 -=  3;         
                    if ((*ptr_16 *= *ptr_16))       
                        uc_9 = 9;              
                } while (c_5 > 2 );    
            }
        while ( uli_10 ++ );
    }
}

$time gcc -g -O3 -c s.c

real    10m25.417s
user    9m58.685s
sys     0m0.142s


$time gcc -g -O2 -c s.c

real    0m0.124s
user    0m0.045s
sys     0m0.011s


$gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/haoxin/haoxin-data/compilers/gcc/build/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/home/haoxin/haoxin-data/compilers/gcc/build/ --enable-bootstrap
--enable-checking=release --enable-languages=c,c++ --enable-multilib :
(reconfigured) ../configure
--prefix=/home/haoxin/haoxin-data/compilers/gcc/build/ --enable-bootstrap
--enable-checking=release --enable-languages=c,c++ --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210913 (experimental) (GCC) 

Reproduced in Godbolt: https://godbolt.org/z/47dqnPbad

Thanks,
Haoxin

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-01 10:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16  4:40 [Bug c/102356] New: compile-time explosion at -O3 haoxintu at gmail dot com
2021-09-16  6:45 ` [Bug rtl-optimization/102356] compile-time explosion at -O3 -g in var-tracking rguenth at gcc dot gnu.org
2021-09-16  9:13 ` [Bug rtl-optimization/102356] [11/12 Regression] compile-time explosion at -O3 -g in var-tracking since r11-209-g74dc179a6da33cd0 marxin at gcc dot gnu.org
2021-09-19 23:17 ` pinskia at gcc dot gnu.org
2021-09-22 13:58 ` vmakarov at gcc dot gnu.org
2021-11-29 19:03 ` jakub at gcc dot gnu.org
2021-12-01  9:20 ` cvs-commit at gcc dot gnu.org
2021-12-01  9:46 ` [Bug rtl-optimization/102356] [11 " jakub at gcc dot gnu.org
2021-12-01  9:59 ` cvs-commit at gcc dot gnu.org
2021-12-01 10:30 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).