wrong unprototyped calls with optimization in amd64 linux suncc 12

In C modus it doesn't seem to handle an unprototyped function call

like a varargs (...) call, but like (void). The code doesn't initialize eax to zero which is required for varargs calls in the amd64 ABI. icc and gcc

both get this correct.

This could be potentially deadly when calling a gcc generated

varargs function this way. gcc uses the eax input for an computed

jump to save the right number of SSE registers. If there is random

junk in eax it will jump to a random place which is hard to debug.

This seems to only happen when optimization is enabled, without

optimization the code is correct.

Test case:

f()

{

f2();

f2();

return 1; // prevent tail call

}

generates with -O2

callf2;/ line : 4

callf2;/ line : 5

(no eax initialization)

without -O it gives correctly:

movl$0, %eax

callf2

/ Line 5

movl$0, %eax

callf2

[979 byte] By [yetanotheranonymousa] at [2007-11-27 7:27:37]
# 1
Thanks for reporting the problem.Filed the bug 6569055 on that.regards,__Fedor.
SFVa at 2007-7-12 19:07:53 > top of Java-index,Development Tools,Solaris and Linux Development Tools...