<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 reaches unreachable processing incorrect code with VLA"
   href="https://bugs.llvm.org/show_bug.cgi?id=43884">43884</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang reaches unreachable processing incorrect code with VLA
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>coillol@yandex.ru
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang crashes on unreachable statement in debug mode (version 8.0.0) and with
OOM in release (<a href="https://godbolt.org/z/Ddt1Wp">https://godbolt.org/z/Ddt1Wp</a>) processing this text:

int foo();

int main() {
  struct S {
    using X = int[foo()];
  };
  using X = S::X;
}

Compiling it using debug clang-8 with no options gives this stacktrace:

type class is never variably-modified!
UNREACHABLE executed at
llvm-8.0.0.src/tools/clang/lib/CodeGen/CodeGenFunction.cpp:2056!
Stack dump:
0.      Program arguments: clang/8.0.0/bin/clang-8 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
second.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu
x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir
clang/8.0.0/lib/clang/8.0.0 -internal-isystem
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3
-internal-isystem
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/x86_64-suse-linux
-internal-isystem
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../include/c++/4.3/backward
-internal-isystem /usr/local/include -internal-isystem
clang/8.0.0/lib/clang/8.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir experimental -ferror-limit 19 -fmessage-length 211
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/second-1d9e53.o -x c++ second.cpp -faddrsig
1.      <eof> parser at end of file
2.      second.cpp:3:5: LLVM IR generation of declaration 'main'
3.      second.cpp:3:5: Generating code for declaration 'main'
 #0 0x00000000018381fa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(clang/8.0.0/bin/clang-8+0x18381fa)
 #1 0x0000000001836145 llvm::sys::RunSignalHandlers()
(clang/8.0.0/bin/clang-8+0x1836145)
 #2 0x000000000183625c SignalHandler(int) (clang/8.0.0/bin/clang-8+0x183625c)
 #3 0x00007ffff7bcf850 __restore_rt (/lib64/libpthread.so.0+0xf850)
 #4 0x00007ffff67f8875 __GI_raise (/lib64/libc.so.6+0x32875)
 #5 0x00007ffff67f9e51 __GI_abort (/lib64/libc.so.6+0x33e51)
 #6 0x00000000017dd84a (clang/8.0.0/bin/clang-8+0x17dd84a)
 #7 0x0000000001aa23b0
clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(clang::QualType)
(clang/8.0.0/bin/clang-8+0x1aa23b0)
 #8 0x0000000001c2003d clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&) (clang/8.0.0/bin/clang-8+0x1c2003d)
 #9 0x0000000001a5621f
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
(clang/8.0.0/bin/clang-8+0x1a5621f)
#10 0x0000000001a6334b
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
(clang/8.0.0/bin/clang-8+0x1a6334b)
#11 0x0000000001a5f550 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>) (clang/8.0.0/bin/clang-8+0x1a5f550)
#12 0x0000000001a5fc63
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) (clang/8.0.0/bin/clang-8+0x1a5fc63)
#13 0x0000000001a98c48
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
(clang/8.0.0/bin/clang-8+0x1a98c48)
#14 0x0000000001aa7d0b
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(clang/8.0.0/bin/clang-8+0x1aa7d0b)
#15 0x0000000001ae390b
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (clang/8.0.0/bin/clang-8+0x1ae390b)
#16 0x0000000001ae1544
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (clang/8.0.0/bin/clang-8+0x1ae1544)
#17 0x0000000001ae1b53
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(clang/8.0.0/bin/clang-8+0x1ae1b53)
#18 0x0000000001ae7508
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.6983)
(clang/8.0.0/bin/clang-8+0x1ae7508)
#19 0x000000000234e22d (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(clang/8.0.0/bin/clang-8+0x234e22d)
#20 0x0000000002343b7b
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(clang/8.0.0/bin/clang-8+0x2343b7b)
#21 0x0000000002c2d3d6 clang::ParseAST(clang::Sema&, bool, bool)
(clang/8.0.0/bin/clang-8+0x2c2d3d6)
#22 0x000000000234b8cc clang::CodeGenAction::ExecuteAction()
(clang/8.0.0/bin/clang-8+0x234b8cc)
#23 0x0000000001e984ae clang::FrontendAction::Execute()
(clang/8.0.0/bin/clang-8+0x1e984ae)
#24 0x0000000001e5fd3e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(clang/8.0.0/bin/clang-8+0x1e5fd3e)
#25 0x0000000001f37fea
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(clang/8.0.0/bin/clang-8+0x1f37fea)
#26 0x0000000000a486f0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (clang/8.0.0/bin/clang-8+0xa486f0)
#27 0x00000000009e53a2 main (clang/8.0.0/bin/clang-8+0x9e53a2)
#28 0x00007ffff67e4c36 __libc_start_main (/lib64/libc.so.6+0x1ec36)
#29 0x0000000000a44569 _start
/usr/src/packages/BUILD/glibc-2.11.3/csu/../sysdeps/x86_64/elf/start.S:116:0
clang-8: error: unable to execute command: Aborted
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>