]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/34817 (mixed-kind "any" and "all" intrinsics with expressions)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 19 Jan 2008 22:47:47 +0000 (22:47 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sat, 19 Jan 2008 22:47:47 +0000 (22:47 +0000)
2008-01-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/34817
PR fortran/34838
* iresolve.c (gfc_resolve_all):  Remove conversion of mask
argument to kind=1 by removing call to resolve_mask_arg().
(gfc_resolve_any):  Likewise.

2008-01-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/34817
PR fortran/34838
* gfortran.dg/any_all_1.f90:  New test.
* gfortran.dg/any_all_2.f90:  New test.

From-SVN: r131660

gcc/fortran/ChangeLog
gcc/fortran/iresolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/any_all_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/any_all_2.f90 [new file with mode: 0644]

index 46c95e00f26bd751dfcd47e96bf724796e08218f..11d9c2378a15b58f49e3abcc3c7347efa6eac223 100644 (file)
@@ -1,3 +1,11 @@
+2008-01-19  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/34817
+       PR fortran/34838
+       * iresolve.c (gfc_resolve_all):  Remove conversion of mask
+       argument to kind=1 by removing call to resolve_mask_arg().
+       (gfc_resolve_any):  Likewise.
+
 2008-01-19  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/34760
index bdb4054fe411fa9e506a220d50a42d60a866daa8..79b46e2501c19a459fa9ddfcc12800c2a8d10b21 100644 (file)
@@ -256,8 +256,6 @@ gfc_resolve_all (gfc_expr *f, gfc_expr *mask, gfc_expr *dim)
       f->shape = gfc_copy_shape_excluding (mask->shape, mask->rank, dim);
     }
 
-  resolve_mask_arg (mask);
-
   f->value.function.name
     = gfc_get_string (PREFIX ("all_%c%d"), gfc_type_letter (mask->ts.type),
                      mask->ts.kind);
@@ -306,8 +304,6 @@ gfc_resolve_any (gfc_expr *f, gfc_expr *mask, gfc_expr *dim)
       f->shape = gfc_copy_shape_excluding (mask->shape, mask->rank, dim);
     }
 
-  resolve_mask_arg (mask);
-
   f->value.function.name
     = gfc_get_string (PREFIX ("any_%c%d"), gfc_type_letter (mask->ts.type),
                      mask->ts.kind);
index 96b2a6ceeb9cd34ace0295037037fae179e8434f..5ea52a26f40535e2811d1a0233c961ed7c2f59f4 100644 (file)
@@ -1,3 +1,10 @@
+2008-01-19  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/34817
+       PR fortran/34838
+       * gfortran.dg/any_all_1.f90:  New test.
+       * gfortran.dg/any_all_2.f90:  New test.
+
 2008-01-19  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        * g++.dg/eh/ia64-2.C: Place "dg-do run" statement before
diff --git a/gcc/testsuite/gfortran.dg/any_all_1.f90 b/gcc/testsuite/gfortran.dg/any_all_1.f90
new file mode 100644 (file)
index 0000000..f1a1447
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do run }
+! PR 34817 - the wrong library function was called,
+! leading to garbage in the return value
+program main
+  real, dimension(2,2) :: a
+  logical(kind=4), dimension(2) :: b
+  integer, dimension(2) :: i
+  equivalence (b,i)
+  data a /1.0, 2.0, -0.1, -0.2 /
+
+  i = 16843009 ! Initialize i to put junk into b
+  b = any(a>0.5,dim=1)
+  if (b(2) .or. .not. b(1)) call abort
+
+  i = 16843009  ! Initialize i to put junk into b
+  b = all(a>0.5,dim=1)
+  if (b(2) .or. .not. b(1)) call abort
+end program main
diff --git a/gcc/testsuite/gfortran.dg/any_all_2.f90 b/gcc/testsuite/gfortran.dg/any_all_2.f90
new file mode 100644 (file)
index 0000000..57df0cf
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR 34838 - this failed with "Can't convert LOGICAL(1) to LOGICAL(1)
+! Test case contributed by Manfred Schwab.
+program main
+  Logical(kind=1) :: bmp(1),bmpv(1)
+
+  bmp(1)=.false.
+  bmpv(1)=.true.
+
+  if ( ANY(bmp(1:1) .NEQV. bmpv(1:1)) ) then
+     print*,"hello"
+  end if
+
+  if ( ALL(bmp(1:1) .NEQV. bmpv(1:1)) ) then
+     print*,"hello"
+  end if
+
+end program main