Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 943925 - dev-gap/cvec-2.8.1-r1 - [libtool] [gcc-15] src/cvec.c: error: initialization of struct OpaqueBag ( )(void) from incompatible pointer type struct OpaqueBag ( )(struct Opaq
Summary: dev-gap/cvec-2.8.1-r1 - [libtool] [gcc-15] src/cvec.c: error: initialization ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Michael Orlitzky
URL: https://github.com/gap-packages/cvec/...
Whiteboard:
Keywords:
Depends on:
Blocks: c23-porting
  Show dependency tree
 
Reported: 2024-11-19 08:45 UTC by Toralf Förster
Modified: 2025-01-06 02:48 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,21.65 KB, text/plain)
2024-11-19 08:45 UTC, Toralf Förster
Details
dev-gap:cvec-2.8.1-r1:20241118-221652.log (dev-gap:cvec-2.8.1-r1:20241118-221652.log,22.71 KB, text/plain)
2024-11-19 08:45 UTC, Toralf Förster
Details
emerge-history.txt.xz (emerge-history.txt.xz,86.57 KB, application/x-xz)
2024-11-19 08:45 UTC, Toralf Förster
Details
environment (environment,34.67 KB, text/plain)
2024-11-19 08:45 UTC, Toralf Förster
Details
etc.clang.tar.xz (etc.clang.tar.xz,1.20 KB, application/x-xz)
2024-11-19 08:45 UTC, Toralf Förster
Details
etc.portage.tar.xz (etc.portage.tar.xz,32.07 KB, application/x-xz)
2024-11-19 08:45 UTC, Toralf Förster
Details
logs.tar.xz (logs.tar.xz,22.14 KB, application/x-xz)
2024-11-19 08:45 UTC, Toralf Förster
Details
qlist-info.txt.xz (qlist-info.txt.xz,89.54 KB, application/x-xz)
2024-11-19 08:45 UTC, Toralf Förster
Details
temp.tar.xz (temp.tar.xz,10.09 KB, application/x-xz)
2024-11-19 08:45 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2024-11-19 08:45:30 UTC
Using settings from /usr/lib64/gap/sysinfo.gap
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-gap/cvec-2.8.1-r1/work/cvec-2.8.1 ...
make -O -j4 V=1 
"/usr/bin/gac" -d -p "   -O2 -pipe -march=native -fno-diagnostics-color -O2 -pipe -march=native -fno-diagnostics-color" -P " -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--defsym=__gentoo_check_ldflags__=0 " src/cvec.c -o bin/amd64/cvec.so
x86_64-pc-linux-gnu-gcc -pthread -O2 -pipe -march=native -fno-diagnostics-color -fPIC -O2 -pipe -march=native -fno-diagnostics-color -O2 -pipe -march=native -fno-diagnostics-color -o /var/tmp/portage/dev-gap/cvec-2.8.1-r1/temp/gacVAEpDKm/29_cvec.o -I/usr/include/gap -I/usr/include -DUSE_GASMAN=1 -c src/cvec.c
src/cvec.c:4234:5: error: initialization of struct OpaqueBag * (*)(void) from incompatible pointer type struct OpaqueBag * (*)(struct OpaqueBag *) [-Wincompatible-pointer-types]
 4234 |     TEST_ASSUMPTIONS,
      |     ^~~~~~~~~~~~~~~~

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 23.0-20241110-003003

  UNMASKED:
  <sys-devel/gcc-15.0.9999:15

  The attached etc.portage.tar.xz has all details.
  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-15 *
clang version 19.1.3
llvm-config: 19.1.3
Python 3.12.7
go version go1.23.2 linux/amd64
Available Ruby profiles:
  [1]   ruby32 (with Rubygems)
  [2]   ruby33 (with Rubygems) *
Available Rust versions:
  [1]   rust-bin-1.71.1
  [2]   rust-bin-1.77.1
  [3]   rust-bin-1.81.0
  [4]   rust-bin-1.82.0
  [5]   rust-1.82.0 *
The following VMs are available for generation-2:
1)	Eclipse Temurin JDK 11.0.25_p9 [openjdk-bin-11]
2)	Eclipse Temurin JDK 17.0.13_p11 [openjdk-bin-17]
*)	Eclipse Temurin JDK 21.0.5_p11 [openjdk-bin-21]
4)	Eclipse Temurin JDK 8.432_p06 [openjdk-bin-8]
Available Java Virtual Machines:
  [1]   openjdk-bin-8 
  [2]   openjdk-bin-11 
  [3]   openjdk-bin-17 
  [4]   openjdk-bin-21  system-vm


  HEAD of ::gentoo
commit 8566b21081f24b8ff8c5a8ecadbce83f2bdad484
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Mon Nov 18 17:03:30 2024 +0000

    2024-11-18 17:03:29 UTC

