severity 534722 normal
forwarded 534722 f...@fftw.org
thanks

Hello Frank,

The upstream authors are included in this thread.

Frank Hess wrote:
> Package: libfftw3-dev
> Version: 3.1.2-3.1
> Severity: important
> 
> FFTW3 has a mis-design feature where if complex.h is included before fftw3.h 
> (maybe indirectly and
> unintentionally through another header) then the header changes the 
> definition of
> the "fftw_complex" types (without doing any mangling to give them different 
> names).

Indeed, this is a documented behavior, see:
http://www.fftw.org/doc/Complex-numbers.html

> This means if a user doesn't include fftw3.h first, before
> any possible inclusion of complex.h, then his
> code may be using a different ABI than that of the libfftw3.so provided by 
> debian.
> Or, indeed, different translation units of the user's program may be using 
> different
> definitions of fftw_complex depending on exactly when each translation unit
> included fftw3.h. This
> will at the very least cause violations of the C strict aliasing rules which 
> can
> cause mysterious crashes when optimization is turned on (unless gcc's 
> -fno-strict-aliasing
> option is used).  I have personally seen these crashes, and the problems can 
> also be visible when using valgrind (I saw it cause various uninitialized 
> memory problems
> in my program which valgrind reported).

Could you provide a test-case to reproduce said crashes?

Also, did you use fftw_cleanup() in your programs when running through
valgrind?


> As a workaround, Debian should alter the fftw3.h header so it does not define
> fftw_complex based on header inclusion order, but always defines fftw_complex 
> in
> the same way it is defined when Debian compiles libfftw3.so.

Except this would defeat the whole purpose of the current design.

For the record, we have this in api/api.h:

/* just in case: force <fftw3.h> not to use C99 complex numbers
   (we need this for IBM xlc because _Complex_I is treated specially

   and is defined even if <complex.h> is not included) */

#define FFTW_NO_Complex


and this in api/fftw3.h

/* If <complex.h> is included, use the C99 complex type.  Otherwise
   define a type bit-compatible with C99 complex */

#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex)
&& defined(I)
#  define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C

#else
#  define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]

#endif

cheers, piem


> 
> -- System Information:
> Debian Release: 5.0.1
>   APT prefers stable
>   APT policy: (500, 'stable')
> Architecture: i386 (i686)
> 
> Kernel: Linux 2.6.26-2-686 (SMP w/2 CPU cores)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash
> 
> Versions of packages libfftw3-dev depends on:
> ii  libc6                         2.7-18     GNU C Library: Shared libraries
> ii  libfftw3-3                    3.1.2-3.1  library for computing Fast 
> Fourier
> 
> libfftw3-dev recommends no packages.
> 
> libfftw3-dev suggests no packages.
> 
> -- no debconf information
> 
> 
> 
> 




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to