ipa-cp.c (ipcp_cloning_candidate_p): Use opt_for_fn.
[gcc.git] / gcc / opts.c
index a31b28de56b238413915c2be649e68dea28bde88..a83345b91e21fd5a02dd69252385695dedbc9a1a 100644 (file)
@@ -1,5 +1,5 @@
 /* Command line option handling.
-   Copyright (C) 2002-2013 Free Software Foundation, Inc.
+   Copyright (C) 2002-2014 Free Software Foundation, Inc.
    Contributed by Neil Booth.
 
 This file is part of GCC.
@@ -431,8 +431,8 @@ static const struct default_options default_options_table[] =
     { OPT_LEVELS_1_PLUS, OPT_fguess_branch_probability, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fcprop_registers, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fforward_propagate, NULL, 1 },
-    { OPT_LEVELS_1_PLUS, OPT_fif_conversion, NULL, 1 },
-    { OPT_LEVELS_1_PLUS, OPT_fif_conversion2, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion2, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fipa_pure_const, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fipa_reference, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fipa_profile, NULL, 1 },
@@ -440,7 +440,7 @@ static const struct default_options default_options_table[] =
     { OPT_LEVELS_1_PLUS, OPT_fshrink_wrap, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fsplit_wide_types, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_ftree_ccp, NULL, 1 },
-    { OPT_LEVELS_1_PLUS, OPT_ftree_bit_ccp, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_bit_ccp, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_ftree_dce, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_ftree_dominator_opts, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_ftree_dse, NULL, 1 },
@@ -454,6 +454,10 @@ static const struct default_options default_options_table[] =
     { OPT_LEVELS_1_PLUS, OPT_fcombine_stack_adjustments, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fcompare_elim, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_ftree_slsr, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fbranch_count_reg, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fmove_loop_invariants, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_ftree_pta, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fssa_phiopt, NULL, 1 },
 
     /* -O2 optimizations.  */
     { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 },
