public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
@ 2013-10-25  3:00 ferdinandw+gcc at gmail dot com
  2013-10-25  5:44 ` [Bug c++/58868] [4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: ferdinandw+gcc at gmail dot com @ 2013-10-25  3:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58868
           Summary: ICE: in count_type_elements, at expr.c:5495 with
                    -std=gnu++0x
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ferdinandw+gcc at gmail dot com

/opt/gcc-trunk/libexec/gcc/x86_64-redhat-linux/4.9.0/cc1plus -quiet -v
TelemetryVFS.ii -O0 -g0 -std=gnu++0x -version -o TelemetryVFS.s

GNU C++ (GCC) version 4.9.0 20131025 (experimental) (x86_64-redhat-linux)
    compiled by GNU C version 4.9.0 20131025 (experimental), GMP version 5.1.1,
MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: e6bf66d0889337cd67d51ee6eb43d8c3
TelemetryVFS.ii:12:1: internal compiler error: in count_type_elements, at
expr.c:5495
 };
 ^


../gcc/configure --prefix=/opt/gcc-trunk --enable-shared
--enable-languages=c,c++ --enable-threads=posix --enable-checking
--enable-__cxa_atexit --enable-clocale=gnu --enable-initfini-array
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --disable-nls --disable-multilib
--with-system-zlib --build=x86_64-redhat-linux

====================================


enum ID {
  PLACES
};

struct Histograms {
  const ID foo;
};

Histograms gHistograms[] = {
  { PLACES }
};


====================================

Fairly recent, comes from building firefox aurora with gcc trunk


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
@ 2013-10-25  5:44 ` mpolacek at gcc dot gnu.org
  2013-10-25  6:56 ` mpolacek at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-25  5:44 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-10-25
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
            Summary|ICE: in                     |[4.9 Regression] ICE: in
                   |count_type_elements, at     |count_type_elements, at
                   |expr.c:5495 with            |expr.c:5495 with
                   |-std=gnu++0x                |-std=gnu++0x
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
  2013-10-25  5:44 ` [Bug c++/58868] [4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2013-10-25  6:56 ` mpolacek at gcc dot gnu.org
  2013-10-25  7:15 ` mpolacek at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-25  6:56 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r203985.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
  2013-10-25  5:44 ` [Bug c++/58868] [4.9 Regression] " mpolacek at gcc dot gnu.org
  2013-10-25  6:56 ` mpolacek at gcc dot gnu.org
@ 2013-10-25  7:15 ` mpolacek at gcc dot gnu.org
  2013-10-27 17:14 ` tsaunders at mozilla dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-25  7:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We somehow create 
    type <lang_type 0x7f62b24dcdc8 init list VOID
        align 1 symtab 0 alias set -1 canonical type 0x7f62b24dcdc8>
    constant lngt 1
and count_type_elements can't handle LANG_TYPE.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (2 preceding siblings ...)
  2013-10-25  7:15 ` mpolacek at gcc dot gnu.org
@ 2013-10-27 17:14 ` tsaunders at mozilla dot com
  2013-10-31  7:07 ` octoploid at yandex dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tsaunders at mozilla dot com @ 2013-10-27 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

Trevor Saunders <tsaunders at mozilla dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tsaunders at mozilla dot com

--- Comment #4 from Trevor Saunders <tsaunders at mozilla dot com> ---
> enum ID {
>   PLACES
> };
> 
> struct Histograms {
>   const ID foo;

the enum isn't actually needed, I can reproduce with
static struct {
  const int type;
} const cnvNameType[] = {
  {  1 }
};

> Fairly recent, comes from building firefox aurora with gcc trunk

to be pedantic it is in icu, and presumably if you just build that you get this
crash too.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (3 preceding siblings ...)
  2013-10-27 17:14 ` tsaunders at mozilla dot com
@ 2013-10-31  7:07 ` octoploid at yandex dot com
  2013-10-31  7:09 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: octoploid at yandex dot com @ 2013-10-31  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

octoploid at yandex dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |octoploid at yandex dot com

--- Comment #5 from octoploid at yandex dot com ---
This bug is breaking almost every non-trivial C++ project.
It should be P1 IMO.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (4 preceding siblings ...)
  2013-10-31  7:07 ` octoploid at yandex dot com
@ 2013-10-31  7:09 ` mpolacek at gcc dot gnu.org
  2013-11-04 22:24 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-31  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thus marking it as such.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (5 preceding siblings ...)
  2013-10-31  7:09 ` mpolacek at gcc dot gnu.org
@ 2013-11-04 22:24 ` mpolacek at gcc dot gnu.org
  2013-11-05 11:57 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-11-04 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Even shorter:

struct { const int i; } a[] = { 1 };


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (6 preceding siblings ...)
  2013-11-04 22:24 ` mpolacek at gcc dot gnu.org
@ 2013-11-05 11:57 ` mpolacek at gcc dot gnu.org
  2013-11-05 15:48 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-11-05 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The issue, as I understand it, is that in check_initializer, in C++11 mode, we
enter this block

      if ((type_build_ctor_call (type) || CLASS_TYPE_P (type))
          && !(flags & LOOKUP_ALREADY_DIGESTED)
          && !(init && BRACE_ENCLOSED_INITIALIZER_P (init)
               && CP_AGGREGATE_TYPE_P (type)
               && (CLASS_TYPE_P (type)
                   || type_has_extended_temps (type))))
        {

because type_build_ctor_call (type) is true in C++11, but false in C++03, and
here we basically only set LOOKUP_ALREADY_DIGESTED.  Then later on in
store_init_value we have

  if (flags & LOOKUP_ALREADY_DIGESTED)
    value = init;
  else 
    /* Digest the specified initializer into an expression.  */
    value = digest_init_flags (type, init, flags);

as a result, in C++11 "value" is {{1}}, while in C++03 {{.i=1}}.  In C++03, we
save this into DECL_INITIAL and everything looks peachy, but in C++11 we call
split_nonconstant_init and from there the things go wrong, I'd say.

I'm not clear on whether type_build_ctor_call should for struct s[1] return
true or false.
It's also interesting why type_build_ctor_call returns false in C++03, it has
this check

  if (cxx_dialect < cxx11)
    return false;

but that can be dropped and it still returns false.  The difference is in new
hunk that came with r203985:

  /* A user-declared constructor might be private, and a constructor might
     be trivial but deleted.  */
  for (tree fns = lookup_fnfields_slot (inner, complete_ctor_identifier);
       fns; fns = OVL_NEXT (fns))
    {    
      tree fn = OVL_CURRENT (fns);
      debug_tree (fn);
      if (!DECL_ARTIFICIAL (fn) 
          || DECL_DELETED_FN (fn))
        return true;
    }

in C++03, there are two __comp_ctor's, in C++11 there are three __comp_ctor's,
and the last one is DECL_DELETED_FN, thus we return true.  Why is that I have
no clue whatsoever.

So, this all boils down to whether type_build_ctor_call is correct, or whether
I should be looking for a bug elsewhere.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (7 preceding siblings ...)
  2013-11-05 11:57 ` mpolacek at gcc dot gnu.org
@ 2013-11-05 15:48 ` jason at gcc dot gnu.org
  2013-11-05 18:05 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-11-05 15:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (8 preceding siblings ...)
  2013-11-05 15:48 ` jason at gcc dot gnu.org
@ 2013-11-05 18:05 ` jason at gcc dot gnu.org
  2013-11-05 18:07 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-11-05 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Nov  5 18:03:03 2013
New Revision: 204406

URL: http://gcc.gnu.org/viewcvs?rev=204406&root=gcc&view=rev
Log:
    PR c++/58868
    * decl.c (check_initializer): Don't use build_vec_init for arrays
    of trivial type.

Added:
    trunk/gcc/testsuite/g++.dg/init/array35.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (9 preceding siblings ...)
  2013-11-05 18:05 ` jason at gcc dot gnu.org
@ 2013-11-05 18:07 ` jason at gcc dot gnu.org
  2013-11-05 21:24 ` reichelt at gcc dot gnu.org
  2013-11-23 16:29 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-11-05 18:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
type_build_ctor_call is correct to return true here: the default constructor
for Histograms is deleted in C++11 because it has a const member with no
explicit initializer.

Fixed.


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (10 preceding siblings ...)
  2013-11-05 18:07 ` jason at gcc dot gnu.org
@ 2013-11-05 21:24 ` reichelt at gcc dot gnu.org
  2013-11-23 16:29 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-11-05 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
*** Bug 58966 has been marked as a duplicate of this bug. ***


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

* [Bug c++/58868] [4.9 Regression] ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x
  2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
                   ` (11 preceding siblings ...)
  2013-11-05 21:24 ` reichelt at gcc dot gnu.org
@ 2013-11-23 16:29 ` jason at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-11-23 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Sat Nov 23 16:28:57 2013
New Revision: 205311

URL: http://gcc.gnu.org/viewcvs?rev=205311&root=gcc&view=rev
Log:
    PR c++/58868
    * init.c (build_aggr_init): Don't clobber the type of init
    if we got an INIT_EXPR back from build_vec_init.
    (build_vec_init): Do digest_init on trivial initialization.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c


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

end of thread, other threads:[~2013-11-23 16:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25  3:00 [Bug c++/58868] New: ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x ferdinandw+gcc at gmail dot com
2013-10-25  5:44 ` [Bug c++/58868] [4.9 Regression] " mpolacek at gcc dot gnu.org
2013-10-25  6:56 ` mpolacek at gcc dot gnu.org
2013-10-25  7:15 ` mpolacek at gcc dot gnu.org
2013-10-27 17:14 ` tsaunders at mozilla dot com
2013-10-31  7:07 ` octoploid at yandex dot com
2013-10-31  7:09 ` mpolacek at gcc dot gnu.org
2013-11-04 22:24 ` mpolacek at gcc dot gnu.org
2013-11-05 11:57 ` mpolacek at gcc dot gnu.org
2013-11-05 15:48 ` jason at gcc dot gnu.org
2013-11-05 18:05 ` jason at gcc dot gnu.org
2013-11-05 18:07 ` jason at gcc dot gnu.org
2013-11-05 21:24 ` reichelt at gcc dot gnu.org
2013-11-23 16:29 ` jason 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).