public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
@ 2012-01-02 20:04 blog at tessarakt dot de
  2012-01-02 20:11 ` [Bug c++/51737] " blog at tessarakt dot de
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: blog at tessarakt dot de @ 2012-01-02 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51737
           Summary: g++ crashes (internal compiler error: Segmentation
                    fault) when compiling quickbook
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: blog@tessarakt.de


g++ crashes when compiling quickbook from the Boost documentation.

Command line and output follows, preprocessed source is attached.

$ LC_ALL=C LANG=C "g++" -v -save-temps  -ftemplate-depth-300 -O3
-finline-functions -Wno-inline -Wall -g0 -DBOOST_ALL_NO_LIB=1
-DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG  -I".."
-c -o
"../bin.v2/tools/quickbook/src/gcc-4.6.1/release/link-static/id_manager.o"
"/home/jens/devel/boost-trunk/tools/quickbook/src/id_manager.cpp"
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin
--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.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-ftemplate-depth=300' '-O3'
'-finline-functions' '-Wno-inline' '-Wall' '-g0' '-D' 'BOOST_ALL_NO_LIB=1' '-D'
'BOOST_FILESYSTEM_NO_DEPRECATED' '-D' 'BOOST_SYSTEM_STATIC_LINK=1' '-D'
'NDEBUG' '-I' '..' '-c' '-o'
'../bin.v2/tools/quickbook/src/gcc-4.6.1/release/link-static/id_manager.o'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1plus -E -quiet -v -I .. -imultilib .
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE -D BOOST_ALL_NO_LIB=1 -D
BOOST_FILESYSTEM_NO_DEPRECATED -D BOOST_SYSTEM_STATIC_LINK=1 -D NDEBUG
/home/jens/devel/boost-trunk/tools/quickbook/src/id_manager.cpp -mtune=generic
-march=x86-64 -Wno-inline -Wall -ftemplate-depth=300 -finline-functions -O3
-fpch-preprocess -fstack-protector -o id_manager.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 ..
 /usr/include/c++/4.6
 /usr/include/c++/4.6/x86_64-linux-gnu/.
 /usr/include/c++/4.6/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.6.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.6.1/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-ftemplate-depth=300' '-O3'
'-finline-functions' '-Wno-inline' '-Wall' '-g0' '-D' 'BOOST_ALL_NO_LIB=1' '-D'
'BOOST_FILESYSTEM_NO_DEPRECATED' '-D' 'BOOST_SYSTEM_STATIC_LINK=1' '-D'
'NDEBUG' '-I' '..' '-c' '-o'
'../bin.v2/tools/quickbook/src/gcc-4.6.1/release/link-static/id_manager.o'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1plus -fpreprocessed id_manager.ii
-quiet -dumpbase id_manager.cpp -mtune=generic -march=x86-64 -auxbase-strip
../bin.v2/tools/quickbook/src/gcc-4.6.1/release/link-static/id_manager.o -g0
-O3 -Wno-inline -Wall -version -ftemplate-depth=300 -finline-functions
-fstack-protector -o id_manager.s
GNU C++ (Ubuntu/Linaro 4.6.1-9ubuntu3) version 4.6.1 (x86_64-linux-gnu)
        compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version
3.0.1-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (Ubuntu/Linaro 4.6.1-9ubuntu3) version 4.6.1 (x86_64-linux-gnu)
        compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version
3.0.1-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 63a745aba0054d1605090177d8e4bbb4
In file included from ../boost/intrusive_ptr.hpp:16:0,
                 from
/home/jens/devel/boost-trunk/tools/quickbook/src/fwd.hpp:15,
                 from
/home/jens/devel/boost-trunk/tools/quickbook/src/values.hpp:20,
                 from
/home/jens/devel/boost-trunk/tools/quickbook/src/id_manager.hpp:14,
                 from
/home/jens/devel/boost-trunk/tools/quickbook/src/id_manager.cpp:9:
../boost/smart_ptr/intrusive_ptr.hpp: In destructor
'boost::intrusive_ptr<T>::~intrusive_ptr() [with T = quickbook::file_info]':
../boost/smart_ptr/intrusive_ptr.hpp:94:5: internal compiler error:
Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccp8PLF3.out file, please attach this to
your bugreport.


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

* [Bug c++/51737] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
@ 2012-01-02 20:11 ` blog at tessarakt dot de
  2012-01-02 20:21 ` blog at tessarakt dot de
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: blog at tessarakt dot de @ 2012-01-02 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jens Müller <blog at tessarakt dot de> 2012-01-02 20:10:51 UTC ---
Created attachment 26222
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26222
preprocessed source

(bzip2'ed because of excessive size)


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

* [Bug c++/51737] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
  2012-01-02 20:11 ` [Bug c++/51737] " blog at tessarakt dot de