@@ -493,7 +497,10 @@ static const struct default_options default_options_table[] =
     { OPT_LEVELS_2_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_CHEAP },
     { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_foptimize_strlen, NULL, 1 },
     { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
-    { OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths, NULL, 1 },
+    { OPT_LEVELS_2_PLUS, OPT_fipa_icf, NULL, 1 },
+    { OPT_LEVELS_2_PLUS, OPT_fisolate_erroneous_paths_dereference, NULL, 1 },
+    { OPT_LEVELS_2_PLUS, OPT_fuse_caller_save, NULL, 1 },
+    { OPT_LEVELS_2_PLUS, OPT_flra_remat, NULL, 1 },
 
     /* -O3 optimizations.  */
     { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
@@ -615,6 +622,13 @@ default_options_optimization (struct gcc_options *opts,
      opt2 ? default_param_value (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP) : 1000,
      opts->x_param_values, opts_set->x_param_values);
 
+  /* At -Ofast, allow store motion to introduce potential race conditions.  */
+  maybe_set_param_value
+    (PARAM_ALLOW_STORE_DATA_RACES,
+     opts->x_optimize_fast ? 1
+     : default_param_value (PARAM_ALLOW_STORE_DATA_RACES),
+     opts->x_param_values, opts_set->x_param_values);
+
   if (opts->x_optimize_size)
     /* We want to crossjump as much as possible.  */
     maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS, 1,
@@ -624,6 +638,12 @@ default_options_optimization (struct gcc_options *opts,
                           default_param_value (PARAM_MIN_CROSSJUMP_INSNS),
                           opts->x_param_values, opts_set->x_param_values);
 
+  /* Restrict the amount of work combine does at -Og while retaining
+     most of its useful transforms.  */
+  if (opts->x_optimize_debug)
+    maybe_set_param_value (PARAM_MAX_COMBINE_INSNS, 2,
+                          opts->x_param_values, opts_set->x_param_values);
+
   /* Allow default optimizations to be specified on a per-machine basis.  */
   maybe_default_options (opts, opts_set,
                         targetm_common.option_optimization_table,
@@ -641,7 +661,9 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 {
   enum unwind_info_type ui_except;
 
-  if (opts->x_dump_base_name && ! IS_ABSOLUTE_PATH (opts->x_dump_base_name))
+  if (opts->x_dump_base_name
+      && ! IS_ABSOLUTE_PATH (opts->x_dump_base_name)
+      && ! opts->x_dump_base_name_prefixed)
     {
       /* First try to make OPTS->X_DUMP_BASE_NAME relative to the
         OPTS->X_DUMP_DIR_NAME directory.  Then try to make
@@ -671,6 +693,7 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
              opts->x_dump_base_name = new_dump_base_name;
            }
        }
+       opts->x_dump_base_name_prefixed = true;
     }
 
   /* Handle related options for unit-at-a-time, toplevel-reorder, and
@@ -808,16 +831,15 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 #else
       error_at (loc, "LTO support has not been enabled in this configuration");
 #endif
-      if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
-        error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin.");
-}
-  if ((opts->x_flag_lto_partition_balanced != 0) + (opts->x_flag_lto_partition_1to1 != 0)
-       + (opts->x_flag_lto_partition_none != 0) >= 1)
-    {
-      if ((opts->x_flag_lto_partition_balanced != 0)
-          + (opts->x_flag_lto_partition_1to1 != 0)
-          + (opts->x_flag_lto_partition_none != 0) > 1)
-       error_at (loc, "only one -flto-partition value can be specified");
+      if (!opts->x_flag_fat_lto_objects
+         && (!HAVE_LTO_PLUGIN
+             || (opts_set->x_flag_use_linker_plugin
+                 && !opts->x_flag_use_linker_plugin)))
+       {
+         if (opts_set->x_flag_fat_lto_objects)
+            error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin");
+         opts->x_flag_fat_lto_objects = 1;
+       }
     }
 
   /* We initialize opts->x_flag_split_stack to -1 so that targets can set a
@@ -852,9 +874,49 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
     maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0,
                            opts->x_param_values, opts_set->x_param_values);
 
-  /* The -gsplit-dwarf option requires -gpubnames.  */
+  /* The -gsplit-dwarf option requires -ggnu-pubnames.  */
   if (opts->x_dwarf_split_debug_info)
-    opts->x_debug_generate_pub_sections = 1;
+    opts->x_debug_generate_pub_sections = 2;
+
+  /* Userspace and kernel ASan conflict with each other.  */
+
+  if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS)
+      && (opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS))
+    error_at (loc,
+             "-fsanitize=address is incompatible with "
+             "-fsanitize=kernel-address");
+
+  /* And with TSan.  */
+
+  if ((opts->x_flag_sanitize & SANITIZE_ADDRESS)
+      && (opts->x_flag_sanitize & SANITIZE_THREAD))
+    error_at (loc,
+             "-fsanitize=address and -fsanitize=kernel-address "
+             "are incompatible with -fsanitize=thread");
+
+  /* Error recovery is not allowed for ASan and TSan.  */
+
+  if (opts->x_flag_sanitize_recover & SANITIZE_USER_ADDRESS)
+    error_at (loc, "-fsanitize-recover=address is not supported");
+
+  if (opts->x_flag_sanitize_recover & SANITIZE_THREAD)
+    error_at (loc, "-fsanitize-recover=thread is not supported");
+
+  if (opts->x_flag_sanitize_recover & SANITIZE_LEAK)
+    error_at (loc, "-fsanitize-recover=leak is not supported");
+
+  /* When instrumenting the pointers, we don't want to remove
+     the null pointer checks.  */
+  if (opts->x_flag_sanitize & (SANITIZE_NULL | SANITIZE_NONNULL_ATTRIBUTE
+                               | SANITIZE_RETURNS_NONNULL_ATTRIBUTE))
+    opts->x_flag_delete_null_pointer_checks = 0;
+
+  /* Aggressive compiler optimizations may cause false negatives.  */
+  if (opts->x_flag_sanitize)
+    {
+      opts->x_flag_aggressive_loop_optimizations = 0;
+      opts->x_flag_strict_overflow = 0;
+    }
 }
 
 #define LEFT_COLUMN    27
@@ -919,6 +981,7 @@ print_filtered_help (unsigned int include_flags,
   const char *help;
   bool found = false;
   bool displayed = false;
+  char new_help[128];
 
   if (include_flags == CL_PARAMS)
     {
@@ -937,6 +1000,15 @@ print_filtered_help (unsigned int include_flags,
          /* Get the translation.  */
          help = _(help);
 
+         if (!opts->x_quiet_flag)
+           {
+             snprintf (new_help, sizeof (new_help),
+                       _("default %d minimum %d maximum %d"),
+                       compiler_params[i].default_value,
+                       compiler_params[i].min_value,
+                       compiler_params[i].max_value);
+             help = new_help;
+           }
          wrap_help (help, param, strlen (param), columns);
        }
       putchar ('\n');
@@ -951,7 +1023,6 @@ print_filtered_help (unsigned int include_flags,
 
   for (i = 0; i < cl_options_count; i++)
     {
-      char new_help[128];
       const struct cl_option *option = cl_options + i;
       unsigned int len;
       const char *opt;
@@ -1236,6 +1307,50 @@ print_specific_help (unsigned int include_flags,
                       opts->x_help_columns, opts, lang_mask);
 }
 
+/* Enable FDO-related flags.  */
+
+static void
+enable_fdo_optimizations (struct gcc_options *opts,
+                         struct gcc_options *opts_set,
+                         int value)
+{
+  if (!opts_set->x_flag_branch_probabilities)
+    opts->x_flag_branch_probabilities = value;
+  if (!opts_set->x_flag_profile_values)
+    opts->x_flag_profile_values = value;
+  if (!opts_set->x_flag_unroll_loops)
+    opts->x_flag_unroll_loops = value;
+  if (!opts_set->x_flag_peel_loops)
+    opts->x_flag_peel_loops = value;
+  if (!opts_set->x_flag_tracer)
+    opts->x_flag_tracer = value;
+  if (!opts_set->x_flag_value_profile_transformations)
+    opts->x_flag_value_profile_transformations = value;
+  if (!opts_set->x_flag_inline_functions)
+    opts->x_flag_inline_functions = value;
+  if (!opts_set->x_flag_ipa_cp)
+    opts->x_flag_ipa_cp = value;
+  if (!opts_set->x_flag_ipa_cp_clone
+      && value && opts->x_flag_ipa_cp)
+    opts->x_flag_ipa_cp_clone = value;
+  if (!opts_set->x_flag_predictive_commoning)
+    opts->x_flag_predictive_commoning = value;
+  if (!opts_set->x_flag_unswitch_loops)
+    opts->x_flag_unswitch_loops = value;
+  if (!opts_set->x_flag_gcse_after_reload)
+    opts->x_flag_gcse_after_reload = value;
+  if (!opts_set->x_flag_tree_loop_vectorize
+      && !opts_set->x_flag_tree_vectorize)
+    opts->x_flag_tree_loop_vectorize = value;
+  if (!opts_set->x_flag_tree_slp_vectorize
+      && !opts_set->x_flag_tree_vectorize)
+    opts->x_flag_tree_slp_vectorize = value;
+  if (!opts_set->x_flag_vect_cost_model)
+    opts->x_flag_vect_cost_model = VECT_COST_MODEL_DYNAMIC;
+  if (!opts_set->x_flag_tree_loop_distribute_patterns)
+    opts->x_flag_tree_loop_distribute_patterns = value;
+}
+
 /* Handle target- and language-independent options.  Return zero to
    generate an "unknown option" message.  Only options that need
    extra handling need to be listed here; if you simply want
@@ -1429,8 +1544,12 @@ common_handle_option (struct gcc_options *opts,
       break;
 
     case OPT_fsanitize_:
+    case OPT_fsanitize_recover_:
       {
        const char *p = arg;
+       unsigned int *flag
+         = code == OPT_fsanitize_ ? &opts->x_flag_sanitize
+         : &opts->x_flag_sanitize_recover;
        while (*p != 0)
          {
            static const struct
@@ -1440,8 +1559,12 @@ common_handle_option (struct gcc_options *opts,
              size_t len;
            } spec[] =
            {
-             { "address", SANITIZE_ADDRESS, sizeof "address" - 1 },
+             { "address", SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS,
+               sizeof "address" - 1 },
+             { "kernel-address", SANITIZE_ADDRESS | SANITIZE_KERNEL_ADDRESS,
+               sizeof "kernel-address" - 1 },
              { "thread", SANITIZE_THREAD, sizeof "thread" - 1 },
+             { "leak", SANITIZE_LEAK, sizeof "leak" - 1 },
              { "shift", SANITIZE_SHIFT, sizeof "shift" - 1 },
              { "integer-divide-by-zero", SANITIZE_DIVIDE,
                sizeof "integer-divide-by-zero" - 1 },
@@ -1449,7 +1572,25 @@ common_handle_option (struct gcc_options *opts,
              { "unreachable", SANITIZE_UNREACHABLE,
                sizeof "unreachable" - 1 },
              { "vla-bound", SANITIZE_VLA, sizeof "vla-bound" - 1 },
+             { "return", SANITIZE_RETURN, sizeof "return" - 1 },
              { "null", SANITIZE_NULL, sizeof "null" - 1 },
+             { "signed-integer-overflow", SANITIZE_SI_OVERFLOW,
+               sizeof "signed-integer-overflow" -1 },
+             { "bool", SANITIZE_BOOL, sizeof "bool" - 1 },
+             { "enum", SANITIZE_ENUM, sizeof "enum" - 1 },
+             { "float-divide-by-zero", SANITIZE_FLOAT_DIVIDE,
+               sizeof "float-divide-by-zero" - 1 },
+             { "float-cast-overflow", SANITIZE_FLOAT_CAST,
+               sizeof "float-cast-overflow" - 1 },
+             { "bounds", SANITIZE_BOUNDS, sizeof "bounds" - 1 },
+             { "alignment", SANITIZE_ALIGNMENT, sizeof "alignment" - 1 },
+             { "nonnull-attribute", SANITIZE_NONNULL_ATTRIBUTE,
+               sizeof "nonnull-attribute" - 1 },
+             { "returns-nonnull-attribute",
+               SANITIZE_RETURNS_NONNULL_ATTRIBUTE,
+               sizeof "returns-nonnull-attribute" - 1 },
+             { "object-size", SANITIZE_OBJECT_SIZE,
+               sizeof "object-size" - 1 },
              { NULL, 0, 0 }
            };
            const char *comma;
@@ -1474,30 +1615,60 @@ common_handle_option (struct gcc_options *opts,
                {
                  /* Handle both -fsanitize and -fno-sanitize cases.  */
                  if (value)
-                   flag_sanitize |= spec[i].flag;
+                   *flag |= spec[i].flag;
                  else
-                   flag_sanitize &= ~spec[i].flag;
+                   *flag &= ~spec[i].flag;
                  found = true;
                  break;
                }
 
            if (! found)
-             warning_at (loc, 0,
-                         "unrecognized argument to -fsanitize= option: %q.*s",
-                         (int) len, p);
+             error_at (loc,
+                       "unrecognized argument to -fsanitize%s= option: %q.*s",
+                       code == OPT_fsanitize_ ? "" : "-recover", (int) len, p);
 
            if (comma == NULL)
              break;
            p = comma + 1;
          }
 
-       /* When instrumenting the pointers, we don't want to remove
-          the null pointer checks.  */
-       if (flag_sanitize & SANITIZE_NULL)
-         opts->x_flag_delete_null_pointer_checks = 0;
+       if (code != OPT_fsanitize_)
+         break;
+
+       /* Kernel ASan implies normal ASan but does not yet support
+          all features.  */
+       if (opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS)
+         {
+           maybe_set_param_value (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+           maybe_set_param_value (PARAM_ASAN_GLOBALS, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+           maybe_set_param_value (PARAM_ASAN_STACK, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+           maybe_set_param_value (PARAM_ASAN_USE_AFTER_RETURN, 0,
+                                  opts->x_param_values,
+                                  opts_set->x_param_values);
+         }
+
        break;
       }
 
+    case OPT_fasan_shadow_offset_:
+      /* Deferred.  */
+      break;
+
+    case OPT_fsanitize_recover:
+      if (value)
+       opts->x_flag_sanitize_recover
+         |= SANITIZE_UNDEFINED | SANITIZE_NONDEFAULT;
+      else
+       opts->x_flag_sanitize_recover
+         &= ~(SANITIZE_UNDEFINED | SANITIZE_NONDEFAULT);
+      break;
+
     case OPT_O:
     case OPT_Os:
     case OPT_Ofast:
@@ -1643,6 +1814,17 @@ common_handle_option (struct gcc_options *opts,
       /* Deferred.  */
       break;
 
+    case OPT_foffload_:
+      /* Deferred.  */
+      break;
+
+#ifndef ACCEL_COMPILER
+    case OPT_foffload_abi_:
+      error_at (loc, "-foffload-abi option can be specified only for "
+               "offload compiler");
+      break;
+#endif
+
     case OPT_fpack_struct_:
       if (value <= 0 || (value & (value - 1)) || value > 16)
        error_at (loc,
@@ -1663,48 +1845,30 @@ common_handle_option (struct gcc_options *opts,
       value = true;
       /* No break here - do -fprofile-use processing. */
     case OPT_fprofile_use:
-      if (!opts_set->x_flag_branch_probabilities)
-       opts->x_flag_branch_probabilities = value;
-      if (!opts_set->x_flag_profile_values)
-       opts->x_flag_profile_values = value;
-      if (!opts_set->x_flag_unroll_loops)
-       opts->x_flag_unroll_loops = value;
-      if (!opts_set->x_flag_peel_loops)
-       opts->x_flag_peel_loops = value;
-      if (!opts_set->x_flag_tracer)
-       opts->x_flag_tracer = value;
-      if (!opts_set->x_flag_value_profile_transformations)
-       opts->x_flag_value_profile_transformations = value;
-      if (!opts_set->x_flag_inline_functions)
-       opts->x_flag_inline_functions = value;
-      if (!opts_set->x_flag_ipa_cp)
-       opts->x_flag_ipa_cp = value;
-      if (!opts_set->x_flag_ipa_cp_clone
-         && value && opts->x_flag_ipa_cp)
-       opts->x_flag_ipa_cp_clone = value;
-      if (!opts_set->x_flag_predictive_commoning)
-       opts->x_flag_predictive_commoning = value;
-      if (!opts_set->x_flag_unswitch_loops)
-       opts->x_flag_unswitch_loops = value;
-      if (!opts_set->x_flag_gcse_after_reload)
-       opts->x_flag_gcse_after_reload = value;
-      if (!opts_set->x_flag_tree_loop_vectorize
-          && !opts_set->x_flag_tree_vectorize)
-       opts->x_flag_tree_loop_vectorize = value;
-      if (!opts_set->x_flag_tree_slp_vectorize
-          && !opts_set->x_flag_tree_vectorize)
-       opts->x_flag_tree_slp_vectorize = value;
-      if (!opts_set->x_flag_vect_cost_model)
-       opts->x_flag_vect_cost_model = VECT_COST_MODEL_DYNAMIC;
-      if (!opts_set->x_flag_tree_loop_distribute_patterns)
-       opts->x_flag_tree_loop_distribute_patterns = value;
-      /* Indirect call profiling should do all useful transformations
-        speculative devirutalization does.  */
+      enable_fdo_optimizations (opts, opts_set, value);
+      if (!opts_set->x_flag_profile_reorder_functions)
+         opts->x_flag_profile_reorder_functions = value;
+       /* Indirect call profiling should do all useful transformations
+          speculative devirtualization does.  */
       if (!opts_set->x_flag_devirtualize_speculatively
          && opts->x_flag_value_profile_transformations)
        opts->x_flag_devirtualize_speculatively = false;
       break;
 
+    case OPT_fauto_profile_:
+      opts->x_auto_profile_file = xstrdup (arg);
+      opts->x_flag_auto_profile = true;
+      value = true;
+      /* No break here - do -fauto-profile processing. */
+    case OPT_fauto_profile:
+      enable_fdo_optimizations (opts, opts_set, value);
+      if (!opts_set->x_flag_profile_correction)
+       opts->x_flag_profile_correction = value;
+      maybe_set_param_value (
+       PARAM_EARLY_INLINER_MAX_ITERATIONS, 10,
+       opts->x_param_values, opts_set->x_param_values);
+      break;
+
     case OPT_fprofile_generate_:
       opts->x_profile_data_prefix = xstrdup (arg);
       value = true;
@@ -1719,7 +1883,7 @@ common_handle_option (struct gcc_options *opts,
       /* FIXME: Instrumentation we insert makes ipa-reference bitmaps
         quadratic.  Disable the pass until better memory representation
         is done.  */
-      if (!opts_set->x_flag_ipa_reference && opts->x_in_lto_p)
+      if (!opts_set->x_flag_ipa_reference)
         opts->x_flag_ipa_reference = false;
       break;
 
@@ -1778,7 +1942,7 @@ common_handle_option (struct gcc_options *opts,
                             ? STATIC_BUILTIN_STACK_CHECK
                             : GENERIC_STACK_CHECK;
       else
-       warning_at (loc, 0, "unknown stack check parameter \"%s\"", arg);
+       warning_at (loc, 0, "unknown stack check parameter %qs", arg);
       break;
 
     case OPT_fstack_limit:
@@ -1800,7 +1964,7 @@ common_handle_option (struct gcc_options *opts,
 
     case OPT_g:
       set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, arg, opts, opts_set,
-                      loc);
+                       loc);
       break;
 
     case OPT_gcoff:
@@ -1852,6 +2016,11 @@ common_handle_option (struct gcc_options *opts,
                       loc);
       break;
 
+    case OPT_gz:
+    case OPT_gz_:
+      /* Handled completely via specs.  */
+      break;
+
     case OPT_pedantic_errors:
       dc->pedantic_errors = 1;
       control_warning_option (OPT_Wpedantic, DK_ERROR, value,
@@ -1888,6 +2057,11 @@ common_handle_option (struct gcc_options *opts,
        opts->x_flag_wrapv = 0;
       break;
 
+    case OPT_fipa_icf:
+      opts->x_flag_ipa_icf_functions = value;
+      opts->x_flag_ipa_icf_variables = value;
+      break;
+
     default:
       /* If the flag was handled in a standard way, assume the lack of
         processing here is intentional.  */
@@ -2044,25 +2218,27 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg,
       if (opts_set->x_write_symbols != NO_DEBUG
          && opts->x_write_symbols != NO_DEBUG
          && type != opts->x_write_symbols)
-       error_at (loc, "debug format \"%s\" conflicts with prior selection",
+       error_at (loc, "debug format %qs conflicts with prior selection",
                  debug_type_names[type]);
       opts->x_write_symbols = type;
       opts_set->x_write_symbols = type;
     }
 
-  /* A debug flag without a level defaults to level 2.  */
+  /* A debug flag without a level defaults to level 2.
+     If off or at level 1, set it to level 2, but if already
+     at level 3, don't lower it.  */ 
   if (*arg == '\0')
     {
-      if (!opts->x_debug_info_level)
+      if (opts->x_debug_info_level < DINFO_LEVEL_NORMAL)
        opts->x_debug_info_level = DINFO_LEVEL_NORMAL;
     }
   else
     {
       int argval = integral_argument (arg);
       if (argval == -1)
-       error_at (loc, "unrecognised debug output level \"%s\"", arg);
+       error_at (loc, "unrecognised debug output level %qs", arg);
       else if (argval > 3)
-       error_at (loc, "debug output level %s is too high", arg);
+       error_at (loc, "debug output level %qs is too high", arg);
       else
        opts->x_debug_info_level = (enum debug_info_levels) argval;
     }
@@ -2192,14 +2368,10 @@ option_name (diagnostic_context *context, int option_index,
        return xstrdup (cl_options[option_index].opt_text);
     }
   /* A warning without option classified as an error.  */
-  else if (orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN
-          || diag_kind == DK_WARNING)
-    {
-      if (context->warning_as_error_requested)
-       return xstrdup (cl_options[OPT_Werror].opt_text);
-      else
-       return xstrdup (_("enabled by default"));
-    }
+  else if ((orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN
+           || diag_kind == DK_WARNING)
+          && context->warning_as_error_requested)
+    return xstrdup (cl_options[OPT_Werror].opt_text);
   else
     return NULL;
 }