Hi, The new gcc.dg/pr94780.c test causes an ICE on aarch64: /gcc/testsuite/gcc.dg/pr94780.c: In function 'foo': /gcc/testsuite/gcc.dg/pr94780.c:8:1: internal compiler error: Segmentation fault 0xd5f4af crash_signal /gcc/toplev.c:328 0xe2b238 contains_struct_check /gcc/tree.h:3400 0xe2b238 convert_nonlocal_reference_op /gcc/tree-nested.c:1065 0x10cf01b walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*, tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*)) /gcc/tree.c:12000 0xa34d93 walk_gimple_op(gimple*, tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /gcc/gimple-walk.c:268 0xa355e4 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /gcc/gimple-walk.c:596 0xa357e8 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /gcc/gimple-walk.c:51 0xa35682 walk_gimple_stmt(gimple_stmt_iterator*, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /gcc/gimple-walk.c:606 0xa357e8 walk_gimple_seq_mod(gimple**, tree_node* (*)(gimple_stmt_iterator*, bool*, walk_stmt_info*), tree_node* (*)(tree_node**, int*, void*), walk_stmt_info*) /gcc/gimple-walk.c:51 0xe23ac1 walk_body /gcc/tree-nested.c:713 0xe24508 walk_function /gcc/tree-nested.c:724 0xe24508 walk_all_functions /gcc/tree-nested.c:789 0xe2a1af lower_nested_functions(tree_node*) /gcc/tree-nested.c:3553 0x86f243 cgraph_node::analyze() /gcc/cgraphunit.c:676 0x872ae3 analyze_functions /gcc/cgraphunit.c:1227 0x8738a2 symbol_table::finalize_compilation_unit() /gcc/cgraphunit.c:2974
Looks like an exact duplicate of the PR but this time for aarch64. The fix is going to be similar (and likely more targets will be affected).
*** Bug 94821 has been marked as a duplicate of this bug. ***
I have an initial fix for aarch64 that is under testing. Will post to gcc-patches when finished.
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:d81bc2af7d2700888e414eb5a322ff5f5b0df0bb commit r10-8038-gd81bc2af7d2700888e414eb5a322ff5f5b0df0bb Author: Haijian Zhang <z.zhanghaijian@huawei.com> Date: Wed Apr 29 10:23:11 2020 +0200 pr94780.c fails with ICE on aarch64 [PR94820] This is a simple fix for pr94820. The PR was only fixed on i386, the same error was also reported on aarch64. This function, because it is sometimes called even outside of function bodies, uses create_tmp_var_raw rather than create_tmp_var. But in order for that to work, when first referenced, the VAR_DECLs need to appear in a TARGET_EXPR so that during gimplification the var gets the right DECL_CONTEXT and is added to local decls. Without that, e.g. tree-nested.c ICEs on those. 2020-04-29 Haijian Zhang <z.zhanghaijian@huawei.com> PR target/94820 * config/aarch64/aarch64-builtins.c (aarch64_atomic_assign_expand_fenv): Use TARGET_EXPR instead of MODIFY_EXPR for first assignment to fenv_cr, fenv_sr and new_fenv_var.
Fixed on the trunk (so far).
The releases/gcc-9 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:029d813ddf3595bfc93bfb4afad645dd033d21bf commit r9-8889-g029d813ddf3595bfc93bfb4afad645dd033d21bf Author: Haijian Zhang <z.zhanghaijian@huawei.com> Date: Wed Apr 29 10:23:11 2020 +0200 pr94780.c fails with ICE on aarch64 [PR94820] This is a simple fix for pr94820. The PR was only fixed on i386, the same error was also reported on aarch64. This function, because it is sometimes called even outside of function bodies, uses create_tmp_var_raw rather than create_tmp_var. But in order for that to work, when first referenced, the VAR_DECLs need to appear in a TARGET_EXPR so that during gimplification the var gets the right DECL_CONTEXT and is added to local decls. Without that, e.g. tree-nested.c ICEs on those. 2020-04-29 Haijian Zhang <z.zhanghaijian@huawei.com> PR target/94820 * config/aarch64/aarch64-builtins.c (aarch64_atomic_assign_expand_fenv): Use TARGET_EXPR instead of MODIFY_EXPR for first assignment to fenv_cr, fenv_sr and new_fenv_var. (cherry picked from commit d81bc2af7d2700888e414eb5a322ff5f5b0df0bb)
Fixed for 8.5 in r8-10495-g840a91477f0157a5811957b7d866489d519fb77f and by the above commit for 9.4+ too.