<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 - Segmentation fault with -O2"
   href="https://bugs.llvm.org/show_bug.cgi?id=39199">39199</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segmentation fault with -O2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dcb314@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This C code:

int a[ 1];
int b;
void c() {
  void *d = b = 0;
  for (;; b++)
    a[b] = (int) d++;
}

seems to compile ok without optimiser on clang-7:

$ clang -c -w option-5d5829.c 
$  

but then the optimiser doesn't seem to like it:

$ clang -c -w -O2 option-5d5829.c
Stack dump:
0.      Program arguments: /usr/bin/clang-7 -cc1 -triple
x86_64-unknown-linux-gn
u -emit-obj -disable-free -disable-llvm-verifier -discard-value-names
-main-file
-name option-5d5829.c -mrelocation-model static -mthread-model posix
-fmath-errn
o -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-c
pu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer
-cov
erage-notes-file /home/dcb/creduce/dcbTest/option-5d5829.gcno -resource-dir
/usr
/lib64/clang/7.0.0 -internal-isystem /usr/local/include -internal-isystem
/usr/l
ib64/clang/7.0.0/include -internal-externc-isystem /include
-internal-externc-is
ystem /usr/include -O2 -w -fdebug-compilation-dir /home/dcb/creduce/dcbTest
-fer
ror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option
-ve
ctorize-loops -vectorize-slp -o option-5d5829.o -x c option-5d5829.c -faddrsig 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'option-5d5829.c'.
4.      Running pass 'Loop Pass Manager' on function '@c'

...</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>