aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-out.c
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 /gcc/lto-streamer-out.c
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
Diffstat (limited to 'gcc/lto-streamer-out.c')
-rw-r--r--gcc/lto-streamer-out.c7
1 files changed, 6 insertions, 1 deletions
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;