From 5f700e6de038a05c3068dac9199b21bbdc70c2e9 Mon Sep 17 00:00:00 2001 From: Asher Langton Date: Sun, 23 Oct 2005 20:42:27 +0000 Subject: [PATCH] Commit for Asher Langton 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. From-SVN: r105823 --- gcc/fortran/ChangeLog | 4 ++++ gcc/fortran/decl.c | 18 ++++++++++++++++++ gcc/testsuite/ChangeLog | 11 ++++++++--- gcc/testsuite/gfortran.dg/byte_1.f90 | 22 ++++++++++++++++++++++ gcc/testsuite/gfortran.dg/byte_2.f90 | 22 ++++++++++++++++++++++ 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/byte_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/byte_2.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index af155949c7f..567248af204 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2005-10-23 Asher Langton + + * decl.c (match_type_spec): Add a BYTE type as an extension. + 2005-10-23 Paul Thomas PR fortran/18022 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 7a605d6799d..48cb9205e7e 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b3522d03c8..5cfc2e86278 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-23 Asher Langton + + * gfortran.dg/byte_1.f90: New test. + * gfortran.dg/byte_2.f90: New test. + 2005-10-23 David Edelsohn * gcc.dg/attr-alias-3.c: XFAIL on AIX. @@ -5,13 +10,13 @@ 2005-10-23 Paul Thomas 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 diff --git a/gcc/testsuite/gfortran.dg/byte_1.f90 b/gcc/testsuite/gfortran.dg/byte_1.f90 new file mode 100644 index 00000000000..a9e239e78da --- /dev/null +++ b/gcc/testsuite/gfortran.dg/byte_1.f90 @@ -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 index 00000000000..a4100555776 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/byte_2.f90 @@ -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