diff options
author | Tobias Burnus <burnus@net-b.de> | 2010-09-27 00:30:48 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-09-27 00:30:48 +0200 |
commit | d000aa67bc4dce06a1436d6b3fbab8134ce38d34 (patch) | |
tree | f28e0b9963e89079003a4eeca7f1c08e9b8a5a35 /gcc/testsuite | |
parent | 414e8be2b09d9a50d39d8c6d48ebc0a95f6e2040 (diff) | |
download | gcc-d000aa67bc4dce06a1436d6b3fbab8134ce38d34.zip gcc-d000aa67bc4dce06a1436d6b3fbab8134ce38d34.tar.gz gcc-d000aa67bc4dce06a1436d6b3fbab8134ce38d34.tar.bz2 |
re PR fortran/40569 (F2008: Support COMPILER_OPTIONS() / COMPILER_VERSION())
2010-09-27 Tobias Burnus <burnus@net-b.de>
PR fortran/40569
PR fortran/40568
* intrinsic.h (gfc_simplify_compiler_options,
gfc_simplify_compiler_version): New prototypes.
* intrinsic.c (gfc_intrinsic_function_by_id,
make_from_module): New functions.
(gfc_find_function, gfc_find_subroutine, gfc_generic_intrinsic,
gfc_specific_intrinsic): Don't return module intrinsics.
(add_functions): Add compiler_options, compiler_version.
(gfc_intrinsic_func_interface): Also lookup symbol by ISYM ID.
* symbol.c (std_for_isocbinding_symbol): Add version check for
NAMED_FUNCTIONS.
* iso-fortran-env.def: Add compiler_options, compiler_version.
* iso-c-binding.def: Add c_sizeof.
* gfortran.h (gfc_intrinsic_sym): Add from_module:1.
(iso_c_binding_symbol, iso_fortran_env_symbol): Add NAMED_FUNCTIONS.
(gfc_intrinsic_function_by_id): New prototype.
* module.c (create_intrinsic_function): New function.
(import_iso_c_binding_module, use_iso_fortran_env_module): Use it.
* trans-types.c (init_c_interop_kinds): Add NAMED_FUNCTIONS.
* resolve.c (resolve_intrinsic): Try also to resolve intrinsics
by ISYM ID.
* simplify.c (gfc_simplify_compiler_options,
gfc_simplify_compiler_version): New functions.
2010-09-27 Tobias Burnus <burnus@net-b.de>
PR fortran/40569
PR fortran/40568
* gfortran.dg/storage_size_2.f08: Fix test.
* gfortran.dg/c_sizeof_1.f90: Fix test.
* gfortran.dg/c_sizeof_2.f90: Update dg-error.
* gfortran.dg/c_sizeof_3.f90: New.
* gfortran.dg/c_sizeof_4.f90: New.
* gfortran.dg/iso_c_binding_compiler_1.f90: New.
* gfortran.dg/iso_c_binding_compiler_2.f90: New.
From-SVN: r164639
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_sizeof_1.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_sizeof_2.f90 | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_sizeof_3.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_sizeof_4.f90 | 10 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/iso_c_binding_compiler_1.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/iso_c_binding_compiler_2.f90 | 11 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/storage_size_2.f08 | 2 |
8 files changed, 73 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 536003f..dc21e64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2010-09-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/40569 + PR fortran/40568 + * gfortran.dg/storage_size_2.f08: Fix test. + * gfortran.dg/c_sizeof_1.f90: Fix test. + * gfortran.dg/c_sizeof_2.f90: Update dg-error. + * gfortran.dg/c_sizeof_3.f90: New. + * gfortran.dg/c_sizeof_4.f90: New. + * gfortran.dg/iso_c_binding_compiler_1.f90: New. + * gfortran.dg/iso_c_binding_compiler_2.f90: New. + 2010-09-26 Daniel Kraft <d@domob.eu> PR fortran/45783 diff --git a/gcc/testsuite/gfortran.dg/c_sizeof_1.f90 b/gcc/testsuite/gfortran.dg/c_sizeof_1.f90 index b30bdc5..e0ac06f 100644 --- a/gcc/testsuite/gfortran.dg/c_sizeof_1.f90 +++ b/gcc/testsuite/gfortran.dg/c_sizeof_1.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! Support F2008's c_sizeof() ! -use iso_c_binding, only: c_int, c_char, c_ptr, c_intptr_t, c_null_ptr +use iso_c_binding, only: c_int, c_char, c_ptr, c_intptr_t, c_null_ptr, c_sizeof integer(kind=c_int) :: i, j(10) character(kind=c_char,len=4),parameter :: str(1) = "abcd" diff --git a/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 b/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 index fb65adc..e163797 100644 --- a/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 +++ b/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 @@ -2,8 +2,8 @@ ! { dg-options "-std=f2003 -Wall -Wno-conversion" } ! Support F2008's c_sizeof() ! -USE ISO_C_BINDING +USE ISO_C_BINDING, only: C_SIZE_T, c_sizeof ! { dg-error "new in Fortran 2008" } integer(C_SIZE_T) :: i -i = c_sizeof(i) ! { dg-warning "Fortran 2008" } +i = c_sizeof(i) end diff --git a/gcc/testsuite/gfortran.dg/c_sizeof_3.f90 b/gcc/testsuite/gfortran.dg/c_sizeof_3.f90 new file mode 100644 index 0000000..8a68cb9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_sizeof_3.f90 @@ -0,0 +1,18 @@ +! { dg-do link } +! +! PR fortran/40568 +! +! Module checks for C_SIZEOF (part of ISO_C_BINDING) +! +subroutine test +use iso_c_binding, only: foo => c_sizeof, bar=> c_sizeof, c_sizeof, c_int +integer(c_int) :: i +print *, c_sizeof(i), bar(i), foo(i) +end + +use iso_c_binding +implicit none +integer(c_int) :: i +print *, c_sizeof(i) +call test() +end diff --git a/gcc/testsuite/gfortran.dg/c_sizeof_4.f90 b/gcc/testsuite/gfortran.dg/c_sizeof_4.f90 new file mode 100644 index 0000000..16172f0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_sizeof_4.f90 @@ -0,0 +1,10 @@ +! { dg-do link } +! +! PR fortran/40568 +! +! Module checks for C_SIZEOF (part of ISO_C_BINDING) +! + +implicit none +intrinsic c_sizeof ! { dg-error "does not exist" } +end diff --git a/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_1.f90 b/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_1.f90 new file mode 100644 index 0000000..8eccb6b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_1.f90 @@ -0,0 +1,18 @@ +! { dg-do link } +! +! PR fortran/40569 +! +! Check compiler_version/compiler_options intrinsics +! +subroutine test() + use iso_fortran_env, only: compiler_version + print '(3a)', '>>',compiler_version(),'<<' +end + +use iso_fortran_env, foo => compiler_version, bar => compiler_version + implicit none + print *, foo() + print *, bar() + print '(3a)', '>',compiler_options(),'<' + call test() +end diff --git a/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_2.f90 b/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_2.f90 new file mode 100644 index 0000000..279cfe6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/iso_c_binding_compiler_2.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } +! +! PR fortran/40569 +! +! Check compiler_version/compiler_options intrinsics +! +use iso_fortran_env, only: compiler_options ! { dg-error "is not in the selected standard" } +use iso_fortran_env, only: compiler_version ! { dg-error "is not in the selected standard" } + implicit none +end diff --git a/gcc/testsuite/gfortran.dg/storage_size_2.f08 b/gcc/testsuite/gfortran.dg/storage_size_2.f08 index 50de957..c18155e 100644 --- a/gcc/testsuite/gfortran.dg/storage_size_2.f08 +++ b/gcc/testsuite/gfortran.dg/storage_size_2.f08 @@ -4,7 +4,7 @@ ! ! Contributed by Janus Weil <janus@gcc.gnu.org> -use iso_c_binding, only: c_int +use iso_c_binding, only: c_int, c_sizeof type, bind(c) :: t integer(c_int) :: j |