public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
@ 2015-03-23 16:49 marciso.gcc at gmail dot com
  2015-03-24 10:23 ` [Bug c++/65525] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: marciso.gcc at gmail dot com @ 2015-03-23 16:49 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5637 bytes --]

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

            Bug ID: 65525
           Summary: ICE: sorry, unimplemented: unexpected AST of kind
                    mem_ref (-std=c++14, ICE: in
                    potential_constant_expression_1, at
                    cp/constexpr.c:4432)
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marciso.gcc at gmail dot com

// The following code triggers "unimplemented ICE" when compiled with
"-std=c++14";
// "-std=c++11" compiles fine.

// g++ -std=c++14 test.cpp
// Tested with:
//   g++ (GCC) 5.0.0 20150308 (experimental)
//   g++ (GCC) 5.0.0 20150323 (experimental)

struct A
{
    int x;
    char y; // Actually, short and bool (types smaller than int?) trigger this
ICE too
    // Also: the problem doesn't occur if you put the smaller type first, e.g.
"char x; int y;"

    A(int x) {} // custom ctor needed for ICE
};

int main()
{
    A a{0}, x{1}, y{2};

    x = a; // OK
    y = a; // OK
    x = y = a; // ICE: sorry, unimplemented: unexpected AST of kind mem_ref
    // internal compiler error: in potential_constant_expression_1, at
cp/constexpr.c:4432

    return 0;
}

/*
./gcc/bin/g++ -std=c++14    test.cpp   -o test
test.cpp: In function ‘int main()’:
test.cpp:20:13: sorry, unimplemented: unexpected AST of kind mem_ref
     x = y = a; // ICE: sorry, unimplemented: unexpected AST of kind mem_ref
             ^
test.cpp:20:13: internal compiler error: in potential_constant_expression_1, at
cp/constexpr.c:4432
0x843238 potential_constant_expression_1
        ../../gcc/cp/constexpr.c:4432
0x842eca potential_constant_expression_1
        ../../gcc/cp/constexpr.c:4049
0x8423e5 potential_constant_expression_1
        ../../gcc/cp/constexpr.c:4379
0x74c3d2 cp_parser_constant_expression
        ../../gcc/cp/parser.c:8672
0x74c0b4 cp_parser_assignment_expression
        ../../gcc/cp/parser.c:8434
0x74e80d cp_parser_expression
        ../../gcc/cp/parser.c:8569
0x74f0f6 cp_parser_expression_statement
        ../../gcc/cp/parser.c:9976
0x73c8b5 cp_parser_statement
        ../../gcc/cp/parser.c:9827
0x73d422 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.c:10099
0x73d57b cp_parser_compound_statement
        ../../gcc/cp/parser.c:10053
0x75233b cp_parser_function_body
        ../../gcc/cp/parser.c:19185
0x75233b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.c:19221
0x75cbaa cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.c:23464
0x75da23 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.c:23376
0x75da23 cp_parser_init_declarator
        ../../gcc/cp/parser.c:17055
0x75efbc cp_parser_simple_declaration
        ../../gcc/cp/parser.c:11592
0x75f313 cp_parser_block_declaration
        ../../gcc/cp/parser.c:11466
0x767879 cp_parser_declaration
        ../../gcc/cp/parser.c:11363
0x767afa cp_parser_declaration_seq_opt
        ../../gcc/cp/parser.c:11249
0x767e0f cp_parser_translation_unit
        ../../gcc/cp/parser.c:4100
Please submit a full bug report,
>From gcc-bugs-return-481279-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Mar 23 16:16:00 2015
Return-Path: <gcc-bugs-return-481279-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 87870 invoked by alias); 23 Mar 2015 16:15:59 -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 87801 invoked by uid 48); 23 Mar 2015 16:15:56 -0000
From: "wilson at tuliptree dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/60408] ARM: inefficient code for vget_lane_f32 intrinsic
Date: Mon, 23 Mar 2015 17:02: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: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: wilson at tuliptree dot org
X-Bugzilla-Status: NEW
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: cc attachments.created
Message-ID: <bug-60408-4-ffhVOaxi6e@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60408-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60408-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: 2015-03/txt/msg02423.txt.bz2
Content-length: 519

https://gcc.gnu.org/bugzilla/show_bug.cgi?id`408

Jim Wilson <wilson at tuliptree dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at tuliptree dot org

--- Comment #2 from Jim Wilson <wilson at tuliptree dot org> ---
Created attachment 35114
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id5114&actioníit
patch to use subregs instead of vec_extract


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

* [Bug c++/65525] ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
  2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
@ 2015-03-24 10:23 ` rguenth at gcc dot gnu.org
  2015-03-24 10:25 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-24 10:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-24
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

Btw, I wonder why we sorry here instead of simply treating it as
non-constant...


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

* [Bug c++/65525] ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
  2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
  2015-03-24 10:23 ` [Bug c++/65525] " rguenth at gcc dot gnu.org
