Really funny... What would you expect the following program to output?

#include <stdio.h>
#include <string.h>

int main (void)
{
  int i = 1 , j = -1;
  char c = 1, d = 1;

  memset(&c, 2, i + j);
  memset(&d, 2, i + j);

  printf("%d %d\n", c, d);

  return 0;
}

On the T2 with gcc (tried a few different versions) it outputs "1 2".
Dunno how to run the sun compiler.

The asm looks reasonable; excerpt:

        mov     1, %g1
        st      %g1, [%fp-8]
        mov     -1, %g1
        st      %g1, [%fp-4]
        mov     1, %g1
        stb     %g1, [%fp-9]
        mov     1, %g1
        stb     %g1, [%fp-10]

        ld      [%fp-8], %g2
        ld      [%fp-4], %g1
        add     %g2, %g1, %g1
        add     %fp, -9, %g2
        mov     %g2, %o0
        mov     2, %o1
        mov     %g1, %o2
        call    memset, 0
         nop

        ld      [%fp-8], %g2
        ld      [%fp-4], %g1
        add     %g2, %g1, %g1
        add     %fp, -10, %g2
        mov     %g2, %o0
        mov     2, %o1
        mov     %g1, %o2
        call    memset, 0
         nop

Notation:

i -> [%fp-8]
j -> [%fp-4]
c -> [%fp-9]
d -> [%fp-10]


Maybe you can try compiling to assembler on the T2 and compiling this
assembler on your blade to see if it gives some clue?

Gonzalo

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to