@ 2012-01-02 20:21 ` blog at tessarakt dot de
  2012-01-02 20:40 ` paolo.carlini at oracle dot com
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: blog at tessarakt dot de @ 2012-01-02 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jens Müller <blog at tessarakt dot de> 2012-01-02 20:21:41 UTC ---
Someone on IRC confirmed that 4.6.2 also crashes.


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

* [Bug c++/51737] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
  2012-01-02 20:11 ` [Bug c++/51737] " blog at tessarakt dot de
  2012-01-02 20:21 ` blog at tessarakt dot de
@ 2012-01-02 20:40 ` paolo.carlini at oracle dot com
  2012-01-02 21:21 ` blog at tessarakt dot de
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-02 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-02 20:40:31 UTC ---
Please, do your best to reduce the testcase to a manageable size, it's normally
rather doable with tools like delta:

  http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction


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

* [Bug c++/51737] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (2 preceding siblings ...)
  2012-01-02 20:40 ` paolo.carlini at oracle dot com
@ 2012-01-02 21:21 ` blog at tessarakt dot de
  2012-01-02 21:23 ` paolo.carlini at oracle dot com
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: blog at tessarakt dot de @ 2012-01-02 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jens Müller <blog at tessarakt dot de> 2012-01-02 21:20:48 UTC ---
Thanks, delta is running. I'll send a result in a few hours :-)


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

* [Bug c++/51737] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (3 preceding siblings ...)
  2012-01-02 21:21 ` blog at tessarakt dot de
@ 2012-01-02 21:23 ` paolo.carlini at oracle dot com
  2012-01-03  4:17 ` blog at tessarakt dot de
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-01-02 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-01-02 21:22:46 UTC ---
Great ;) topformat is also useful, iterating between the two as explained in
the wiki, that is.


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

* [Bug c++/51737] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (4 preceding siblings ...)
  2012-01-02 21:23 ` paolo.carlini at oracle dot com
@ 2012-01-03  4:17 ` blog at tessarakt dot de
  2012-01-03  9:21 ` [Bug tree-optimization/51737] [4.6 Regression] " rguenth at gcc dot gnu.org
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: blog at tessarakt dot de @ 2012-01-03  4:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jens Müller <blog at tessarakt dot de> 2012-01-03 04:17:07 UTC ---
Created attachment 26223
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26223
reduced testcase

OK, I don't get it any smaller ...


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (5 preceding siblings ...)
  2012-01-03  4:17 ` blog at tessarakt dot de
@ 2012-01-03  9:21 ` rguenth at gcc dot gnu.org
  2012-01-03 16:00 ` rguenth at gcc dot gnu.org
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-03  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-03
          Component|c++                         |tree-optimization
      Known to work|                            |4.5.3
   Target Milestone|---                         |4.6.3
            Summary|g++ crashes (internal       |[4.6 Regression] g++
                   |compiler error:             |crashes (internal compiler
                   |Segmentation fault) when    |error: Segmentation fault)
                   |compiling quickbook         |when compiling quickbook
     Ever Confirmed|0                           |1

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-03 09:21:16 UTC ---
Confirmed (on the unreduced testcase) with 4.6.2 and the 4.6 branch head
with just -O2:

