Fix coding-related core dumps with gcc -ftrapv.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 May 2012 22:27:21 +0000 (15:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 May 2012 22:27:21 +0000 (15:27 -0700)
commitc1892f1145dd05df037fc580acc5616f6d164238
treef56ded1081fc8c09076df37b41e7abe844380410
parent38264cc938d9f2fb63f1697b4ec3dc9b86640e5f
Fix coding-related core dumps with gcc -ftrapv.

The code was computing A - B, where A and B are pointers, and B is
random garbage.  This can lead to core dumps on platforms that
have special pointer registers, and it also leads to core dumps on
x86-64 when compiled with gcc -ftrapv.  The fix is to compute
A - B only when B is initialized properly.
* coding.c (coding_set_source, coding_set_destination): Return void.
(coding_change_source, coding_change_destinations): New functions,
with the old behaviors of coding_set_source and coding_set_destination.
All callers that need an offset changed to use these new functions.
src/ChangeLog
src/coding.c