[PATCH] tighten up validation of built-in redeclarations (PR 93926)
Martin Sebor
msebor@gmail.com
Thu Feb 27 22:40:00 GMT 2020
GCC considers valid explicit declarations of built-ins whose return
types match in their modes, even if the types themselves are
incompatible (say integer and pointer of the same size). This is
more permissive than for argument types where a pointer/integer
mismatch disqualifies the redeclaration.
With -Wextra enabled although -Wbuiltin-declaration-mismatch
diagnoses these "benign" mismatches in return types the C front-end
still considers the mismatched declaration one of the built-in. That
can lead to problems down the line when the middle attempts to do its
own sanity checking based on some simple and reasonable notion of type
compatibility (like a malloc kind of function returning a pointer).
The attached patch tightens up the requirements a declaration has to
meet in order to match a built-in to apply the same matching to their
return types as to their arguments.
Tested on x86_64-linux.
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-93926.diff
Type: text/x-patch
Size: 7489 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20200227/d9d2a0d0/attachment.bin>
More information about the Gcc-patches
mailing list