Bug 97330 - [11 Regression] ice for stmt with wrong VUSE
Summary: [11 Regression] ice for stmt with wrong VUSE
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: 11.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-08 08:39 UTC by David Binderman
Modified: 2020-10-08 12:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-10-08 00:00:00


Attachments
C source code (16.73 KB, text/x-csrc)
2020-10-08 08:39 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2020-10-08 08:39:39 UTC
Created attachment 49328 [details]
C source code

Sometime between 20201007 and 20201008, the attached code
has broken.

$ /home/dcb/gcc/results/bin/gcc -c -O2 -w /home/dcb/gcc/foundBugs/bug647.c 
auprocess.c: In function ‘rcm_1’:
auprocess.c:1275:17: error: stmt with wrong VUSE
# VUSE <.MEM_34(D)>
n_39 = el_35(D)->nextSample;
expected .MEM_33
during GIMPLE pass: sink
auprocess.c:1275:17: internal compiler error: verify_ssa failed
0xf02e86 verify_ssa(bool, bool)
	../../trunk.git/gcc/tree-ssa.c:1208
0xbcd9c1 execute_function_todo(function*, void*)
	../../trunk.git/gcc/passes.c:1999
0xbcc211 execute_todo(unsigned int)
	../../trunk.git/gcc/passes.c:2046

I'll have a go at reducing the code.
Comment 1 David Binderman 2020-10-08 08:51:22 UTC
Reduced code is:

typedef int a;
typedef char b;
int c;
void d(e, f, dst, g, avail, h) int e;
b *f, *dst;
a g, avail;
int h;
{
  b i = *f;
  if (e)
    goto j;
  while (avail) {
    *dst = i;
  j:
    avail -= c;
  }
}
Comment 2 David Binderman 2020-10-08 09:04:25 UTC
Flags -Werror=implicit-int and -Werror=old-style-definition seem useful.

Here is another reduced test case:

int a, b, d;
char c, e;
void f(void) {
  char g = c;
  if (b)
    goto h;
  while (d) {
    e = c;
  h:
    d -= a;
  }
}
Comment 3 Richard Biener 2020-10-08 11:03:37 UTC
Mine.
Comment 4 Martin Liška 2020-10-08 12:03:54 UTC
Just for the record, started with r11-3705-gdae673abd37d4004.
Comment 5 GCC Commits 2020-10-08 12:22:37 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:629e0547af33221a925f38757b52a9284148b68a

commit r11-3726-g629e0547af33221a925f38757b52a9284148b68a
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Oct 8 13:18:57 2020 +0200

    tree-optimization/97330 - fix bad load sinking
    
    This fixes bad placement of sunk loads.
    
    2020-10-08  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/97330
            * tree-ssa-sink.c (statement_sink_location): Avoid skipping
            PHIs when they dominate the insert location.
    
            * gcc.dg/torture/pr97330-1.c: New testcase.
            * gcc.dg/torture/pr97330-2.c: Likewise.
Comment 6 Richard Biener 2020-10-08 12:22:55 UTC
Fixed.