From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53486 invoked by alias); 6 Oct 2017 06:20:40 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 53476 invoked by uid 89); 6 Oct 2017 06:20:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*R:D*edu, sessions, sgktroutmaskaplwashingtonedu, sgk@troutmask.apl.washington.edu X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Oct 2017 06:20:38 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id v966KalY033806 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 5 Oct 2017 23:20:36 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id v966KY9E033805; Thu, 5 Oct 2017 23:20:34 -0700 (PDT) (envelope-from sgk) Date: Fri, 06 Oct 2017 06:20:00 -0000 From: Steve Kargl To: Richard Biener Cc: Jerry DeLisle , fortran@gcc.gnu.org Subject: Re: BOZ, F2008 and F2015, and future of gfortran Message-ID: <20171006062034.GA33771@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20171005211023.GA67765@troutmask.apl.washington.edu> <20171006050210.GB33258@troutmask.apl.washington.edu> <1CFEB0A1-3A0C-4639-B97E-0761EA007933@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1CFEB0A1-3A0C-4639-B97E-0761EA007933@gmail.com> User-Agent: Mutt/1.7.2 (2016-11-26) X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00026.txt.bz2 On Fri, Oct 06, 2017 at 07:58:58AM +0200, Richard Biener wrote: > On October 6, 2017 7:02:10 AM GMT+02:00, Steve Kargl wrote: > > > >program foo > > integer :: i(2) = [z'124', z'bed'] > > print *, i > >end program foo > > > >First, this is nonstandard in that a BOZ-literal-constant cannot > >appear in the above context. Unfortunately, the above leads > >to an ICE. I need to figure how to walk the array constructor > >and have gfortran use the type and type kind parameter of the > >lhs to convert the rhs boz. > > I'm just guessing the semantics but you might find native_encode/interpret_expr useful in this context. > I can handle the needed transformation in the Fortran FE once I figure out how we handle array constructors. In Fortran, [z'124', z'bed'] is an array constructor and Fortran forbids a BOZ from appearing here. This is currently allowed in gfortran, because gfortran upon parsing a BOZ immediately converts it to an INTEGER(N) (with N=8 or 16 depending on target). My patch gives a BOZ a basic type of BT_BOZ, which is new and treated as a typeless sequence of bits. I need to catch an entity with a BT_BOZ basic type and do essentially a JIT conversion to the correct type when translating an array constructor. Unfortunately, gdb sessions suggest that we have a use-after-free bug lurking. -- Steve 20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4 20161221 https://www.youtube.com/watch?v=IbCHE-hONow