aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-06-19 16:07:58 +0000
committerIain Sandoe <iains@gcc.gnu.org>2019-06-19 16:07:58 +0000
commit33f0ad50f48cefeec7f3136e30229c9f85bbd372 (patch)
tree90a9613d1f69f51efe83ec63a1a1a3caf3f87fed
parent742f80b15861510ad14b46f24a81157041b7acf0 (diff)
downloadgcc-33f0ad50f48cefeec7f3136e30229c9f85bbd372.zip
gcc-33f0ad50f48cefeec7f3136e30229c9f85bbd372.tar.gz
gcc-33f0ad50f48cefeec7f3136e30229c9f85bbd372.tar.bz2
[Darwin] Fix two off-by-one errors in the driver.
2019-06-19 Iain Sandoe <iain@sandoe.co.uk> * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors in computing the number of options to be moved. From-SVN: r272479
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/darwin-driver.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e5c455f..919ceaf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-19 Iain Sandoe <iain@sandoe.co.uk>
+
+ * config/darwin-driver.c (darwin_driver_init): Fix off-by-one errors
+ in computing the number of options to be moved.
+
2019-06-19 Maya Rashish <coypu@sdf.org>
* config/arm/netbsd-elf.h (SYSARCH_ARM_SYNC_ICACHE): New definition.
diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
index 01238e2..3d85f29c 100644
--- a/gcc/config/darwin-driver.c
+++ b/gcc/config/darwin-driver.c
@@ -261,7 +261,7 @@ darwin_driver_init (unsigned int *decoded_options_count,
if (*decoded_options_count > i) {
memmove (*decoded_options + i,
*decoded_options + i + 1,
- ((*decoded_options_count - i)
+ ((*decoded_options_count - i - 1)
* sizeof (struct cl_decoded_option)));
}
--i;
@@ -307,7 +307,7 @@ darwin_driver_init (unsigned int *decoded_options_count,
if (*decoded_options_count > i) {
memmove (*decoded_options + i,
*decoded_options + i + 1,
- ((*decoded_options_count - i)
+ ((*decoded_options_count - i - 1)
* sizeof (struct cl_decoded_option)));
}
--i;