public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63241] New: Internal error in gimplify_init_constructor when using constexr and multidimensional arrays
@ 2014-09-12 12:36 thibaut.lutz at googlemail dot com
  2014-09-17 14:12 ` [Bug c++/63241] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: thibaut.lutz at googlemail dot com @ 2014-09-12 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63241
           Summary: Internal error in gimplify_init_constructor when using
                    constexr and multidimensional arrays
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thibaut.lutz at googlemail dot com

I stumbled upon a weird regression bug. The test case below is working fine
with GCC 4.8 and 4.9.0 but triggers an internal error on 4.9.1. I haven't
tested 4.9.2.

Any of these modifications would remove the error:
- removing `constexpr` from the constructor at line 2
- using `0` instead of `i` in the second array element constructor at line 8
- using `const int i` instead of `int i` at line 6
- using a 1D array instead of a 2D array at line 7
So I believe the example below cannot be reduced further.

However somehow the combination of `constexpr` constructor and multidimensional
array is causing the compiler to crash.

Details:

* GCC version: 4.9.1 built with default config

* System: x86_64 GNU/Linux

* Command line: c++ -std=c++11 bug.cpp

* Minimal example:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
struct A {
  constexpr A(int){}
};

int main() {
  int i = 1;
  A array[2][2] =
    {{{0}, {i}},
     {{0}, {0}}};
}
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

* Output:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bug.cpp: In function ‘int main()’:
bug.cpp:9:16: internal compiler error: in gimplify_init_constructor, at
gimplify.c:4007
      {{0}, {0}}};
                ^
0x7f6213 gimplify_init_constructor
        ../.././gcc/gimplify.c:4007
0x7f6dee gimplify_modify_expr_rhs
        ../.././gcc/gimplify.c:4167
0x7f6ec4 gimplify_modify_expr
        ../.././gcc/gimplify.c:4486
0x7f7dda gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../.././gcc/gimplify.c:7627
0x7facd6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../.././gcc/gimplify.c:5373
0x7f806a gimplify_cleanup_point_expr
        ../.././gcc/gimplify.c:5149
0x7f806a gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../.././gcc/gimplify.c:7990
0x7facd6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../.././gcc/gimplify.c:5373
0x7f8d3b gimplify_statement_list
        ../.././gcc/gimplify.c:1432
0x7f8d3b gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../.././gcc/gimplify.c:8042
0x7facd6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../.././gcc/gimplify.c:5373
0x7f806a gimplify_cleanup_point_expr
        ../.././gcc/gimplify.c:5149
0x7f806a gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../.././gcc/gimplify.c:7990
0x7facd6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../.././gcc/gimplify.c:5373
0x7f8d3b gimplify_statement_list
        ../.././gcc/gimplify.c:1432
0x7f8d3b gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../.././gcc/gimplify.c:8042
0x7facd6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../.././gcc/gimplify.c:5373
0x7fb56b gimplify_bind_expr
        ../.././gcc/gimplify.c:1099
0x7f7fc0 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        ../.././gcc/gimplify.c:7824
0x7facd6 gimplify_stmt(tree_node**, gimple_statement_base**)
        ../.././gcc/gimplify.c:5373
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.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>From gcc-bugs-return-461669-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Sep 12 12:45:26 2014
Return-Path: <gcc-bugs-return-461669-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13719 invoked by alias); 12 Sep 2014 12:45:25 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13646 invoked by uid 48); 12 Sep 2014 12:45:21 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs
Date: Fri, 12 Sep 2014 12:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: ebotcazou at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status component assigned_to
Message-ID: <bug-62631-4-6Oz3ZxQ7lh@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62631-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62631-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-09/txt/msg01503.txt.bz2
Content-length: 955

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
          Component|tree-optimization           |target
           Assignee|unassigned at gcc dot gnu.org      |ebotcazou at gcc dot gnu.org

--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> * For the mult part, rtx_code calls sparc_rtx_cost, which has
> 
>     case MULT:
>       if (float_mode_p)
> 	*total = sparc_costs->float_mul;
>       else if (! TARGET_HARD_MUL)
> 	*total = COSTS_N_INSNS (25);
> 
>   On SPARCv9/-m64, TARGET_HARD_MUL is false, so we get the 25*4 = 100 part,
>   unlike v8, which explains why the test only fails for 64-bit.

Ugh, thanks for spotting it, this looks like an annoying oversight.
>From gcc-bugs-return-461670-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Sep 12 12:56:44 2014
Return-Path: <gcc-bugs-return-461670-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18696 invoked by alias); 12 Sep 2014 12:56:44 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18653 invoked by uid 48); 12 Sep 2014 12:56:39 -0000
From: "wbrana at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/63242] New: memory starvation caused by flatten attribute
Date: Fri, 12 Sep 2014 12:56:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: lto
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: wbrana at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-63242-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-09/txt/msg01504.txt.bz2
Content-length: 977

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc242

            Bug ID: 63242
           Summary: memory starvation caused by flatten attribute
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wbrana at gmail dot com

forwarded from https://bugs.freedesktop.org/show_bug.cgi?idw580

Hello,
    I've been testing GCC 4.9 for a virtual gentoo machine and I noticed that
you us flatten attribute in source code. In case of src/sna/sna_glyphs.c
flatten functions, inliner inlines about 3.3M functions and crashes because of
no free memory (I have 8GB memory).

Please notice that LTO has ability to optimize whole program. As a result, it
sees almost all function bodies and that leads to enormous inlining.

Suggested patch removes these flatten attributes for selected functions.

Thank you,
MArtin


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

* [Bug c++/63241] Internal error in gimplify_init_constructor when using constexr and multidimensional arrays
  2014-09-12 12:36 [Bug c++/63241] New: Internal error in gimplify_init_constructor when using constexr and multidimensional arrays thibaut.lutz at googlemail dot com
@ 2014-09-17 14:12 ` paolo.carlini at oracle dot com
  2014-09-17 14:30 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-09-17 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is already fixed in current 4_9-branch. I'm adding the testcase and
