[Bug c/12362] Compiler generates incorrect code at -O2
sean at mcneil dot com
gcc-bugzilla@gcc.gnu.org
Mon Sep 22 15:09:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12362
sean at mcneil dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
------- Additional Comments From sean at mcneil dot com 2003-09-22 14:47 -------
The code is not invalid. To illustrate my point, I have removed all type
casting and I still get the erroneous code produced. There is no illegal code here.
#define EARLY 4
typedef int (*FUNCPTR) ();
typedef struct
{
FUNCPTR removeRtn;
FUNCPTR calibrateRtn;
FUNCPTR putRtn;
} Q_CLASS;
typedef struct
{
Q_CLASS *pQClass;
} Q_HEAD;
typedef int Q_NODE;
typedef struct
{
int status;
Q_NODE node;
} ID;
extern int ticks;
extern ID *id;
extern Q_HEAD queue;
extern Q_HEAD t_queue;
#define Q_REMOVE(pQHead,pQNode) \
(*(((pQHead))->pQClass->removeRtn)) \
(((pQHead)), ((pQNode)))
#define Q_CALIBRATE(pQHead,keyDelta) \
(*(((pQHead))->pQClass->calibrateRtn)) \
(((pQHead)), ((keyDelta)))
#define Q_PUT(pQHead,pQNode,key) \
(*(((pQHead))->pQClass->putRtn)) \
(((pQHead)), ((pQNode)), (key))
int early (register int timeout)
{
Q_REMOVE (&queue, &id->node);
if ((unsigned)(ticks + timeout) < ticks)
{
Q_CALIBRATE (&t_queue, ~ticks + 1);
ticks = 0;
}
Q_PUT (&queue, &id->node, timeout + ticks);
id->status |= EARLY;
return 0;
}
More information about the Gcc-bugs
mailing list