Bug 97830 - [11 Regression] ICE in expressions_equal_p at gcc/tree-ssa-sccvn.c:5631 since r11-4982-g4d6b8d4213376e8a
Summary: [11 Regression] ICE in expressions_equal_p at gcc/tree-ssa-sccvn.c:5631 since...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P1 normal
Target Milestone: 11.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
: 97845 (view as bug list)
Depends on:
Blocks: spec
  Show dependency treegraph
 
Reported: 2020-11-14 19:57 UTC by Martin Liška
Modified: 2020-11-16 09:27 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 10.2.0
Known to fail: 11.0
Last reconfirmed: 2020-11-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2020-11-14 19:57:41 UTC
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.
Comment 1 Martin Liška 2020-11-14 19:58:15 UTC
Seen in a SPEC benchmark 436.cactusADM.
Comment 2 David Binderman 2020-11-15 09:11:07 UTC
I see this also. I will make a reproducer.
Comment 3 David Binderman 2020-11-15 09:27:49 UTC
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.
Comment 4 Richard Biener 2020-11-16 07:18:47 UTC
Mine.
Comment 5 Martin Liška 2020-11-16 07:33:22 UTC
*** Bug 97845 has been marked as a duplicate of this bug. ***
Comment 6 GCC Commits 2020-11-16 09:27:28 UTC
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.
Comment 7 Richard Biener 2020-11-16 09:27:41 UTC
Fixed.