aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2007-11-29 15:56:48 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2007-11-29 15:56:48 +0100
commit42a8c358ced433f956f1a6010d4d4188bd3b6074 (patch)
treed4243f7dae02c16b6e49115e05a28093ba7e8ad0 /gcc
parenta6dcb051e93cdf2b5280a11a9f4225d6cc46b434 (diff)
downloadgcc-42a8c358ced433f956f1a6010d4d4188bd3b6074.zip
gcc-42a8c358ced433f956f1a6010d4d4188bd3b6074.tar.gz
gcc-42a8c358ced433f956f1a6010d4d4188bd3b6074.tar.bz2
re PR fortran/34262 (MVBITS does not work for arrays)
2007-11-29 Tobias Burnus <burnus@net-b.de> PR fortran/34262 * intrinsic.c (gfc_get_intrinsic_sub_symbol): Add comment. (gfc_intrinsic_sub_interface): Copy elemental state if needed. * iresolve.c (gfc_resolve_mvbits): Mark procedure as elemental. 2007-11-29 Tobias Burnus <burnus@net-b.de> PR fortran/34262 * gfortran.dg/mvbits_3.f90: New. From-SVN: r130513
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/intrinsic.c8
-rw-r--r--gcc/fortran/iresolve.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/mvbits_3.f9031
5 files changed, 51 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b117d18..a176c27 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-29 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/34262
+ * intrinsic.c (gfc_get_intrinsic_sub_symbol): Add comment.
+ (gfc_intrinsic_sub_interface): Copy elemental state if needed.
+ * iresolve.c (gfc_resolve_mvbits): Mark procedure as elemental.
+
2007-11-28 Jakub Jelinek <jakub@redhat.com>
* trans-expr.c (gfc_trans_string_copy): Convert both dest and
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index a67ec70..467f771 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -96,7 +96,8 @@ gfc_type_letter (bt type)
}
-/* Get a symbol for a resolved name. */
+/* Get a symbol for a resolved name. Note, if needed be, the elemental
+ attribute has be added afterwards. */
gfc_symbol *
gfc_get_intrinsic_sub_symbol (const char *name)
@@ -3501,7 +3502,10 @@ gfc_intrinsic_sub_interface (gfc_code *c, int error_flag)
if (isym->resolve.s1 != NULL)
isym->resolve.s1 (c);
else
- c->resolved_sym = gfc_get_intrinsic_sub_symbol (isym->lib_name);
+ {
+ c->resolved_sym = gfc_get_intrinsic_sub_symbol (isym->lib_name);
+ c->resolved_sym->attr.elemental = isym->elemental;
+ }
if (gfc_pure (NULL) && !isym->elemental)
{
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index b847044..a68e42e 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -2581,6 +2581,8 @@ gfc_resolve_mvbits (gfc_code *c)
name = gfc_get_string (PREFIX ("mvbits_i%d"),
c->ext.actual->expr->ts.kind);
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
+ /* Mark as elemental subroutine as this does not happen automatically. */
+ c->resolved_sym->attr.elemental = 1;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f509021..e062abc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-29 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/34262
+ * gfortran.dg/mvbits_3.f90: New.
+
2007-11-28 Bob Wilson <bob.wilson@acm.org>
* lib/target-supports.exp (check_effective_target_mips_soft_float):
diff --git a/gcc/testsuite/gfortran.dg/mvbits_3.f90 b/gcc/testsuite/gfortran.dg/mvbits_3.f90
new file mode 100644
index 0000000..74f24e0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/mvbits_3.f90
@@ -0,0 +1,31 @@
+! { dg-do run }
+!
+! PR fortran/
+!
+! The trans-*.c part of the compiler did no know
+! that mvbits is an elemental function.
+!
+! Test case contributed by P.H. Lundow.
+!
+program main
+ implicit none
+ integer :: a( 2 ), b( 2 )
+ integer :: x, y
+
+ a = 1
+ b = 0
+ x = 1
+ y = 0
+
+ call mvbits (a, 0, 1, b, 1)
+ call mvbits (x, 0, 1, y, 1)
+
+! write (*, *) 'a: ', a
+! write (*, *) 'x: ', x
+! write (*, *)
+! write (*, *) 'b: ', b
+! write (*, *) 'y: ', y
+! write (*, *)
+
+ if ( any (b /= y) ) call abort()
+end program main