From: Tamar Christina Date: Thu, 4 Oct 2018 13:06:59 +0000 (+0000) Subject: Remove superfluous assignment in add_params. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac712e4eb43f3dd8d7f12624ea4014ecb2a9cf34;p=gcc.git Remove superfluous assignment in add_params. This fixes the superfluous assignment that Coverity reported in add_params, and changes the starting index from 0 to num_params - n in order for it to work properly if add_params is called multiple times. validate_params calls error so it doesn't matter that we don't check the results here. The results is checked in individual parameter updates after front-end initialization. 2018-10-04 Tamar Christina * params.c (add_params): Fix initialization. From-SVN: r264841 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fdae3d1909a..21631ae0679 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2018-10-04 Tamar Christina + + * params.c (add_params): Fix initialization. + 2018-10-04 Martin Liska PR gcov-profile/84107 diff --git a/gcc/params.c b/gcc/params.c index b6a33dfd6bf..af473968e0b 100644 --- a/gcc/params.c +++ b/gcc/params.c @@ -87,12 +87,10 @@ add_params (const param_info params[], size_t n) if (!diagnostic_ready_p ()) diagnostic_initialize (global_dc, 0); - /* Now perform some validation and set the value if it validates. */ - for (size_t i = 0; i < n; i++) - { - if (validate_param (dst_params[i].default_value, dst_params[i], (int)i)) - dst_params[i].default_value = dst_params[i].default_value; - } + /* Now perform some validation and validation failures trigger an error so + initialization will stop. */ + for (size_t i = num_compiler_params - n; i < n; i++) + validate_param (params[i].default_value, params[i], (int)i); } /* Add all parameters and default values that can be set in both the