------- Comment #13 from david dot kirkby at onetel dot net 2009-07-16 21:29 ------- (In reply to comment #11) > You haven't mentioned what options you compiled this file with. So, assuming > -O2, I see: > add %i4, -1, %l5 ! n,, tmp186 > sethi %hi(1073740800), %o2 !, tmp189 > sll %l5, 2, %l5 ! tmp186,, D.4491 > or %o2, 1023, %o2 ! tmp189,, tmp188 > st %g1, [%i0+%l5] !,* D.4491 > add %i4, %o2, %o2 ! n, tmp188, tmp187 > mov %i0, %o0 ! a, > sll %o2, 2, %o2 ! tmp187,, > call memset, 0 !, > mov 0, %o1 !, > for this memset call, which looks correct to me. The st %g1, [%i0+%l5] line > stores to %i0 a[n-1] and memset is called with memset (a, 0, (n + 0x3fffffffU) > << 2); So, if this doesn't work (and you see the same), you hit a bug in > Solaris memset implementation, which doesn't handle properly length with > garbage in upper 32-bits, guess it could use brz,pn %o2, do_nothing or > something similar, which is fine for 64-bit code, but certainly not for 32-bit > code. >
I should add we are using the Sun assembler and linker, not the GNU ones. I don't know whether that would effect the output. If so, can you tell me how to generate the assembler code? Or as I say, you can have an account. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40757