Bug 32466 - nrun build error
Summary: nrun build error
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: sim (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 16.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-16 14:39 UTC by cqwrteur
Modified: 2024-12-16 20:18 UTC (History)
4 users (show)

See Also:
Host: x86_64-linux-gnu
Target: aarch64-linux-gnu
Build: x86_64-linux-gnu
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cqwrteur 2024-12-16 14:39:23 UTC
/home/cqwrteur/toolchains_build/binutils-gdb/sim/common/nrun.c:150:23: error: assignment to 'void (*)(void)' from incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
  150 |           prev_sigint = signal (SIGINT, cntrl_c);
      |                       ^
/home/cqwrteur/toolchains_build/binutils-gdb/sim/common/nrun.c:152:27: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
  152 |           signal (SIGINT, prev_sigint);
      |                           ^~~~~~~~~~~
      |                           |
      |                           void (*)(void)
In file included from ../gnulib/import/signal.h:52,
                 from /home/cqwrteur/toolchains_build/binutils-gdb/sim/common/nrun.c:20:
/home/cqwrteur/toolchains/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
/home/cqwrteur/toolchains_build/binutils-gdb/sim/common/nrun.c:175:23: error: assignment to 'void (*)(void)' from incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'} [-Wincompatible-pointer-types]
  175 |           prev_sigint = osa.sa_handler;
      |                       ^
/home/cqwrteur/toolchains_build/binutils-gdb/sim/common/nrun.c:180:27: error: passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
  180 |           signal (SIGINT, prev_sigint);
      |                           ^~~~~~~~~~~
      |                           |
      |                           void (*)(void)
/home/cqwrteur/toolchains/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/usr/include/signal.h:88:57: note: expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
yes
checking for execinfo.h... yes
make[3]: *** [Makefile:5167: aarch64/nrun.o] Error 1
make[3]: *** Waiting for unfinished jobs....
Comment 1 Nick Clifton 2024-12-16 14:47:13 UTC
The sim code is part of GDB not the binutils, so I have changed the Product field
Comment 2 Tom Tromey 2024-12-16 15:40:32 UTC
What compiler are you using?

prev_sigint is:

  RETSIGTYPE (*prev_sigint) ();

Which isn't the same as (void).

Maybe this is a C23 thing though.
Comment 4 cqwrteur 2024-12-16 16:16:11 UTC
   gcc 15
   On Dec 16, 2024 10:40, tromey at sourceware dot org
   <sourceware-bugzilla@sourceware.org> wrote:

     https://sourceware.org/bugzilla/show_bug.cgi?id=32466

     Tom Tromey <tromey at sourceware dot org> changed:

     What |Removed |Added
     ----------------------------------------------------------------------------
     CC| |tromey at sourceware dot org

     --- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
     What compiler are you using?

     prev_sigint is:

     RETSIGTYPE (*prev_sigint) ();

     Which isn't the same as (void).

     Maybe this is a C23 thing though.

     --
     You are receiving this mail because:
     You reported the bug.
     You are on the CC list for the bug.
Comment 5 Sourceware Commits 2024-12-16 20:17:34 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7a8cc0983ae3b954cba68dc874b0b0e738347e79

commit 7a8cc0983ae3b954cba68dc874b0b0e738347e79
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Dec 16 09:12:48 2024 -0700

    Use correct type for saved signal handler
    
    A user noticed that the sim assigns the result of a call to 'signal'
    to a variable like:
    
      RETSIGTYPE (*prev_sigint) ();
    
    However, it's more correct to use (int) here.
    
    This patch fixes the error.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32466
    Approved-By: Andrew Burgess <aburgess@redhat.com>
Comment 6 Tom Tromey 2024-12-16 20:18:07 UTC
Fixed.