attribute mode is unknown (Sun cc)

Jay K jay.krell at
Mon Nov 8 09:31:55 CET 2010

>   "gmp-impl.h", line 2812: warning:  attribute "mode" is unknown, ignored
>   "gmp-impl.h", line 2812: warning: attribute parameter "QI" is undefined
> OK, so have Oracle added some incompatible variant of GMP's attribute
> extension?  Or is this some non-standard compiler from Oracle?

No. It has __attribute__, has no __attribute__ (mode), and using it 
merely warns.

Which is good enough for autoconf to decide it works.

I found documentation here:


  configure:21992: checking whether gcc __attribute__ ((mode (XX))) 

  configure:22018: /usr/bin/cc -c -g  conftest.c >&5  

  "conftest.c", line 57: warning:  attribute "mode" is unknown, ignored 

  "conftest.c", line 57: warning: attribute parameter "SI" is undefined 

  configure:22024: $? = 0  

  configure:22040: result: yes  

>   diff -u -r1.5 gmp-impl.h
>   +#if HAVE_ATTRIBUTE_MODE && defined(__GNUC__)
> The correct fix for this is to tweak the feature test for
> HAVE_ATTRIBUTE_MODE, leaving it undefined for compilers that do ot
> really support it.

Agreed but I'm not skilled in autoconf/bash. (yeah yeah, it doesn't look that hard,
but I'm also not a fan of autoconf, so often fails at its task, like here..)
Grep for the warnings???
For now I have the patch shown.
The #else branch is also good fine portable to all compilers??
Or less efficient?
If I have #define NO_ASM --  as in building within gcc tree -- maybe take that as a hint that deoptimization is ok??
(I wonder about using that "dumpmp.c" file, but I think it isn't currently adequate.)
 - Jay

More information about the gmp-bugs mailing list