Bug 61800 - [5 Regression] ICE: Segmentation fault during Firefox build
Summary: [5 Regression] ICE: Segmentation fault during Firefox build
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-14 13:27 UTC by Markus Trippelsdorf
Modified: 2014-08-19 06:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-08-15 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2014-07-14 13:27:01 UTC
markus@x4 http % /var/tmp/gcc_test/usr/local/bin/c++ -o TunnelUtils.o -c -I../../../dist/stl_wrappers -I../../../dist/system_wrappers -include /var/tmp/mozilla-central/config
/gcc_hidden.h -DOS_POSIX=1 -DOS_LINUX=1 -DMOZ_GLUE_IN_PROGRAM -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL  -DSTATIC_EXPORTABLE_JS_API -DNO_NSPR_10_SUPPORT -I/var/tmp/mozilla-central
/netwerk/protocol/http -I. -I/var/tmp/mozilla-central/ipc/chromium/src -I/var/tmp/mozilla-central/ipc/glue -I/var/tmp/mozilla-central/netwerk/protocol/http/../../base/src -I/
var/tmp/mozilla-central/content/base/src -I/var/tmp/moz-build-dir/ipc/ipdl/_ipdlheaders -I../../../dist/include  -I/usr/include/nspr -I/usr/include/nss  -I/var/tmp/moz-build-
dir/dist/include  -I/usr/include/pixman-1    -fPIC   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -MD -MP -MF .deps/TunnelUtils.o.pp  -Wall -Wpointer-arith -Woverloade
d-virtual -Werror=return-type -Werror=int-to-pointer-cast -Wtype-limits -Wempty-body -Wsign-compare -Wno-invalid-offsetof -Wcast-align -fno-semantic-interposition -ffunction-
sections -fdata-sections -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -std=gnu++0x -pthread -pipe  -DNDEBUG -DTRIMMED -O3 -fomit-frame-point
er      /var/tmp/mozilla-central/netwerk/protocol/http/TunnelUtils.cpp
In file included from /var/tmp/mozilla-central/ipc/chromium/src/base/message_loop.h:19:0,
                 from ../../../dist/include/mozilla/ipc/MessageLink.h:12,
                 from ../../../dist/include/mozilla/ipc/ProtocolUtils.h:22,
                 from /var/tmp/moz-build-dir/ipc/ipdl/_ipdlheaders/mozilla/net/PNecko.h:16,
                 from /var/tmp/moz-build-dir/ipc/ipdl/_ipdlheaders/mozilla/net/PNeckoChild.h:9,
                 from ../../../dist/include/mozilla/net/NeckoChild.h:11,
                 from /var/tmp/mozilla-central/netwerk/protocol/http/HttpLog.h:42,
                 from /var/tmp/mozilla-central/netwerk/protocol/http/TunnelUtils.cpp:8:
/var/tmp/mozilla-central/ipc/chromium/src/base/task.h:27:7: internal compiler error: Segmentation fault
 class CancelableTask : public Task {
       ^
0xb87bff crash_signal
        ../../gcc/gcc/toplev.c:337
0x9f4e46 tree_check
        ../../gcc/gcc/tree.h:2730
0x9f4e46 decl_maybe_in_construction_p(tree_node*, tree_node*, gimple_statement_base*, tree_node*)
        ../../gcc/gcc/ipa-devirt.c:1974
0x9f5dd1 get_polymorphic_call_info(tree_node*, tree_node*, tree_node**, long*, ipa_polymorphic_call_context*, gimple_statement_base*)
        ../../gcc/gcc/ipa-devirt.c:2176
0x845414 cgraph_create_indirect_edge(cgraph_node*, gimple_statement_base*, int, long, int)
        ../../gcc/gcc/cgraph.c:970
0x84e1c1 cgraph_clone_edge(cgraph_edge*, cgraph_node*, gimple_statement_base*, unsigned int, long, int, bool)
        ../../gcc/gcc/cgraphclones.c:139
0x84ed8e cgraph_clone_node(cgraph_node*, tree_node*, long, int, bool, vec<cgraph_edge*, va_heap, vl_ptr>, bool, cgraph_node*, bitmap_head*)
        ../../gcc/gcc/cgraphclones.c:473
0x10acc2e clone_inlined_nodes(cgraph_edge*, bool, bool, int*, int)
        ../../gcc/gcc/ipa-inline-transform.c:188
0x10acf67 inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*, int*, bool, bool*)
        ../../gcc/gcc/ipa-inline-transform.c:275
