bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/28630] [mingw] bfd/coffgen.c triggers "cast to pointer fro


From: clement.chigot at atos dot net
Subject: [Bug binutils/28630] [mingw] bfd/coffgen.c triggers "cast to pointer from integer of different size" [-Werror=int-to-pointer-cast]
Date: Mon, 29 Nov 2021 10:24:16 +0000

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

Clément Chigot <clement.chigot at atos dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clement.chigot at atos dot net

--- Comment #1 from Clément Chigot <clement.chigot at atos dot net> ---
Hi, 

> 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.

I'm not sure I correctly understand the last part. 
If I'm not mistaking, x_offset is already a pointer (but stored as a long)
according to
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/coffgen.c;h=5474f6c24d8d35d513ebb0fe36912aae236d649a;hb=HEAD#l865,
even natively on mingw32. 
Thus casting it to (bfd_hostptr_t) looks good to me.

And if it's casting a pointer to a (char *) which is problematic when how are
you retrieving a string from a pointer in this case ?

-- 
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]