bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/28630] New: [mingw] bfd/coffgen.c triggers "cast to pointe


From: pexu at sourceware dot mail.kapsi.fi
Subject: [Bug binutils/28630] New: [mingw] bfd/coffgen.c triggers "cast to pointer from integer of different size" [-Werror=int-to-pointer-cast]
Date: Fri, 26 Nov 2021 16:00:50 +0000

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

            Bug ID: 28630
           Summary: [mingw] bfd/coffgen.c triggers "cast to pointer from
                    integer of different size"
                    [-Werror=int-to-pointer-cast]
           Product: binutils
           Version: 2.38 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: pexu at sourceware dot mail.kapsi.fi
  Target Milestone: ---

Hi.

The following compile error happens when __INTPTR_TYPE__ is not long int (e.g.
x86_64-linux-gnu and x86_64-w64-mingw32-gcc).

/usr/local/gcc-aarch64-build/src/binutils/bfd/coffgen.c: In function
'coff_print_symbol':
/usr/local/gcc-aarch64-build/src/binutils/bfd/coffgen.c:2221:9: error: cast to
pointer from integer of different size [-Werror=int-to-pointer-cast]
 2221 |         (char *) auxp->u.auxent.x_file.x_n.x_n.x_offset);
      |         ^

binutils/bfd/coffgen.c:
2218                   if (auxp->u.auxent.x_file.x_ftype)
2219                     fprintf (file, "ftype %d fname \"%s\"",
2220                              auxp->u.auxent.x_file.x_ftype,
2221                              (char *)
auxp->u.auxent.x_file.x_n.x_n.x_offset);

A crude fix would be to do `(char *) (bfd_hostptr_t)' and it solves this issue.
 However I wonder if that simply causes more troubles down the road since in
this particual example (mingw32) that involves narrowing and thus the stored
pointer might become invalid if it any of the MSBs are (silently) discarded.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]