From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42445 invoked by alias); 16 Mar 2018 08:09:16 -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 42435 invoked by uid 89); 16 Mar 2018 08:09:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=30am, vax, sugar, UD:A X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Mar 2018 08:09:14 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 445FB40201A3 for ; Fri, 16 Mar 2018 08:09:12 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.36.118.110]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9A9710B00A0; Fri, 16 Mar 2018 08:08:58 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id w2G88u74007885; Fri, 16 Mar 2018 09:08:56 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w2G88oaV007884; Fri, 16 Mar 2018 09:08:50 +0100 Date: Fri, 16 Mar 2018 08:09:00 -0000 From: Jakub Jelinek To: Jeff Law Cc: gcc-patches , fortran@gcc.gnu.org Subject: Re: [PATCH][committed][Fortran] Add a few new tests for -fdec-static and -fdec-structure Message-ID: <20180316080850.GH5866@tucnak> Reply-To: Jakub Jelinek References: <20180316080130.GB8577@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180316080130.GB8577@tucnak> User-Agent: Mutt/1.9.1 (2017-09-22) X-SW-Source: 2018-03/txt/msg00083.txt.bz2 On Fri, Mar 16, 2018 at 09:01:30AM +0100, Jakub Jelinek wrote: > On Thu, Mar 15, 2018 at 11:09:13PM -0600, Jeff Law wrote: > > Tested on x86_64-linux-gnu. Installing on the trunk. > > ENOPATCH. Here it is from svn: 03-16-2018 Mark Doffman Jim MacArthur * gfortran.dg/automatic_1.f90: New test. * gfortran.dg/automatic_repeat.f90: New test * gfortran.dg/automatic_save.f90: New test. * gfortran.dg/vax_structure.f90: New test. --- testsuite/gfortran.dg/automatic_repeat.f90 (nonexistent) +++ testsuite/gfortran.dg/automatic_repeat.f90 (revision 258584) @@ -0,0 +1,8 @@ +! { dg-do compile } +! { dg-options "-fdec-static" } +! An AUTOMATIC statement cannot duplicated +FUNCTION X() +REAL, AUTOMATIC, AUTOMATIC :: Y ! { dg-error "Duplicate AUTOMATIC attribute" } +y = 1 +END FUNCTION X +END --- testsuite/gfortran.dg/automatic_save.f90 (nonexistent) +++ testsuite/gfortran.dg/automatic_save.f90 (revision 258584) @@ -0,0 +1,8 @@ +! { dg-do compile } +! { dg-options "-fdec-static" } +! An AUTOMATIC statement cannot be used with SAVE +FUNCTION X() +REAL, SAVE, AUTOMATIC :: Y ! { dg-error "AUTOMATIC attribute conflicts with SAVE attribute" } +y = 1 +END FUNCTION X +END --- testsuite/gfortran.dg/automatic_1.f90 (nonexistent) +++ testsuite/gfortran.dg/automatic_1.f90 (revision 258584) @@ -0,0 +1,31 @@ +! { dg-do run } +! { dg-options "-O2 -fdec-static -fno-automatic" } + subroutine foo (b) + logical b + integer i, j + character*24 s + automatic i + if (b) then + i = 26 + j = 131 + s = 'This is a test string' + else + if (i .eq. 26 .or. j .ne. 131) call abort + if (s .ne. 'This is a test string') call abort + end if + end subroutine foo + subroutine bar (s) + character*42 s + if (s .ne. '0123456789012345678901234567890123456') call abort + call foo (.false.) + end subroutine bar + subroutine baz + character*42 s + ! Just clobber stack a little bit. + s = '0123456789012345678901234567890123456' + call bar (s) + end subroutine baz + call foo (.true.) + call baz + call foo (.false.) + end --- testsuite/gfortran.dg/vax_structure_1.f90 (nonexistent) +++ testsuite/gfortran.dg/vax_structure_1.f90 (revision 258584) @@ -0,0 +1,27 @@ +! { dg-do compile } +! { dg-options "-fdec-structure" } +! Tests the VAX STRUCTURE and RECORD statements. +! These are syntactic sugar for TYPE statements. + + program vax_structure_1 + structure /stocklevel/ + integer*2 A + integer*4 B + integer*4 CS(0:15) + byte D(0:15) + end structure + + record /stocklevel/ rec1, recs(100) + integer x + integer*2 y + + rec1.A = 100 + recs(100).CS(10)=1 + x = 150 + y = 150 + + print *, rec1.B.eq.100 + print *, rec1.A.eq.x ! {dg-error "are INTEGER(2)/INTEGER(4)"} + print *, rec1.A.eq.y + print *, recs(100).CS(10) + end program Jakub