diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 354bce0..a18a89d 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1056,6 +1056,11 @@ read_cmdline_option (struct gcc_options *opts,
   if (!handle_option (opts, opts_set, decoded, lang_mask, DK_UNSPECIFIED,
 		      loc, handlers, false, dc))
     error_at (loc, "unrecognized command line option %qs", opt);
+
+  if ((option->flags & CL_OPTIMIZATION)
+      && !opts->x_optimize)
+    warning_at (loc, 0, "optimization option %qs has no effect "
+		"at zero -O level", opt);
 }
 
 /* Set any field in OPTS, and OPTS_SET if not NULL, for option
