public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2")
@ 2014-01-26  0:26 timshen at gcc dot gnu.org
  2014-01-29 13:30 ` [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: timshen at gcc dot gnu.org @ 2014-01-26  0:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59947
           Summary: Segmentation fault with #pragma GCC optimize ("O2")
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: timshen at gcc dot gnu.org

The following piece of code causes a gcc segmentation fault:

// test.cc
#pragma GCC optimize ("O2")
#include <regex>
template class std::basic_regex<char>;


The backtrace info:

~ # /usr/local/bin/g++ -std=c++11 test.cc
In file included from /usr/local/include/c++/4.9.0/bits/basic_ios.h:37:0,
                 from /usr/local/include/c++/4.9.0/ios:44,
                 from /usr/local/include/c++/4.9.0/ostream:38,
                 from /usr/local/include/c++/4.9.0/iterator:64,
                 from /usr/local/include/c++/4.9.0/regex:44,
                 from test.cc:2:
/usr/local/include/c++/4.9.0/bits/locale_facets.h: In member function ‘char
std::ctype<char>::narrow(std::ctype<char>::char_type, char) const’:
/usr/local/include/c++/4.9.0/bits/locale_facets.h:927:42: internal compiler
error: Segmentation fault
  const char __t = do_narrow(__c, __dfault);
                                          ^
0xb8afaf crash_signal
    /home/root/src/gcc/gcc/toplev.c:337
0xa0c5a1 hash_table<odr_hasher, xcallocator>::find_slot_with_hash(tree_node
const*, unsigned int, insert_option)
    /home/root/src/gcc/gcc/hash-table.h:774
0xa097bc get_odr_type(tree_node*, bool)
    /home/root/src/gcc/gcc/ipa-devirt.c:413
0xa0b0a4 possible_polymorphic_call_targets(tree_node*, long,
ipa_polymorphic_call_context, bool*, void**)
    /home/root/src/gcc/gcc/ipa-devirt.c:1242
0x9c8774 possible_polymorphic_call_targets(tree_node*, bool*, void**)
    /home/root/src/gcc/gcc/ipa-utils.h:135
0x9c5a83 gimple_fold_call
    /home/root/src/gcc/gcc/gimple-fold.c:1193
0x9c5a83 fold_stmt_1
    /home/root/src/gcc/gcc/gimple-fold.c:1306
0x9e643f gimplify_modify_expr
    /home/root/src/gcc/gcc/gimplify.c:4582
0x9dab3b gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7441
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9da393 gimplify_cleanup_point_expr
    /home/root/src/gcc/gcc/gimplify.c:5110
0x9da393 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7804
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9dad83 gimplify_statement_list
    /home/root/src/gcc/gcc/gimplify.c:1405
0x9dad83 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7856
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9df862 gimplify_bind_expr
    /home/root/src/gcc/gcc/gimplify.c:1072
0x9da849 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    /home/root/src/gcc/gcc/gimplify.c:7638
0x9debf6 gimplify_stmt(tree_node**, gimple_statement_base**)
    /home/root/src/gcc/gcc/gimplify.c:5334
0x9e03a9 gimplify_body(tree_node*, bool)
    /home/root/src/gcc/gcc/gimplify.c:8548
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


My gcc is trunk@207098.

Thanks!
>From gcc-bugs-return-441551-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jan 26 03:44:41 2014
Return-Path: <gcc-bugs-return-441551-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14122 invoked by alias); 26 Jan 2014 03:44:40 -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 14055 invoked by uid 48); 26 Jan 2014 03:44:35 -0000
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/59934] Bootstrap fail since r206941: expmed.h:252:33: error: array subscript is above array bounds
Date: Sun, 26 Jan 2014 03:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: law at redhat dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: law at redhat dot com
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59934-4-2inCUfDN5U@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59934-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59934-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: 2014-01/txt/msg02693.txt.bz2
Content-length: 189

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

--- Comment #14 from Jeffrey A. Law <law at redhat dot com> ---
Seems like a reasonable approach.  I'm bootstrapping it now on an s390x.


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
@ 2014-01-29 13:30 ` rguenth at gcc dot gnu.org
  2014-01-30 19:16 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-29 13:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Version|unknown                     |4.9.0
   Last reconfirmed|                            |2014-01-29
          Component|c++                         |ipa
                 CC|                            |hubicka at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|Segmentation fault with     |[4.9 Regression]
                   |#pragma GCC optimize ("O2") |Segmentation fault with
                   |                            |#pragma GCC optimize
                   |                            |("O2"), ICE in get_odr_type
   Target Milestone|---                         |4.9.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  Worked in earlier snapshots - we ICE in the devirt machinery.


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
  2014-01-29 13:30 ` [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type rguenth at gcc dot gnu.org
@ 2014-01-30 19:16 ` jakub at gcc dot gnu.org
  2014-01-31 11:39 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-30 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:
