<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 - [KNL][AVX-512]uncaught_exception: wrong return value on release and abort on compilation on debug"
   href="https://bugs.llvm.org/show_bug.cgi?id=32472">32472</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[KNL][AVX-512]uncaught_exception: wrong return value on release and abort on compilation on debug
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>ilia.taraban@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>==============test.cpp=================
#include <exception>
#include <cstdio>
using namespace std;


struct C {
        ~C() { if (uncaught_exception())
                        printf("uncaught exception true\n");
                else printf("uncaught exception false\n"); }
};

void foo() {
        try {
                C c;
                throw 0;
        }
        catch (...){}
}

int main() {
        foo();
}
======================================

<span class="quote">>>>clang -v</span >
clang version 5.0.0 (trunk 298928)
...
InstalledDir: .../Release/bin

<span class="quote">>>>clang++   -O0    test.cpp
>>>./a.out</span >
uncaught exception true


<span class="quote">>>>clang++   -O0   -march=skylake-avx512  test.cpp
>>> sde -skx -- ./a.out</span >
uncaught exception false       #Wrong answer

But if use debug build:

<span class="quote">>>>clang++   -O0   -march=skylake-avx512  test.cpp
>>>clang++   -O0   -march=skylake-avx512  test.cpp</span >
Cannot emit physreg copy instruction
UNREACHABLE executed at /llvm/lib/Target/X86/X86InstrInfo.cpp:6553!
#0 0x0000000003badc87 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/llvm/lib/Support/Unix/Signals.inc:398:0
#1 0x0000000003badd18 PrintStackTraceSignalHandler(void*)
/llvm/lib/Support/Unix/Signals.inc:462:0
#2 0x0000000003bac276 llvm::sys::RunSignalHandlers()
/llvm/lib/Support/Signals.cpp:44:0
#3 0x0000000003bad61f SignalHandler(int)
/llvm/lib/Support/Unix/Signals.inc:252:0
#4 0x00007f386d5bd130 __restore_rt (/lib64/libpthread.so.0+0xf130)
#5 0x00007f386c1b75d7 __GI_raise (/lib64/libc.so.6+0x355d7)
#6 0x00007f386c1b8cc8 __GI_abort (/lib64/libc.so.6+0x36cc8)
#7 0x0000000003b34776 bindingsErrorHandler(void*, std::string const&, bool)
/llvm/lib/Support/ErrorHandling.cpp:127:0
#8 0x0000000002cd5791 llvm::X86InstrInfo::copyPhysReg(llvm::MachineBasicBlock&,
llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc
const&, unsigned int, unsigned in
t, bool) const /llvm/lib/Target/X86/X86InstrInfo.cpp:6554:0
#9 0x0000000003347dcd (anonymous
namespace)::ExpandPostRA::LowerCopy(llvm::MachineInstr*)
/llvm/lib/CodeGen/ExpandPostRAPseudos.cpp:165:0
#10 0x00000000033480c5 (anonymous
namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&)
/llvm/lib/CodeGen/ExpandPostRAPseudos.c
pp:211:0
#11 0x00000000031623f3
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/llvm/lib/CodeGen/MachineFunctionPass.cpp:62:0
#12 0x000000000354f0f0 llvm::FPPassManager::runOnFunction(llvm::Function&)
/llvm/lib/IR/LegacyPassManager.cpp:1513:0
#13 0x000000000354f283 llvm::FPPassManager::runOnModule(llvm::Module&)
/llvm/lib/IR/LegacyPassManager.cpp:1534:0
#14 0x000000000354f60f (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/llvm/lib/IR/LegacyPassManager.cpp:1590:0
#15 0x000000000354fd00 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/llvm/lib/IR/LegacyPassManager.cpp:1693:0
#16 0x000000000354ff41 llvm::legacy::PassManager::run(llvm::Module&)
/llvm/lib/IR/LegacyPassManager.cpp:1725:0
#17 0x0000000003e5071f (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:749:0
#18 0x0000000003e52022 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1018:0
#19 0x00000000048b54f0
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:260:0
#20 0x00000000054916f4 clang::ParseAST(clang::Sema&, bool, bool)
/llvm/tools/clang/lib/Parse/ParseAST.cpp:161:0
#21 0x0000000004419bf0 clang::ASTFrontendAction::ExecuteAction()
/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:613:0
#22 0x00000000048b3569 clang::CodeGenAction::ExecuteAction()
/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:990:0
#23 0x0000000004419669 clang::FrontendAction::Execute()
/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:516:0
#24 0x00000000043bf19c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:970:0
#25 0x0000000004543b33
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:249:0
#26 0x0000000001e5d9a8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#27 0x0000000001e53ad0 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) /llvm/tools/clang/tools/driver/driver.cpp:299:0
#28 0x0000000001e5465f main /llvm/tools/clang/tools/driver/driver.cpp:380:0
#29 0x00007f386c1a3af5 __libc_start_main (/lib64/libc.so.6+0x21af5)
#30 0x0000000001e514e9 _start (/Debug/bin/clang-5.0+0x1e514e9)
Stack dump:
0.      Program arguments: /Debug/bin/clang-5.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
test.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu skylake-avx512 -dwarf-column-info
-debugger-tuning=gdb -resource-dir /Debug/lib/clang/5.0.0 -c-isystem
/Debug/projects/openmp/runtime/src -c-isystem . -cxx-isystem
/Debug/projects/openmp/runtime/src -cxx-isystem . -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/backward
-internal-isystem /usr/local/include -internal-isystem
/Debug/lib/clang/5.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O0 -fdeprecated-macro
-fdebug-compilation-dir /tests -ferror-limit 19 -fmessage-length 189
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/test-2c519c.o -x c++ test.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'test.cpp'.
4.      Running pass 'Post-RA pseudo instruction expansion pass' on function
'@_ZN1CD2Ev'
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 298928)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /Debug/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-5.0: note: diagnostic msg: /tmp/test-99c20c.cpp
clang-5.0: note: diagnostic msg: /tmp/test-99c20c.sh
clang-5.0: note: diagnostic msg:

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


------------------------
Intel Software Engineer
Ilia Taraban</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>