From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38217 invoked by alias); 22 Nov 2015 18:41:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 38204 invoked by uid 89); 22 Nov 2015 18:41:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 22 Nov 2015 18:41:37 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 8F15A544FD9; Sun, 22 Nov 2015 19:41:33 +0100 (CET) Date: Sun, 22 Nov 2015 18:49:00 -0000 From: Jan Hubicka To: Eric Botcazou Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: Fix lto-symtab ICE during Ada LTO bootstrap Message-ID: <20151122184131.GA85454@kam.mff.cuni.cz> References: <20151121182122.GB23225@kam.mff.cuni.cz> <1690140.OfB3ATH0FC@polaris> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1690140.OfB3ATH0FC@polaris> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-11/txt/msg02617.txt.bz2 > > 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. Yep, I read the specification yesterday. It seems to me that the only way to handle this is to put the integer type used to represent pointers to the same alias set as void_ptr_type. This is doable by simply making gimple_canonical_types_compatible_p and lto.c handle this type specially as "pointer". I can implement this; but I woul dlike to enable this kind of globing only when there is an union in Ada. > > > : 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. Great! > > > ../../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. Actually the volatility is not a big deal: we ignore it for canonical type computation anyway (probably we don't, but in general we do not need to care much about optimizing volatile memory accesses, so we lose nothing by handling this safely) > > > 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). That sounds good. I can try to cook up the prototype patch for pointers. I fixed issues that breaks Ada bootstrap, but I still get an ICE in LTO built gnat1 in Ada code. I am not quite sure what is wrong (it fails early setting some flags in atree, but that is as far as I can read the code) Honza > > > 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