public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51488] New: ICE on infinite template recursion
@ 2011-12-09 23:09 cas43 at cs dot stanford.edu
  2013-08-10 21:06 ` [Bug c++/51488] " paolo.carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: cas43 at cs dot stanford.edu @ 2011-12-09 23:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51488

             Bug #: 51488
           Summary: ICE on infinite template recursion
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cas43@cs.stanford.edu


OFFENDING CODE:

template<class T,class U=void> struct s;
template<class T> struct s<T,typename s<T>::a> {};
s<int> ca;


HOW TO REPRODUCE:

g++ file.cpp


WHAT HAPPENS:

g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


WHICH COMPILERS PRODUDE THIS RESULT:

I have tried with 6 different versions of gcc, and it fails the same way with
each:

#1:
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/i-4.7/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/i-4.7/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.7/configure --prefix=/home/cas43/new-gcc/i-4.7
Thread model: posix
gcc version 4.7.0 20111208 (experimental) (GCC) 

#2:
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/i-4.6/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/i-4.6/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.6/configure --prefix=/home/cas43/new-gcc/i-4.6
Thread model: posix
gcc version 4.6.3 20111121 (prerelease) (GCC) 

#3:
Using built-in specs.
COLLECT_GCC=/home/cas43/new-gcc/i-4.5/bin/g++
COLLECT_LTO_WRAPPER=/home/cas43/new-gcc/i-4.5/libexec/gcc/x86_64-unknown-linux-gnu/4.5.4/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.5/configure --prefix=/home/cas43/new-gcc/i-4.5
Thread model: posix
gcc version 4.5.4 20111208 (prerelease) (GCC) 

#4:
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../s-4.4/configure --prefix=/home/cas43/new-gcc/i-4.4
Thread model: posix
gcc version 4.4.7 20111208 (prerelease) (GCC) 

#5:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc
--disable-werror --with-arch-32=i486 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) 

#6:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default
--with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/51488] ICE on infinite template recursion
  2011-12-09 23:09 [Bug c++/51488] New: ICE on infinite template recursion cas43 at cs dot stanford.edu
@ 2013-08-10 21:06 ` paolo.carlini at oracle dot com
  2013-08-11 10:03 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-10 21:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51488

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-08-10
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Related to c++/56163 and c++/58059.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/51488] ICE on infinite template recursion
  2011-12-09 23:09 [Bug c++/51488] New: ICE on infinite template recursion cas43 at cs dot stanford.edu
  2013-08-10 21:06 ` [Bug c++/51488] " paolo.carlini at oracle dot com
@ 2013-08-11 10:03 ` paolo.carlini at oracle dot com
  2013-08-22 19:39 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-11 10:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51488

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Manuel, looks like these 3 testcases are instances of the very same issue: our
template instantiation depth control mechanism doesn't handle this case. I'm
attaching below a piece of a stack trace, to show you the infinite recursion.

I seem to remember you did work in this area: any tips to handle this case too?

////////////////

#82 0x000000000060338e in instantiate_class_template (type=0x7ffff687eb28) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:9176
#83 0x00000000006e1e94 in complete_type (type=0x7ffff687eb28) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/typeck.c:131
#84 0x000000000061142b in tsubst (t=0x7ffff687e930, args=0x7ffff613d880,
complain=0, in_decl=0x0) at /scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:11815
#85 0x00000000006033fc in tsubst_template_arg (t=0x7ffff687e930,
args=0x7ffff613d880, complain=0, in_decl=0x0) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:9189
#86 0x000000000060549d in tsubst_template_args (t=0x7ffff613fe60,
args=0x7ffff613d880, complain=0, in_decl=0x0) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:9730
#87 0x0000000000610886 in tsubst (t=0x7ffff613fe60, args=0x7ffff613d880,
complain=0, in_decl=0x0) at /scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:11580
#88 0x000000000062f333 in get_class_bindings (main_tmpl=0x7ffff6878ac8,
tparms=0x7ffff688a800, spec_args=0x7ffff613fe60, args=0x7ffff688d528) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:18055
#89 0x0000000000630399 in most_specialized_class (type=0x7ffff687eb28,
tmpl=0x7ffff6878ac8, complain=3) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:18279
#90 0x0000000000600ad1 in instantiate_class_template_1 (type=0x7ffff687eb28) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:8665
#91 0x000000000060338e in instantiate_class_template (type=0x7ffff687eb28) at
/scratch/Gcc/svn-dirs/trunk/gcc/cp/pt.c:9176


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/51488] ICE on infinite template recursion
  2011-12-09 23:09 [Bug c++/51488] New: ICE on infinite template recursion cas43 at cs dot stanford.edu
  2013-08-10 21:06 ` [Bug c++/51488] " paolo.carlini at oracle dot com
  2013-08-11 10:03 ` paolo.carlini at oracle dot com
@ 2013-08-22 19:39 ` paolo.carlini at oracle dot com
  2013-09-07 19:34 ` paolo.carlini at oracle dot com
  2014-07-01 18:12 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-22 19:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51488

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Another one: c++/53618


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/51488] ICE on infinite template recursion
  2011-12-09 23:09 [Bug c++/51488] New: ICE on infinite template recursion cas43 at cs dot stanford.edu
                   ` (2 preceding siblings ...)
  2013-08-22 19:39 ` paolo.carlini at oracle dot com
@ 2013-09-07 19:34 ` paolo.carlini at oracle dot com
  2014-07-01 18:12 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-09-07 19:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51488

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Infinite recursion, which nothing stops. In the meanwhile I posted this:
http://gcc.gnu.org/ml/gcc-patches/2013-08/msg01348.html

I think those issue should be fixable relatively easily.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/51488] ICE on infinite template recursion
  2011-12-09 23:09 [Bug c++/51488] New: ICE on infinite template recursion cas43 at cs dot stanford.edu
                   ` (3 preceding siblings ...)
  2013-09-07 19:34 ` paolo.carlini at oracle dot com
@ 2014-07-01 18:12 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-01 18:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51488

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-01 18:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 23:09 [Bug c++/51488] New: ICE on infinite template recursion cas43 at cs dot stanford.edu
2013-08-10 21:06 ` [Bug c++/51488] " paolo.carlini at oracle dot com
2013-08-11 10:03 ` paolo.carlini at oracle dot com
2013-08-22 19:39 ` paolo.carlini at oracle dot com
2013-09-07 19:34 ` paolo.carlini at oracle dot com
2014-07-01 18:12 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).