public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63649] New: 5.0: ICE with init_priority
@ 2014-10-26 13:18 adam at os dot inf.tu-dresden.de
  2014-10-26 15:35 ` [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332 trippels at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: adam at os dot inf.tu-dresden.de @ 2014-10-26 13:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

            Bug ID: 63649
           Summary: 5.0: ICE with init_priority
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adam at os dot inf.tu-dresden.de

The following code causes an ICE:

struct Per_cpu_ctor_data
{
  typedef void (*Func)();
  Per_cpu_ctor_data() = default;
  void *_base;
};

class Per_cpu_data
{
private:
  typedef Per_cpu_ctor_data Ctor;
  struct Ctor_vector { void push_back(Ctor::Func func); };
  static Ctor_vector ctors;
};

template< typename T >
class Per_cpu : private Per_cpu_data
{
public:
  typedef T Type;
  Per_cpu();
  static void f1();
};

template< typename T > Per_cpu<T>::Per_cpu() { ctors.push_back(&f1); }
template< typename T > void Per_cpu<T>::f1() {}

class A { static Per_cpu<int *> a; };

static Per_cpu_ctor_data __b;
__attribute__((init_priority(0xfffe))) Per_cpu<int *> A::a;

$ g++ --version
g++ (GCC) 5.0.0 20141026 (experimental)
$ uname -m
x86_64
$ g++ -c -std=c++0x -O1 t.i
mem_space.i:31:59: internal compiler error: Segmentation fault
 __attribute__((init_priority(0xfffe))) Per_cpu<int *> A::a;
                                                           ^
0xc022af crash_signal
        ../../gcc/gcc/toplev.c:349
0x11df22c ipa_comdats
        ../../gcc/gcc/ipa-comdats.c:330
0x11df22c execute
        ../../gcc/gcc/ipa-comdats.c:371
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.

I could not reduce the testcase more as the segfault would not happen.
The segfault also does not happen with -O0, and it also does not happen with
init_priority 0xffff.
Code compiles with gcc <= 4.9.


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

* [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332
  2014-10-26 13:18 [Bug c++/63649] New: 5.0: ICE with init_priority adam at os dot inf.tu-dresden.de
@ 2014-10-26 15:35 ` trippels at gcc dot gnu.org
  2014-10-26 16:58 ` trippels at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-10-26 15:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.8.3, 4.9.2
   Last reconfirmed|                            |2014-10-26
          Component|c++                         |ipa
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |trippels at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|5.0: ICE with init_priority |[5 Regression] ICE:
                   |                            |Segmentation fault in
                   |                            |gcc/ipa-comdats.c:332
   Target Milestone|---                         |5.0
      Known to fail|                            |5.0

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Started with r210597.

A bit more reduced:

markus@x4 /tmp % cat ipa.ii

struct A
{
  typedef void Func ();
  A () = default;
  void *_base;
};
struct B
{
  struct Ctor_vector
  {
    void m_fn1 (A::Func);
  } ctors;
};
template <typename> class C : B
{
public:
  C ();
  static void
  m_fn2 ()
  {
  }
};

A b;
__attribute__ ((init_priority (0xfffe))) C<int> a;
template <typename T> C<T>::C () { ctors.m_fn1 (m_fn2); }


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

* [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332
  2014-10-26 13:18 [Bug c++/63649] New: 5.0: ICE with init_priority adam at os dot inf.tu-dresden.de
  2014-10-26 15:35 ` [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332 trippels at gcc dot gnu.org
@ 2014-10-26 16:58 ` trippels at gcc dot gnu.org
  2014-10-31 21:31 ` adam at os dot inf.tu-dresden.de
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-10-26 16:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |trippels at gcc dot gnu.org

--- Comment #2 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Possible fix:

diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c
index b270d9717b27..8843410545e0 100644
--- a/gcc/ipa-comdats.c
+++ b/gcc/ipa-comdats.c
@@ -317,8 +317,11 @@ ipa_comdats (void)
          && !symbol->alias
          && symbol->real_symbol_p ())
        {
-         tree group = *map.get (symbol);
+         tree *val = map.get (symbol);
+         if (!val)
+           continue;

+         group = *val;
          if (group == error_mark_node)
            continue;
          if (dump_file)


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

* [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332
  2014-10-26 13:18 [Bug c++/63649] New: 5.0: ICE with init_priority adam at os dot inf.tu-dresden.de
  2014-10-26 15:35 ` [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332 trippels at gcc dot gnu.org
  2014-10-26 16:58 ` trippels at gcc dot gnu.org
@ 2014-10-31 21:31 ` adam at os dot inf.tu-dresden.de
  2014-11-20 12:40 ` rguenth at gcc dot gnu.org
  2014-12-15  1:04 ` hubicka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: adam at os dot inf.tu-dresden.de @ 2014-10-31 21:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

--- Comment #3 from Adam Lackorzynski <adam at os dot inf.tu-dresden.de> ---
Thanks, seems to fix the issue for me.


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

* [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332
  2014-10-26 13:18 [Bug c++/63649] New: 5.0: ICE with init_priority adam at os dot inf.tu-dresden.de
                   ` (2 preceding siblings ...)
  2014-10-31 21:31 ` adam at os dot inf.tu-dresden.de
@ 2014-11-20 12:40 ` rguenth at gcc dot gnu.org
  2014-12-15  1:04 ` hubicka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-20 12:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

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

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


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

* [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332
  2014-10-26 13:18 [Bug c++/63649] New: 5.0: ICE with init_priority adam at os dot inf.tu-dresden.de
                   ` (3 preceding siblings ...)
  2014-11-20 12:40 ` rguenth at gcc dot gnu.org
@ 2014-12-15  1:04 ` hubicka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-12-15  1:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63649

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

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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
this no longer reproduce to me. I suppose it was fixed by the fix for PR
ipa/61324


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

end of thread, other threads:[~2014-12-15  1:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-26 13:18 [Bug c++/63649] New: 5.0: ICE with init_priority adam at os dot inf.tu-dresden.de
2014-10-26 15:35 ` [Bug ipa/63649] [5 Regression] ICE: Segmentation fault in gcc/ipa-comdats.c:332 trippels at gcc dot gnu.org
2014-10-26 16:58 ` trippels at gcc dot gnu.org
2014-10-31 21:31 ` adam at os dot inf.tu-dresden.de
2014-11-20 12:40 ` rguenth at gcc dot gnu.org
2014-12-15  1:04 ` 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).