From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90772 invoked by alias); 31 Oct 2015 17:17:59 -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 90742 invoked by uid 89); 31 Oct 2015 17:17:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 31 Oct 2015 17:17:57 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 9CE21285FDB1; Sat, 31 Oct 2015 18:17:54 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1eitE_XEWpR7; Sat, 31 Oct 2015 18:17:54 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 75F31285FDAF; Sat, 31 Oct 2015 18:17:54 +0100 (CET) From: Eric Botcazou To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org, Richard Biener Subject: Re: Add VIEW_CONVERT_EXPR to operand_equal_p Date: Sat, 31 Oct 2015 17:39:00 -0000 Message-ID: <1693727.sAndYEapaL@polaris> User-Agent: KMail/4.14.9 (Linux/3.16.7-29-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: <20151030151759.GJ37773@kam.mff.cuni.cz> References: <20151014162944.GE16672@kam.mff.cuni.cz> <1739286.yXNLCe3m6q@polaris> <20151030151759.GJ37773@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart12054733.uUCytF2WA5" Content-Transfer-Encoding: 7Bit X-SW-Source: 2015-10/txt/msg03488.txt.bz2 This is a multi-part message in MIME format. --nextPart12054733.uUCytF2WA5 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 2445 > Lets go with this patch and hopefully stabilize the tree. I don't think the > vector conversions represent an important case. Unfortunately the patch introduces GIMPLE checking failures in Ada so it will need to be completed/improved. But let's postpone it because we have another class of GIMPLE checking failures introduced by the useless_type_conversion_p change itself: c37213j.adb:21:05: warning: variable "X" is read but never assigned c37213j.adb: In function 'C37213J.PROC.CONSTPROP': c37213j.adb:41:4: error: invalid conversion in gimple call struct c37213j__proc__value___PAD struct c37213j__proc__value___PAD # .MEM_38 = VDEF <.MEM_37> MEM[(struct c37213j__proc__value___PAD *)R.12_25] = c37213j.proc.value (); [static-chain: &FRAME.39] [return slot optimization] and: eric@polaris:~/build/gcc/native> ~/install/gnat-head/bin/gcc -S c37213j.adb - O2 c37213j.adb:21:05: warning: variable "X" is read but never assigned c37213j.adb: In function 'C37213J.PROC.VALUE': c37213j.adb:26:5: error: invalid conversion in return statement struct c37213j__proc__value___PAD struct c37213j__proc__value___PAD # VUSE <.MEM_11> return _9(D); What happens here is that GIMPLE statements are remapped through cloning and we have a variably-modified type returned by a nested function, so the type of the LHS of a GIMPLE_CALL or that of the RHS of a GIMPLE_RETURN is remapped but of course not the return type of the function. This used to be OK because remapping is done by means of copy_node and preserves TYPE_CANONICAL, so the conversion between remapped and original type was deemed useless; now the TYPE_CANONICAL check is gone so the conversion is not useless anymore... I don't think that we want to introduce an artificial VCE to fix this so we probably need a couple of kludges in the GIMPLE verifier instead. In any case, the more I look into the fallout of the useless_type_conversion_p change, the more I find it ill-advised. We used to have a solid type system in the middle-end by means of the predicate and now we have cases for which it ought to return false and returns true (e.g. non-structurally equivalent types with different calling conventions) and cases for which it can return true and returns false (remapped types or types deemed equivalent by the languages). I don't really know what it was made for, but there must be a better way... * gnat.dg/discr45.adb: New test. -- Eric Botcazou --nextPart12054733.uUCytF2WA5 Content-Disposition: attachment; filename="discr45.adb" Content-Transfer-Encoding: 7Bit Content-Type: text/x-adasrc; charset="utf-8"; name="discr45.adb" Content-length: 806 -- { dg-do run } -- { dg-options "-O2 -gnatws" } procedure Discr45 is function Ident_Int (I : Integer) return Integer is begin return I; end; procedure Proc (Signal : Boolean) is subtype Index is Integer range 1..10; type My_Arr is array (Index range <>) OF Integer; type Rec (D3 : Integer := Ident_Int(1)) is record case D3 is when -5..10 => C1 : My_Arr(D3..Ident_Int(11)); when Others => C2 : Integer := Ident_Int(5); end case; end record; X : Rec; function Value return Rec; pragma No_Inline (Value); function Value return Rec is begin return X; end; begin if X /= Value then raise Constraint_Error; elsif Signal then raise Program_Error; end if; end; begin Proc (True); end; --nextPart12054733.uUCytF2WA5--