public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran@gcc.gnu.org
Subject: Re: [PATCH][committed][Fortran] Add a few new tests for -fdec-static and -fdec-structure
Date: Fri, 16 Mar 2018 08:09:00 -0000	[thread overview]
Message-ID: <20180316080850.GH5866@tucnak> (raw)
In-Reply-To: <20180316080130.GB8577@tucnak>

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  <mark.doffman@codethink.co.uk>
            Jim MacArthur  <jim.macarthur@codethink.co.uk>

	* 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

           reply	other threads:[~2018-03-16  8:09 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20180316080130.GB8577@tucnak>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180316080850.GH5866@tucnak \
    --to=jakub@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).