From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13992 invoked by alias); 9 May 2012 16:02:58 -0000 Received: (qmail 13943 invoked by uid 22791); 9 May 2012 16:02:55 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 May 2012 16:02:40 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/45424] F2008: Add is_contiguous intrinsic Date: Wed, 09 May 2012 16:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg01028.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45424 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #2 from Tobias Burnus 2012-05-09 16:02:18 UTC --- (In reply to comment #1) > a) Array element with nonzero strides I meant: A an array containing a single element and having a nonunity stride. > type t > integer :: i, j > end type t > print *, is_contiguous(x(:)%i) ! Shall be false - but prints "true". Those kind of arguments can get really tricky! Assume as component a: integer :: i(1) ! or "i(2) or class(t), allocatable :: a or integer, allocatable :: a(:) which is accessed as "is_contiguous(x(:)%a(1))". Intel and Cray handle it simply: by always returning "F" - even for "type t; integer :: i; end type", which should have no padding and be contiguous in memory. We could do the same - or we rule out BT_CLASS, arrays and coarrays and do then a size check: whole derived type == expr->ts.type size. Another issue are substrings. For those one needs to check that the substring range matches the string length.