<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - crash on invalid c++ code on x86_64-linux-gnu (segmentation fault, c++ template)"
   href="https://llvm.org/bugs/show_bug.cgi?id=30459">30459</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash on invalid c++ code on x86_64-linux-gnu (segmentation fault, c++ template)
          </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>Windows NT
          </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>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang-trunk -v
clang version 4.0.0 (trunk 281908) (llvm/trunk 281907)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ clang-trunk small.C
small.C:2:31: fatal error: recursive template instantiation exceeded maximum
depth of 1024
template <class> struct A { C<A<A>::x> c; };                                    
                              ^                                                 
#0 0x0000000001c9e155 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c9e155)
#1 0x0000000001c9c0fe llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1c9c0fe)
#2 0x0000000001c9c262 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1c9c262)
#3 0x00007f955e429340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00000000032c6004 clang::TemplateArgument::print(clang::PrintingPolicy
const&, llvm::raw_ostream&) const
(/usr/local/clang-trunk/bin/clang-4.0+0x32c6004)
#5 0x00000000032df63f
clang::TemplateSpecializationType::PrintTemplateArgumentList(llvm::raw_ostream&,
llvm::ArrayRef<clang::TemplateArgument>, clang::PrintingPolicy const&, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x32df63f)
#6 0x00000000032e05a0 (anonymous
namespace)::TypePrinter::printTag(clang::TagDecl*, llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x32e05a0)
#7 0x00000000032e3011 (anonymous
namespace)::TypePrinter::printBefore(clang::Type const*, clang::Qualifiers,
llvm::raw_ostream&) (/usr/local/clang-trunk/bin/clang-4.0+0x32e3011)
#8 0x00000000032e1da7 (anonymous namespace)::TypePrinter::print(clang::Type
const*, clang::Qualifiers, llvm::raw_ostream&, llvm::StringRef)
(/usr/local/clang-trunk/bin/clang-4.0+0x32e1da7)
#9 0x00000000032e1ec1 clang::QualType::print(clang::Type const*,
clang::Qualifiers, llvm::raw_ostream&, clang::PrintingPolicy const&,
llvm::Twine const&, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x32e1ec1)
#10 0x00000000032c6009 clang::TemplateArgument::print(clang::PrintingPolicy
const&, llvm::raw_ostream&) const
(/usr/local/clang-trunk/bin/clang-4.0+0x32c6009)
#11 0x00000000032df63f
clang::TemplateSpecializationType::PrintTemplateArgumentList(llvm::raw_ostream&,
llvm::ArrayRef<clang::TemplateArgument>, clang::PrintingPolicy const&, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x32df63f)
#12 0x00000000032e05a0 (anonymous
namespace)::TypePrinter::printTag(clang::TagDecl*, llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x32e05a0)
#13 0x00000000032e3011 (anonymous
namespace)::TypePrinter::printBefore(clang::Type const*, clang::Qualifiers,
llvm::raw_ostream&) (/usr/local/clang-trunk/bin/clang-4.0+0x32e3011)
#14 0x00000000032e1da7 (anonymous namespace)::TypePrinter::print(clang::Type
const*, clang::Qualifiers, llvm::raw_ostream&, llvm::StringRef)
(/usr/local/clang-trunk/bin/clang-4.0+0x32e1da7)
#15 0x00000000032e1ec1 clang::QualType::print(clang::Type const*,
clang::Qualifiers, llvm::raw_ostream&, clang::PrintingPolicy const&,
llvm::Twine const&, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x32e1ec1)
#16 0x00000000032c6009 clang::TemplateArgument::print(clang::PrintingPolicy
const&, llvm::raw_ostream&) const
(/usr/local/clang-trunk/bin/clang-4.0+0x32c6009)
#17 0x00000000032df63f
clang::TemplateSpecializationType::PrintTemplateArgumentList(llvm::raw_ostream&,
llvm::ArrayRef<clang::TemplateArgument>, clang::PrintingPolicy const&, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x32df63f)
#18 0x00000000032e05a0 (anonymous
namespace)::TypePrinter::printTag(clang::TagDecl*, llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x32e05a0)
........................................
189.    small.C:2:25: instantiating class definition
'A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<int>
<span class="quote">> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > >'</span >
190.    small.C:2:25: instantiating class definition
'A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<int>
<span class="quote">> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > >'</span >
191.    small.C:2:25: instantiating class definition
'A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<int>
<span class="quote">> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > >'</span >
192.    small.C:2:25: instantiating class definition
'A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<int>
<span class="quote">> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > >'</span >
193.    small.C:2:25: instantiating class definition
'A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<int>
<span class="quote">> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >'</span >
194.    small.C:2:25: instantiating class definition 'A<clang-4.0: error:
unable to execute command: Segmentation fault (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 281908) (llvm/trunk 281907)                          
Target: x86_64-unknown-linux-gnu                                                
Thread model: posix                                                             
InstalledDir: /usr/bin                                                          
clang-4.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-4.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-4.0: note: diagnostic msg: /tmp/small-ae7b98.cpp                          
clang-4.0: note: diagnostic msg: /tmp/small-ae7b98.sh                           
clang-4.0: note: diagnostic msg:                                                

********************                
$ cat small.C
template <int> struct C;
template <class> struct A { C<A<A>::x> c; };
A<int> a;</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>