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

--- Comment #1 from ldrumm at rtps dot co ---
Sorry. I clicked submit too soon.

Interestingly if the index operation is a constant (but not a constant
expression), the error message is correct

```
struct Node {
    int n_successors;
};

int foo(int n, struct Node *nodes[])
{
    enum {a};
    nodes[a].n_successors;
}

/home/luke/code/cc/src/gcc-bug.c:8:13: error: ‘*nodes’ is a pointer; did you
mean to use ‘->’?
    8 |     nodes[a].n_successors;
      |             ^
      |             ->

```

but with a more complex expression (but still an ICE):
```
struct Node {
    int n_successors;
};

int foo(int n, struct Node *nodes[])
{
    enum {a = 1};
    nodes[a << 2].n_successors;
}
/home/luke/code/cc/src/gcc-bug.c:8:18: error: ‘*(nodes + 32)’ is a pointer; did
you mean to use ‘->’?
    8 |     nodes[a << 2].n_successors;
      |                  ^
      |                  ->
```

I see this behaviour on current top of tree built from source
(e86f87930567b7e5444260ffc1d46507ebc8f520) as well as the debian-packaged
version shipped with my OS ((Debian 9.2.1-4) 9.2.1 20190821)

I'm willing to help debug this one, but I'm unfamiliar with the code, so I'd
appreciate any guidance

Reply via email to