public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/17719] New: regparm __attribute__ not set in function casts
@ 2004-09-28 23:18 jfran at clip dot dia dot fi dot upm dot es
2004-09-28 23:34 ` [Bug c/17719] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: jfran at clip dot dia dot fi dot upm dot es @ 2004-09-28 23:18 UTC (permalink / raw)
To: gcc-bugs
Direct cast from void pointer to function pointer forgets about regparm
attributes (resulting a segfault). The bug does not appear if a temporal union
is used to do the cast (like in FUNCCAST0).
--
#include <stdio.h>
#define ATTR __attribute__((regparm(1)))
//#define ATTR
ATTR void f(char *s);
typedef ATTR void (*f_t)(char *s);
#define FUNCCAST0(T, X) ((union { T t; } *)&(X))->t
#define FUNCCAST1(T, X) ((T)(X))
int main() {
void *fp;
fp = f;
FUNCCAST0(f_t, fp)("ok0");
FUNCCAST1(f_t, fp)("ok1");
return 0;
}
ATTR void f(char *s) {
printf("%s\n", s);
}
--
Summary: regparm __attribute__ not set in function casts
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jfran at clip dot dia dot fi dot upm dot es
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17719
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/17719] regparm __attribute__ not set in function casts
2004-09-28 23:18 [Bug c/17719] New: regparm __attribute__ not set in function casts jfran at clip dot dia dot fi dot upm dot es
@ 2004-09-28 23:34 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-28 23:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-09-28 23:34 -------
Fixed in 3.4.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |RESOLVED
Keywords| |wrong-code
Resolution| |FIXED
Target Milestone|--- |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17719
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-09-28 23:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-28 23:18 [Bug c/17719] New: regparm __attribute__ not set in function casts jfran at clip dot dia dot fi dot upm dot es
2004-09-28 23:34 ` [Bug c/17719] " 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).