<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang memory hog + time hog + Killed signal on valid C code (on target i386-unknown-linux-gnu)"
   href="https://bugs.llvm.org/show_bug.cgi?id=50464">50464</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang memory hog + time hog + Killed signal on valid C code (on target i386-unknown-linux-gnu)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>haoxintu@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 (<a href="https://github.com/llvm/llvm-project">https://github.com/llvm/llvm-project</a>
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:
<a href="https://godbolt.org/z/hb4zE33cn">https://godbolt.org/z/hb4zE33cn</a>

Thanks
Haoxin</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>