0x10a916e inline_small_functions
        ../../gcc/gcc/ipa-inline.c:1814
0x10a916e ipa_inline
        ../../gcc/gcc/ipa-inline.c:2185
0x10a916e execute
        ../../gcc/gcc/ipa-inline.c:2545
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.

Probably started with r212304. Reducing.
Comment 1 Markus Trippelsdorf 2014-07-14 14:18:09 UTC
markus@x4 http % cat TunnelUtils.ii
#pragma GCC visibility push(hidden)
#pragma GCC visibility push(default)
typedef unsigned int uint32_t;
#pragma GCC visibility pop
typedef enum class tag_nsresult : uint32_t
{
  NS_OK = 0,
} nsresult;
typedef int nsIID;
class A
{
public:
  virtual nsresult operator()(const nsIID &, void **) const = 0;
};
template <class T> class B
{
public:
  typedef T element_type;
  B (const A &p1)
  {
    uint32_t __trans_tmp_1;
    void *newRawPtr;
    __trans_tmp_1
        = NS_FAILED_impl (p1 ((T::template D<T, void>::kIID), &newRawPtr));
  }
};

class F : public A
{
  virtual nsresult operator()(const nsIID &p1, void **) const;
};
class G
{
public:
  template <typename T, typename U> struct D;
};
template <typename T> struct G::D<G, T>
{
  static const nsIID kIID __attribute__ ((visibility ("hidden")));
};
class H : public G
{
  virtual nsresult CloseWithStatus (nsresult p1);
};
inline uint32_t NS_FAILED_impl (nsresult p1) {}

inline const F do_QueryReferent (G *p1, nsresult *p2 = 0) {}

nsresult H::CloseWithStatus (nsresult p1)
{
  B<G> baseTrans (do_QueryReferent (0));
  return CloseWithStatus (nsresult::NS_OK);
}


markus@x4 http % /var/tmp/gcc_test/usr/local/bin/c++ -c -O3 -std=c++11 TunnelUtils.ii
TunnelUtils.ii:53:1: internal compiler error: Segmentation fault
 }
 ^
0xb87bff crash_signal
        ../../gcc/gcc/toplev.c:337
0x9f4e46 tree_check
        ../../gcc/gcc/tree.h:2730
0x9f4e46 decl_maybe_in_construction_p(tree_node*, tree_node*, gimple_statement_base*, tree_node*)
        ../../gcc/gcc/ipa-devirt.c:1974
0x9f5dd1 get_polymorphic_call_info(tree_node*, tree_node*, tree_node**, long*, ipa_polymorphic_call_context*, gimple_statement_base*)
        ../../gcc/gcc/ipa-devirt.c:2176
0x845414 cgraph_create_indirect_edge(cgraph_node*, gimple_statement_base*, int, long, int)
        ../../gcc/gcc/cgraph.c:970
0x84e1c1 cgraph_clone_edge(cgraph_edge*, cgraph_node*, gimple_statement_base*, unsigned int, long, int, bool)
        ../../gcc/gcc/cgraphclones.c:139
0x84ed8e cgraph_clone_node(cgraph_node*, tree_node*, long, int, bool, vec<cgraph_edge*, va_heap, vl_ptr>, bool, cgraph_node*, bitmap_head*)
        ../../gcc/gcc/cgraphclones.c:473
0x10a97a2 recursive_inlining
        ../../gcc/gcc/ipa-inline.c:1388
0x10a97a2 inline_small_functions
        ../../gcc/gcc/ipa-inline.c:1768
0x10a97a2 ipa_inline
        ../../gcc/gcc/ipa-inline.c:2185
0x10a97a2 execute
        ../../gcc/gcc/ipa-inline.c:2545
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.
Comment 2 Markus Trippelsdorf 2014-08-15 09:14:00 UTC
Testcase from comment2 now passes.

