public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12846] New: No warning when function pointer cast drops __attribute__ ((regparm))
@ 2003-10-30 20:19 anders at kaseorg dot com
  2003-11-05  8:07 ` [Bug c/12846] " pinskia at gcc dot gnu dot org
  2004-02-27  4:31 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: anders at kaseorg dot com @ 2003-10-30 20:19 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: No warning when function pointer cast drops
                    __attribute__ ((regparm))
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anders at kaseorg dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux

The following code is invalid and won't work correctly (because the cast drops
the __attribute__ and changes the calling convention):

void test (int a) __attribute__ ((regparm (3)));
...
void (*ptest) (int) = test;  /* wrong */
ptest (a);

However, GCC miscompiles it without a warning. If the same thing is done with
__attribute__ ((stdcall)) instead (which also changes the calling convention),
GCC gives "warning: initialization from incompatible pointer type". Shouldn't it
give this warning for __attribute__ ((regparm (3))) as well?


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

* [Bug c/12846] No warning when function pointer cast drops __attribute__ ((regparm))
  2003-10-30 20:19 [Bug c/12846] New: No warning when function pointer cast drops __attribute__ ((regparm)) anders at kaseorg dot com
@ 2003-11-05  8:07 ` pinskia at gcc dot gnu dot org
  2004-02-27  4:31 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-05  8:07 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-05 08:07:10
               date|                            |


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-05 08:07 -------
I can confirm this on the mainline (20031105).


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

* [Bug c/12846] No warning when function pointer cast drops __attribute__ ((regparm))
  2003-10-30 20:19 [Bug c/12846] New: No warning when function pointer cast drops __attribute__ ((regparm)) anders at kaseorg dot com
  2003-11-05  8:07 ` [Bug c/12846] " pinskia at gcc dot gnu dot org
@ 2004-02-27  4:31 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-27  4:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-27 04:31 -------
Fixed for 3.4.0 by:

        * i386/i386.c (ix86_comp_type_attributes): Check for
        regparm attributes.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


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


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

end of thread, other threads:[~2004-02-27  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-30 20:19 [Bug c/12846] New: No warning when function pointer cast drops __attribute__ ((regparm)) anders at kaseorg dot com
2003-11-05  8:07 ` [Bug c/12846] " pinskia at gcc dot gnu dot org
2004-02-27  4:31 ` pinskia at gcc dot gnu dot 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).