#pragma GCC optimize ("O2")
template <typename T>
inline void
foo (T & a) noexcept { T tmp = static_cast <T &&> (a); };
struct A
{
  A () noexcept : a (1), b (1) {}
  virtual void c () noexcept = 0;
  void d () noexcept { c (); }
  int a;
  int b;
};
struct B
{
  ~B () noexcept { e->d (); }
  A *e;
};
template <typename T>
struct C
{
  B f;
};
struct D {};
template <typename T>
struct E
{
  void bar () { foo (g); }
  C <D> g;
};
template class E <char>;


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
  2014-01-29 13:30 ` [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type rguenth at gcc dot gnu.org
  2014-01-30 19:16 ` jakub at gcc dot gnu.org
@ 2014-01-31 11:39 ` rguenth at gcc dot gnu.org
  2014-01-31 16:55 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-31 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-01-31 11:39 ` rguenth at gcc dot gnu.org
@ 2014-01-31 16:55 ` jakub at gcc dot gnu.org
  2014-01-31 17:08 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-31 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r206042.


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-01-31 16:55 ` jakub at gcc dot gnu.org
@ 2014-01-31 17:08 ` jakub at gcc dot gnu.org
  2014-02-03 18:09 ` hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-31 17:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/ipa-devirt.c.jj    2014-01-13 08:54:29.000000000 +0100
+++ gcc/ipa-devirt.c    2014-01-31 18:04:01.869210678 +0100
@@ -1212,7 +1212,7 @@ devirt_variable_node_removal_hook (varpo
    temporarily change to one of base types.  INCLUDE_DERIVER_TYPES make
    us to walk the inheritance graph for all derivations.

-   If COMPLETEP is non-NULL, store true if the list is complette. 
+   If COMPLETEP is non-NULL, store true if the list is complete. 
    CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry
    in the target cache.  If user needs to visit every target list
    just once, it can memoize them.
@@ -1231,7 +1231,7 @@ possible_polymorphic_call_targets (tree
   static struct cgraph_node_hook_list *node_removal_hook_holder;
   pointer_set_t *inserted;
   pointer_set_t *matched_vtables;
-  vec <cgraph_node *> nodes=vNULL;
+  vec <cgraph_node *> nodes = vNULL;
   odr_type type, outer_type;
   polymorphic_call_target_d key;
   polymorphic_call_target_d **slot;
@@ -1239,6 +1239,13 @@ possible_polymorphic_call_targets (tree
   tree binfo, target;
   bool final;

+  if (!odr_hash.is_created ())
+    {
+      if (completep)
+    *completep = false;
+      return nodes;
+    }
+
   type = get_odr_type (otr_type, true);

   /* Lookup the outer class type we want to walk.  */

fixes this, but not sure if that is what Honza wants.  As odr_hash isn't
public, the other possibility would be just to export some function whether it
is ok to call possible_polymorphic_call_targets, that gimple_fold_call could
check.


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-01-31 17:08 ` jakub at gcc dot gnu.org
@ 2014-02-03 18:09 ` hubicka at gcc dot gnu.org
  2014-02-05 15:35 ` jakub at gcc dot gnu.org
  2014-02-05 16:16 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-02-03 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
So far I was trying to make the users of ipa-devirt to not query ipa-devirt
with -fno-devirtualize or at wrong time. With fold I guess it is only way to
make it do nothing before we build the graph. So the patch is OK. Thanks!


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-02-03 18:09 ` hubicka at gcc dot gnu.org
@ 2014-02-05 15:35 ` jakub at gcc dot gnu.org
  2014-02-05 16:16 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-05 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Feb  5 15:34:25 2014
New Revision: 207512

URL: http://gcc.gnu.org/viewcvs?rev=207512&root=gcc&view=rev
Log:
    PR ipa/59947
    * ipa-devirt.c (possible_polymorphic_call_targets): Fix
    a comment typo and formatting issue.  If odr_hash hasn't been
    created, return vNULL and set *completep to false.

    * g++.dg/opt/pr59947.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr59947.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-devirt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type
  2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-02-05 15:35 ` jakub at gcc dot gnu.org
@ 2014-02-05 16:16 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-05 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-02-05 16:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-26  0:26 [Bug c++/59947] New: Segmentation fault with #pragma GCC optimize ("O2") timshen at gcc dot gnu.org
2014-01-29 13:30 ` [Bug ipa/59947] [4.9 Regression] Segmentation fault with #pragma GCC optimize ("O2"), ICE in get_odr_type rguenth at gcc dot gnu.org
2014-01-30 19:16 ` jakub at gcc dot gnu.org
2014-01-31 11:39 ` rguenth at gcc dot gnu.org
2014-01-31 16:55 ` jakub at gcc dot gnu.org
2014-01-31 17:08 ` jakub at gcc dot gnu.org
2014-02-03 18:09 ` hubicka at gcc dot gnu.org
2014-02-05 15:35 ` jakub at gcc dot gnu.org
2014-02-05 16:16 ` jakub 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).