-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build failure with GCC 15 (incompatible pointer types) #5857
Comments
Great. This will break basically all packages with kernel extensions. Gotta love how C committee replace the C language by a new language but retains the old name and shoves it down everyone's throat. |
I have access to neither GCC 14 and 15 and won't go out of my way to obtain it and work on this. But if anyone would like to submit reasonable patches to address this (likely by adding a gazillion type casts), I'll happily review and merge it. Perhaps it would also work to change the first argument of But there are a bunch of other functions taking an |
Isn't one potential fix to just explicitly state the C standard that GAP is using? I.e. instead of using the default |
Not all compiler support that. One thing C and C++ standardization efforts completely dropped the ball is build systems. Which to me is the number 1 issue in terms of portability these days. Of course we can try to handle it in configure... or just pretend only gcc and clang exist... It is also a transitive issue, as we also need to specify this in GAP packages with a kernel extension. We could just try to pass the required -std option on, but a kext might be built using a different compiler than GAP... urgh |
I should mention that |
Thanks for the pointers @orlitzky . Of course it shouldn't fall on you to deal with this, I understand you have other things on your plate. I am mostly grateful that we got a report, I much prefer this over applying patches without telling us! |
https://formulae.brew.sh/formula/gcc#default gives you gcc 14. |
While it's solving the problem by just turning off all checking, I installed gcc-14, observed the failuers, then changed common.h:168 (definition of ObjFunc) to just Note some packages still fail, as they define variables called |
Using I also did a few more experiments with GCC on the other hand is not so lucky. Building (say) cvec against the installed GAP (where ObjFunc is declared with a variable number of args) with gcc-15 still produces a bunch of
But what's strange to me is the type in the error message. There are no ellipses in the first type, which makes me wonder if GCC is still thinking that |
Here is a minimal example that fails with both clang and gcc in c23 mode: #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);
} |
The syntax of ISO C requires at least one fixed argument before the ‘…’. To make the example above work with clang 18, one needs to change two declarations/definitions:
|
That should have changed with C23 though. Here is the old text:
And the new:
The paragraphs about compatible parameter lists have changed, too, though. In C17:
And C23:
So maybe it comes down to the precise meaning of that word salad, or the interpretation of "agree." |
Original report: https://bugs.gentoo.org/944036
GCC 15 has
-Werror=incompatible-pointer-types
andstd=gnu23
by default, and this is causing some issues with the function pointers that GAP passes around. For example,(and many others like it).
After investigating the same issue in cvec, it looks like the issue can be traced back to the
ObjFunc
typedef. In C23,foo()
means that foo takes zero arguments, so a cast is needed if you want to pass in a function that takes arguments in place of such afoo()
.The text was updated successfully, but these errors were encountered: