From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122182 invoked by alias); 18 Mar 2018 15:40:02 -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 121482 invoked by uid 89); 18 Mar 2018 15:40:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=l1, s2, L1 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; Sun, 18 Mar 2018 15:40:00 +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 w2IFdxm1086004 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Sun, 18 Mar 2018 08:39:59 -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 w2IFdwr0086003 for fortran@gcc.gnu.org; Sun, 18 Mar 2018 08:39:58 -0700 (PDT) (envelope-from sgk) Date: Sun, 18 Mar 2018 15:40:00 -0000 From: Steve Kargl To: fortran@gcc.gnu.org Subject: Odd bug from Stack Overflow Message-ID: <20180318153958.GB85774@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00095.txt.bz2 So, who knows how the scalarizer works? This code program test implicit none integer, parameter :: n = 65536 integer, dimension(n) :: y integer*4 :: i y = (/ (1, i=1, n) /) if (y(2) /= 1) stop 1 end program test generates a loops that does the right thing. offset.1 = 0; shadow_loopvar.2 = 1; while (1) { if (shadow_loopvar.2 > 65536) goto L.1; (*(integer(kind=4)[65536] * restrict) atmp.0.data)[offset.1] = 1; offset.1 = offset.1 + 1; shadow_loopvar.2 = shadow_loopvar.2 + 1; } L.1:; Clearly, 1 is being assigned to each element of the array 'y'. Now change the type of 'y' to real. offset.1 = 0; (*(real(kind=4)[65536] * restrict) atmp.0.data)[offset.1] = 1.0e+0; offset.1 = offset.1 + 1; { integer(kind=4) S.2; S.2 = 0; while (1) { if (S.2 > 65535) goto L.1; y[S.2] = (*(real(kind=4)[65536] * restrict) atmp.0.data)[S.2]; S.2 = S.2 + 1; } L.1:; } The value of 1.0 is assigned to the first element of atmp, a temporary array. Then the loop assigns the values from temporary array 'atmp'. The problem is atmp(2:65536) have never been set. I was expecting the -fdump-tree-original for the integer and real codes to look substantially the same. Something has gone sideways. Anyone have a good guess where? -- Steve