https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123816

            Bug ID: 123816
           Summary: [M68K][Fixed-Point] Internal compilation error when
                    using typedef
           Product: gcc
           Version: 14.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: djipi.mari at gmail dot com
  Target Milestone: ---

I have adapted the gcc 14.3.0 config file, and compiled with the
--enable-fixed-point so gcc can compile with the fixed-point types.
I'm using gcc 14.3.0 but I think the issue can also apply to more recent gcc
versions.

About the configure options:

      --prefix="/c/Projects/GNU/build" \
      --target=m68k-elf \
      --with-cpu=m68000 \
      --with-newlib --with-gnu-as --with-gnu-ld \
      --without-headers \
      --enable-fixed-point \
      --enable-languages=c,c++ \
      --enable-lto \
      --enable-silent-rules \
      --enable-static \
      --disable-bootstrap \
      --disable-checking \
      --disable-docs \
      --disable-hosted-libstdcxx \
      --disable-libgomp \
      --disable-libssp \
      --disable-libstdcxx-pch \
      --disable-libstdcxx-verbose \
      --disable-libquadmath \
      --disable-multilib \
      --disable-nls \
      --disable-plugins \
      --disable-shared \
      --disable-threads \
      --disable-tls

And I have added these lines in the gcc configure with the mips, arm &
loongarch parts:
      m68k*)
      enable_fixed_point=yes
        ;;

The gcc compiler is generated without problems.

For a project, I wanted to use the typedef instruction.

typedef _Accum vec_t;
vec_t a;
_Accum b;
...
if (a < b)
...

The test line will generate this compilation error:
sorry, unimplemented: GCC cannot support operators with integer types and
fixed-point types that have too many integral and fractional bits together
   40 |         if (a < b)
      |         ^~
testaccum.c:40: confused by earlier errors, bailing out

If I do the following line, no compilation error is generated
...
if ((_Accum)a < b)

It seems typedef may be confused with fixed point type.

Reply via email to