[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Cross-building on MacOS X/lint failure
>> I tracked down the source of that problem to the following statement in
>> src/usr.bin/xlint/lint1/tree.c: (function getnnode(), line 345)
>> *n->tn_val = sym->s_value;
>Does sym happen to be pointing at (or overlapping) n->tn_sym?
>tn_val is part of a union, which happens to also have a sym_t member.
No; I thought of that, but that is definately NOT the case. However,
n and the allocated memory for tn_val are right next to each other. But
I checked that very closely, and they don't overlap. If they did overlap,
the loop I wrote would also fail, right? (FWIW, I also tried memmove();
failed the same way memcpy() did).
>> This, however, makes no sense to me. This assignment looks perfectly legal,
>> and it shouldn't be corrupting the pointer value. I replace this with:
>> memcpy(n->tn_val, &sym->s_value, sizeof(val_t));
>> And I got the same exact corrupted pointer. Just for the hell of it,
>> I replaced this with a loop copying the memory byte by byte, and it worked.
>Did your loop use a temporary variable for the value of &sym->s_value?
>If sym overlaps with tn_val that would make things work since you'd have a
>consistent view of the value of that pointer.
Nope, didn't use a temporary value for any of the variables in that loop.
Main Index |
Thread Index |