#0  0x0000000000b7f910 in delete_unreachable_blocks_update_callgraph (
    id=<optimized out>)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/tree-inline.c:4972
#1  0x0000000000b8d2b0 in tree_function_versioning (old_decl=0x7ffff1f18f00, 
    new_decl=0x7ffff0649600, tree_map=<optimized out>, 
    update_clones=128 '\200', args_to_skip=<optimized out>, 
    blocks_to_copy=0x0, new_entry=0x0)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/tree-inline.c:5232
#2  0x0000000000b52961 in save_inline_function_body (node=0x7ffff1886160)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/cgraphunit.c:2149
#3  0x0000000000b5c1f8 in inline_transform (node=0x7ffff1886160)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/ipa-inline.c:2122
#4  inline_transform (node=0x7ffff1886160)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/ipa-inline.c:2108

does not reproduce on trunk, but that may be artificial.

Re-reducing.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (6 preceding siblings ...)
  2012-01-03  9:21 ` [Bug tree-optimization/51737] [4.6 Regression] " rguenth at gcc dot gnu.org
@ 2012-01-03 16:00 ` rguenth at gcc dot gnu.org
  2012-01-05 16:16 ` jamborm at gcc dot gnu.org
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-03 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu.org
      Known to work|                            |4.7.0

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-03 15:59:53 UTC ---
Testcase, ICEs at -O2, works on trunk.  The code we ICE on is the same
on the branch and trunk, so maybe the issue is still latent there or maybe
we fixed it elsewhere.  -fno-ipa-sra fixes it on the branch.

template<class T> class intrusive_ptr {
public:
    ~intrusive_ptr() { intrusive_ptr_release( px ); }
    T * px;
};
template <typename T>     struct intrusive_base     {
    friend void intrusive_ptr_release(T* ptr) { delete ptr; }
};
struct section_info;
struct file_info : intrusive_base<file_info> {
    intrusive_ptr<file_info> parent;
    intrusive_ptr<section_info> switched_section;
};
struct section_info : intrusive_base<section_info> {
    intrusive_ptr<section_info> parent;
};
struct id_state {
    void * start_file(void);
};
void * id_state::start_file(void) {
    intrusive_ptr<file_info> parent;
}
struct id_generation_data : intrusive_base<id_generation_data> {
    void child_length() const {}
};
void generate_id(id_generation_data& generation_data)
{
  generation_data.child_length();
}


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (7 preceding siblings ...)
  2012-01-03 16:00 ` rguenth at gcc dot gnu.org
@ 2012-01-05 16:16 ` jamborm at gcc dot gnu.org
  2012-01-06 12:02 ` jamborm at gcc dot gnu.org
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-01-05 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-01-05 16:16:29 UTC ---
I can reproduce the segfault when compiling both the testcase from
comment #8 and the original unreduced test case on the 4.6 branch but
not on my trunk checkout (revision 182785).  I will have a look at
what is going on nevertheless.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (8 preceding siblings ...)
  2012-01-05 16:16 ` jamborm at gcc dot gnu.org
@ 2012-01-06 12:02 ` jamborm at gcc dot gnu.org
  2012-01-09 22:42 ` jamborm at gcc dot gnu.org
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-01-06 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #10 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-01-06 12:02:04 UTC ---
This bug is not triggered when IPA-SRA is switched off, however, from
what I have seen in the debugger, I don't think the bug is in IPA-SRA
but that it is in fact an inlining problem (and also very probably
just latent on trunk).

The immediate reason for the segfault is that one of very many inline
clones of "intrusive_ptr<T>::~intrusive_ptr() [with T = file_info]"
have NULL clone_of pointer.  Looking more into why, I noticed that
immediately before the crash id->dst_node->clones is NULL too, which
should not happen since this code is guarded by a condition that this
pointer is not NULL.

Therefore I assume that the real problem is that it is not safe to
call cgraph_remove_node_and_inline_clones on "inlined recursive" edges
from delete_unreachable_blocks_update_callgraph since it destroys the
clone tree we are traversing.

Currently I do not know what to do about this other than push the
nodes to be deleted on a stack and remove after the traversal.
Honza, do you have a better idea?


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (9 preceding siblings ...)
  2012-01-06 12:02 ` jamborm at gcc dot gnu.org
