This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Implicit function declarations and GCC 10
- From: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>
- To: Florian Weimer <fweimer at redhat dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Cc: nd <nd at arm dot com>
- Date: Fri, 5 Jul 2019 13:57:13 +0000
- Subject: Re: Implicit function declarations and GCC 10
- References: <87wogyjazk.fsf@oldenburg2.str.redhat.com>
On 04/07/2019 12:27, Florian Weimer wrote:
> Implicit function declarations were removed from C99, more than twenty
> years ago. So far, GCC only warns about them because there were too
> many old configure scripts where an error would lead to incorrect
> configure check failures.
>
> I can try to fix the remaining configure scripts in Fedora and submit
> the required changes during this summer and fall.
>
> I would appreciate if GCC 10 refused to declare functions implicitly by
> default.
+1
>
> According to my observations, lack of an error diagnostic has turned
> into a major usability issue. For bugs related to pointer truncation,
> we could perhaps change the C front end to produce a hard error if an
> int value returned from an implicitly declared function is converted to
> a pointer. But the other case involves functions defined as returning
> _Bool, and the result is used in a boolean context. The x86-64 ABI only
> requires that the lowest 8 bits of the return value are defined, so an
> implicit int results in int values which incorrectly compare as inqueal
> to zero.
>
> Given that the pointer truncation issue is only slightly more common,
> than the _Bool issue, I don't think the diagnostic improvement for
> pointers would be very helpful, and we should just transition to errors.
>
> Implicit int we should remove as well. Checking configure scripts for
> both issues at the same time would not be much more work.
+1 for making implicit int an error by default.
>
> Thanks,
> Florian
>