bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/24536] New: ld/ldbuildid.c: Incompatible pointer types in an ass


From: pexu at sourceware dot mail.kapsi.fi
Subject: [Bug ld/24536] New: ld/ldbuildid.c: Incompatible pointer types in an assignment, -Werror/-Wcast-function-type
Date: Wed, 08 May 2019 08:05:06 +0000

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

            Bug ID: 24536
           Summary: ld/ldbuildid.c: Incompatible pointer types in an
                    assignment, -Werror/-Wcast-function-type
           Product: binutils
           Version: 2.33 (HEAD)
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: pexu at sourceware dot mail.kapsi.fi
  Target Milestone: ---

Created attachment 11765
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11765&action=edit
Suppress the warning by doing a `VOID (WINAPI *)(VOID)' cast.

Hello.

`ld/ldbuildid.c' hasn't changed for a while, but as of GCC8 it will not compile
as there's an assignment using incompatible pointer types on line 139:

uuid_create = (UuidCreateFn) GetProcAddress (rpc_library, "UuidCreate");

There's nothing wrong with the statement except that GCC8 has a new warning
-Wcast-function-type that is (correctly) hit.  By default -Werror is used if
using GCC and not doing a release.

Attached a proposed patch.  It basically does an extra (stylized) `void
(*)(void)' cast, as suggested by GCC documentation.  `*((FARPROC *)
&uuid_create) = ...', a style used by some Windows APIs, will break
strict-aliasing rules, so it causes more problems that what it solves.

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