OSDN Git Service

Commit for Asher Langton <langton2@llnl.gov>
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 23 Oct 2005 20:42:27 +0000 (20:42 +0000)
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 23 Oct 2005 20:42:27 +0000 (20:42 +0000)
gcc/
* decl.c (match_type_spec): Add a BYTE type as an extension.

testsuite/
* gfortran.dg/byte_1.f90: New test.
* gfortran.dg/byte_2.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105823 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/byte_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/byte_2.f90 [new file with mode: 0644]

index af15594..567248a 100644 (file)
@@ -1,3 +1,7 @@
+2005-10-23  Asher Langton  <langton2@llnl.gov>
+
+       * decl.c (match_type_spec): Add a BYTE type as an extension.
+
 2005-10-23  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/18022
index 7a605d6..48cb920 100644 (file)
@@ -1386,6 +1386,24 @@ match_type_spec (gfc_typespec * ts, int implicit_flag)
 
   gfc_clear_ts (ts);
 
+  if (gfc_match (" byte") == MATCH_YES)
+    {
+      if (gfc_notify_std(GFC_STD_GNU, "Extension: BYTE type at %C") 
+         == FAILURE)
+       return MATCH_ERROR;
+
+      if (gfc_validate_kind (BT_INTEGER, 1, true) < 0)
+       {
+         gfc_error ("BYTE type used at %C "
+                    "is not available on the target machine");
+         return MATCH_ERROR;
+       }
+      
+      ts->type = BT_INTEGER;
+      ts->kind = 1;
+      return MATCH_YES;
+    }
+
   if (gfc_match (" integer") == MATCH_YES)
     {
       ts->type = BT_INTEGER;
index 1b3522d..5cfc2e8 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-23  Asher Langton  <langton2@llnl.gov>
+
+       * gfortran.dg/byte_1.f90: New test.
+       * gfortran.dg/byte_2.f90: New test.
+
 2005-10-23  David Edelsohn  <edelsohn@gnu.org>
 
        * gcc.dg/attr-alias-3.c: XFAIL on AIX.
 2005-10-23  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/18022
-       gfortran.dg/assign_func_dtcomp_1.f90: New test.
+       gfortran.dg/assign_func_dtcomp_1.f90: New test.
 
        PR fortran/24311
-       gfortran.dg/merge_char_const.f90: New test.
+       gfortran.dg/merge_char_const.f90: New test.
 
        PR fortran/24384
-       gfortran.dg/spread_scalar_source.f90: New test.
+       gfortran.dg/spread_scalar_source.f90: New test.
 
 2005-10-22  Hans-Peter Nilsson  <hp@axis.com>
 
diff --git a/gcc/testsuite/gfortran.dg/byte_1.f90 b/gcc/testsuite/gfortran.dg/byte_1.f90
new file mode 100644 (file)
index 0000000..a9e239e
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+program testbyte
+  integer(1) :: ii = 7
+  call foo(ii)
+end program testbyte
+
+subroutine foo(ii)
+  integer(1) ii
+  byte b          ! { dg-error "BYTE type" }
+  b = ii
+  call bar(ii,b)
+end subroutine foo
+
+subroutine bar(ii,b)
+  integer (1) ii
+  byte b          ! { dg-error "BYTE type" }
+  if (b.ne.ii) then
+!     print *,"Failed"
+     call abort
+  end if
+end subroutine bar
diff --git a/gcc/testsuite/gfortran.dg/byte_2.f90 b/gcc/testsuite/gfortran.dg/byte_2.f90
new file mode 100644 (file)
index 0000000..a410055
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do run }
+! { dg-options "-std=gnu" }
+program testbyte
+  integer(1) :: ii = 7
+  call foo(ii)
+end program testbyte
+
+subroutine foo(ii)
+  integer(1) ii
+  byte b
+  b = ii
+  call bar(ii,b)
+end subroutine foo
+
+subroutine bar(ii,b)
+  integer (1) ii
+  byte b
+  if (b.ne.ii) then
+!     print *,"Failed"
+     call abort
+  end if
+end subroutine bar