This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(committed) Re: [Patch, Fortran] PR33941 - Fix reading of modules with non-character intrinsic operators
- From: Tobias Burnus <burnus at net-b dot de>
- To: Dominique Dhumieres <dominiq at lps dot ens dot fr>, gcc-patches <gcc-patches at gcc dot gnu dot org>, François-Xavier Coudert <fxcoudert at gmail dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 31 Oct 2007 16:10:54 +0100
- Subject: (committed) Re: [Patch, Fortran] PR33941 - Fix reading of modules with non-character intrinsic operators
- References: <20071030232002.613D45BBB5@mailhost.lps.ens.fr>
Dominique Dhumieres wrote:
> Compound comparison operators (<=, ==, /=, ..) still give errors
> (see PR33941 for examples).
>
Ok, fixed it now by using only alphabetic entries in the module files.
The patch build/regtested and was pre-approved in the PR by FX.
Checked in as Rev. 129801.
Tobias
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 129800)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,3 +1,9 @@
+2007-10-31 Dominique d'Humieres <dominiq@lps.ens.fr>
+ Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33941
+ * gfortran.dg/module_read_1.f90: New.
+
2007-10-31 Tom Tromey <tromey@redhat.com>
PR preprocessor/30786:
Index: gcc/testsuite/gfortran.dg/module_read_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/module_read_1.f90 (Revision 0)
+++ gcc/testsuite/gfortran.dg/module_read_1.f90 (Revision 0)
@@ -0,0 +1,29 @@
+! { dg-do run }
+! PR fortran/33941
+! The problem was that the intrinsic operators
+! were written to the module file as '/=' etc.
+! but this format was not understood on reading.
+!
+! Test case by Toby White, stripped down by
+! Dominique d'Humieres and Francois-Xavier Coudert
+
+module foo
+contains
+ function pop(n) result(item)
+ integer :: n
+ character(len=merge(1, 0, n > 0)) :: item
+ end function pop
+ function push(n) result(item)
+ integer :: n
+ character(len=merge(1, 0, n /= 0)) :: item
+ end function push
+end module foo
+
+program test
+ use foo
+ if(len(pop(0)) /= 0) call abort()
+ if(len(pop(1)) /= 1) call abort()
+ if(len(push(0)) /= 0) call abort()
+ if(len(push(1)) /= 1) call abort()
+end program
+! { dg-final { cleanup-modules "foo" } }
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 129800)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,9 @@
+2007-10-31 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33941
+ * modules.c (intrinsics): Use only alphabetic names for
+ intrinsic operators.
+
2007-10-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/33162
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c (Revision 129800)
+++ gcc/fortran/module.c (Arbeitskopie)
@@ -2627,17 +2627,17 @@ static const mstring intrinsics[] =
minit ("OR", INTRINSIC_OR),
minit ("EQV", INTRINSIC_EQV),
minit ("NEQV", INTRINSIC_NEQV),
- minit ("==", INTRINSIC_EQ),
+ minit ("EQ_SIGN", INTRINSIC_EQ),
minit ("EQ", INTRINSIC_EQ_OS),
- minit ("/=", INTRINSIC_NE),
+ minit ("NE_SIGN", INTRINSIC_NE),
minit ("NE", INTRINSIC_NE_OS),
- minit (">", INTRINSIC_GT),
+ minit ("GT_SIGN", INTRINSIC_GT),
minit ("GT", INTRINSIC_GT_OS),
- minit (">=", INTRINSIC_GE),
+ minit ("GE_SIGN", INTRINSIC_GE),
minit ("GE", INTRINSIC_GE_OS),
- minit ("<", INTRINSIC_LT),
+ minit ("LT_SIGN", INTRINSIC_LT),
minit ("LT", INTRINSIC_LT_OS),
- minit ("<=", INTRINSIC_LE),
+ minit ("LE_SIGN", INTRINSIC_LE),
minit ("LE", INTRINSIC_LE_OS),
minit ("NOT", INTRINSIC_NOT),
minit ("PARENTHESES", INTRINSIC_PARENTHESES),