public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters
@ 2014-11-23 21:31 mail at jonasplatte dot de
  2014-12-03  9:55 ` [Bug c++/64035] [4.8/4.9/5 Regression] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mail at jonasplatte dot de @ 2014-11-23 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64035
           Summary: [C++11] ICE in reshape_init_r when using initializer
                    list aggregate initialization for default function
                    parameters
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mail at jonasplatte dot de

Created attachment 34081
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34081&action=edit
Test case (not using preprocessor directives, so not precompiled)

gcc -v:

    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
    Target: x86_64-unknown-linux-gnu
    Configured with: /build/gcc/src/gcc-4.9.2/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-cloog-backend=isl --disable-isl-version-check
--disable-cloog-version-check --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu --disable-multilib
--disable-werror --enable-checking=release
    Thread model: posix
    gcc version 4.9.2 (GCC) 

My system is a x86_64 arch linux, with linux 3.17.3-1-ARCH.

Compiler invocation for the test case:

    g++ -std=c++11 test2.cpp -Wall -Wextra

The exact error message I get (also added it to the test case as comment):

    test1.cpp:21:7: internal compiler error: in reshape_init_r, at
cp/decl.c:5481

I tried changing -std to c++14 and adding -pedantic to see if they make a
difference, which both don't.


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

* [Bug c++/64035] [4.8/4.9/5 Regression] [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters
  2014-11-23 21:31 [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters mail at jonasplatte dot de
@ 2014-12-03  9:55 ` mpolacek at gcc dot gnu.org
  2014-12-10 13:19 ` [Bug c++/64035] " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-12-03  9:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-03
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.8.4
            Summary|[C++11] ICE in              |[4.8/4.9/5 Regression]
                   |reshape_init_r when using   |[C++11] ICE in
                   |initializer list aggregate  |reshape_init_r when using
                   |initialization for default  |initializer list aggregate
                   |function parameters         |initialization for default
                   |                            |function parameters
     Ever confirmed|0                           |1

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


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

* [Bug c++/64035] [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters
  2014-11-23 21:31 [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters mail at jonasplatte dot de
  2014-12-03  9:55 ` [Bug c++/64035] [4.8/4.9/5 Regression] " mpolacek at gcc dot gnu.org
@ 2014-12-10 13:19 ` rguenth at gcc dot gnu.org
  2014-12-10 16:58 ` mail at jonasplatte dot de
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-10 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.4                       |---
            Summary|[4.8/4.9/5 Regression]      |[C++11] ICE in
                   |[C++11] ICE in              |reshape_init_r when using
                   |reshape_init_r when using   |initializer list aggregate
                   |initializer list aggregate  |initialization for default
                   |initialization for default  |function parameters
                   |function parameters         |
      Known to fail|                            |4.8.3, 5.0

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
But 4.7 rejects it so there is no version that works.  How's it a regression?


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

