Aallegra.325
net.bugs.4bsd
utcsrgv!utzoo!decvax!ucbvax!mhtsa!allegra!honey
Fri Mar 19 22:49:46 1982
one or two bugs in /lib/c2
the following routine breaks c2:
main()
{
short s[10];
register short *ptr = s;
long l;
printf("in: %x\n", ptr);
l = *ptr++ & 0xFFFF; /* auto-increment ptr's register */
printf("out: %x\n", ptr);
}
the dereference + mask gets compiled into cvtwl + bicl2, which c2 turns
into extvz. when ptr is dereferenced it is incremented by 2 in cvtwl
(word operand), by 1 in extvz (byte operand). another application of c2
replaces extvz by movzwl (word operand). here two wrongs do make a right.
a tip of the honey hat to jfr.
-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <
[email protected]>
of
http://communication.ucsd.edu/A-News/
This Usenet Oldnews Archive
article may be copied and distributed freely, provided:
1. There is no money collected for the text(s) of the articles.
2. The following notice remains appended to each copy:
The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.