Bug 84729 - [6/7 Regression] internal compiler error: verify_gimple failed
Summary: [6/7 Regression] internal compiler error: verify_gimple failed
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0.1
: P2 normal
Target Milestone: 6.5
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
 
Reported: 2018-03-06 07:34 UTC by Vegard Nossum
Modified: 2018-03-23 01:31 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-03-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vegard Nossum 2018-03-06 07:34:24 UTC
Input:

typedef int b[2];

void a() {
  new b(a);
}

Output:

$ xgcc -x c++ -S -std=c++14 -fpermissive -fno-toplevel-reorder -
<stdin>: In function 'void a()':
<stdin>:4:10: warning: parenthesized initializer in array new [-fpermissive]
<stdin>:3:6: error: non-trivial conversion at assignment
int
void <T85> (void)
*D.2125 = a.1_1;
<stdin>:3:6: internal compiler error: verify_gimple failed
0x32b4a77 verify_gimple_in_seq(gimple*)
        /home/vegard/git/gcc/gcc/tree-cfg.c:5247
0x2232b54 gimplify_body(tree_node*, bool)
        /home/vegard/git/gcc/gcc/gimplify.c:12710
0x2233a20 gimplify_function_tree(tree_node*)
        /home/vegard/git/gcc/gcc/gimplify.c:12800
0x199ff87 cgraph_node::analyze()
        /home/vegard/git/gcc/gcc/cgraphunit.c:670
0x19b305b analyze_functions
        /home/vegard/git/gcc/gcc/cgraphunit.c:1131
0x19b7d71 symbol_table::finalize_compilation_unit()
        /home/vegard/git/gcc/gcc/cgraphunit.c:2691

$ xgcc --version
xgcc (GCC) 8.0.1 20180306 (experimental)

Built from git 11a93d7a09b871b3b9a2eb108eb91ad83d94e070 (r258271).

Seems to have appeared between 4.6.4 and 4.7.1.

Test case was minimised by C-Reduce.
Comment 1 Martin Liška 2018-03-06 08:46:12 UTC
Confirmed, started with GCC 4.7.0.
Comment 2 Marek Polacek 2018-03-06 08:50:14 UTC
Probably started with r175674.
Comment 3 Jakub Jelinek 2018-03-09 08:49:22 UTC
There is decay_conversion or something similar missing somewhere, trying to convers a FUNCTION_DECL to int type is not going to work.  But no idea what exactly and where (if in the build_vec_init caller, or in build_vec_init itself.
Comment 4 Alexandre Oliva 2018-03-10 09:41:40 UTC
Mine
Comment 5 Alexandre Oliva 2018-03-10 12:03:33 UTC
Proposed patch at https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00475.html
Comment 6 Alexandre Oliva 2018-03-23 01:19:37 UTC
Author: aoliva
Date: Fri Mar 23 01:19:01 2018
New Revision: 258791

URL: https://gcc.gnu.org/viewcvs?rev=258791&root=gcc&view=rev
Log:
[PR c++/84729] reject parenthesized array init

A parenthesized initializer was only accepted when new()ing an array in
permissive mode.  We were not careful, however, to convert the
TREE_LIST initializer to the array element type in this extension.

Instead of fixing it, converting the initializer to the base type
after turning the TREE_LIST initializer to a compound_expr, we disable
this deprecated extension.


for  gcc/cp/ChangeLog

	PR c++/84729
	* init.c (build_vec_init): Error at parenthesized array init.

for  gcc/testsuite/ChangeLog

	PR c++/84729
	* g++.dg/pr84729.C: New.
        * g++.old-deja/g++.ext/arrnew2.C: Require error.
	* g++.old-deja/g++.robertl/eb58.C: Likewise.
	* g++.old-deja/g++.robertl/eb63.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/pr84729.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C
    trunk/gcc/testsuite/g++.old-deja/g++.robertl/eb58.C
    trunk/gcc/testsuite/g++.old-deja/g++.robertl/eb63.C