[llvm-bugs] [Bug 51933] New: Accessing invalid member of template class in other namespace causes ICE

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 21 21:04:04 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51933

            Bug ID: 51933
           Summary: Accessing invalid member of template class in other
                    namespace causes ICE
           Product: clang
           Version: 9.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haydenflinner at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The following code triggers an ICE / segfault in older clangs, on the later
ones it simply errors out with return code 254 (and no error message or other
info):

namespace abc {  // Yes, the namespace is necessary
template<typename T>
struct BusinessLogic {};
} // namespace abc

int main()
{
    abc::BusinessLogic.ArbitraryStringHere;
}

--
Error:

1.      <source>:8:10: current parser token 'BusinessLogic'
2.      <source>:7:1: parsing function body 'main'
3.      <source>:7:1: in compound statement ('{}')
  #0 0x000055d6cedd6f7a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x27d6f7a)
  #1 0x000055d6cedd4d44 llvm::sys::RunSignalHandlers()
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x27d4d44)
  #2 0x000055d6cedd4e82 SignalHandler(int)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x27d4e82)
  #3 0x00007f6777a853c0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
  #4 0x000055d6d0bebc9c clang::DeclContext::lookup(clang::DeclarationName)
const (/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x45ebc9c)
  #5 0x000055d6d0760a05 LookupDirect(clang::Sema&, clang::LookupResult&,
clang::DeclContext const*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x4160a05)
  #6 0x000055d6d0761490 clang::Sema::LookupQualifiedName(clang::LookupResult&,
clang::DeclContext*, bool) (.part.1132)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x4161490)
  #7 0x000055d6d0504581 clang::Sema::getTypeName(clang::IdentifierInfo const&,
clang::SourceLocation, clang::Scope*, clang::CXXScopeSpec*, bool, bool,
clang::OpaquePtr<clang::QualType>, bool, bool, bool, clang::IdentifierInfo**)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3f04581)
  #8 0x000055d6d02f52cb
clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(clang::CXXScopeSpec&,
bool) (/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3cf52cb)
  #9 0x000055d6d02f7e9f clang::Parser::TryAnnotateTypeOrScopeToken()
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3cf7e9f)
 #10 0x000055d6d03a20a5
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da20a5)
 #11 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
...
#253 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
#254 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
#255 0x000055d6d03a27ef
clang::Parser::isCXXDeclarationSpecifier(clang::Parser::TPResult, bool*)
(/opt/compiler-explorer/clang-9.0.1/bin/clang-9+0x3da27ef)
clang-9: error: unable to execute command: Segmentation fault (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
Compiler returned: 254


--

https://godbolt.org/z/rTfGWGdPz

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210922/5b81f9c7/attachment-0001.html>


More information about the llvm-bugs mailing list