Bug 2335997 - BibTool fails to build with GCC 15 (error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(struct rECORD *, struct rECORD *)’ [-Wincompatible-pointer-types])
Summary: BibTool fails to build with GCC 15 (error: assignment to ‘int (*)(void)’ ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: BibTool
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Michael J Gruber
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: gcc-15-mass-prebuild
TreeView+ depends on / blocked
 
Reported: 2025-01-06 21:52 UTC by Dave Malcolm
Modified: 2025-01-14 19:25 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-01-14 19:25:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dave Malcolm 2025-01-06 21:52:29 UTC
I'm experimentally rebuilding rawhide with the not-yet-released GCC 15 to see if anything breaks, and to help write the porting guide.  See https://fedoraproject.org/wiki/User:Dmalcolm/gcc-15

My test build with GCC 15 failed:
  https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed/build/8476031/

whereas my test build with GCC 14 succeeded:
  https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed.checker/build/8476693/

In the logs for the failed build I see:

main.c:564:33: error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(struct rECORD *, struct rECORD *)’ [-Wincompatible-pointer-types]
  564 |     { if (rsc_sort_reverse) fct = rec_lt_cased;    /*                        */
      |                                 ^
main.c:565:33: error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(struct rECORD *, struct rECORD *)’ [-Wincompatible-pointer-types]
  565 |       else                  fct = rec_gt_cased;    /*                        */
      |                                 ^
main.c:568:33: error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(struct rECORD *, struct rECORD *)’ [-Wincompatible-pointer-types]
  568 |     { if (rsc_sort_reverse) fct = rec_lt;          /*                        */
      |                                 ^
main.c:569:33: error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(struct rECORD *, struct rECORD *)’ [-Wincompatible-pointer-types]
  569 |       else                  fct = rec_gt;          /*                        */
      |                                 ^
main.c:571:21: error: passing argument 2 of ‘db_sort’ from incompatible pointer type [-Wincompatible-pointer-types]
  571 |     db_sort(the_db, fct);                          /*                        */
      |                     ^~~
      |                     |
      |                     int (*)(void)
In file included from include/bibtool/expand.h:32,
                 from include/bibtool/bibtool.h:46,
                 from main.c:64:
include/bibtool/database.h:173:33: note: expected ‘int (*)(struct rECORD *, struct rECORD *)’ but argument is of type ‘int (*)(void)’
  173 |  void db_sort _ARG((DB db,int (*less)_ARG((Record, Record))));/*             */
      |                                 ^
include/bibtool/database.h:158:17: note: in definition of macro ‘_ARG’
  158 | #define _ARG(A) A
      |                 ^


This may be due to GCC 15 now defaulting to -std=gnu23, whereas GCC 14 defaulted to -std=gnu17, and C23 is stricter about function prototypes than C17.  It might be fixable by fixing the function prototypes (or by manually adding -std=gnu17 to the C build flags), but it looks like the function prototypes need fixing.


Reproducible: Always

Comment 1 Michael J Gruber 2025-01-07 16:53:48 UTC
I pushed a fix to rawhide, confirmed locally with:

```
copr mock-config dmalcolm/gcc-15-smoketest-3 fedora-rawhide-x86_64 > ~/.config/mock/fedora-rawhide-gcc15-x86_64.cfg
fedpkg mockbuild --root fedora-rawhide-gcc15-x86_64
```

(Might help some folks to add this to the change page.)

Do you want me to build this into rawhide, or should it just get picked up with the next rebuild?

Comment 2 Dave Malcolm 2025-01-07 18:31:46 UTC
(In reply to Michael J Gruber from comment #1)
> I pushed a fix to rawhide, confirmed locally with:
> 
> ```
> copr mock-config dmalcolm/gcc-15-smoketest-3 fedora-rawhide-x86_64 >
> ~/.config/mock/fedora-rawhide-gcc15-x86_64.cfg
> fedpkg mockbuild --root fedora-rawhide-gcc15-x86_64
> ```
> 
> (Might help some folks to add this to the change page.)

Thanks!  I've added it to the wiki page.


> Do you want me to build this into rawhide, or should it just get picked up
> with the next rebuild?

I believe it will get picked up in the next rebuild.


Note You need to log in before you can comment on or make changes to this bug.