tccgen: x86_64: fix garbage in the SValue upper bits
commit5879c854fb94f722a7ffdd4e895c9ce418548959
authorgrischka <grischka>
Fri, 4 Apr 2014 18:18:39 +0000 (4 20:18 +0200)
committergrischka <grischka>
Fri, 4 Apr 2014 18:20:44 +0000 (4 20:20 +0200)
tree63f264a9801208674d477322f2bf487edd0234b5
parent2024c445411f80b7c4b761322521d823e606418d
tccgen: x86_64: fix garbage in the SValue upper bits

This was going wrong (case TOK_LAND in unary: computed labels)
-        vset(&s->type, VT_CONST | VT_SYM, 0);
-        vtop->sym = s;

This does the right thing and is shorter:

+        vpushsym(&s->type, s);

Test case was:

    int main(int argc, char **argv)
    {
        int x;
        static void *label_return = &&lbl_return;
        printf("label_return = %p\n", label_return);
        goto *label_return; //<<<<< here segfault on linux X86_64 without the memset on vset
        printf("unreachable\n");
    lbl_return:
        return 0;
    }

Also::
- Rename "void* CValue.ptr" to more usable "addr_t ptr_offset"
  and start to use it in obvious cases.

- use __attribute__ ((noreturn)) only with gnu compiler

- Revert CValue memsets ("After several days searching ...")
  commit 4bc83ac3933efa565ae3326b55fcd711b63c073d

Doesn't mean that the vsetX/vpush thingy isn't brittle and
there still might be bugs as to differences in how the CValue
union  was set and is then interpreted later on.

However the big memset hammer was just too slow (-3% overall).
tcc.h
tccgen.c
tccpp.c