From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15274 invoked by alias); 11 Nov 2008 16:56:48 -0000 Received: (qmail 15247 invoked by uid 22791); 11 Nov 2008 16:56:47 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Nov 2008 16:56:11 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id mABGq1q2023996; Tue, 11 Nov 2008 11:52:01 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mABGq1mj029067; Tue, 11 Nov 2008 11:52:01 -0500 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.2/8.14.2/Submit) id mABGq0w0010158; Tue, 11 Nov 2008 17:52:00 +0100 Date: Tue, 11 Nov 2008 17:21:00 -0000 From: Jakub Jelinek To: Tobias =?iso-8859-1?Q?Schl=FCter?= Cc: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org, Steve Kargl , Feng Wang , Brooks Moses Subject: Re: [PATCH] Fold VIEW_CONVERT_EXPR generated by Fortran FE a lot (PR target/35366) Message-ID: <20081111165200.GF3572@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20081111131749.GZ3572@tyan-ft48-01.lab.bos.redhat.com> <4919A8A4.8000001@physik.uni-muenchen.de> <20081111161100.GE3572@tyan-ft48-01.lab.bos.redhat.com> <4919B110.6060400@physik.uni-muenchen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4919B110.6060400@physik.uni-muenchen.de> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes 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 X-SW-Source: 2008-11/txt/msg00453.txt.bz2 On Tue, Nov 11, 2008 at 05:21:36PM +0100, Tobias Schlüter wrote: > Hm, I haven't found Richard Maine's post that is mentioned in the old > thread, but Fortran has the notion of storage unit. LOGICAL*4, > INTEGER*4 and REAL*4 all occupy 4 storage units. If a circular > transfer(transfer (...) ...) between types with the same number of > storage units is required to return the original value (as Richard Maine > apparently argued), then we'll probably have no choice but to stop using > BOOLEAN_TYPE for LOGICALs. That's pretty sad. Stopping using BOOLEAN_TYPE is going to break basically everything, so certainly can't be done for 4.4. I expect that you'd need to add a lot of conversions everywhere, from the logical*N INTEGER_TYPE to correspondingly sized BOOLEAN_TYPE and back all the time. I wonder what you can do with LOGICALs that have values transfered from INTEGER (other than 0/1). Does the standard define whether something is executed or not in: logical, parameter :: l = transfer (234, .false.) if (l) print *, ".true." ? I.e. is it supposed to be .false. or .true., or undefined behavior? I guess I could in fold_view_convert_expr temporarily /* XXX: Fortran workaround - the FE sometimes wants BOOLEAN_TYPE semantics and sometimes not. */ if (TREE_CODE (type) == BOOLEAN_TYPE && TREE_CODE (expr) == STRING_CST) return NULL_TREE; and the FE would need to make sure the STRING_CST has enough aligned type (on the STRING_CST TREE_TYPE (string_cst) = copy_node (TREE_TYPE (string_cst)); and TYPE_ALIGN (TREE_TYPE (string_cst)) = TYPE_ALIGN (gfc_get_logical_type (expr->ts.kind)); TYPE_USER_ALIGN (TREE_TYPE (string_cst)) = 1;), but guess Richi isn't going to look favourably at it. Unfortunately the result of TRANSFER is supposed to be a constant :(, so we can't play games with asm, volatile or some other optimization barrier. Jakub