<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - cfl-aa with -O1 segfaults binary"
   href="https://llvm.org/bugs/show_bug.cgi?id=28401">28401</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cfl-aa with -O1 segfaults binary
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>matthias.krueger@famsik.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16683" name="attach_16683" title="code snippet">attachment 16683</a> <a href="attachment.cgi?id=16683&action=edit" title="code snippet">[details]</a></span>
code snippet

This original code I found this bug with is
<a href="https://github.com/danmar/cppcheck/blob/e795eef4651ea3db8b60498da2e3608bf5b44aeb/tools/dmake.cpp">https://github.com/danmar/cppcheck/blob/e795eef4651ea3db8b60498da2e3608bf5b44aeb/tools/dmake.cpp</a>

I tried to reduce this (code attached).

llvm was at bafbf2b643f118fd2ea402ed6cd204281c7e9e94
clang was at 0cf7afc057e83969413f10f3817eb107ac8a0933
(using the github llvm-mirror repos)

I compiled with
clang++  -std=c++0x  -mllvm -use-cfl-aa -mllvm -use-cfl-aa-in-codegen -O1   -o
crash code.cpp
which will cause the binary to crash.
Omitting -O1 will prevent the crash.

A debug build
clang++  -std=c++0x  -mllvm -use-cfl-aa -mllvm -use-cfl-aa-in-codegen
-fsanitize=address -g3  -O1   -o crash code.cpp 
revealed this trace:

ASAN:DEADLYSIGNAL
=================================================================
==12120==ERROR: AddressSanitizer: SEGV on unknown address 0x000077000001 (pc
0x7f7ec82d05b3 bp 0x7ffd8fd55fe0 sp 0x7ffd8fd55e78 T0)
==12120==The signal is caused by a READ memory access.
    #0 0x7f7ec82d05b2 in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()
(/lib64/libstdc++.so.6+0x1235b2)
    #1 0x4e95af in void
std::_Destroy_aux<false>::__destroy<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char>
<span class="quote">>*>(std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >*)
/usr/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/bits/stl_construct.h:103:6
    #2 0x4e91d8 in std::vector<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > > >::~vector()
/usr/lib/gcc/x86_64-redhat-linux/6.1.1/../../../../include/c++/6.1.1/bits/stl_vector.h:426:9
    #3 0x4e909e in main /tmp/code.cpp:11:1
    #4 0x7f7ec72c2730 in __libc_start_main (/lib64/libc.so.6+0x20730)
    #5 0x41a828 in _start (/tmp/crash+0x41a828)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib64/libstdc++.so.6+0x1235b2) in
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
<span class="quote">>::~basic_string()</span >
==12120==ABORTING


I'm using a fedora 24 system with glibc 2.23.1-8.fc24 and gcc 6.1.1-3.fc24

Kind regards
Matthias Krüger</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>