The following fails: $ cat schedule.i typedef enum { LangC } cLanguage; typedef enum { FunctionOneArg, FunctionStandard } cFunctionType; void *CCTK_CallFunction_function; cLanguage CCTK_CallFunction_fdata_0; cFunctionType CCTK_CallFunction_fdata_1; void CCTK_CallFunction_data() { void (*standardfunc)(); int (*oneargfunc)(); switch (CCTK_CallFunction_fdata_1) { case FunctionOneArg: oneargfunc = CCTK_CallFunction_function; oneargfunc(CCTK_CallFunction_data); break; case FunctionStandard: switch (CCTK_CallFunction_fdata_0) { case LangC: standardfunc = CCTK_CallFunction_function; standardfunc(CCTK_CallFunction_data); } } } $ gcc schedule.i -c -O2 during GIMPLE pass: pre schedule.i: In function 'CCTK_CallFunction_data': schedule.i:6:6: internal compiler error: Segmentation fault 6 | void CCTK_CallFunction_data() { | ^~~~~~~~~~~~~~~~~~~~~~ 0x13be442 crash_signal /home/marxin/Programming/gcc/gcc/toplev.c:330 0x7ffff7889d1f ??? /usr/src/debug/glibc-2.32-2.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0 0x16badca expressions_equal_p(tree_node*, tree_node*) /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5631 0x16a9f5f vn_reference_eq(vn_reference_s const*, vn_reference_s const*) /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:705 0x16c5e86 vn_reference_hasher::equal(vn_reference_s const*, vn_reference_s const*) /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:246 0x16c6c45 hash_table<vn_reference_hasher, false, xcallocator>::find_slot_with_hash(vn_reference_s* const&, unsigned int, insert_option) /home/marxin/Programming/gcc/gcc/hash-table.h:981 0x16ad9fa vn_reference_lookup_1 /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:1645 0x16b4137 vn_reference_lookup_call(gcall*, vn_reference_s**, vn_reference_s*) /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:3579 0x16b8a1f visit_reference_op_call /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:4897 0x16ba84c visit_stmt /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:5503 0x16c08d2 process_bb /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7110 0x16c29bc do_rpo_vn /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:7597 0x16bf041 run_rpo_vn(vn_lookup_kind) /home/marxin/Programming/gcc/gcc/tree-ssa-sccvn.c:6684 0x1677f18 execute /home/marxin/Programming/gcc/gcc/tree-ssa-pre.c:4392 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.
Seen in a SPEC benchmark 436.cactusADM.
I see this also. I will make a reproducer.
Reduced C code is: a; b() { ((void (*)())b)(a); b(a); } Interestingly, this similar code int a; void b() { ((void (*)())b)(a); b(a); } compiles fine.
Mine.
*** Bug 97845 has been marked as a duplicate of this bug. ***
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:aaccdb9cec423ef4de9d541dbe0a95fa3346f430 commit r11-5047-gaaccdb9cec423ef4de9d541dbe0a95fa3346f430 Author: Richard Biener <rguenther@suse.de> Date: Mon Nov 16 08:40:47 2020 +0100 tree-optimization/97830 - fix compare of incomplete type size in VN This avoids passing NULL to expressions_equal_p. 2020-11-16 Richard Biener <rguenther@suse.de> PR tree-optimization/97830 * tree-ssa-sccvn.c (vn_reference_eq): Check for incomplete types before comparing TYPE_SIZE. * gcc.dg/pr97830.c: New testcase.
Fixed.