]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/params.c
[C++] Protect call to copy_attributes_to_builtin (PR91505)
[thirdparty/gcc.git] / gcc / params.c
index b6a33dfd6bf8c4df43fdac91e30ac6d082f39071..8d5e58f314530f797dbe1ae55f8ab2e8884bad75 100644 (file)
@@ -1,5 +1,5 @@
 /* params.c - Run-time parameters.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
    Written by Mark Mitchell <mark@codesourcery.com>.
 
 This file is part of GCC.
@@ -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