[llvm-bugs] [Bug 31558] New: Incorrect -Wcast-align warning about function pointers after r288267

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 6 01:04:46 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31558

            Bug ID: 31558
           Summary: Incorrect -Wcast-align warning about function pointers
                    after r288267
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

After r288267, -Wcast-align can now incorrectly warn about function pointers
that are about functions with different arguments.

Test case:

struct s;
void f(struct s *);
typedef void (*p)(void *);
p x = (p)&f; // warning: cast from 'void (*)(struct s *)' to 'p' (aka 'void
(*)(void *)') increases required alignment from 1 to 4 [-Wcast-align]
p y = (p)f;  // no warning

So for some reason, using the address-of operator on a function name now makes
it incompatible.  This used to give no warning before r288267.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170106/e47af342/attachment.html>


More information about the llvm-bugs mailing list