This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Testcase for fortran/PR3743 "Reference to intrinsic `ISHFT' invalid".
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: "Billinghurst, David (CRTS)" <David dot Billinghurst at riotinto dot com>, Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 01 Jan 2002 03:08:53 -0500
- Subject: Re: Testcase for fortran/PR3743 "Reference to intrinsic `ISHFT' invalid".
I tracked down the underlying cause of the failure, but the cause
is a fundamental design flaw in g77.
The symptom is intrin.c:ffeintrin_is_intrinsic() returns FALSE for
some Fortran intrinsics. Intrinsics are checked using bsearch() on the
array of intrinsics in intrin.def. The names are compared in the case
determined by ffe_case_intrin() which is initialized to
FFETARGET_defaultCASE_INTRIN in top.c, using the default value
FFE_caseLOWER in target.h.
bsearch() requires a sorted array. The failing testcase,
BIT_SIZE, includes an underscore in the name. Underscore is collated
between uppercase letter and lowercase letters. intrin.def is sorted for
uppercase names.
DEFNAME ("BITEST", "bitest", "BITest", genNONE, specBITEST) /* VXT */
DEFNAME ("BIT_SIZE", "bit_size", "Bit_Size", genNONE, specBIT_SIZE) /* F90 */
DEFNAME ("BJTEST", "bjtest", "BJTest", genNONE, specBJTEST) /* VXT */
bsearch() looks through the array using a lowercase comparison and expects
to find bit_size collated before bitest, not BIT_SIZE collated after
BITEST. This problem may be the cause of other errors with respect to
types of intrinsics.
Because of g77's options for cases, re-sorting the array or
changing the default case would only cover up the problem. libiberty
provides strcasecmp, so maybe that should be used for the comparison
instead of writing all case variants.
David