This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix lto-symtab ICE during Ada LTO bootstrap
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 22 Nov 2015 15:38:59 +0100
- Subject: Re: Fix lto-symtab ICE during Ada LTO bootstrap
- Authentication-results: sourceware.org; auth=none
- References: <20151121182122 dot GB23225 at kam dot mff dot cuni dot cz>
> this patch fixes an ICE seen with Ada LTO bootstrap in reporting type
> mismatches and it also makes us to stop complaining about C++ ODR
> violation. The warnings are however correct. I looked at few:
>
> ../../libiberty/xstrerror.c:40:14: warning: type of ïstrerrorï does not
> match original declaration [-Wlto-type-mismatch] extern char *strerror
> (int);
> ^
>
> ../../gcc/ada/s-os_lib.adb:1007:16: note: return value type mismatch
> function strerror (errnum : Integer) return System.Address;
> ^
>
> ../../gcc/ada/s-os_lib.adb:1007:16: note:
> ïsystem__os_lib__errno_message__strerrorï was previously declared here
>
> Here we have function returning pointer WRT function returning integer:
This one is on purpose and cannot be easily changed. Pointer types (or access
types as called in Ada) are avoided as much as possible in the runtime because
they drag the accessibility machinery, which is the machinery present in the
language to eliminate dangling references and is heavy; so they are usually
imported as System.Address instead.
> <built-in>: warning: type of ï__builtin_strlenï does not match original
> declaration [-Wlto-type-mismatch] ../../gcc/ada/osint.adb:422:19: note:
> return value type mismatch
> ../../gcc/ada/osint.adb:422:19: note: type ïintegerï should match type ïlong
> unsigned intï
>
> Here the signedness of integer does not match:
Yes, it's clearly incorrect on the Ada side and should be fixed in osint.adb.
> ../../gcc/ada/s-os_lib.ads:1053:4: warning: type of
> ïsystem__os_lib__directory_separatorï does not match original declaration
> [-Wlto-type-mismatch] Directory_Separator : constant Character;
> ^
>
> ../../gcc/ada/adaint.c:225:6: note: type ïcharï should match type ïvolatile
> characterï char __gnat_dir_separator = DIR_SEPARATOR;
> ^
>
> Here we get difference in signedness and volatility:
The signedness issue for Character is known and we plan to address it; the
volatility issue was overlooked but looks fixable too.
> All those types will lead to wrong code if ever written to same memory
> location because of TBAA. Eric, does Ada need all this types to be TBAA
> compatible? If so, we need to implement more strict globbing as we did for
> Fortran and we probably finally need to make the globbing aware of
> languages involved (we definitly don't want to glob pointers and integers
> for C/C++ programs)
I think that we can fix all the problems on the Ada side except for the
pointer/System.Address duality (which can be even more problematic on
architectures that use different calling conventions for them).
> Eric, it would be great to have a stand alone testcases in style of
> gcc/testsuite/gfortran.dg/lto/bind_c-*
> which stores and reads the same memory location in same alias set and thus
> trigger the undefined behvaiour.
OK, I'll think about that, thanks.
--
Eric Botcazou