public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition
@ 2013-10-18 16:03 phe.bugzilla at gmail dot com
  2013-10-18 16:05 ` [Bug c++/58789] " phe.bugzilla at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: phe.bugzilla at gmail dot com @ 2013-10-18 16:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58789
           Summary: "internal compiler error: Segmentation fault" with
                    external definition
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: phe.bugzilla at gmail dot com

Created attachment 31040
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31040&action=edit
the output g++

The error goes away if "edges" is defined in "main.cpp" instead of in
"extra.cpp", so I have attached "main.ii" and "extra.ii". "output" is the
output of "g++ -v -save-temps -Wall -Wextra -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -O3 main.cpp extra.cpp".

I have tried to simplify "main.cpp" further, but many changes make the error go
away.


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

* [Bug c++/58789] "internal compiler error: Segmentation fault" with external definition
  2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
  2013-10-18 16:05 ` [Bug c++/58789] " phe.bugzilla at gmail dot com
@ 2013-10-18 16:05 ` phe.bugzilla at gmail dot com
  2013-10-18 16:35 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: phe.bugzilla at gmail dot com @ 2013-10-18 16:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Peter Epstein <phe.bugzilla at gmail dot com> ---
Created attachment 31041
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31041&action=edit
preprocessed source


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

* [Bug c++/58789] "internal compiler error: Segmentation fault" with external definition
  2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
@ 2013-10-18 16:05 ` phe.bugzilla at gmail dot com
  2013-10-18 16:05 ` phe.bugzilla at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: phe.bugzilla at gmail dot com @ 2013-10-18 16:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Peter Epstein <phe.bugzilla at gmail dot com> ---
Created attachment 31042
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31042&action=edit
preprocessed source


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

* [Bug c++/58789] "internal compiler error: Segmentation fault" with external definition
  2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
  2013-10-18 16:05 ` [Bug c++/58789] " phe.bugzilla at gmail dot com
  2013-10-18 16:05 ` phe.bugzilla at gmail dot com
@ 2013-10-18 16:35 ` paolo.carlini at oracle dot com
  2013-10-21  8:48 ` [Bug middle-end/58789] [4.8 Regression] " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-18 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-18
                 CC|                            |hubicka at ucw dot cz
     Ever confirmed|0                           |1

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I can reproduce in 4_8-branch but I can't in mainline. I doubt however this is
a C++ front-end issue, eg it goes away with -O2. Adding Honza in CC, because
the backtrace includes tree-inline.c:

main.cpp: In function ‘int main(int, char**)’:
main.cpp:43:9: internal compiler error: Segmentation fault
         delete_and_nullify_entries(number_to_copy);
         ^
0x90401f crash_signal
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/toplev.c:332
0x940ac0 expand_call_inline
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/tree-inline.c:3813
0x940ac0 gimple_expand_calls_inline
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/tree-inline.c:4161
0x940ac0 optimize_inline_calls(tree_node*)
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/tree-inline.c:4315
0xcca7c8 inline_transform(cgraph_node*)
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/ipa-inline-transform.c:415
0x86f0b9 execute_one_ipa_transform_pass
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/passes.c:2175
0x86f0b9 execute_all_ipa_transforms()
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/passes.c:2211
0x6ca0ba expand_function
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/cgraphunit.c:1633
0x6cb562 expand_all_functions
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/cgraphunit.c:1744
0x6cb562 compile()
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/cgraphunit.c:2042
0x6cbac4 finalize_compilation_unit()
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/cgraphunit.c:2119
0x59a4a8 cp_write_global_declarations()
        /scratch/Gcc/svn-dirs/gcc-4_8-branch/gcc/cp/decl2.c:4333
Please submit a full bug report,
>From gcc-bugs-return-432147-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Oct 18 17:05:42 2013
Return-Path: <gcc-bugs-return-432147-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27752 invoked by alias); 18 Oct 2013 17:05:42 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27708 invoked by uid 48); 18 Oct 2013 17:05:38 -0000
From: "linedot at xcpp dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/55800] Link failure with thread_local in unnamed namespace
Date: Fri, 18 Oct 2013 17:05:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: linedot at xcpp dot org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-55800-4-h1CnTgSLV5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-55800-4@http.gcc.gnu.org/bugzilla/>
References: <bug-55800-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg01291.txt.bz2
Content-length: 3232

http://gcc.gnu.org/bugzilla/show_bug.cgi?idU800

linedot at xcpp dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |linedot at xcpp dot org

--- Comment #2 from linedot at xcpp dot org ---
I have encountered a similar problem

output of gcc -v:
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.8.1-r1/work/gcc-4.8.1/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-cloog --disable-isl-version-check --enable-lto
--enable-nls --without-included-gettext --with-system-zlib --enable-obsolete
--disable-werror --enable-secureplt --enable-multilib
--with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp
--enable-libgomp
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/python
--enable-checking=release --disable-libgcj --enable-libstdcxx-time
--enable-languages=c,c++,fortran --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.1-r1 p1.2,
pie-0.5.7'
Thread model: posix
gcc version 4.8.1 (Gentoo 4.8.1-r1 p1.2, pie-0.5.7)

========================================================================
Here's a simplified version of the code I was using:
========================================================================main.cpp:

#include "xyz.hpp"

int main()
{
    return *xyz::getBla();
}

========================================================================xyz.hpp:

#include <memory>

class xyz
{
private:
    static thread_local std::unique_ptr<int> bla;
public:
    static int* getBla()
    {
        if(!bla.get())
        {
            bla.reset(new int(4));
        }
        return bla.get();
    }
};

========================================================================xyz.cpp:

#include "xyz.hpp"

thread_local std::unique_ptr<int> xyz::bla;

========================================================================If I try to compile this with
g++ -std=c++11 main.cpp xyz.cpp

/tmp/ccLJmEUa.o: In function `_ZTWN3xyz3blaE':
main.cpp:(.text._ZTWN3xyz3blaE[_ZTWN3xyz3blaE]+0x5): undefined reference to
`_ZTHN3xyz3blaE'
collect2: error: ld returned 1 exit status

I don't know if the following is any help:
I messed with the assembly output of g++ when compiling xyz.cpp and it looks
that _ZTWN3xyz3blaE should be where __tls_init begins - at least adding
.globl  _ZTWN3xyz3blaE
_ZTWN3xyz3blaE = __tls_init

manually at the end of the assembly seems to make the code do what it is
supposed to.


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

* [Bug middle-end/58789] [4.8 Regression] "internal compiler error: Segmentation fault" with external definition
  2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-18 16:35 ` paolo.carlini at oracle dot com
