> The compiler version is 4.01 (on Fedora 4). If I compile with -O0 then the > creation of buf results in a loop being generated which calls the Z() > constructor 100 times. > > But then if I compile with -O the constructor will be inlined. The generated > machine code contains a loop which does nothing 100 times: > movl $100, %eax > .L11: > decl %eax > jne .L11 > > I think that the optimiser should get rid of the loop once it has got rid of > the body! > > Should I submit this as a bug?
This has been fixed in 4.1.0 already. This is the normal not removing empty loops problem which was fixed in 4.1.0. -- Pinski