This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[avr, 5 + trunk, committed]: Fix "KiB" diagnostic for wrong address space.
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Denis Chertykov <chertykov at gmail dot com>
- Date: Thu, 20 Aug 2015 16:33:15 +0200
- Subject: [avr, 5 + trunk, committed]: Fix "KiB" diagnostic for wrong address space.
- Authentication-results: sourceware.org; auth=none
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)
{