@ 2013-10-21  8:48 ` rguenth at gcc dot gnu.org
  2013-10-24 17:22 ` jamborm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-21  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu.org
          Component|c++                         |middle-end
      Known to work|                            |4.7.3
   Target Milestone|---                         |4.8.3
            Summary|"internal compiler error:   |[4.8 Regression] "internal
                   |Segmentation fault" with    |compiler error:
                   |external definition         |Segmentation fault" with
                   |                            |external definition
      Known to fail|                            |4.8.2

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
ICEs with -O2 -fipa-cp-clone on the 4.8 branch:

main.cpp:16:1: error: inlined_to pointer set for noninline callers
main.cpp:16:1: error: multiple inline callers
_ZN5ArrayI11edge_structE26delete_and_nullify_entriesEii/25 (void
Array<Type>::delete_and_nullify_entries(int, int) [with Type = edge_struct])
@0x7eff9b99acb8
  Type: function
  Visibility: public weak comdat
comdat_group:_ZN5ArrayI11edge_structE26delete_and_nullify_entriesEii one_only
virtual
  References: 
  Referring: 
  Function void Array<Type>::delete_and_nullify_entries(int, int) [with Type =
edge_struct]/25 is inline copy in int main(int, char**)/3
  Availability: local
  Function flags: analyzed body local finalized
  Called by: _ZN5ArrayI11edge_structE4growEib.constprop.2/21 (1.19 per call)
_ZN5ArrayI11edge_structE5clearEb/10 (0.30 per call) (inlined)
(indirect_inlining) (can throw external) 
  Calls: 
main.cpp:16:1: internal compiler error: verify_cgraph_node failed

a regression from 4.7.x.  Eventually the bug was fixed on trunk but the fix
not backported.

Martin?


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

