More C type errors by default for GCC 14
Florian Weimer
fweimer@redhat.com
Wed May 17 10:06:17 GMT 2023
* Jason Merrill:
> As a compromise, it should be possible to error by default only in
> cases where the implicit int (including as a return value) is either
> the source or target of a non-value-preserving conversion, as those
> are very likely to be bugs. That seems desirable for both camps.
Not sure, malloc returning 31-bit pointers goes a long way towards
maintaining int/pointer compatibility for 64-bit systems, too. People
might actually have a working implicit-declared malloc on 64-bit today,
and still argue against the changes.
> A simpler change to catch this particular bug would be to make
> -Wint-conversion an error by default iff the sizes differ.
That doesn't address other bugs around implicitly-declared functions,
such as the bool/int ABI incompatibility, or the lack of type checking
for arguments. I don't see those programmer mistakes because I think
it's easier to debug them on your own: swapped arguments are visible in
the source code, and GDB probably gives you enough data as well. So I
suspect that people figure this out on their own. They are still
wasting time on this, but probably somewhat less.
Thanks,
Florian
More information about the Gcc
mailing list