Hello, The build of my program terminates on file mtfcontrolargsM.f90, and I see the following message: mtfcontrolargsM.f90:805.25: end module MTFControlArgs 1 Internal Error at (1): mtfcontrolargsM.f90:631.32: This % NLam = count (.not. Near0 (This % PolyMTFWeight(1: NO_MTF_WAVES))) 1 Can't convert LOGICAL(1) to LOGICAL(1) at (1) As soon as I am assigned a bug number, I will upload a tar file, bug3.tgz to the following address: gcc-bugzilla@gcc.gnu.org. Unpack the file and invoke the shell script bug3.sh to reproduce the problem. I'll indicate the bug number in the subject line. I am running Open SuSE 10.1 on a dual core Athlon chip. I'm using the gcc-trunk build: norm@oxford:~/design/gfortran/bug3/test> gfortran --version GNU Fortran (GCC) 4.4.0 20080621 (experimental) [trunk revision 137000] Copyright (C) 2008 Free Software Foundation, Inc. I am not able to reduce the size of the problem. Yours truly, Norm Clerman
Subject: gfortran bug 36590 Hello, Attached is the zipped tar archive that will enable you to reproduce gfortran bug 36590. Unpack the archive in a directory and then invoke file bug3.sh to reproduce it. If there are any problems or questions, do not hesitate to send me an e-mail Thank you for your attention. Norm Clerman
Created attachment 15799 [details] bug3.tgz
I have not confirmed this but its not a "blocker". Next step will be to see if someone can reduce this.
CONFIRM. Reduced test case: MODULE MTFControlArgs TYPE, PUBLIC :: TMTFControlArgs Real(8) :: PolyMTFWeight (1:10) end type TMTFControlArgs interface Near0 elemental function Near0_dp (TestNumber) result (NumberNear0) real (8), intent(in) :: TestNumber logical (1) :: NumberNear0 end function Near0_dp elemental function Near0_sp (TestNumber) result (NumberNear0) real (4), intent(in) :: TestNumber logical (1) :: NumberNear0 end function Near0_sp end interface contains subroutine getSpc_MTFCA (This) type (TMTFControlArgs), intent(inout) :: This integer(1) :: i i = count (.not. Near0 (This % PolyMTFWeight(1: 10))) end subroutine GetSpc_MTFCA end module MTFControlArgs
The error only occurs for logical(1), kind=2,4,8,16 all work. The program also works if one removes the .not. interface Near0 function Near0_dp (TestNumber) result (NumberNear0) real :: TestNumber(2) logical(1) :: NumberNear0(2) end function Near0_dp end interface real :: PolyMTFWeight(2) i = count (.not. Near0 (PolyMTFWeight(1:2))) end
Patch. The problem was that gfortran failed to find a conversion routine for logical(1) to logical(1), now it simply does nothing and reports success. I'm not sure whether BT_VOID needs some special care or not. (Cf. interface.c's gfc_compare_types. Probably BT_VOID can never happen - or can it?) Index: intrinsic.c =================================================================== --- intrinsic.c (Revision 137011) +++ intrinsic.c @@ -3701,8 +3701,7 @@ gfc_convert_type_warn (gfc_expr *expr, g if (expr->ts.type == BT_UNKNOWN) goto bad; - if (expr->ts.type == BT_DERIVED && ts->type == BT_DERIVED - && gfc_compare_types (&expr->ts, ts)) + if (gfc_compare_types (&expr->ts, ts)) return SUCCESS; sym = find_conv (&expr->ts, ts);
Subject: Bug 36590 Author: tkoenig Date: Wed Jul 2 14:36:58 2008 New Revision: 137355 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137355 Log: 2008-07-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36590 PR fortran/36681 * iresolve.c (resolve_mask_arg): Don't convert mask to kind=1 logical if it is of that type already. 2008-07-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36590 PR fortran/36681 * gfortran.dg/count_mask_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/count_mask_1.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/iresolve.c trunk/gcc/testsuite/ChangeLog
Fixed. Closing.