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

            Bug ID: 109835
           Summary: -Wincompatible-function-pointer-types as a subset of
                    -Wincompatible-pointer-types?
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: fw at gcc dot gnu.org
  Target Milestone: ---

wrt the C changes we're planning for 14
(https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html,
https://gcc.gnu.org/pipermail/gcc/2023-May/241502.html): GCC has
-Wincompatible-pointer-types which is a bit noisier than
-Wincompatible-function-pointer-types which Clang also provides.

Example which should emit the prosp. new warning:
```
void func(const int *i);
void other(void) {
  void (*fp)(int *) = func; // Emits -Wincompatible-function-pointer-types
}
```

Example which shouldn't, but should emit -Wincompatible-pointer-types:
```
void other(void) {
  int* x;
  unsigned int* y = &x; // Emits -Wincompatible-pointer-types
}
```

Note that function pointers are a bit more interesting in that you need this
fixed for CFI and the bugs tend to be more notable (although there's still
const-correctness noise).

-Wincompatible-pointer-types is still a sin but so far, looks noisier to me.

Reply via email to