[ns] [bug] rtable problem
Frank Duerr
frank.duerr at informatik.uni-stuttgart.de
Fri Feb 13 04:55:16 PST 2004
[Bug Report]
-----------------------------
Category: Other
Package: ns 2..27
OS: Linux
Environment Variables:
LD_LIBRARY_PATH=
TCL_LIBRARY=
TK_LIBRARY=
-----------------------------
Description:
Description of Problem:
In the method AddEntry in file ns-2.27/dsdv/rtable.cc the following code (line 102) is error-prone:
while (i >= max)
rtab[i+1] = rtab[i--];
Depending on the compiler used and its optimizations, the second line is equivalent to
foo = rtab[i--];
rtab[i+1] = foo; // That means, e.g. rtab[42] = rtab[42]
which is clearly not intended. gcc compiles this code "correctly", but for instance the Intel Compiler icc8 for Linux compiles the "wrong" code.
Solution: Use this code instead
while (i >= max) {
rtab[i+1] = rtab[i];
i--;
}
How Easily Reproducible:
(e.g. every time, intermittent, once only, etc.)
Every time using the Intel compiler icc8 for Linux.
More information about the Ns-users
mailing list