[patch, libgfortran] Some more transformational intrinsic speedups

Tobias Schlüter Tobias.Schlueter@physik.uni-muenchen.de
Tue Apr 8 14:54:00 GMT 2008


Tobias Schlüter wrote:
> FX wrote:
>>>  Without looking at the details of Thomas' patch I think intptr_t is the
>>> right type, i.e. an integer type that is defined to always be wide 
>>> enough to
>>> contain a pointer.
>>
>> uintptr_t (the unsigned type) seems more appropriate here. But are we
>> guaranteed it is defined? When I used intptr_t in the past (in
>> intrinsics/signal.c and runtime/backtrace.c) I've defined a macro
>> depending on HAVE_INTPTR_T.
> 
> FAIK it's required by C99, and the library is built with a C99 compiler, 
> i.e. gcc.  But one of my assumptions may be wrong, and it may make sense 
> to fall back to unsigned long if !HAVE_INTRPTR_T.

Ok, so the flawed assumption was that even though the compiler is C99, 
the target library may not be.  I found this piece of code by rth while 
googling around <http://gcc.gnu.org/ml/libstdc++/2007-03/msg00177.html>:
#if __SIZEOF_POINTER__ == __SIZEOF_LONG__
typedef unsigned long _UIntPtrType;
#elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__
typedef unsigned long long _UIntPtrType;
#elif __SIZEOF_POINTER__ == __SIZEOF_INT__
typedef unsigned int _UIntPtrType;
#elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__
typedef unsigned short int _UIntPtrType;
#else
#error
#endif

This can probably be adapted.

Cheers,
- Tobi

-- 
Tobias Schlüter
Am Coulombwall 1, Zi. 326
85748 Garching b. München
Tel.: +49/89/289-14139



More information about the Fortran mailing list