x86_64: Fix segfault for global data
commit1d0a5c251553d8d9199ad18d4780bf356f456298
authorMichael Matz <matz@suse.de>
Sun, 15 Apr 2012 17:29:45 +0000 (15 19:29 +0200)
committerMichael Matz <matz@suse.de>
Wed, 18 Apr 2012 18:57:13 +0000 (18 20:57 +0200)
tree1b15ed00535f7cbbff15a9e2ec5f3acbfa08654b
parent86ac6b9beec1c142867b53350006c02e20e4a7ef
x86_64: Fix segfault for global data

When offsetted addresses of global non-static data are computed
multiple times in the same statement the x86_64 backend uses
gen_gotpcrel with offset, which implements an add insn on the
register given.  load() uses the R member of the to-be-loaded
value, which doesn't yet have a reg assigned in all cases.

So use the register we're supposed to load the value into as
that register.
tests/tcctest.c
x86_64-gen.c