This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Fortran, committed] Fix for comparison in intrinsic table.
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 31 Jan 2002 00:07:00 +0100
- Subject: [Fortran, committed] Fix for comparison in intrinsic table.
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
L.S.,
I applied the attached patch to fix the problem of the matching
intrinsics in the intrinsics table in intrin.def using a binary search.
The fix will compare the would-be-intrinsic-name to the upper case entry
of the table (forcing the would-be-intrinsic-name to upper case),
because that's the part of the table that's correctly sorted.
Make bootstrap (C and Fortran) and make install on i686-pc-linux-gnu and
mips-sgi-irix6.5, make check (Fortran only) on i686-pc-linux-gnu.
By explicit hand compiling I checked that
testsuite/g77.f-torture/compile/pr3743.f
and
testsuite/g77.f-torture/execute/f90-intrinsic-bit.f
compile correctly on mips-sgi-irix6.5.
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
2002-01-30 Toon Moene <toon@moene.indiv.nluug.nl>
* intrin.c (upcasecmp_): New function.
(ffeintrin_cmp_name_): Use it to correctly compare name
and table entry for bsearch.
*** intrin.c.orig Fri Jan 25 22:15:28 2002
--- intrin.c Tue Jan 29 21:33:01 2002
*************** ffeintrin_check_any_ (ffebld arglist)
*** 1154,1158 ****
}
! /* Compare name to intrinsic's name. Uses strcmp on arguments' names.
The intrinsics table is sorted on the upper case entries; so first
compare irrespective of case on the `uc' entry. If it matches,
--- 1154,1174 ----
}
! /* Compare a forced-to-uppercase name with a known-upper-case name. */
!
! static int
! upcasecmp_ (const char *name, const char *ucname)
! {
! for ( ; *name != 0 && *ucname != 0; name++, ucname++)
! {
! int i = TOUPPER(*name) - *ucname;
!
! if (i != 0)
! return i;
! }
!
! return *name - *ucname;
! }
!
! /* Compare name to intrinsic's name.
The intrinsics table is sorted on the upper case entries; so first
compare irrespective of case on the `uc' entry. If it matches,
*************** ffeintrin_cmp_name_ (const void *name, c
*** 1167,1171 ****
int i;
! if ((i = strcasecmp (name, uc)) == 0)
{
switch (ffe_case_intrin ())
--- 1183,1187 ----
int i;
! if ((i = upcasecmp_ (name, uc)) == 0)
{
switch (ffe_case_intrin ())