public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project.
@ 2010-11-09 18:34 m.strashun at gmail dot com
  2010-11-09 18:40 ` [Bug c++/46400] " m.strashun at gmail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: m.strashun at gmail dot com @ 2010-11-09 18:34 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: g++ Segmentation Fault on heavily templated project.
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: m.strashun@gmail.com


[mist@fog h2d2]$ g++ -Wfatal-errors test_case.cpp 
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Attached file is generated from project with heavy Boost::Spirit2 usage ( C99
grammar parsing with AST building ). It definetely has a lot of template usage
errors in state that was attempted to compile, but can't say anything more -
g++ just crashed.

System: Arch Linux i686


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
@ 2010-11-09 18:40 ` m.strashun at gmail dot com
  2010-11-09 19:00 ` paolo.carlini at oracle dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: m.strashun at gmail dot com @ 2010-11-09 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Michael Strashun <m.strashun at gmail dot com> 2010-11-09 18:40:38 UTC ---
Preprocessed file to compile (too large to attach ):
http://www.mstr.lv/test_case.cpp


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
  2010-11-09 18:40 ` [Bug c++/46400] " m.strashun at gmail dot com
@ 2010-11-09 19:00 ` paolo.carlini at oracle dot com
  2010-11-09 19:36 ` m.strashun at gmail dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-11-09 19:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot
                   |                            |com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-11-09 19:00:29 UTC ---
If you compress it (which gzip, bzip2, or something else) for sure becomes much
smaller. It would be nice if you could try to reduce it a bit, by using delta,
maybe http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
  2010-11-09 18:40 ` [Bug c++/46400] " m.strashun at gmail dot com
  2010-11-09 19:00 ` paolo.carlini at oracle dot com
@ 2010-11-09 19:36 ` m.strashun at gmail dot com
  2010-11-09 19:43 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: m.strashun at gmail dot com @ 2010-11-09 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Michael Strashun <m.strashun at gmail dot com> 2010-11-09 19:36:37 UTC ---
It seems to me that bug reporting guideline prohibits attaching archives, but,
probably, I have misunderstood.

I ll try to do my best at reducing, but it is not fast and easy task at all -
project compilation time is about 2 mins for me and delta processing takes
ages. Original file is quite hard to reduce, too, because nothing will compile
at all if I remove any template-realated part - crash happens somewhere at main
grammar template resolution time.

I ll think what I can do about this.


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (2 preceding siblings ...)
  2010-11-09 19:36 ` m.strashun at gmail dot com
@ 2010-11-09 19:43 ` paolo.carlini at oracle dot com
  2010-11-09 19:44 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-11-09 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.11.09 19:43:05
     Ever Confirmed|0                           |1

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-11-09 19:43:05 UTC ---
Thanks. I don't see why an individual .ii compressed by a GNU tool should not
be ok. I'm taking care of that. Please experiment a bit with Delta and the
testcase reduction instructions, if you can...


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (3 preceding siblings ...)
  2010-11-09 19:43 ` paolo.carlini at oracle dot com
@ 2010-11-09 19:44 ` paolo.carlini at oracle dot com
  2010-11-10 12:08 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-11-09 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-11-09 19:44:16 UTC ---
Created attachment 22351
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22351
gzipped .ii


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (4 preceding siblings ...)
  2010-11-09 19:44 ` paolo.carlini at oracle dot com
@ 2010-11-10 12:08 ` rguenth at gcc dot gnu.org
  2010-11-10 12:37 ` m.strashun at gmail dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-11-10 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
           Severity|major                       |normal

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-10 12:08:05 UTC ---
We run out of stack space when garbage collecting by means of too deep
recursion (I see 99% gt_ggc_mx_lang_tree_node in the backtrace,
1% gt_ggc_mx_VEC_qualified_typedef_usage_t_gc).

The testcase is probably not easy to reduce, so I wouldn't waste my time.

A workaround is to up stack space with ulimit -s (64MB worked for me).

Note that the testcase throws errors after doing that.


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (5 preceding siblings ...)
  2010-11-10 12:08 ` rguenth at gcc dot gnu.org
@ 2010-11-10 12:37 ` m.strashun at gmail dot com
  2011-06-23 19:29 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: m.strashun at gmail dot com @ 2010-11-10 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Michael Strashun <m.strashun at gmail dot com> 2010-11-10 12:37:47 UTC ---
Workaround helped, thanks. Errors were supposed to be, so everything is
alright.

Reducing with delta looks quite not possible to me : after about a day of
processing it managed to cut out only several thousand lines of cound from more
than 100 000.


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (6 preceding siblings ...)
  2010-11-10 12:37 ` m.strashun at gmail dot com
@ 2011-06-23 19:29 ` paolo.carlini at oracle dot com
  2011-06-24 10:25 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-06-23 19:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-06-23 19:28:53 UTC ---
