[Bug c/91542] internal representation of pointer reference shown in error message

2020-01-29 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91542

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2020-01-29
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug c/91542] internal representation of pointer reference shown in error message

2019-08-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91542

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
Version|unknown |10.0

--- Comment #2 from Richard Biener  ---
This is somewhat expected as GCCs AST is not a 1:1 source representation.

[Bug c/91542] internal representation of pointer reference shown in error message

2019-08-25 Thread ldrumm at rtps dot co
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