I am writing a new backend for GCC 4.3.1 and have run into the
following issue with GCC 4.3.1's support for the
fixed-point 'long _Fract' type when used in a 'typedef'.
I believe this issue is generic to GCC and not to the backend.

See the (very short) testcase below and the output from GCC.
Basically: when I use a 'typedef' for the 'long _Fract' type,
GCC generates an error but when I replace the typedef with
a #define that, at least in this case, leads to equivalent
code, GCC completes without error (and the resulting .s file
contains correct assembly).

It seems as if the typedef is not being handled correctly.
Or am I misunderstanding something?


% cat foo.c
#ifdef USE_TYPEDEF
  /* Error occurs when this typedef is used */
  typedef long _Fract fract32_t;
#else
  /* Error does NOT occur when this define is used */
  #define fract32_t long _Fract
#endif

fract32_t foo(fract32_t a)
{
    return a + 0.25lr;
}



% gcc -DUSE_TYPEDEF -O3 foo.c
foo.c: In function 'foo':
foo.c:11: sorry, unimplemented: GCC cannot support operators with
integer types and fixed-point types that have too many integral and
fractional bits together
foo.c:11: error: invalid operands to binary + (have 'fract32_t' and
'long _Fract')


% gcc -O3 foo.c
<no errors>




      

Reply via email to