public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adam at os dot inf.tu-dresden.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63649] New: 5.0: ICE with init_priority
Date: Sun, 26 Oct 2014 13:18:00 -0000	[thread overview]
Message-ID: <bug-63649-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-10-26 12:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 13:18 adam at os dot inf.tu-dresden.de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-63649-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).