Bug 97897 - ICE tree check: expected ssa_name, have integer_cst in compute_optimized_partition_bases, at tree-ssa-coalesce.c:1638
Summary: ICE tree check: expected ssa_name, have integer_cst in compute_optimized_part...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-11-18 16:39 UTC by G. Steinmetz
Modified: 2021-03-03 10:36 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 10.2.1, 11.0
Known to fail:
Last reconfirmed: 2020-11-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2020-11-18 16:39:40 UTC
Affects versions down to at least r5 :
(compiles with "(_Complex a)" instead)


$ cat z1.c
void h ();
void f () __attribute__ ((returns_twice));
void g (_Complex int a)
{
  f ();
  if (a != 0)
  {
    a = 0;
    h ();
  }
}


$ gcc-11-20201115 -c z1.c
during RTL pass: expand
z1.c: In function 'g':
z1.c:3:6: internal compiler error: tree check: expected ssa_name, have integer_cst in compute_optimized_partition_bases, at tree-ssa-coalesce.c:1638
    3 | void g (_Complex int a)
      |      ^
0x626df8 tree_check_failed(tree_node const*, char const*, int, char const*, ...)
        ../../gcc/tree.c:9779
0xe4bb1f tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc/tree.h:3314
0xe4bb1f compute_optimized_partition_bases
        ../../gcc/tree-ssa-coalesce.c:1638
0xe4bb1f coalesce_ssa_name(_var_map*)
        ../../gcc/tree-ssa-coalesce.c:1718
0xdde89b remove_ssa_form
        ../../gcc/tree-outof-ssa.c:1065
0xdde89b rewrite_out_of_ssa(ssaexpand*)
        ../../gcc/tree-outof-ssa.c:1323
0x80fa70 execute
        ../../gcc/cfgexpand.c:6407
Comment 1 Richard Biener 2020-11-19 07:36:47 UTC
Mine.  We may not have constants in abnormal edge PHI arguments.
Comment 2 GCC Commits 2020-11-19 08:57:57 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:0d8290959ecf2c5f1dd062e57782b5e91be0f8f6

commit r11-5156-g0d8290959ecf2c5f1dd062e57782b5e91be0f8f6
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Nov 19 09:06:50 2020 +0100

    tree-optimization/97897 - complex lowering on abnormal edges
    
    This fixes complex lowering to not put constants into abnormal
    edge PHI values by making sure abnormally used SSA names are
    VARYING in its propagation lattice.
    
    2020-11-19  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/97897
            * tree-complex.c (complex_propagate::visit_stmt): Make sure
            abnormally used SSA names are VARYING.
            (complex_propagate::visit_phi): Likewise.
            * tree-ssa.c (verify_phi_args): Verify PHI arguments on abnormal
            edges are SSA names.
    
            * gcc.dg/pr97897.c: New testcase.
Comment 3 Richard Biener 2020-11-19 09:00:04 UTC
Fixed on trunk sofar.
Comment 4 GCC Commits 2021-03-03 10:36:16 UTC
The releases/gcc-10 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:9272936ac5fac472a3690145572afa6ed19eaa8e

commit r10-9405-g9272936ac5fac472a3690145572afa6ed19eaa8e
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Nov 19 09:06:50 2020 +0100

    tree-optimization/97897 - complex lowering on abnormal edges
    
    This fixes complex lowering to not put constants into abnormal
    edge PHI values by making sure abnormally used SSA names are
    VARYING in its propagation lattice.
    
    2020-11-19  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/97897
            * tree-complex.c (complex_propagate::visit_stmt): Make sure
            abnormally used SSA names are VARYING.
            (complex_propagate::visit_phi): Likewise.
    
            * gcc.dg/pr97897.c: New testcase.
Comment 5 Richard Biener 2021-03-03 10:36:53 UTC
Fixed.  Not planning to backport further.