[Bug c++/105786] New: ICE in compute_distributive_range, at tree-data-ref.cc:593

gcc at olupton dot com gcc-bugzilla@gcc.gnu.org
Tue May 31 08:10:15 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105786

            Bug ID: 105786
           Summary: ICE in compute_distributive_range, at
                    tree-data-ref.cc:593
           Product: gcc
           Version: 12.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at olupton dot com
  Target Milestone: ---

The following example:

```
void sink(const char*);
static const char *a;
int main() {
  const char *b = a;
  for (int i = 0; i < 2; ++i)
    while (*b++)
      ;
  sink(b);
  return 0;
}
```

produces an ICE at -O2 and above with 12.1:

```
during GIMPLE pass: pcom
<source>: In function 'int main()':
<source>:3:5: internal compiler error: in compute_distributive_range, at
tree-data-ref.cc:593
    3 | int main() {
      |     ^~~~
```

this is reproducible on Compiler Explorer (https://godbolt.org/z/z1zrqrrEs) and
also using 12.1.1 installed via `dnf` in a `fedora:latest` Docker container.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102853 reports a similar error
message, but it says the issue is resolved so opening this new issue seems
justified.

Note that adding
```
void set_a(const char* x) {
    a = x;
}
```
so that `a` can be non-null avoids the ICE.


More information about the Gcc-bugs mailing list