public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/58217] New: warning when assigning a function pointer field in a structure having the may_alias attribute
@ 2013-08-22 10:06 zer0@droids-corp.org
  2013-08-22 10:07 ` [Bug c/58217] " zer0@droids-corp.org
  2013-08-22 10:08 ` zer0@droids-corp.org
  0 siblings, 2 replies; 3+ messages in thread
From: zer0@droids-corp.org @ 2013-08-22 10:06 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3542 bytes --]

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58217

            Bug ID: 58217
           Summary: warning when assigning a function pointer field in a
                    structure having the may_alias attribute
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zer0@droids-corp.org
              Host: x86_64
            Target: x86_64

Hello,

When compiling the attached code, I get the following error:

$ gcc -Wall -Wextra foo.c
foo.c: In function ‘main’:
foo.c:16:16: warning: assignment from incompatible pointer type [enabled by
default]

If I remove the "__attribute__((may_alias))", it compiles. A workaround it
to cast the cb function pointer in (void *) before doing the affectation. In my
opinion, this warning is not expected here. Sorry if I missed something.

I also tried:

$ gcc -Wall -Wextra -fno-strict-aliasing -fwrapv foo.c
foo.c: In function ‘main’:
foo.c:16:16: warning: assignment from incompatible pointer type [enabled by
default]


$ gcc --version
gcc (Debian 4.7.3-4) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I can reproduce the problem on several gcc versions 4.4, 4.5, 4.6 at least.
>From gcc-bugs-return-428226-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Aug 22 10:07:44 2013
Return-Path: <gcc-bugs-return-428226-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12039 invoked by alias); 22 Aug 2013 10:07:44 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 11948 invoked by uid 48); 22 Aug 2013 10:07:43 -0000
From: "zer0@droids-corp.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/58217] warning when assigning a function pointer field in a structure having the may_alias attribute
Date: Thu, 22 Aug 2013 10:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.7.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zer0@droids-corp.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-58217-4-Og36YYd8Vp@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58217-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58217-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-08/txt/msg01150.txt.bz2
Content-length: 222

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX217

--- Comment #2 from Olivier MATZ <zer0@droids-corp.org> ---
Created attachment 30686
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id0686&actioníit
gcc -dumpspecs


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/58217] warning when assigning a function pointer field in a structure having the may_alias attribute
  2013-08-22 10:06 [Bug c/58217] New: warning when assigning a function pointer field in a structure having the may_alias attribute zer0@droids-corp.org
@ 2013-08-22 10:07 ` zer0@droids-corp.org
  2013-08-22 10:08 ` zer0@droids-corp.org
  1 sibling, 0 replies; 3+ messages in thread
From: zer0@droids-corp.org @ 2013-08-22 10:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58217

--- Comment #1 from Olivier MATZ <zer0@droids-corp.org> ---
Created attachment 30685
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30685&action=edit
code that triggers the issue


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/58217] warning when assigning a function pointer field in a structure having the may_alias attribute
  2013-08-22 10:06 [Bug c/58217] New: warning when assigning a function pointer field in a structure having the may_alias attribute zer0@droids-corp.org
  2013-08-22 10:07 ` [Bug c/58217] " zer0@droids-corp.org
@ 2013-08-22 10:08 ` zer0@droids-corp.org
  1 sibling, 0 replies; 3+ messages in thread
From: zer0@droids-corp.org @ 2013-08-22 10:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58217

--- Comment #3 from Olivier MATZ <zer0@droids-corp.org> ---
Created attachment 30687
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30687&action=edit
intermediate file foo.i


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-22 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-22 10:06 [Bug c/58217] New: warning when assigning a function pointer field in a structure having the may_alias attribute zer0@droids-corp.org
2013-08-22 10:07 ` [Bug c/58217] " zer0@droids-corp.org
2013-08-22 10:08 ` zer0@droids-corp.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).