But here's a new variant:

markus@x4 xslt % cat test.ii
#pragma GCC visibility push(hidden)
class A
{
public:
  unsigned long m_fn1 () const;
};
class B;
class C
{
public:
  ;
  virtual bool m_fn2 (void) = 0;
};
class D
{
  virtual bool m_fn3 (const int &p1, B *p2) = 0;
};
class F : public D
{
  bool m_fn3 (const int &p1, B *p2);
  A mPredicates;
};
class B
{
};
class G : public B
{
  virtual unsigned int m_fn4 () = 0;
};
class H : public G
{
public:
  int txNodeSetContext_aContextNodeSet;
  H (B *p1) {}
  int
  m_fn5 ()
  {
    return mPosition < m_fn4 ();
  }
  unsigned int m_fn4 ();
  unsigned int mPosition;
};

unsigned int a;
C *b;
bool
F::m_fn3 (const int &p1, B *p2)
{
  if (!b->m_fn2 ())
    return false;
  unsigned int c = mPredicates.m_fn1 ();
  for (1; 1 < c; ++a)
    {
      H d (p2);
      while (d.m_fn5 ())
        {
          do
            {
            }
          while (0);
        }
    }
}

markus@x4 xslt % /var/tmp/gcc_test/usr/local/bin/c++ -c -O2 test.ii
test.ii: In member function ‘virtual bool F::m_fn3(const int&, B*)’:
test.ii:63:1: internal compiler error: Segmentation fault
 }
 ^
0xb9ddcf crash_signal
        ../../gcc/gcc/toplev.c:337
0x9fd5ea decl_maybe_in_construction_p(tree_node*, tree_node*, gimple_statement_base*, tree_node*)
        ../../gcc/gcc/ipa-devirt.c:2214
0x9fe561 get_polymorphic_call_info(tree_node*, tree_node*, tree_node**, long*, ipa_polymorphic_call_context*, gimple_statement_base*)
        ../../gcc/gcc/ipa-devirt.c:2436
0x848244 cgraph_node::create_indirect_edge(gimple_statement_base*, int, long, int)
        ../../gcc/gcc/cgraph.c:968
0x852af1 cgraph_clone_edge(cgraph_edge*, cgraph_node*, gimple_statement_base*, unsigned int, long, int, bool)
        ../../gcc/gcc/cgraphclones.c:139
0x85427f cgraph_node::create_version_clone(tree_node*, vec<cgraph_edge*, va_heap, vl_ptr>, bitmap_head*)
        ../../gcc/gcc/cgraphclones.c:876
0x8543c7 cgraph_node::create_version_clone_with_body(vec<cgraph_edge*, va_heap, vl_ptr>, vec<ipa_replace_map*, va_gc, vl_embed>*, bitmap_head*, bool, bitmap_head*, basic_block_def*, char const*)
        ../../gcc/gcc/cgraphclones.c:943
0x10d1adb split_function
        ../../gcc/gcc/ipa-split.c:1235
0x10d5d8e execute_split_functions
        ../../gcc/gcc/ipa-split.c:1636
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.
markus@x4 xslt %
Comment 3 Kirill Yukhin 2014-08-18 13:26:38 UTC
Author: kyukhin
Date: Mon Aug 18 13:26:06 2014
New Revision: 214099

URL: https://gcc.gnu.org/viewcvs?rev=214099&root=gcc&view=rev
Log:
PR ipa/61800

gcc/
	* cgraph.h (cgraph_node::create_indirect_edge): Add
	compute_indirect_info param.
	* cgraph.c (cgraph_node::create_indirect_edge): Compute
	indirect_info only when it is required.
	* cgraphclones.c (cgraph_clone_edge): Do not recompute
	indirect_info fore cloned indirect edge.

gcc/testsuite/
	* g++.dg/ipa/pr61800.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/ipa/pr61800.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.c
    trunk/gcc/cgraph.h
    trunk/gcc/cgraphclones.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Markus Trippelsdorf 2014-08-19 06:52:25 UTC
Fixed.