gmp-impl.h assumes 32-bit unsigned int in fft_table_nk

Marc Glisse marc.glisse at inria.fr
Fri Dec 18 12:45:44 UTC 2015


On Fri, 18 Dec 2015, Robert Baruch wrote:

> GMP version: 6.1.0
>
> Test program: N/A, just compiling GMP
>
> Description:
> =======================
> My system defines unsigned int as 16 bits. Thus, something like
> struct fft_table_nk {
>  unsigned int n:27;
>  ...
> }
> will cause the compiler to complain that there are not enough bits (see
> output_from_make.txt attached)
> =======================
>
> Platform: Ubuntu 15.10 32-bit
>
> Configure options: CC=avr-gcc CFLAGS=-mmcu=atmega328p --host=avr
>
> // Yes, I realize that trying to compile a high performance multi precision
> library like GMP for an *8-bit microcontroller* is bordering on lunacy, but
> I thought I'd try.
>
> Output from configure: attached
> Output from make: attached
>
> Compilers: gcc: 5.2.1 20151010, avr-gcc: 4.8.1 (obtained via apt-get
> gcc-avr)
>
> uname -a: Linux robuntu 4.2.0-21-generic #25-Ubuntu SMP Wed Dec 2 18:41:50
> UTC 2015 i686 i686 i686 GNU/Linux
>
> ./config.guess: sandybridge-pc-linux-gnu
> ./configfsf.guess: i686-pc-linux-gnu
> config.log: attached
>
> Comments
> ==============================
> Looks like gmp-impl.h defines gmp_uint_least32_t so maybe that's what
> should be used if we want a 27 bit field?
> ==============================

We have --disable-fft, maybe the code in gmp-impl.h could be protected by 
WANT_FFT. gmp_uint_least32_t also looks like it is unlikely to hurt, and 
we are already using it for other bitfields in the same file.

Those changes could make sense whether we support 16 bit systems or not.

-- 
Marc Glisse


More information about the gmp-bugs mailing list