Bug 88958 - ICE in walk_aliased_vdefs_1, at tree-ssa-alias.c:2887
Summary: ICE in walk_aliased_vdefs_1, at tree-ssa-alias.c:2887
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: d (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Iain Buclaw
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-21 18:02 UTC by G. Steinmetz
Modified: 2019-03-10 16:31 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-01-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2019-01-21 18:02:21 UTC
With following snippet :


$ cat z1.d
void f(int) {}
void g(...) {}
void h()
{
    g(*&f);
}


$ gdc-9-20190120 -c z1.d
$
$ gdc-9-20190120 -c z1.d -O0 -Wextra
during GIMPLE pass: *early_warn_uninitialized
In function 'h':
d21: internal compiler error: Segmentation fault
0xb821cf crash_signal
        ../../gcc/toplev.c:326
0xc4f63c walk_aliased_vdefs_1
        ../../gcc/tree-ssa-alias.c:2887
0xc4f7e1 walk_aliased_vdefs(ao_ref*, tree_node*, bool (*)(ao_ref*, tree_node*, void*), void*, bitmap_head**, bool*, unsigned int)
        ../../gcc/tree-ssa-alias.c:2945
0xd34d04 warn_uninitialized_vars
        ../../gcc/tree-ssa-uninit.c:342
0xd34f80 execute_early_warn_uninitialized
        ../../gcc/tree-ssa-uninit.c:2736
0xd34f80 execute
        ../../gcc/tree-ssa-uninit.c:2771
Comment 1 G. Steinmetz 2019-01-21 18:02:52 UTC
$ gdc-9-20190120 -c z1.d -O0
$
$ gdc-9-20190120 -c z1.d -O1
during GIMPLE pass: fre
In function 'h':
d21: internal compiler error: in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:976
0xce83a5 copy_reference_ops_from_ref
        ../../gcc/tree-ssa-sccvn.c:976
0xce90a5 valueize_shared_reference_ops_from_ref
        ../../gcc/tree-ssa-sccvn.c:1626
0xcea5a9 vn_reference_lookup(tree_node*, tree_node*, vn_lookup_kind, vn_reference_s**, bool)
        ../../gcc/tree-ssa-sccvn.c:2708
0xcf16f9 visit_reference_op_load
        ../../gcc/tree-ssa-sccvn.c:4067
0xcf16f9 visit_stmt
        ../../gcc/tree-ssa-sccvn.c:4485
0xcf2aeb process_bb
        ../../gcc/tree-ssa-sccvn.c:6055
0xcf3eff do_rpo_vn
        ../../gcc/tree-ssa-sccvn.c:6662
0xcf4e2c execute
        ../../gcc/tree-ssa-sccvn.c:6797
Comment 2 Iain Buclaw 2019-01-27 01:04:41 UTC
This is code that the front-end implementation accepts as valid code, but it should be an error.  Referencing f on is own does not automatically take the address of it, e.g:

auto a = f;    // f(int) is not callable using argument types ().
auto b = *&f;  // b cannot be declared to be a function.
Comment 3 Martin Liška 2019-02-04 12:20:19 UTC
Author: marxin
Date: Mon Feb  4 12:19:48 2019
New Revision: 268516

URL: https://gcc.gnu.org/viewcvs?rev=268516&root=gcc&view=rev
Log:
Bail out when ipa_fn_summaries does not contain entry for callee (PR ipa/88958).

2019-02-04  Martin Liska  <mliska@suse.cz>

	PR ipa/88958
	* ipa-fnsummary.c (estimate_edge_devirt_benefit): Bail
	out when ipa_fn_summaries does not contain entry for callee.
2019-02-04  Martin Liska  <mliska@suse.cz>

	PR ipa/88958
	* gcc.dg/ipa/pr88958.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/ipa/pr88958.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-fnsummary.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Martin Liška 2019-02-04 12:23:42 UTC
(In reply to Martin Liška from comment #3)
> Author: marxin
> Date: Mon Feb  4 12:19:48 2019
> New Revision: 268516
> 
> URL: https://gcc.gnu.org/viewcvs?rev=268516&root=gcc&view=rev
> Log:
> Bail out when ipa_fn_summaries does not contain entry for callee (PR
> ipa/88958).
> 
> 2019-02-04  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/88958
> 	* ipa-fnsummary.c (estimate_edge_devirt_benefit): Bail
> 	out when ipa_fn_summaries does not contain entry for callee.
> 2019-02-04  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/88958
> 	* gcc.dg/ipa/pr88958.c: New test.
> 
> Added:
>     trunk/gcc/testsuite/gcc.dg/ipa/pr88958.c
> Modified:
>     trunk/gcc/ChangeLog
>     trunk/gcc/ipa-fnsummary.c
>     trunk/gcc/testsuite/ChangeLog

Sorry, wrong changelog entry.
Comment 5 ibuclaw 2019-03-10 16:30:24 UTC
Author: ibuclaw
Date: Sun Mar 10 16:29:48 2019
New Revision: 269557

URL: https://gcc.gnu.org/viewcvs?rev=269557&root=gcc&view=rev
Log:
    PR d/88958
d/dmd: Merge upstream dmd 0fc786f49

Backport fix to disallow passing functions as parameters.

Fixes https://gcc.gnu.org/PR88958

Reviewed-on: https://github.com/dlang/dmd/pull/9437

Added:
    trunk/gcc/testsuite/gdc.test/fail_compilation/test19608.d
Modified:
    trunk/gcc/d/dmd/MERGE
    trunk/gcc/d/dmd/expressionsem.c
Comment 6 Iain Buclaw 2019-03-10 16:31:59 UTC
Fixed in r269557.