This is the mail archive of the
mailing list for the GCC project.
Re: [gfortran] PR 14928: Fix two-argument variant of MINLOC/MAXLOC
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: tobias dot schlueter at physik dot uni-muenchen dot de (Tobias Schlüter)
- Cc: paul at codesourcery dot com (Paul Brook), fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org (patch)
- Date: Sat, 12 Jun 2004 08:34:47 -0400 (EDT)
- Subject: Re: [gfortran] PR 14928: Fix two-argument variant of MINLOC/MAXLOC
> Paul Brook wrote:
> >>2004-06-05 Tobias Schlueter <firstname.lastname@example.org>
> >> Andrew Vaught <email@example.com>
> >> * check.c (gfc_check_minloc_maxloc): Take argument list insted
> >> of individual arguments, reorder if necessary.
> >> * intrinsic.h (gfc_check_minloc_maxloc): ... adapt prototype.
> >> * intrinsic.c (add_functions): Special treatment for MINLOC,
> >> MAXLOC, pass check function as (void *).
> >> (check_specific): Catch special case MINLOC, MAXLOC.
> > You can't typecast a function pointer to (void *), it will break on targets
> > that use function descriptors (eg. ia64). You'll need to figure out another
> > way of doing this. Maybe add a new variant of add_sym_3, (similar to
> > gfc_add_sym_3s).
> Actually, it doesn't call the function pointed to by the (void *), but
> only compares (void *)check_function (I forgot the name in the code) to
> (void *)gfc_check_minloc_maxloc, so the function pointer need not be
> callable, it only has to be unique. I agree that it would still be
> cleaner to implement its own add_sym* function, even though I refrained
> from doing this, as MINLOC is indeed unique in its characteristics.
Even on some targets you cannot just compare function pointers which have
been casted as again they are function descriptors (ie PA RISC) and the
comparision have to be expanded to two comparisions.
There is a bug report about this and I cannot remember the number.