Xref: utzoo comp.lang.c:30078 comp.unix.ultrix:3853 Newsgroups: comp.lang.c,comp.unix.ultrix Path: utzoo!utgpu!watserv1!maytag!watdragon!watsol.waterloo.edu!tbray From: tbray@watsol.waterloo.edu (Tim Bray) Subject: bug in ultrix cc (possibly fixed now) Message-ID: <1990Jul3.214603.2704@watdragon.waterloo.edu> Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes) Organization: University of Waterloo Date: Tue, 3 Jul 90 21:46:03 GMT Lines: 25 The following little fragment illustrates (I think) a horrible bug in ultrix v2 cc. OK, OK, I'm upgrading to ultrix v3 tomorrow, but for those still at v2, and in the horrible eventuality that v3 doesn't fix this, her it is: typedef struct { int garbage; int parameter; } t; main() { t *pt; pt = (t*) malloc(sizeof(t)); pt->parameter = -2; printf("%d\n", -6 * pt->parameter); } The bug is that the code prints -12, not 12. It seems to have to do with dereferencing structure members & multiplying by negative literals in an arg list. I dumped the .s code but don't know mips assembler well enough to figure out what's up (it looks like jal (which is a macro?) is doing something wrong).