<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 - Interpreter crashes due to an "Unknown constant pointer type!""
   href="https://bugs.llvm.org/show_bug.cgi?id=44778">44778</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Interpreter crashes due to an "Unknown constant pointer type!"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.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>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>barbaro.alberto@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23087" name="attach_23087" title="pngpixel_crash.bc + mini.png">attachment 23087</a> <a href="attachment.cgi?id=23087&action=edit" title="pngpixel_crash.bc + mini.png">[details]</a></span>
pngpixel_crash.bc + mini.png

Hi all,
I have noticed that the interpreter is not able to deal with a pointer to a
struct in a store instruction. In the present case the following instruction
caused the crash:

About to interpret:   store <2 x %struct.code*> <%struct.code* getelementptr
inbounds ([512 x %struct.code], [512 x %struct.code]* @fixedtables.lenfix.681,
i64 0, i64 0), %struct.code* getelementptr inbounds ([32 x %struct.code], [32 x
%struct.code]* @fixedtables.distfix.682, i64 0, i64 0)>, <2 x %struct.code*>*
%96, align 8, !tbaa !50

The entire crash dump is:

Unknown constant pointer type!
UNREACHABLE executed at
/home/al/llvm-9.0.0.src/lib/ExecutionEngine/ExecutionEngine.cpp:1008!
Stack dump:
0. Program arguments: /usr/local/bin/lli --force-interpreter pngpixel_crash.bc
0 0 mini.png
 #0 0x0000564bad642af9 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/al/llvm-9.0.0.src/lib/Support/Unix/Signals.inc:533:0
 #1 0x0000564bad642b8c PrintStackTraceSignalHandler(void*)
/home/al/llvm-9.0.0.src/lib/Support/Unix/Signals.inc:594:0
 #2 0x0000564bad640a66 llvm::sys::RunSignalHandlers()
/home/al/llvm-9.0.0.src/lib/Support/Signals.cpp:68:0
 #3 0x0000564bad6424b0 SignalHandler(int)
/home/al/llvm-9.0.0.src/lib/Support/Unix/Signals.inc:385:0
 #4 0x00007f697df61890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x00007f697ca0ae97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #6 0x00007f697ca0c801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #7 0x0000564bad5ce768 bindingsErrorHandler(void*,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, bool) /home/al/llvm-9.0.0.src/lib/Support/ErrorHandling.cpp:218:0
 #8 0x0000564bacfc2e5a llvm::ExecutionEngine::getConstantValue(llvm::Constant
const*) /home/al/llvm-9.0.0.src/lib/ExecutionEngine/ExecutionEngine.cpp:1013:0
 #9 0x0000564bacfeb873 llvm::Interpreter::getOperandValue(llvm::Value*,
llvm::ExecutionContext&)
/home/al/llvm-9.0.0.src/lib/ExecutionEngine/Interpreter/Execution.cpp:2108:0
#10 0x0000564bacfe548a llvm::Interpreter::visitStoreInst(llvm::StoreInst&)
/home/al/llvm-9.0.0.src/lib/ExecutionEngine/Interpreter/Execution.cpp:1105:0
#11 0x0000564bacfee32f llvm::InstVisitor<llvm::Interpreter,
void>::visitStore(llvm::StoreInst&)
/home/al/llvm-9.0.0.src/include/llvm/IR/Instruction.def:173:0
#12 0x0000564bacfed18d llvm::InstVisitor<llvm::Interpreter,
void>::visit(llvm::Instruction&)
/home/al/llvm-9.0.0.src/include/llvm/IR/Instruction.def:173:0
#13 0x0000564bacfebd7b llvm::Interpreter::run()
/home/al/llvm-9.0.0.src/lib/ExecutionEngine/Interpreter/Execution.cpp:2161:0
#14 0x0000564bacfd6bdc llvm::Interpreter::runFunction(llvm::Function*,
llvm::ArrayRef<llvm::GenericValue>)
/home/al/llvm-9.0.0.src/lib/ExecutionEngine/Interpreter/Interpreter.cpp:101:0
#15 0x0000564bacfbfb94
llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,
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> > > > const&, char const* const*)
/home/al/llvm-9.0.0.src/lib/ExecutionEngine/ExecutionEngine.cpp:470:0
#16 0x0000564bac794cc4 main /home/al/llvm-9.0.0.src/tools/lli/lli.cpp:614:0
#17 0x00007f697c9edb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#18 0x0000564bac791a9a _start (/usr/local/bin/lli+0x110aa9a)
[1]    12828 abort (core dumped)  /usr/local/bin/lli --force-interpreter
pngpixel_crash.bc 0 0 mini.png

You should be able to reproduce the bug using the following command:

/usr/local/bin/lli --force-interpreter pngpixel_crash.bc 0 0 mini.png</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>