closing the bug.


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

* [Bug c++/63241] Internal error in gimplify_init_constructor when using constexr and multidimensional arrays
  2014-09-12 12:36 [Bug c++/63241] New: Internal error in gimplify_init_constructor when using constexr and multidimensional arrays thibaut.lutz at googlemail dot com
  2014-09-17 14:12 ` [Bug c++/63241] " paolo.carlini at oracle dot com
@ 2014-09-17 14:30 ` paolo at gcc dot gnu.org
  2014-09-17 14:31 ` paolo at gcc dot gnu.org
  2014-09-17 14:31 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-09-17 14:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Sep 17 14:30:18 2014
New Revision: 215326

URL: https://gcc.gnu.org/viewcvs?rev=215326&root=gcc&view=rev
Log:
2014-09-17  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/63241
    * g++.dg/cpp0x/constexpr-63241.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/63241] Internal error in gimplify_init_constructor when using constexr and multidimensional arrays
  2014-09-12 12:36 [Bug c++/63241] New: Internal error in gimplify_init_constructor when using constexr and multidimensional arrays thibaut.lutz at googlemail dot com
                   ` (2 preceding siblings ...)
  2014-09-17 14:31 ` paolo at gcc dot gnu.org
@ 2014-09-17 14:31 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-09-17 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.2

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

* [Bug c++/63241] Internal error in gimplify_init_constructor when using constexr and multidimensional arrays
  2014-09-12 12:36 [Bug c++/63241] New: Internal error in gimplify_init_constructor when using constexr and multidimensional arrays thibaut.lutz at googlemail dot com
  2014-09-17 14:12 ` [Bug c++/63241] " paolo.carlini at oracle dot com
  2014-09-17 14:30 ` paolo at gcc dot gnu.org
@ 2014-09-17 14:31 ` paolo at gcc dot gnu.org
  2014-09-17 14:31 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-09-17 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Sep 17 14:30:35 2014
New Revision: 215327

URL: https://gcc.gnu.org/viewcvs?rev=215327&root=gcc&view=rev
Log:
2014-09-17  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/63241
    * g++.dg/cpp0x/constexpr-63241.C: New.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C
Modified:
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2014-09-17 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12 12:36 [Bug c++/63241] New: Internal error in gimplify_init_constructor when using constexr and multidimensional arrays thibaut.lutz at googlemail dot com
2014-09-17 14:12 ` [Bug c++/63241] " paolo.carlini at oracle dot com
2014-09-17 14:30 ` paolo at gcc dot gnu.org
2014-09-17 14:31 ` paolo at gcc dot gnu.org
2014-09-17 14:31 ` paolo.carlini at oracle dot com

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).