public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58430] New: GCC hangs with 100% cpu core utilization during template compilation
@ 2013-09-16  6:37 apirogov@manage-it.ru
  2013-09-16  8:14 ` [Bug c++/58430] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: apirogov@manage-it.ru @ 2013-09-16  6:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58430
           Summary: GCC hangs with 100% cpu core utilization during
                    template compilation
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: apirogov@manage-it.ru

The next code leads hanging up of the compiler:

template<unsigned I1, unsigned I2>
void test()
{
    test<I1 + ((I2 - I1) / 2) + 1, I2>();
    test<I1, I1 + ((I2 - I1) / 2) >();
};

int main() 
{
    test<0, 0>();
    return 0;
}


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

* [Bug c++/58430] GCC hangs with 100% cpu core utilization during template compilation
  2013-09-16  6:37 [Bug c++/58430] New: GCC hangs with 100% cpu core utilization during template compilation apirogov@manage-it.ru
@ 2013-09-16  8:14 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-09-16  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
You are instantitating 2^900 templates which will take quite some time.
Lower -ftemplate-depth to something reasonable (the default is 900) to
get an error:

> g++-4.7 -S t.C -ftemplate-depth=3
t.C:4:3: error: template instantiation depth exceeds maximum of 3 (use
-ftemplate-depth= to increase the maximum) substituting 'template<unsigned int
I1, unsigned int I2> void test() [with unsigned int I1 = 3221225473u; unsigned
int I2 = 0u]'
t.C:4:3:   recursively required from 'void test() [with unsigned int I1 = 1u;
unsigned int I2 = 0u]'
t.C:4:3:   required from 'void test() [with unsigned int I1 = 0u; unsigned int
I2 = 0u]'
t.C:10:14:   required from here

Or limit instantiation by providing a terminating specialization.


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

end of thread, other threads:[~2013-09-16  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-16  6:37 [Bug c++/58430] New: GCC hangs with 100% cpu core utilization during template compilation apirogov@manage-it.ru
2013-09-16  8:14 ` [Bug c++/58430] " rguenth at gcc dot gnu.org

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).