Strict aliasing is an assumption, made by the C (or C++) compiler, that dereferencing pointers to objects of different types will never refer to the same memory location (i.e. alias each other.)

In the following example, int * and float * are different pointer types, so the assembly only loads %rdi once, but not for the case where both arguments have the same pointer type.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void f(int *x, int *y)
{
static int z;
z += *x;
*y = *y + 1;
z += *x;
// addl (%rdi), %eax
// incl (%rsi)
// addl (%rdi), %eax
}

void g(int *x, float *y)
{
static int z;
z += *x;
*y = *y + 1;
z += *x;
// movl (%rdi), %eax
// movl g.z(%rip), %ecx
// addl %eax, %ecx
// addl %eax, %ecx
}

http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html