@ 2012-01-09 22:42 ` jamborm at gcc dot gnu.org
  2012-02-29 12:27 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jamborm at gcc dot gnu.org @ 2012-01-09 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Martin Jambor <jamborm at gcc dot gnu.org> 2012-01-09 22:42:00 UTC ---
The problem is much more fundamental than just a clone removal while
also walking the clones of the same function although that is the
reason why we segfault.  But that would be almost easy to solve.

The bigger problem is indeed materialization of recursive loads
itself: We have a function that calls itself twice and some of these
calls and their calls are scheduled to be recursively inlined.  When
the decisions are to be carried out, we recognize we need to save a
copy of the body to copy from somewhere and so we call
save_inline_function_body.  That function elects a clone to "own" the
body copy and calls tree_function_versioning to copy it.  And
tree_function_versioning calls the problematic
delete_unreachable_blocks_update_callgraph which analyzes CFG and
finds some BBs unreachable - I'm not quite sure what made them so
suddenly unreachable, but it almost certainly has something to do with
EH BBs that somehow are stale at that point.  And so the function
begins to nuke respective call graph edges and also call graph nodes
of respective inlined callees and their inlined callees and... and
sure enough it decides to delete the node that
save_inline_function_body chose to hold the new body, in other words
it intends to delete id->dst_node of currently running
tree_function_versioning.

Thus even if we taught delete_unreachable_blocks_update_callgraph to
be more careful about deleted nodes, tree_function_versioning would
fail nevertheless.

I'm wondering whether we could just skip
delete_unreachable_blocks_update_callgraph when
tree_function_versioning is called from within
save_inline_function_body, though I can imagine the verifier could
complain about something.  I have to run now, will experiment more
tomorrow.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (10 preceding siblings ...)
  2012-01-09 22:42 ` jamborm at gcc dot gnu.org
@ 2012-02-29 12:27 ` rguenth at gcc dot gnu.org
  2012-02-29 15:07 ` hubicka at ucw dot cz
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-29 12:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-29 12:09:19 UTC ---
The question is why we call delete_unreachable_blocks from
tree_function_versioning at all.  We do not bother updating the
callgraph anywhere else.

Honza, you added that beast?


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (11 preceding siblings ...)
  2012-02-29 12:27 ` rguenth at gcc dot gnu.org
@ 2012-02-29 15:07 ` hubicka at ucw dot cz
  2012-02-29 15:18 ` hubicka at gcc dot gnu.org
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at ucw dot cz @ 2012-02-29 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jan Hubicka <hubicka at ucw dot cz> 2012-02-29 15:01:31 UTC ---
> The question is why we call delete_unreachable_blocks from
> tree_function_versioning at all.  We do not bother updating the
> callgraph anywhere else.
> 
> Honza, you added that beast?

Well, after clonning we alter CFG and we need to update SSA for which we need
to update dominators and those needs unreachable blocks gone.  I will look into
this.

Honza


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (12 preceding siblings ...)
  2012-02-29 15:07 ` hubicka at ucw dot cz
@ 2012-02-29 15:18 ` hubicka at gcc dot gnu.org
  2012-02-29 15:24 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-02-29 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |hubicka at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #14 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-02-29 15:15:46 UTC ---
mine.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (13 preceding siblings ...)
  2012-02-29 15:18 ` hubicka at gcc dot gnu.org
