[LLVMbugs] [Bug 17493] New: infinite loop for clang -cc1 -undef -ast-dump-xml sample.cpp

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 7 06:35:26 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17493

            Bug ID: 17493
           Summary: infinite loop for  clang -cc1 -undef -ast-dump-xml
                    sample.cpp
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey154 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hello

I got following problem out of clang 3.4 (trunk)
While trying to dump xml out of

template <class D>
class scoped_ptr_impl {
  template <typename V> friend class scoped_ptr_impl;
};
scoped_ptr_impl<char> bla;

snippet i got infinite loop of friend template instantiations.
The example is taken from WebKit source code and minimized.

Steps to reproduce:
$ echo "\
> template <class D> \
> class scoped_ptr_impl { \
>   template <typename V> friend class scoped_ptr_impl; \
> }; \
> scoped_ptr_impl<char> bla; \
> " > sample.cpp
$ clang -cc1 -undef -ast-dump-xml  sample.cpp 2>&1 | tee out.txt
... goes into infinite loop
$ cat out.txt | less
...
 <ClassTemplate ptr="0x4ee6400" name="scoped_ptr_impl">
  <template_parameters>
   <TemplateTypeParm ptr="0x4ee62c0" name="D" typeptr="0x4ee6330" depth="0"
index="0"/>
  </template_parameters>
  <CXXRecord ptr="0x4ee6370" name="scoped_ptr_impl" typeptr="0x4ee65f0">
   <CXXRecord ptr="0x4f1f8d0" name="scoped_ptr_impl" typeptr="0x4ee65f0"/>
   <Friend ptr="0x4f1fb10">
    <ClassTemplate ptr="0x4f1faa0" name="scoped_ptr_impl" previous="0x4ee6400">
     <template_parameters>
      <TemplateTypeParm ptr="0x4f1f960" name="V" typeptr="0x4f1f9d0" depth="1"
index="0"/>
     </template_parameters>
     <CXXRecord ptr="0x4f1fa10" name="scoped_ptr_impl" typeptr="0x4ee65f0"
previous="0x4ee6370"/>
     <instantiation>
      <template_arguments>
       <BuiltinType ptr="0x4ee59a0" canonical="0x4ee59a0"/>
      </template_arguments>
      <ClassTemplateSpecialization ptr="0x4f1fb70" name="scoped_ptr_impl"
typeptr="0x4f1fc50">
       <CXXRecord ptr="0x4f1fde0" name="scoped_ptr_impl" typeptr="0x4f1fc50"
previous="0x4f1fb70"/>
       <Friend ptr="0x4f1fff0">
        <ClassTemplate ptr="0x4f1ff80" name="scoped_ptr_impl"
previous="0x4f1faa0">
         <template_parameters>
          <TemplateTypeParm ptr="0x4f1fe70" name="V" typeptr="0x4f1feb0"
depth="0" index="0"/>
         </template_parameters>
         <CXXRecord ptr="0x4f1fef0" name="scoped_ptr_impl" typeptr="0x4ee65f0"
previous="0x4f1fa10"/>
         <instantiation>
          <template_arguments>
           <BuiltinType ptr="0x4ee59a0" canonical="0x4ee59a0"/>
          </template_arguments>
          <ClassTemplateSpecialization ptr="0x4f1fb70" name="scoped_ptr_impl"
typeptr="0x4f1fc50">
           <CXXRecord ptr="0x4f1fde0" name="scoped_ptr_impl"
typeptr="0x4f1fc50" previous="0x4f1fb70"/>
           <Friend ptr="0x4f1fff0">
...
looping friend template instatntiation...

I will try to fix it. But your help will be appreciated :)
Kind regards,
Andrey Fedorov

-- 
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/20131007/4e529464/attachment.html>


More information about the llvm-bugs mailing list