]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
AVR: Better location for late (during final) diagnostic.
authorGeorg-Johann Lay <avr@gjlay.de>
Sat, 7 Dec 2024 18:54:02 +0000 (19:54 +0100)
committerGeorg-Johann Lay <avr@gjlay.de>
Sat, 7 Dec 2024 18:54:02 +0000 (19:54 +0100)
gcc/
* config/avr/avr.cc (avr_print_operand_address): Use
avr_insn_location as location for late (during final) diagnostic.

gcc/config/avr/avr.cc

index 3544571d3dfaaaea06961c805bc63bce5033b5e4..7c7736781c8a22e9e542cb2662f797f9b8864de5 100644 (file)
@@ -2538,11 +2538,17 @@ avr_print_operand_address (FILE *file, machine_mode /*mode*/, rtx addr)
              fprintf (file, "+" HOST_WIDE_INT_PRINT_DEC ")",
                       2 * INTVAL (XEXP (x, 1)));
              if (AVR_3_BYTE_PC)
-               if (warning (0, "pointer offset from symbol maybe incorrect"))
-                 {
-                   output_addr_const (stderr, addr);
-                   fprintf (stderr, "\n");
-                 }
+               {
+                 location_t loc = avr_insn_location != UNKNOWN_LOCATION
+                   ? avr_insn_location
+                   : input_location;
+                 if (warning_at (loc, 0, "pointer offset from symbol may be"
+                                 " incorrect"))
+                   {
+                     output_addr_const (stderr, addr);
+                     fprintf (stderr, "\n");
+                   }
+               }
            }
          else
            {