@ 2012-02-29 15:24 ` rguenth at gcc dot gnu.org
  2012-02-29 15:27 ` hubicka at ucw dot cz
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-02-29 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-29 15:17:33 UTC ---
(In reply to comment #13)
> > The question is why we call delete_unreachable_blocks from
> > tree_function_versioning at all.  We do not bother updating the
> > callgraph anywhere else.
> > 
> > Honza, you added that beast?
> 
> Well, after clonning we alter CFG and we need to update SSA for which we need
> to update dominators and those needs unreachable blocks gone.  I will look into
> this.

Ok - but why bother updating the callgraph?


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (14 preceding siblings ...)
  2012-02-29 15:24 ` rguenth at gcc dot gnu.org
@ 2012-02-29 15:27 ` hubicka at ucw dot cz
  2012-03-01 14:47 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at ucw dot cz @ 2012-02-29 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jan Hubicka <hubicka at ucw dot cz> 2012-02-29 15:24:18 UTC ---
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51737
> 
> --- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-29 15:17:33 UTC ---
> (In reply to comment #13)
> > > The question is why we call delete_unreachable_blocks from
> > > tree_function_versioning at all.  We do not bother updating the
> > > callgraph anywhere else.
> > > 
> > > Honza, you added that beast?
> > 
> > Well, after clonning we alter CFG and we need to update SSA for which we need
> > to update dominators and those needs unreachable blocks gone.  I will look into
> > this.
> 
> Ok - but why bother updating the callgraph?

Because the edges still hold important information about inlining and
redirecting, so we can not rebuild callgraph because the info would be lost.
Ignoring the update would result in ill formed callgraph with missing/stale
edges that is probably way to hell, too. So I opted to write code to keep it up
to date.

This is all part of the materialization clones: we do have virtual clones of
single function, each with different parameters and different redirection of
it. With materialization we need to build the bodies in one step, update the
call according to edge redirection in following step and finally inline before
doing the local optimization. Callgrpah needs to stay intact over the whole
process. (and as we discussed, we may want to make it intact even longer ;)

Honza


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (15 preceding siblings ...)
  2012-02-29 15:27 ` hubicka at ucw dot cz
@ 2012-03-01 14:47 ` jakub at gcc dot gnu.org
  2012-03-20 16:23 ` hubicka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-01 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.3                       |4.6.4

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-01 14:38:29 UTC ---
GCC 4.6.3 is being released.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (16 preceding siblings ...)
  2012-03-01 14:47 ` jakub at gcc dot gnu.org
@ 2012-03-20 16:23 ` hubicka at gcc dot gnu.org
  2012-03-22 14:49 ` hubicka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-03-20 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-03-20 16:19:55 UTC ---
Created attachment 26932
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26932
patch in testing

I am testing the attached patch.  It basically delays removal of the clone
until after the body saving process is finished.  
The problem is still on trunk, just the testcase passes because we optimize it
too early.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (17 preceding siblings ...)
  2012-03-20 16:23 ` hubicka at gcc dot gnu.org
@ 2012-03-22 14:49 ` hubicka at gcc dot gnu.org
  2012-03-22 17:32 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-03-22 14:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-03-22 14:33:37 UTC ---
Author: hubicka
Date: Thu Mar 22 14:33:27 2012
New Revision: 185694

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185694
Log:
    PR middle-end/51737
    * cgraph.c (cgraph_remove_node_and_inline_clones): Add FORBIDDEN_NODE
    parameter.
    * cgraph.h (cgraph_remove_node_and_inline_clones): Update prototype.
    * ipa-inline-transform.c (save_inline_function_body): Remove copied clone
    if needed.
    * tree-inline.c (delete_unreachable_blocks_update_callgraph): Update.

    PR middle-end/51737
    * g++.dg/torture/pr51737.C: New testcase

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.c
    trunk/gcc/cgraph.h
    trunk/gcc/ipa-inline-transform.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-inline.c


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (18 preceding siblings ...)
  2012-03-22 14:49 ` hubicka at gcc dot gnu.org
@ 2012-03-22 17:32 ` hubicka at gcc dot gnu.org
  2012-03-25  9:41 ` hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-03-22 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-03-22 17:12:28 UTC ---
I started to look into why the testcase does not fire on mainline.  It seems to
be effect of change in early inliner.  We used to inline intrusive_ptr_release
in early inlining ignoring the code size growth. This leads to large divergence
of inlining decisions.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (19 preceding siblings ...)
  2012-03-22 17:32 ` hubicka at gcc dot gnu.org
@ 2012-03-25  9:41 ` hubicka at gcc dot gnu.org
  2012-03-25  9:44 ` hubicka at gcc dot gnu.org
  2012-03-25 13:28 ` hubicka at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-03-25  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-03-25 09:39:38 UTC ---
Author: hubicka
Date: Sun Mar 25 09:39:32 2012
New Revision: 185774

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185774
Log:
    PR middle-end/51737
    * cgraph.c (cgraph_remove_node_and_inline_clones): Add FORBIDDEN_NODE
    parameter.
    * cgraph.h (cgraph_remove_node_and_inline_clones): Update prototype.
    * ipa-inline-transform.c (save_inline_function_body): Remove copied clone
    if needed.
    * tree-inline.c (delete_unreachable_blocks_update_callgraph): Update.

    PR middle-end/51737
    * g++.dg/torture/pr51737.C: New testcase

Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/cgraph.c
    branches/gcc-4_6-branch/gcc/cgraph.h
    branches/gcc-4_6-branch/gcc/cgraphunit.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-inline.c


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (20 preceding siblings ...)
  2012-03-25  9:41 ` hubicka at gcc dot gnu.org
@ 2012-03-25  9:44 ` hubicka at gcc dot gnu.org
  2012-03-25 13:28 ` hubicka at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-03-25  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #22 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-03-25 09:40:05 UTC ---
Fixed.


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

* [Bug tree-optimization/51737] [4.6 Regression] g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook
  2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
                   ` (21 preceding siblings ...)
  2012-03-25  9:44 ` hubicka at gcc dot gnu.org
@ 2012-03-25 13:28 ` hubicka at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: hubicka at gcc dot gnu.org @ 2012-03-25 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-03-25 13:25:56 UTC ---
Author: hubicka
Date: Sun Mar 25 13:25:51 2012
New Revision: 185776

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185776
Log:

    PR middle-end/51737
    * g++.dg/torture/pr51737.C: New testcase

Added:
    trunk/gcc/testsuite/g++.dg/torture/pr51737.C


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

end of thread, other threads:[~2012-03-25 13:26 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-02 20:04 [Bug c++/51737] New: g++ crashes (internal compiler error: Segmentation fault) when compiling quickbook blog at tessarakt dot de
2012-01-02 20:11 ` [Bug c++/51737] " blog at tessarakt dot de
2012-01-02 20:21 ` blog at tessarakt dot de
2012-01-02 20:40 ` paolo.carlini at oracle dot com
2012-01-02 21:21 ` blog at tessarakt dot de
2012-01-02 21:23 ` paolo.carlini at oracle dot com
2012-01-03  4:17 ` blog at tessarakt dot de
2012-01-03  9:21 ` [Bug tree-optimization/51737] [4.6 Regression] " rguenth at gcc dot gnu.org
2012-01-03 16:00 ` rguenth at gcc dot gnu.org
2012-01-05 16:16 ` jamborm at gcc dot gnu.org
2012-01-06 12:02 ` jamborm at gcc dot gnu.org
2012-01-09 22:42 ` jamborm at gcc dot gnu.org
2012-02-29 12:27 ` rguenth at gcc dot gnu.org
2012-02-29 15:07 ` hubicka at ucw dot cz
2012-02-29 15:18 ` hubicka at gcc dot gnu.org
2012-02-29 15:24 ` rguenth at gcc dot gnu.org
2012-02-29 15:27 ` hubicka at ucw dot cz
2012-03-01 14:47 ` jakub at gcc dot gnu.org
2012-03-20 16:23 ` hubicka at gcc dot gnu.org
2012-03-22 14:49 ` hubicka at gcc dot gnu.org
2012-03-22 17:32 ` hubicka at gcc dot gnu.org
2012-03-25  9:41 ` hubicka at gcc dot gnu.org
2012-03-25  9:44 ` hubicka at gcc dot gnu.org
2012-03-25 13:28 ` hubicka 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).