<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 - vector type declaration in parens causes assert/OOM crash"
   href="https://bugs.llvm.org/show_bug.cgi?id=48540">48540</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>vector type declaration in parens causes assert/OOM crash
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>C
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>erich.keane@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://godbolt.org/z/jvY5vq">https://godbolt.org/z/jvY5vq</a>

This valid declaration: int (__attribute__((vector_size(16))) b4[4][3][2]);

causes an assertion (see below) in debug mode, and an OOM error otherwise.  It
apperas that the VectorTypeLoc isn't handled here in the DeclaratorLocFiller,
which causes the issue.

I don't have a good idea of how to implement this (or what sort of information
is required here), so I'm hoping I can get some guidance.



bash-4.2$ ./bin/clang -cc1 temp.c
unsupported TypeLoc kind in declarator!
UNREACHABLE executed at
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaType.cpp:6138!
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ./bin/clang -cc1 temp.c
1.      temp.c:1:51: current parser token ';'
 #0 0x000000000508c787 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Unix/Signals.inc:563:22
 #1 0x000000000508c83e PrintStackTraceSignalHandler(void*)
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Unix/Signals.inc:630:1
 #2 0x000000000508a821 llvm::sys::RunSignalHandlers()
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Signals.cpp:71:20
 #3 0x000000000508c1cf SignalHandler(int)
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/Unix/Signals.inc:405:1
 #4 0x00007f9d2063d5e0 __restore_rt (/lib64/libpthread.so.0+0xf5e0)
 #5 0x00007f9d1f1b61f7 raise (/lib64/libc.so.6+0x351f7)
 #6 0x00007f9d1f1b78e8 abort (/lib64/libc.so.6+0x368e8)
 #7 0x0000000004fdae7c bindingsErrorHandler(void*,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, bool)
/iusers/ekeane1/workspaces/llvm-project/llvm/lib/Support/ErrorHandling.cpp:222:55
 #8 0x0000000008bdee51 fillAtomicQualLoc(clang::AtomicTypeLoc,
clang::DeclaratorChunk const&)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaType.cpp:6143:80
 #9 0x0000000008beeaaf clang::TypeLocVisitor<(anonymous
namespace)::DeclaratorLocFiller,
void>::VisitVectorTypeLoc(clang::VectorTypeLoc)
/iusers/ekeane1/workspaces/llvm-project/build/tools/clang/include/clang/AST/TypeNodes.inc:77:1
#10 0x0000000008becc8b clang::TypeLocVisitor<(anonymous
namespace)::DeclaratorLocFiller, void>::Visit(clang::UnqualTypeLoc)
/iusers/ekeane1/workspaces/llvm-project/build/tools/clang/include/clang/AST/TypeNodes.inc:77:1
#11 0x0000000008bdf673 GetTypeSourceInfoForDeclarator((anonymous
namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaType.cpp:6254:36
#12 0x0000000008bdcb2d GetFullTypeForDeclarator((anonymous
namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaType.cpp:5659:56
#13 0x0000000008bdcc1c clang::Sema::GetTypeForDeclarator(clang::Declarator&,
clang::Scope*)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaType.cpp:5678:34
#14 0x000000000810b845 clang::Sema::HandleDeclarator(clang::Scope*,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaDecl.cpp:5759:47
#15 0x000000000810a7e0 clang::Sema::ActOnDeclarator(clang::Scope*,
clang::Declarator&)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Sema/SemaDecl.cpp:5547:31
#16 0x0000000007e42e09
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/ParseDecl.cpp:2216:14
#17 0x0000000007e42430 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/ParseDecl.cpp:2039:35
#18 0x0000000007e23db8
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/Parser.cpp:1135:1
#19 0x0000000007e23e72
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/Parser.cpp:1150:57
#20 0x0000000007e23348
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (.localalias.1)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/Parser.cpp:970:58
#21 0x0000000007e2241b
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/Parser.cpp:716:42
#22 0x0000000007e21d1e
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/Parser.cpp:588:43
#23 0x0000000007e1db0e clang::ParseAST(clang::Sema&, bool, bool)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Parse/ParseAST.cpp:157:47
#24 0x0000000005c5f877 clang::ASTFrontendAction::ExecuteAction()
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1056:11
#25 0x0000000005c5f1a3 clang::FrontendAction::Execute()
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Frontend/FrontendAction.cpp:953:38
#26 0x0000000005bd15ed
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:991:42
#27 0x0000000005dd90de
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/iusers/ekeane1/workspaces/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#28 0x00000000024061f5 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/iusers/ekeane1/workspaces/llvm-project/clang/tools/driver/cc1_main.cpp:240:40
#29 0x00000000023fb2c7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/iusers/ekeane1/workspaces/llvm-project/clang/tools/driver/driver.cpp:330:20
#30 0x00000000023fb9c8 main
/iusers/ekeane1/workspaces/llvm-project/clang/tools/driver/driver.cpp:407:26
#31 0x00007f9d1f1a2c05 __libc_start_main (/lib64/libc.so.6+0x21c05)
#32 0x00000000023f9b69 _start (./bin/clang+0x23f9b69)
Aborted (core dumped)</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>