* [Bug c++/64035] [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters
  2014-11-23 21:31 [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters mail at jonasplatte dot de
  2014-12-03  9:55 ` [Bug c++/64035] [4.8/4.9/5 Regression] " mpolacek at gcc dot gnu.org
  2014-12-10 13:19 ` [Bug c++/64035] " rguenth at gcc dot gnu.org
@ 2014-12-10 16:58 ` mail at jonasplatte dot de
  2014-12-10 17:03 ` mail at jonasplatte dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mail at jonasplatte dot de @ 2014-12-10 16:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonas Platte <mail at jonasplatte dot de> ---
(In reply to Richard Biener from comment #2)
> But 4.7 rejects it so there is no version that works.  How's it a regression?

Does the bug report imply this is a regression? If so, that was not
intentional.


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

* [Bug c++/64035] [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters
  2014-11-23 21:31 [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters mail at jonasplatte dot de
                   ` (2 preceding siblings ...)
  2014-12-10 16:58 ` mail at jonasplatte dot de
@ 2014-12-10 17:03 ` mail at jonasplatte dot de
  2015-08-05  0:38 ` mail at jonasplatte dot de
  2015-08-05 15:39 ` miyuki at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mail at jonasplatte dot de @ 2014-12-10 17:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonas Platte <mail at jonasplatte dot de> ---
EDIT: Sorry for the noise, I didn't notice the summary change before.


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

* [Bug c++/64035] [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters
  2014-11-23 21:31 [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters mail at jonasplatte dot de
                   ` (3 preceding siblings ...)
  2014-12-10 17:03 ` mail at jonasplatte dot de
@ 2015-08-05  0:38 ` mail at jonasplatte dot de
  2015-08-05 15:39 ` miyuki at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mail at jonasplatte dot de @ 2015-08-05  0:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jonas Platte <mail at jonasplatte dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.9.2                       |5.2.0
      Known to fail|                            |5.2.0

--- Comment #5 from Jonas Platte <mail at jonasplatte dot de> ---
Still makes the compiler crash in 5.2.0 with pretty much the same error
message.

With decent experience in C++, but no experience working on GCC (or any other
compiler), could I help fixing this?


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

* [Bug c++/64035] [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters
  2014-11-23 21:31 [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters mail at jonasplatte dot de
                   ` (4 preceding siblings ...)
  2015-08-05  0:38 ` mail at jonasplatte dot de
@ 2015-08-05 15:39 ` miyuki at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-08-05 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

Mikhail Maltsev <miyuki at gcc dot gnu.org> changed:

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

--- Comment #6 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
(In reply to Jonas Platte from comment #5)
> With decent experience in C++, but no experience working on GCC (or any
> other compiler), could I help fixing this?

Certainly. Some relevant wiki pages:
https://gcc.gnu.org/wiki/GettingStarted - about contributing to GCC (in
general)
https://gcc.gnu.org/wiki/DebuggingGCC - notes on debugging

Steps which seem reasonable (for me) to start debugging this particular case:
1. build the compiler with debugging information (-ggdb3) and low optimization
level (-Og)
2. run the compiler proper from build/gcc directory under debugger (suppose
that "build" is the top-level build directory and "test.cc" is your testcase):
gdb --args ./cc1plus test.cc
(note: gdb should load .gdbinit which is created in gcc directory during build;
it contains several useful macros)
3. I hit the breakpoint in fancy_abort (it is set by .gdbinit) and go one frame
up:
#1  0x0000000000605a28 in reshape_init_r (type=<array_type 0x7ffff6800348>,
d=d@entry=0x7fffffffd870, first_initializer_p=first_initializer_p@entry=false,
complain=complain@entry=2) at /home/miyuki/gcc/src/gcc/cp/decl.c:5734
5734                  gcc_assert (BRACE_ENCLOSED_INITIALIZER_P (init));

This asserion fails. I can look at the contents of "init" like this:
(gdb) p init
$1 = <constructor 0x7ffff680adf8>
(gdb) p debug_tree(init)
 <constructor 0x7ffff680adf8
    type <array_type 0x7ffff6800348
        type <integer_type 0x7ffff669f7e0 int public SI
            size <integer_cst 0x7ffff66bd0a8 constant 32>
            unit size <integer_cst 0x7ffff66bd0c0 constant 4>
            align 32 symtab 0 alias set -1 canonical type 0x7ffff669f7e0
precision 32 min <integer_cst 0x7ffff66bd060 -2147483648> max <integer_cst
0x7ffff66bd078 2147483647>
            pointer_to_this <pointer_type 0x7ffff66c1930>>
        DI
        size <integer_cst 0x7ffff669be58 constant 64>
        unit size <integer_cst 0x7ffff669be70 constant 8>
        align 32 symtab 0 alias set -1 canonical type 0x7ffff6800348
        domain <integer_type 0x7ffff68002a0 type <integer_type 0x7ffff669f1f8
sizetype>
            type_6 DI size <integer_cst 0x7ffff669be58 64> unit size
<integer_cst 0x7ffff669be70 8>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff68002a0
precision 64 min <integer_cst 0x7ffff669be88 0> max <integer_cst 0x7ffff669bf60
1>>>
    constant static lngt 0>

So, init is some AST node. If I go 4 frames up, I can see an AST for the entire
initializer:

#5  0x00000000005c0305 in implicit_conversion (to=to@entry=<record_type
0x7ffff6800150 testStruct>, from=<lang_type 0x7ffff67f6a80 init list>,
expr=expr@entry=<constructor 0x7ffff680ade0>, c_cast_p=c_cast_p@entry=false, 
    flags=flags@entry=5, complain=2, complain@entry=3) at
/home/miyuki/gcc/src/gcc/cp/call.c:1763
1763          expr = reshape_init (to, expr, complain);

 <constructor 0x7ffff680ade0
    type <lang_type 0x7ffff67f6a80 init list VOID
        align 1 symtab 0 alias set -1 canonical type 0x7ffff67f6a80>
    lngt 1
    val <constructor 0x7ffff680adf8
        type <array_type 0x7ffff6800348 type <integer_type 0x7ffff669f7e0 int>
            DI
            size <integer_cst 0x7ffff669be58 constant 64>
            unit size <integer_cst 0x7ffff669be70 constant 8>
            align 32 symtab 0 alias set -1 canonical type 0x7ffff6800348 domain
<integer_type 0x7ffff68002a0>>
        constant static lngt 0>>

You need to figure out what went wrong here and why do we get unexpected AST
(perhaps by comparing it with AST that is built in "func({{}});" case).


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

end of thread, other threads:[~2015-08-05 15:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-23 21:31 [Bug c++/64035] New: [C++11] ICE in reshape_init_r when using initializer list aggregate initialization for default function parameters mail at jonasplatte dot de
2014-12-03  9:55 ` [Bug c++/64035] [4.8/4.9/5 Regression] " mpolacek at gcc dot gnu.org
2014-12-10 13:19 ` [Bug c++/64035] " rguenth at gcc dot gnu.org
2014-12-10 16:58 ` mail at jonasplatte dot de
2014-12-10 17:03 ` mail at jonasplatte dot de
2015-08-05  0:38 ` mail at jonasplatte dot de
2015-08-05 15:39 ` miyuki 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).