@ 2015-03-24 10:25 ` rguenth at gcc dot gnu.org
  2015-03-24 10:29 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-24 10:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Run till exit from #0  0x00000000012bf93a in build2_stat (code=MEM_REF, 
    tt=<array_type 0x7ffff6a35f18>, arg0=<addr_expr 0x7ffff6a39760>, 
    arg1=<integer_cst 0x7ffff6a33228>)
    at /space/rguenther/src/svn/trunk/gcc/tree.c:4385
0x00000000006f8b40 in build_over_call (cand=0x24f7aa0, flags=1, complain=3)
    at /space/rguenther/src/svn/trunk/gcc/cp/call.c:7456
7456              t = build2 (MODIFY_EXPR, void_type_node,
Value returned is $9 = (tree_node *) 0x7ffff6a37758
(gdb) l
7451              array_type = build_array_type (char_type_node,
7452                                             build_index_type
7453                                               (size_binop (MINUS_EXPR,
7454                                                            arg2, size_int
(1))));
7455              alias_set = build_int_cst (build_pointer_type (type), 0);
7456              t = build2 (MODIFY_EXPR, void_type_node,
7457                          build2 (MEM_REF, array_type, arg0, alias_set),
7458                          build2 (MEM_REF, array_type, arg, alias_set));
7459              val = build2 (COMPOUND_EXPR, TREE_TYPE (to), t, to);

so the C++ FE even builds this itself.


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

* [Bug c++/65525] ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
  2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
  2015-03-24 10:23 ` [Bug c++/65525] " rguenth at gcc dot gnu.org
  2015-03-24 10:25 ` rguenth at gcc dot gnu.org
@ 2015-03-24 10:29 ` rguenth at gcc dot gnu.org
  2015-03-26 16:21 ` [Bug c++/65525] [5 Regression] " jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-24 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, and that was me:

2011-08-12  Richard Guenther  <rguenther@suse.de>

       * call.c (build_over_call): Instead of memcpy use an
       assignment of two MEM_REFs.

which implements memcpy as *(char[n])ptr1 = *(char[n])ptr2;

But we ask

#4  0x000000000097fdb9 in potential_rvalue_constant_expression (
    t=<compound_expr 0x7ffff6a377a8>)
    at /space/rguenther/src/svn/trunk/gcc/cp/constexpr.c:4478
(gdb) p debug_generic_expr (expression)
MEM[(struct A *)&y] = MEM[(struct A *)(const struct A &) (const struct A *)
&a];, y

so I wonder why we look at the side-effects at all?  That is, why does
COMPOUND_EXPR handling not return false on side-effects early?


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

* [Bug c++/65525] [5 Regression] ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
  2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
                   ` (2 preceding siblings ...)
  2015-03-24 10:29 ` rguenth at gcc dot gnu.org
@ 2015-03-26 16:21 ` jason at gcc dot gnu.org
  2015-03-26 18:25 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-03-26 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> so I wonder why we look at the side-effects at all?  That is, why does
> COMPOUND_EXPR handling not return false on side-effects early?

Because a call to a constexpr function has TREE_SIDE_EFFECTS; we don't know
whether it's constant until we do the evaluation.


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

* [Bug c++/65525] [5 Regression] ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
  2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
                   ` (3 preceding siblings ...)
  2015-03-26 16:21 ` [Bug c++/65525] [5 Regression] " jason at gcc dot gnu.org
@ 2015-03-26 18:25 ` jason at gcc dot gnu.org
  2015-03-26 18:31 ` jason at gcc dot gnu.org
  2015-03-27 10:06 ` rogero at howzatt dot demon.co.uk
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-03-26 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.


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

* [Bug c++/65525] [5 Regression] ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
  2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
                   ` (4 preceding siblings ...)
  2015-03-26 18:25 ` jason at gcc dot gnu.org
@ 2015-03-26 18:31 ` jason at gcc dot gnu.org
  2015-03-27 10:06 ` rogero at howzatt dot demon.co.uk
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-03-26 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Mar 26 17:58:39 2015
New Revision: 221699

URL: https://gcc.gnu.org/viewcvs?rev=221699&root=gcc&view=rev
Log:
    PR c++/65525
    * constexpr.c (potential_constant_expression_1): Handle MEM_REF.

Added:
    trunk/gcc/testsuite/g++.dg/parse/assign1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c


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

* [Bug c++/65525] [5 Regression] ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)
  2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
                   ` (5 preceding siblings ...)
  2015-03-26 18:31 ` jason at gcc dot gnu.org
@ 2015-03-27 10:06 ` rogero at howzatt dot demon.co.uk
  6 siblings, 0 replies; 8+ messages in thread
From: rogero at howzatt dot demon.co.uk @ 2015-03-27 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Roger Orr <rogero at howzatt dot demon.co.uk> ---
Thanks!


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

end of thread, other threads:[~2015-03-27  9:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-23 16:49 [Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432) marciso.gcc at gmail dot com
2015-03-24 10:23 ` [Bug c++/65525] " rguenth at gcc dot gnu.org
2015-03-24 10:25 ` rguenth at gcc dot gnu.org
2015-03-24 10:29 ` rguenth at gcc dot gnu.org
2015-03-26 16:21 ` [Bug c++/65525] [5 Regression] " jason at gcc dot gnu.org
2015-03-26 18:25 ` jason at gcc dot gnu.org
2015-03-26 18:31 ` jason at gcc dot gnu.org
2015-03-27 10:06 ` rogero at howzatt dot demon.co.uk

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