Seems I missed a case in my patch for PR 34671:
program main
real, dimension(2,2) :: a
logical, 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
call random_number(a)
b = any(a>0.5,dim=1)
if (b(1) .or. .not. b(2)) print *,b
i = 16843009 ! Initialize i to put junk into b
b = all(a>0.5,dim=1)
if (b(1) .or. .not. b(2)) print *,b
end program main
Here's a patch (untested, because I am currently
bootstrapping):
Index: iresolve.c
===================================================================
--- iresolve.c (revision 131577)
+++ iresolve.c (working copy)
@@ -247,7 +247,10 @@ gfc_resolve_dint (gfc_expr *f, gfc_expr
void
gfc_resolve_all (gfc_expr *f, gfc_expr *mask, gfc_expr *dim)
{
+ int kind;
+
f->ts = mask->ts;
+ kind = mask->ts.kind;
if (dim != NULL)
{
@@ -260,7 +263,7 @@ gfc_resolve_all (gfc_expr *f, gfc_expr *
f->value.function.name
= gfc_get_string (PREFIX ("all_%c%d"), gfc_type_letter (mask->ts.type),
- mask->ts.kind);
+ kind);
}
@@ -297,7 +300,10 @@ gfc_resolve_dnint (gfc_expr *f, gfc_expr
void
gfc_resolve_any (gfc_expr *f, gfc_expr *mask, gfc_expr *dim)
{
+ int kind;
+
f->ts = mask->ts;
+ kind = mask->ts.kind;
if (dim != NULL)
{
@@ -310,7 +316,7 @@ gfc_resolve_any (gfc_expr *f, gfc_expr *
f->value.function.name
= gfc_get_string (PREFIX ("any_%c%d"), gfc_type_letter (mask->ts.type),
- mask->ts.kind);
+ kind);
}
--
Summary: [4.3 regression] mixed-kind "any" and "all" intrinsics
with expressions
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: tkoenig at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34817