Richard, what should we do here?


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (7 preceding siblings ...)
  2011-06-23 19:29 ` paolo.carlini at oracle dot com
@ 2011-06-24 10:25 ` jakub at gcc dot gnu.org
  2011-06-24 21:11 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-24 10:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-24 10:24:36 UTC ---
Created attachment 24590
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24590
gcc47-pr46400.patch

This seems to fix it for me, otherwise untested.
TREE_CHAIN for types, if I understand it right, is either NULL, or contains
TYPE_DECL, so IMHO it doesn't make much sense to consider it as chain_next.
Even if the TYPE_DECL has a long TYPE_CHAIN itself, that long chain would be
handled when handling the TYPE_DECL, so would result in at most one extra
frame.
But TYPE_NEXT_VARIANT is potentially long chain.


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (8 preceding siblings ...)
  2011-06-24 10:25 ` jakub at gcc dot gnu.org
@ 2011-06-24 21:11 ` jakub at gcc dot gnu.org
  2011-06-24 21:30 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-24 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-24 21:11:19 UTC ---
Author: jakub
Date: Fri Jun 24 21:11:16 2011
New Revision: 175389

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175389
Log:
    PR c++/46400
    * cp-tree.h (union lang_tree_node): Use TYPE_NEXT_VARIANT
    instead of TYPE_CHAIN for chain_next for types.

    * c-decl.c (union lang_tree_node): Use TYPE_NEXT_VARIANT
    instead of TYPE_CHAIN for chain_next for types.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (9 preceding siblings ...)
  2011-06-24 21:11 ` jakub at gcc dot gnu.org
@ 2011-06-24 21:30 ` paolo.carlini at oracle dot com
  2011-06-26 16:52 ` jakub at gcc dot gnu.org
  2012-04-12 19:17 ` bergner at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-06-24 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-06-24 21:29:33 UTC ---
Thanks Jakub.


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (10 preceding siblings ...)
  2011-06-24 21:30 ` paolo.carlini at oracle dot com
@ 2011-06-26 16:52 ` jakub at gcc dot gnu.org
  2012-04-12 19:17 ` bergner at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-26 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-26 16:52:03 UTC ---
Fixed.  I'll adjust chain_next to use inline as requested by rth as a
follow-up.


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

* [Bug c++/46400] g++ Segmentation Fault on heavily templated project.
  2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
                   ` (11 preceding siblings ...)
  2011-06-26 16:52 ` jakub at gcc dot gnu.org
@ 2012-04-12 19:17 ` bergner at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: bergner at gcc dot gnu.org @ 2012-04-12 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Peter Bergner <bergner at gcc dot gnu.org> 2012-04-12 19:16:16 UTC ---
Created attachment 27145
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27145
Test case from EMAN2

Here's yet another test case that fails (on powerpc64-linux) and is fixed on
mainline with Jakub's patch.  However, we encountered this using GCC 4.6. 
Jakub, is it possible to backport your patch to FSF 4.6?

I looked at backporting the patch myself, but I'm not really sure what all that
GC magic macro stuff is doing to feel confident in backporting it myself.


bergner@bns:~/gcc/BUGS>
/home/bergner/gcc/install/gcc-fsf-mainline-r175389/bin/g++ -m64 -mcpu=power7
-O0 -ffast-math -fPIC -S libpyEMData2.ii 
bergner@bns:~/gcc/BUGS> echo $?
0
bergner@bns:~/gcc/BUGS>
/home/bergner/gcc/install/gcc-fsf-mainline-r175388/bin/g++ -m64 -mcpu=power7
-O0 -ffast-math -fPIC -S libpyEMData2.ii 
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.


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

end of thread, other threads:[~2012-04-12 19:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-09 18:34 [Bug c++/46400] New: g++ Segmentation Fault on heavily templated project m.strashun at gmail dot com
2010-11-09 18:40 ` [Bug c++/46400] " m.strashun at gmail dot com
2010-11-09 19:00 ` paolo.carlini at oracle dot com
2010-11-09 19:36 ` m.strashun at gmail dot com
2010-11-09 19:43 ` paolo.carlini at oracle dot com
2010-11-09 19:44 ` paolo.carlini at oracle dot com
2010-11-10 12:08 ` rguenth at gcc dot gnu.org
2010-11-10 12:37 ` m.strashun at gmail dot com
2011-06-23 19:29 ` paolo.carlini at oracle dot com
2011-06-24 10:25 ` jakub at gcc dot gnu.org
2011-06-24 21:11 ` jakub at gcc dot gnu.org
2011-06-24 21:30 ` paolo.carlini at oracle dot com
2011-06-26 16:52 ` jakub at gcc dot gnu.org
2012-04-12 19:17 ` bergner 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).