* [Bug middle-end/58789] [4.8 Regression] "internal compiler error: Segmentation fault" with external definition
  2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
                   ` (3 preceding siblings ...)
  2013-10-21  8:48 ` [Bug middle-end/58789] [4.8 Regression] " rguenth at gcc dot gnu.org
@ 2013-10-24 17:22 ` jamborm at gcc dot gnu.org
  2013-10-29 14:32 ` jamborm at gcc dot gnu.org
  2013-10-29 14:43 ` jamborm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2013-10-24 17:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Well, IPA-CP devirtualization is required to trigger the bug but it is
a clone materialization problem.

The following line (invoked as a consequence of fold_stmt
devirtualization) in cgraph_update_edges_for_call_stmt_node causes the
bug:

      ne = cgraph_create_edge (node, cgraph_get_create_node (new_call),
                   new_stmt, count, frequency);

cgraph_get_create_node returns an inlined clone and it gets an extra
caller edge.  Verifier then complains there is an un-inlined edge to
an inlined node but the problem really is that there are two edges.

Either we need to make sure that we keep an un-inlined node for
devirtualization which cgraph_get_create_node can pick up until we are
done with materializations, ore need to backport and use
cgraph_get_create_real_symbol_node from
http://gcc.gnu.org/ml/gcc-patches/2013-03/msg00621.html


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

* [Bug middle-end/58789] [4.8 Regression] "internal compiler error: Segmentation fault" with external definition
  2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
                   ` (4 preceding siblings ...)
  2013-10-24 17:22 ` jamborm at gcc dot gnu.org
@ 2013-10-29 14:32 ` jamborm at gcc dot gnu.org
  2013-10-29 14:43 ` jamborm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2013-10-29 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Author: jamborm
Date: Tue Oct 29 14:32:13 2013
New Revision: 204163

URL: http://gcc.gnu.org/viewcvs?rev=204163&root=gcc&view=rev
Log:
2013-10-29  Martin Jambor  <mjambor@suse.cz>

    PR middle-end/58789
    Backport from mainline
        2013-05-09  Martin Jambor  <mjambor@suse.cz>

    PR lto/57084
    * gimple-fold.c (canonicalize_constructor_val): Call
    cgraph_get_create_real_symbol_node instead of cgraph_get_create_node.

    Backport from mainline
    2013-03-16  Jan Hubicka  <jh@suse.cz>

    * cgraph.h (cgraph_get_create_real_symbol_node): Declare.
    * cgraph.c (cgraph_get_create_real_symbol_node): New function.
    * cgrpahbuild.c: Use cgraph_get_create_real_symbol_node instead
    of cgraph_get_create_node.
    * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise.


Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/cgraph.c
    branches/gcc-4_8-branch/gcc/cgraph.h
    branches/gcc-4_8-branch/gcc/cgraphbuild.c
    branches/gcc-4_8-branch/gcc/gimple-fold.c
    branches/gcc-4_8-branch/gcc/ipa-prop.c


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

* [Bug middle-end/58789] [4.8 Regression] "internal compiler error: Segmentation fault" with external definition
  2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
                   ` (5 preceding siblings ...)
  2013-10-29 14:32 ` jamborm at gcc dot gnu.org
@ 2013-10-29 14:43 ` jamborm at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2013-10-29 14:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2013-10/msg02413.htm
                   |                            |l
         Resolution|---                         |FIXED

--- Comment #8 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Fixed with http://gcc.gnu.org/ml/gcc-patches/2013-10/msg02413.html


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

end of thread, other threads:[~2013-10-29 14:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-18 16:03 [Bug c++/58789] New: "internal compiler error: Segmentation fault" with external definition phe.bugzilla at gmail dot com
2013-10-18 16:05 ` [Bug c++/58789] " phe.bugzilla at gmail dot com
2013-10-18 16:05 ` phe.bugzilla at gmail dot com
2013-10-18 16:35 ` paolo.carlini at oracle dot com
2013-10-21  8:48 ` [Bug middle-end/58789] [4.8 Regression] " rguenth at gcc dot gnu.org
2013-10-24 17:22 ` jamborm at gcc dot gnu.org
2013-10-29 14:32 ` jamborm at gcc dot gnu.org
2013-10-29 14:43 ` jamborm 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).