Bug 2335997

Summary: BibTool fails to build with GCC 15 (error: assignment to ‘int (*)(void)’ from incompatible pointer type ‘int (*)(struct rECORD *, struct rECORD *)’ [-Wincompatible-pointer-types])
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: BibToolAssignee: Michael J Gruber <mjg>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: mjg, orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-01-14 19:25:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2333037    

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.