From 7c1bc95a48ba184da800007a5eb123f8ca81c509 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 23 Oct 2019 22:01:25 +0200 Subject: [PATCH] lto-streamer-out.c (cmp_symbol_files): Watch for overflow. * lto-streamer-out.c (cmp_symbol_files): Watch for overflow. From-SVN: r277348 --- gcc/ChangeLog | 4 ++++ gcc/lto-streamer-out.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6c0c9e..b975798 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-10-23 Jan Hubicka + * lto-streamer-out.c (cmp_symbol_files): Watch for overflow. + +2019-10-23 Jan Hubicka + * ipa-reference.c (varpool_removal_hook, ipa_reference_c_finalize): Fix previous patch. diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 2c71292..3ecaddd 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2447,7 +2447,12 @@ cmp_symbol_files (const void *pn1, const void *pn2) /* Order within static library. */ if (n1->lto_file_data && n1->lto_file_data->id != n2->lto_file_data->id) - return n1->lto_file_data->id - n2->lto_file_data->id; + { + if (n1->lto_file_data->id > n2->lto_file_data->id) + return 1; + if (n1->lto_file_data->id < n2->lto_file_data->id) + return -1; + } /* And finaly order by the definition order. */ return n1->order - n2->order; -- 2.7.4