Article View: alt.msdos.programmer
Article #1267new MSC 5.1 bug?
From: Dan Lanciani
Date: Fri, 09 Feb 1990 00:25
Date: Fri, 09 Feb 1990 00:25
32 lines
1274 bytes
1274 bytes
The following useless program illustrates what I think is
a bug in the loop optimization code. It appears that the compiler
becomes confused and believes that p1 and p2 are equal even when
the code within the if statement is not executed. Compiling with
-Od produces correct results. In case it isn't obvious, this
loop abstracts a search (with intent to delete) from a linked list.
If this example is perhaps too far reduced in content, the original
bug tripper can be found in the Sun rpc portmapper daemon's
deregistration function.
Dan Lanciani
ddl@harvard.*
struct foo {
int a, b;
struct foo *next;
} protofoo = { 1, 2 }, *foo = &protofoo;
main()
{
struct foo *p1, *p2;
for (p1 = 0, p2 = foo;;) {
if (p2->a != protofoo.a || p2->b != protofoo.b) {
p1 = p2;
p2 = p2->next;
continue;
}
printf("p1 = %x, p2 = %x\n", p1, p2);
}
}
Technical Details
Message-ID:
<1537@husc6.harvard.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!lll-winken!bu.edu!bu-cs!husc6!ddlShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!lll-winken!bu.edu!bu-cs!husc6!ddl From: ddl@husc6.harvard.edu (Dan Lanciani) Newsgroups: alt.msdos.programmer,comp.sys.ibm.pc Subject: new MSC 5.1 bug? Keywords: bug MSC 5.1 loops Message-ID: <1537@husc6.harvard.edu> Date: 9 Feb 90 00:25:57 GMT Organization: Harvard University, Cambridge MA Lines: 32