https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115498
Bug ID: 115498
Summary: Missing warning for comparing distinct (char*)
pointers
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Target Milestone: ---
This is from an intermediate bad reduction in another PR:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115137#c5
```
enum { a } b;
int d, e;
static void f(char *g, char *h) {
for (; g < h; g++) /* Comparison of two distinct & disjoint pointers */
if (b)
++d;
}
int main() { f("somepage.html", "" + e); }
```
We don't warn on comparing these distinct pointers.
I suppose it might be hard to do this in general without some aliasing
sanitizer, but for constant pool references, it should be okay?