This is a memory aliasing bug that causes the instruction scheduler to perform invalid code movement. It only occurs when both const and volatile are present on a function argument. When you use volatile, the compiler forces the argument to the stack. When you use const, the compiler marks the stack read as a const read, but does not also similarly mark the stack write. Thus the scheduler thinks the write and read do not alias and can be re-ordered. If I use -O2 -fno-schedule-insns I get correct code. For a more complicated example, you might also need to use -fno-schedule-insns2. Or you can just use -O to avoid the problem. The new toolchain does not have this bug. JimReceived on Mon Oct 02 18:00:29 2000
This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:00 EST