public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/114216] New: gnu2x: error: too many arguments to function ‘host_fn’
@ 2024-03-03  4:00 jeffrey.cliff at gmail dot com
  2024-03-03  4:08 ` [Bug libgomp/114216] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jeffrey.cliff at gmail dot com @ 2024-03-03  4:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114216
           Summary: gnu2x: error: too many arguments to function ‘host_fn’
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jeffrey.cliff at gmail dot com
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

tl;dr : gcc fails to build, consistently failing at 

"checking for library containing gettext..." 

with error

../../../libgomp/target.c: In function ‘gomp_target_rev’:
../../../libgomp/target.c:3782:3: error: too many arguments to function
‘host_fn’
 3782 |   host_fn (devaddrs);
      |   ^~~~~~~

when building gcc with CFLAGS=" -std=gnu2x "

system installed version of gcc:

system: lfs no microsoft
https://git.freecumextremist.com/themusicgod1/LFS-no-microsoft  Linux fatima
6.7.0-gnm-c23lfs #1 SMP PREEMPT_DYNAMIC Tue Jan  9 15:37:28 CST 2024 x86_64
GNU/Linux. (ie linux-libre 6.7 with patch to allow it to work compile with
-std=gnu23 on a custom (Free) LFS system)
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr --disable-multilib
--with-system-zlib --enable-default-ssp --disable-fixincludes
--enable-languages=c,c++,fortran
CFLAGS=" -Oz ";
CXXFLAGS=" -Os ";
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240220 (experimental) (GCC) 

gcc being built:

gcc version 14.0.1 20240220 (experimental) (GCC) 
CFLAGS: -std=gnu2x
CXXFLAGS: (none)
Configured with:      --prefix=/usr             --disable-multilib       
--with-system-zlib        --enable-default-ssp      --disable-fixincludes    
--enable-languages=c,c++,fortran;

first observed in gcc 13.2 (however, i could not find anything in git bisect
history that would suggest post-2020 that this would work)

I get that gnu2x is "experimental and incomplete", but it really does seem like
something specific is broken at that point that should be
documented...somewhere, and this represents an actual
bug/not-yet-working-functionality thing

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libgomp/114216] gnu2x: error: too many arguments to function ‘host_fn’
  2024-03-03  4:00 [Bug libgomp/114216] New: gnu2x: error: too many arguments to function ‘host_fn’ jeffrey.cliff at gmail dot com
@ 2024-03-03  4:08 ` pinskia at gcc dot gnu.org
  2024-03-04 10:48 ` cvs-commit at gcc dot gnu.org
  2024-03-04 10:52 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-03  4:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>when building gcc with CFLAGS=" -std=gnu2x "


Why are you building with this?

Also basically target.c is still written in C99.

This patch should fix the issue though:
```
diff --git a/libgomp/target.c b/libgomp/target.c
index 1367e9cce6c..945244b33de 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -3447,7 +3447,7 @@ gomp_target_rev (uint64_t fn_ptr, uint64_t mapnum,
uint64_t devaddrs_ptr,

   if (n == NULL)
     gomp_fatal ("Cannot find reverse-offload function");
-  void (*host_fn)() = (void (*)()) n->k->host_start;
+  void (*host_fn)(void*) = (void (*)(void*)) n->k->host_start;

   if ((devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) || mapnum == 0)
     {

```

> but it really does seem like something specific is broken at that point that should be documented

It is documented in the C standard as being an incompatible change between
C11/C17/C90/C99 and C23. Basically `()` as the function paramaters is no longer
the same as `(...)` but rather the same as `(void)`.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libgomp/114216] gnu2x: error: too many arguments to function ‘host_fn’
  2024-03-03  4:00 [Bug libgomp/114216] New: gnu2x: error: too many arguments to function ‘host_fn’ jeffrey.cliff at gmail dot com
  2024-03-03  4:08 ` [Bug libgomp/114216] " pinskia at gcc dot gnu.org
@ 2024-03-04 10:48 ` cvs-commit at gcc dot gnu.org
  2024-03-04 10:52 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-04 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:dea9ac2a00d1e4126d61b65a8302c2bd523f0b99

commit r14-9294-gdea9ac2a00d1e4126d61b65a8302c2bd523f0b99
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Mar 4 11:40:27 2024 +0100

    libgomp: Use void (*) (void *) rather than void (*)() for host_fn type
[PR114216]

    For the type of the target callbacks we use elsehwere void (*) (void *) and
    IMHO should use that for the reverse offload fallback as well (where the
actual
    callback is emitted using the same code as for host fallback or device
kernel
    entry routines), even when it is also ok to use void (*) () before C23 and
    we aren't building libgomp with C23 yet.  On some arches perhaps void (*)
()
    could result in worse code generation because calls in that case like casts
    to unprototyped functions need to sometimes pass argument in two different
spots
    etc. so that it deals with both passing it through ... and as a named
argument.

    2024-03-04  Jakub Jelinek  <jakub@redhat.com>

            PR libgomp/114216
            * target.c (gomp_target_rev): Change host_fn type and corresponding
            cast from void (*)() to void (*) (void *).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libgomp/114216] gnu2x: error: too many arguments to function ‘host_fn’
  2024-03-03  4:00 [Bug libgomp/114216] New: gnu2x: error: too many arguments to function ‘host_fn’ jeffrey.cliff at gmail dot com
  2024-03-03  4:08 ` [Bug libgomp/114216] " pinskia at gcc dot gnu.org
  2024-03-04 10:48 ` cvs-commit at gcc dot gnu.org
@ 2024-03-04 10:52 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-04 10:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Committed mainly for consistency reasons.
As has been said earlier, you shouldn't override the options with which libgomp
nor other libraries are built, libgomp in particular is written in C11, not C23
and so it is just fine there.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-04 10:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-03  4:00 [Bug libgomp/114216] New: gnu2x: error: too many arguments to function ‘host_fn’ jeffrey.cliff at gmail dot com
2024-03-03  4:08 ` [Bug libgomp/114216] " pinskia at gcc dot gnu.org
2024-03-04 10:48 ` cvs-commit at gcc dot gnu.org
2024-03-04 10:52 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).