Index: gcc/diagnostic.c
===================================================================
--- gcc/diagnostic.c	(revision 187337)
+++ gcc/diagnostic.c	(working copy)
@@ -145,10 +145,11 @@ diagnostic_initialize (diagnostic_contex
   diagnostic_starter (context) = default_diagnostic_starter;
   diagnostic_finalizer (context) = default_diagnostic_finalizer;
   context->option_enabled = NULL;
   context->option_state = NULL;
   context->option_name = NULL;
+  context->last_location = UNKNOWN_LOCATION;
   context->last_module = 0;
   context->x_data = NULL;
   context->lock = 0;
   context->inhibit_notes_p = false;
 }
@@ -261,13 +262,15 @@ diagnostic_show_locus (diagnostic_contex
   int max_width;
   const char *saved_prefix;
 
 
   if (!context->show_caret
-      || diagnostic->location <= BUILTINS_LOCATION)
+      || diagnostic->location <= BUILTINS_LOCATION
+      || diagnostic->location == context->last_location)
     return;
 
+  context->last_location = diagnostic->location;
   s = expand_location_to_spelling_point (diagnostic->location);
   line = location_get_source_line (s);
   if (line == NULL)
     return;
 
Index: gcc/diagnostic.h
===================================================================
--- gcc/diagnostic.h	(revision 187337)
+++ gcc/diagnostic.h	(working copy)
@@ -170,10 +170,13 @@ struct diagnostic_context
   char *(*option_name) (diagnostic_context *, int, diagnostic_t, diagnostic_t);
 
   /* Auxiliary data for client.  */
   void *x_data;
 
+  /* Used to detect that the last caret was printed at the same location.  */
+  location_t last_location;
+
   /* Used to detect when the input file stack has changed since last
      described.  */
   const struct line_map *last_module;
 
   int lock;
