[llvm-bugs] [Bug 50464] New: clang memory hog + time hog + Killed signal on valid C code (on target i386-unknown-linux-gnu)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 25 05:25:27 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50464

            Bug ID: 50464
           Summary: clang memory hog + time hog + Killed signal on valid C
                    code (on target i386-unknown-linux-gnu)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hi all.

$cat small.c
#include <stdint.h>

uint16_t us_0 = 0x059C;
uint16_t us_6 = 0x944B;
int32_t i_7 = 0x75F5FBC4;
uint64_t uli_10 = 0xA306B7BACA58FABD;
volatile uint64_t uli_11 = 0x3C1DB306CBCC06F0;
uint64_t uli_13 = 0x532BB157E5921AFD;

int func(){
    long  i_17;
    unsigned  uli_19;
    short  uli_21;
    volatile int64_t li_24 = 0xAADB149E383E3931;
    uint64_t *ptr_26 = &uli_11;
    int64_t li_29 = 0x0;
    uint16_t *ptr_30 = &us_0;
    volatile uint64_t uli_31 = 0x4A1CA3B53FBE0D95;

    *ptr_30 /= (uli_31 = (((0x0 == 0x0) != (0xDF3E && i_7)) >= (uli_21 -=
(li_24 <= i_17))));
    for(i_17 = 9; i_17 <= 57; i_17 += 1){
        uint64_t uli_40 = 0xBD803862B3FC4908;
        if((li_29 = (((uli_21 |= uli_11) & (*ptr_26 /= uli_19)) && ((uli_13 >
0x0) + (uli_40 -= uli_10))))){
            ;
        }
    }
    *ptr_30 /= (uli_31 = (((0x0 == 0x0) != (0xDF3E && i_7)) >= (uli_21 -=
(li_24 <= i_17))));   
    return 0;
}

int main(){
    func();
    return 0;
}

$time clang -w -g -m32 -O3 small.c (clang eats all my 64G memory then triggers
the killed signal)
clang-13: error: unable to execute command: Killed
clang-13: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project
f47575f83ceac6b3023b540de4286239f61a5107)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/haoxin/haoxin-data/dut-research/compilers/llvm-project/build-afl/bin
clang-13: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-13: note: diagnostic msg: /tmp/small-317793.c
clang-13: note: diagnostic msg: /tmp/small-317793.sh
clang-13: note: diagnostic msg: 

********************

real    29m27.981s
user    28m30.728s
sys     0m25.610s

$time clang -w -g -O3 small.c

real    0m0.224s
user    0m0.116s
sys     0m0.038s

Note that this issue may cause by one of the commits after
7d6449322ecba2fa34090ca8ed610328febee108. I tested this case on the above
commit version and clang can handle it well.

This code also can not be compiled on Godbolt currently:
https://godbolt.org/z/hb4zE33cn

Thanks
Haoxin

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210525/24c3bed4/attachment.html>


More information about the llvm-bugs mailing list