emerge -qpvO =dev-gap/cvec-2.8.1-r1
[ebuild  N    ] dev-gap/cvec-2.8.1-r1  USE="-examples -test"
Comment 1 Toralf Förster gentoo-dev 2024-11-19 08:45:31 UTC
Created attachment 909762 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2024-11-19 08:45:32 UTC
Created attachment 909763 [details]
dev-gap:cvec-2.8.1-r1:20241118-221652.log
Comment 3 Toralf Förster gentoo-dev 2024-11-19 08:45:33 UTC
Created attachment 909764 [details]
emerge-history.txt.xz
Comment 4 Toralf Förster gentoo-dev 2024-11-19 08:45:34 UTC
Created attachment 909765 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2024-11-19 08:45:35 UTC
Created attachment 909766 [details]
etc.clang.tar.xz
Comment 6 Toralf Förster gentoo-dev 2024-11-19 08:45:36 UTC
Created attachment 909767 [details]
etc.portage.tar.xz
Comment 7 Toralf Förster gentoo-dev 2024-11-19 08:45:37 UTC
Created attachment 909768 [details]
logs.tar.xz
Comment 8 Toralf Förster gentoo-dev 2024-11-19 08:45:38 UTC
Created attachment 909769 [details]
qlist-info.txt.xz
Comment 9 Toralf Förster gentoo-dev 2024-11-19 08:45:39 UTC
Created attachment 909770 [details]
temp.tar.xz
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-12-04 20:01:23 UTC
Note that the change to -Werror=incompatible-pointer-types was in GCC 14.

The issue here is that () vs (void) changes meaning in C23, as () now always means "no arguments" (same as (void)). -std=gnu23 becomes the default in GCC 15. Just that it's only an error because of that change we got made in 14 :)
Comment 11 Michael Orlitzky gentoo-dev 2024-12-04 20:19:52 UTC
Thanks, I updated the explanation upstream.
Comment 12 Michael Orlitzky gentoo-dev 2024-12-12 14:04:09 UTC
The root cause of this is some new incompatibility in the GAP function types:

  https://github.com/gap-system/gap/issues/5857

The short version is, GAP has a type called ObjFunc that takes any number of arguments and returns an Obj. (Extensions fill a struct with elements of this type to tell GAP which functions they provide.)

In C17 and earlier, declaring ObjFunc with empty parentheses works fine, even when the actual functions may take arguments. In C23 of course, empty parens mean no arguments, and there's a build failure. OK, so we change it to (...). But both compilers now balk at passing a pointer to a function of e.g. one argument where a pointer to a function of a variable number of arguments is expected.

Shouldn't foo(...) be a drop-in replacement for foo() under C23? It's pretty easy to reproduce this outside of GAP. The following works in C17 and earlier, but not C23. Pinging toolchain@ because I honestly don't know what to tell upstream besides maybe to add a million casts.


#if ( __STDC_VERSION__ < 202300L )
// Works in C17 and earlier
typedef int (* IntFunc)();
#else
// Should work in C23?
typedef int (* IntFunc)(...);
#endif

int run_it(IntFunc f) {
  return f(22);
}

int random_number(int x) {
  return 6;
}

int main(int argc, char** argv) {
  return run_it(random_number);
}
Comment 13 Larry the Git Cow gentoo-dev 2025-01-06 00:10:19 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7652dc46d2b3e835f606dac9e7b7e87a5980175b

commit 7652dc46d2b3e835f606dac9e7b7e87a5980175b
Author:     Michael Orlitzky <mjo@gentoo.org>
AuthorDate: 2025-01-06 00:07:47 +0000
Commit:     Michael Orlitzky <mjo@gentoo.org>
CommitDate: 2025-01-06 00:09:56 +0000

    dev-gap/cvec: add 2.8.3, drop 2.8.2
    
    Closes: https://bugs.gentoo.org/943925
    Signed-off-by: Michael Orlitzky <mjo@gentoo.org>

 dev-gap/cvec/Manifest                                 | 2 +-
 dev-gap/cvec/{cvec-2.8.2.ebuild => cvec-2.8.3.ebuild} | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-06 00:14:50 UTC
(In reply to Michael Orlitzky from comment #12)

I'm sorry for missing your question!

> The short version is, GAP has a type called ObjFunc that takes any number of
> arguments and returns an Obj. (Extensions fill a struct with elements of
> this type to tell GAP which functions they provide.)

Yes, you have to use ... for this now, BUT you have to use va_start/va_end with it (proper variadic args).
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-06 00:19:20 UTC
sudo had a similar problem in https://github.com/sudo-project/sudo/issues/420 which they chose a kind of poor/hacky solution for.
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-06 00:35:43 UTC
BTW, a gotcha I should mention just in general for C23, and I'll mention this on our wiki page now too: if a project has custom definitions of bool, swapping that out for _Bool/bool isn't safe unless that previous bool never appeared on an ABI boundary & wasn't serialised to disk, etc.
Comment 17 Michael Orlitzky gentoo-dev 2025-01-06 02:48:39 UTC
(In reply to Sam James from comment #14)
> 
> Yes, you have to use ... for this now, BUT you have to use va_start/va_end
> with it (proper variadic args).

Any chance you could show me how you would fix the program in comment 12?