Re: gcc 14+ and m68k build failure

"Pietro Monteiro" <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Sun, Jun 2, 2024, at 8:58 AM, Joel Sherrill wrote:
> Hi
>
> GCC 14+ fail to build a few newlib targets. I am looking into m68k-rtems
> (m68k-elf) first. If there is a common thread, it appears to be related to
> targets which do not have long double in all multilibs.

The same thing is happening on SH for the m4-single-only multilib.

> First, how do you see more than "CC..file.c"?

Add `V=1' to you make invocation.
 
> The error for m68k starts with this:
>
> ake[3]: Entering directory
> '/home/joel/test-gcc/b-m68k-rtems6-gcc/m68k-rtems6/newlib'
>   CC       libm/complex/libm_a-ccoshl.o
> ../../../gcc/newlib/libm/complex/ccoshl.c: In function 'ccoshl':
> ../../../gcc/newlib/libm/complex/ccoshl.c:43:13: error: implicit
> declaration of function 'coshl'; did you mean 'coshf'?
> [-Wimplicit-function-declaration]
>    43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
>       |             ^~~~~
>       |             coshf
> ../../../gcc/newlib/libm/complex/ccoshl.c:43:24: error: implicit
> declaration of function 'cosl'; did you mean 'cosf'?
> [-Wimplicit-function-declaration]
>    43 |         w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
>
>
> I suspect that since only one multilib for m68k has multilib and that is
> picked at compile time, the multilib here isn't enabling the prototypes for
> long double. That idea seems right but the code doesn't seem to always
> follow up to avoid trying to compile files like the above which assume long
> double.

I think I understand what's going on. `_LDBL_EQ_DBL' is not being defined for that multilib. So, functions like `coshl' aren't compiled (see newlib/libm/common/coshl.c), but the complex versions of the functions don't have the `#ifdef _LDBL_EQ_DBL' guard around them (see: newlib/libm/complex/ccoshl.c). And GCC 14 changed the lack of a function declaration from a warning into an error.

> Ideas appreciated.

I'll try to post a patch adding the ifdefs to add long double complex functions. 

> --joel

pietro
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.