https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101365
Bug ID: 101365 Summary: [12 Regression] ICE: in fold_convert_loc, at fold-const.c:243 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: anbu1024.me at gmail dot com Target Milestone: --- $ cat test.c int var_0; void func_0() { var_0++; } int var_0[] = {1}; ================================ $ gcc-sp12 --version gcc (GCC) 12.0.0 20210704 (experimental) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ================================ $ gcc-sp12 test.c test.c:9:5: error: conflicting types for ‘var_0’; have ‘int[]’ 9 | int var_0[] = {1}; | ^~~~~ test.c:2:5: note: previous declaration of ‘var_0’ with type ‘int’ 2 | int var_0; | ^~~~~ test.c: In function ‘func_0’: test.c:6:8: internal compiler error: in fold_convert_loc, at fold-const.c:2431 6 | var_0++; | ~~~~~^~ 0x6d5399 fold_convert_loc(unsigned int, tree_node*, tree_node*) ../../gcc-12-20210704/gcc/fold-const.c:2431 0xbddc1e gimplify_self_mod_expr(tree_node**, gimple**, gimple**, bool, tree_node*) ../../gcc-12-20210704/gcc/gimplify.c:3204 0xbc77b8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-12-20210704/gcc/gimplify.c:14140 0xbcb3f6 gimplify_stmt(tree_node**, gimple**) ../../gcc-12-20210704/gcc/gimplify.c:6869 0xbcbb4d gimplify_bind_expr ../../gcc-12-20210704/gcc/gimplify.c:1426 0xbc96ae gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-12-20210704/gcc/gimplify.c:14411 0xbe0f59 gimplify_stmt(tree_node**, gimple**) ../../gcc-12-20210704/gcc/gimplify.c:6869 0xbe0f59 gimplify_body(tree_node*, bool) ../../gcc-12-20210704/gcc/gimplify.c:15442 0xbe139d gimplify_function_tree(tree_node*) ../../gcc-12-20210704/gcc/gimplify.c:15596 0xa202e7 cgraph_node::analyze() ../../gcc-12-20210704/gcc/cgraphunit.c:670 0xa22d17 analyze_functions ../../gcc-12-20210704/gcc/cgraphunit.c:1234 0xa239bd symbol_table::finalize_compilation_unit() ../../gcc-12-20210704/gcc/cgraphunit.c:2508 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. ================================ $ gcc-sp11 --version gcc (GCC) 11.1.1 20210703 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ================================ $ gcc-sp11 test.c test.c:9:5: error: conflicting types for ‘var_0’; have ‘int[]’ 9 | int var_0[] = {1}; | ^~~~~ test.c:2:5: note: previous declaration of ‘var_0’ with type ‘int’ 2 | int var_0; | ^~~~~ test.c:6: confused by earlier errors, bailing out