John Fine wrote: > David Livshin wrote: >> >> double a[DIM][DIM]; >> >> >> movl $a, %eax >> >> The register 'eax' ( 'rax' actualy ) is used later in the code as the >> base for an address. >> Questions: >> >> 1. Why 'movl' and not 'movq' is used? ( It seems that compilers >> assumes that the size of the address of the symbol 'a' is 32 bits >> only ) > In other words, the compiler has assumed that the global data object "a" > will be linked in the first 4GB of the address space. > > If it turns out not to be, then you will get an error at link time. > > I have read (but not really understood) various things about "memory > model" restrictions in x86_64 that imply rules. I expect (but I'm not > sure) one such rule is that certain globals in the main image are > restricted to the first 4GB. Yes. http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options See -mcmodel= Andrew.