Does your compiler get this program right?
David Goodenough
dg at lakart.UUCP
Fri Nov 25 08:28:00 AEST 1988
>From article <2298 at cbnews.ATT.COM>, by lvc at cbnews.ATT.COM (Lawrence V. Cipriani):
] A friend of mine found a bug in his C compiler. He found
] the bug on a VAX; it also exists in some 3B compilers. The
] compiler on this SVR3 3b2 does it right and is shown at the
] end. The bug was that the increment to the float pointer
] was happening twice; see the /* miscompiled line */ below.
] I suspect other pcc derived compilers get it wrong too.
]
Relevant parts of program:
] float list1[30], list2[10];
]
] float *f, *g;
]
] f = list1;
] g = list2;
] for (i = 0; i < 10; ++i) {
] *f++ += *g++; /* miscompiled line */
] }
We're using BSD4.3, w/ Greenhills C compiler. Output is as it should be,
so I would say that Greenhills doesn't have the bug. It has others .....
(I won't mention 4["Hello"] - we've hashed that out enough :-) :-) :-) )
Anyone else?
--
dg at lakart.UUCP - David Goodenough +---+
| +-+-+
....... !harvard!xait!lakart!dg +-+-+ |
AKA: dg%lakart.uucp at harvard.harvard.edu +---+
More information about the Comp.lang.c
mailing list