aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2019-10-23 22:01:25 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2019-10-23 20:01:25 +0000
commit7c1bc95a48ba184da800007a5eb123f8ca81c509 (patch)
tree8a7c0749955147e16a57870f7f07e39e13453bad
parent45012be1f5c7e6039e594bab41ebb94d89a9aca0 (diff)
downloadgcc-7c1bc95a48ba184da800007a5eb123f8ca81c509.zip
gcc-7c1bc95a48ba184da800007a5eb123f8ca81c509.tar.gz
gcc-7c1bc95a48ba184da800007a5eb123f8ca81c509.tar.bz2
lto-streamer-out.c (cmp_symbol_files): Watch for overflow.
* lto-streamer-out.c (cmp_symbol_files): Watch for overflow. From-SVN: r277348
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/lto-streamer-out.c7
2 files changed, 10 insertions, 1 deletions
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 <hubicka@ucw.cz>
+ * lto-streamer-out.c (cmp_symbol_files): Watch for overflow.
+
+2019-10-23 Jan Hubicka <hubicka@ucw.cz>
+
* 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;