This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][gfortran][PR 13909] f77 style logical*1 variables unusable


Below is a patch for your consideration to fix PR 13909.  It corrects
the problem reported in the PR and introduces no new testsuite
regressions.  

Tested on i686-pc-linux-gnu.


Changelog entry:

         B.Davis  bdavis9659@comcast.net
 
         PR gfortran/13909
         * intrinsic.c (add_conversions) changed logical to use logical 
conversion instead of real.
         * trans-types.c (gfc_get_logical_type) implemented logical*1
and logical*2.
 


  
As far as testsuite is concerned, may I suggest the following test be
added to gcc/testsuite/g77.f-torture/compile.  My reasoning is thus;
gfortran will compile g77 code, so eventually it will inherit the f77
testsuite.

       LOGICAL*1 A
       A = .TRUE.
       END


I propose the below patch is a "small change" and can be accepted
without copyright assignment.


regards,
bud davis

===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/intrinsic.c,v
retrieving revision 1.1.2.9
diff -c -3 -p -r1.1.2.9 intrinsic.c
*** intrinsic.c 11 Jan 2004 13:57:12 -0000      1.1.2.9
--- intrinsic.c 5 Feb 2004 03:40:08 -0000
*************** add_conversions (void)
*** 1738,1745 ****
        if (i == j)
          continue;
   
!       add_conv (BT_LOGICAL, gfc_real_kinds[i].kind,
!                 BT_LOGICAL, gfc_real_kinds[j].kind,
gfc_convert_constant);
        }
  }
   
--- 1738,1745 ----
        if (i == j)
          continue;
   
!       add_conv (BT_LOGICAL, gfc_logical_kinds[i].kind,
!                 BT_LOGICAL, gfc_logical_kinds[j].kind,
gfc_convert_constant);
        }
  }
   
Index: trans-types.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/Attic/trans-types.c,v
retrieving revision 1.1.2.9
diff -c -3 -p -r1.1.2.9 trans-types.c
*** trans-types.c       11 Jan 2004 13:16:27 -0000      1.1.2.9
--- trans-types.c       5 Feb 2004 03:40:09 -0000
*************** gfc_get_logical_type (int kind)
*** 246,251 ****
--- 246,255 ----
  {
    switch (kind)
      {
+     case 1:
+       return (gfc_logical1_type_node);
+     case 2:
+       return (gfc_logical2_type_node);
      case 4:
        return (gfc_logical4_type_node);
      case 8:






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]