public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [avr, 5 + trunk, committed]: Fix "KiB" diagnostic for wrong address space.
@ 2015-08-20 14:38 Georg-Johann Lay
  0 siblings, 0 replies; only message in thread
From: Georg-Johann Lay @ 2015-08-20 14:38 UTC (permalink / raw)
  To: GCC Patches; +Cc: Denis Chertykov

https://gcc.gnu.org/r227034
https://gcc.gnu.org/r227035

If an address space is used that's beyond the flash of the current device 
(number of 64 KiB segments as specified by -mn-flash=) a diagnostic complains 
and prints the currently specified numbers of flash segments, i.e. 64 KiB 
chunks, and used "KiB" as unit.  Hence the avr_n_flash number of segments has 
to be multiplied by 64 in order to convert from number of segments to KiB.

Applied as obvious to trunk and gcc-5-branch (4.9 does not print the size).


Johann


Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c    (revision 227034)
+++ config/avr/avr.c    (revision 227035)
@@ -9255,10 +9255,10 @@ avr_pgm_check_var_decl (tree node)
          {
            if (TYPE_P (node))
              error ("%qT uses address space %qs beyond flash of %d KiB",
-                   node, avr_addrspace[as].name, avr_n_flash);
+                   node, avr_addrspace[as].name, 64 * avr_n_flash);
            else
              error ("%s %q+D uses address space %qs beyond flash of %d KiB",
-                   reason, node, avr_addrspace[as].name, avr_n_flash);
+                   reason, node, avr_addrspace[as].name, 64 * avr_n_flash);
          }
        else
          {
@@ -9305,7 +9305,7 @@ avr_insert_attributes (tree node, tree *
        if (avr_addrspace[as].segment >= avr_n_flash)
          {
            error ("variable %q+D located in address space %qs beyond flash "
-                 "of %d KiB", node, avr_addrspace[as].name, avr_n_flash);
+                 "of %d KiB", node, avr_addrspace[as].name, 64 * avr_n_flash);
          }
        else if (!AVR_HAVE_LPM && avr_addrspace[as].pointer_size > 2)
         {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-20 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-20 14:38 [avr, 5 + trunk, committed]: Fix "KiB" diagnostic for wrong address space Georg-Johann Lay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).