summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-06-21 10:59:12 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-06-21 10:59:12 +0000
commitc0de8f194f7f4c966783078f688ba76ceed79ff3 (patch)
treecf6543870e2daf6ed7988acd197536ef1d848eb1 /libcpp
parent23a7b91ba16742fbda2637f6fcbd156cc7fc54ab (diff)
* line-map.c (location_adhoc_data_update): Perform addition in
uintptr_t type rather than char * type. Read *data using ptrdiff_t type instead of int64_t. (get_combined_adhoc_loc): Change offset type to ptrdiff_t from int64_t. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249446 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog8
-rw-r--r--libcpp/line-map.c5
2 files changed, 11 insertions, 2 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 9665f6e16c91..526b8023b388 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,11 @@
+2017-06-21 Jakub Jelinek <jakub@redhat.com>
+
+ * line-map.c (location_adhoc_data_update): Perform addition in
+ uintptr_t type rather than char * type. Read *data using
+ ptrdiff_t type instead of int64_t.
+ (get_combined_adhoc_loc): Change offset type to ptrdiff_t from
+ int64_t.
+
2017-06-20 David Malcolm <dmalcolm@redhat.com>
* include/line-map.h (class rich_location): Document that attempts
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 7ba003add987..476a465efa08 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -99,7 +99,8 @@ location_adhoc_data_eq (const void *l1, const void *l2)
static int
location_adhoc_data_update (void **slot, void *data)
{
- *((char **) slot) += *((int64_t *) data);
+ *((char **) slot)
+ = (char *) ((uintptr_t) *((char **) slot) + *((ptrdiff_t *) data));
return 1;
}
@@ -221,7 +222,7 @@ get_combined_adhoc_loc (struct line_maps *set,
set->location_adhoc_data_map.allocated)
{
char *orig_data = (char *) set->location_adhoc_data_map.data;
- int64_t offset;
+ ptrdiff_t offset;
/* Cast away extern "C" from the type of xrealloc. */
line_map_realloc reallocator = (set->reallocator
? set->reallocator