Bug 40112 - [avr] C++, __attribute__((__progmem__)) lost in typedefs.
Summary: [avr] C++, __attribute__((__progmem__)) lost in typedefs.
Status: RESOLVED DUPLICATE of bug 34734
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-12 10:20 UTC by Sergey A. Borshch
Modified: 2009-08-07 19:16 UTC (History)
5 users (show)

See Also:
Host: x86
Target: avr-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey A. Borshch 2009-05-12 10:20:37 UTC
data incorrectly placed into .data or .rodata instead of .progmem. This makes impossible using avr-libc predefined types (avr/pgmspace.h).

test.cpp:
char __attribute__((__progmem__)) Test1[] = "test1";
char const __attribute__((__progmem__)) Test2[] = "test2";

typedef char __attribute__((__progmem__)) prog_char;
prog_char Test3[] = "Test3";
prog_char const Test4[] = "Test4";

void const * array[] = 
{
    Test1, Test2, Test3, Test4
};

listing:
   8               	.global	Test1
   9               		.section	.progmem.data,"a",@progbits
  12               	Test1:
  13 0000 7465 7374 		.string	"test1"
  13      3100 
  14               	.global	Test3
  15               		.data
  18               	Test3:
  19 0000 5465 7374 		.string	"Test3"
  19      3300 
  20               	.global	array
  23               	array:
  24 0006 0000      		.word	Test1
  25 0008 0000      		.word	_ZL5Test2
  26 000a 0000      		.word	Test3
  27 000c 0000      		.word	_ZL5Test4
  28               		.section	.progmem.data
  31               	_ZL5Test2:
  32 0006 7465 7374 		.string	"test2"
  32      3200 
  33               		.data
  36               	_ZL5Test4:
  37 000e 5465 7374 		.string	"Test4"
  37      3400 

First two forms leads to correct placement, but generates incorrect warning (bug 34734)
Comment 1 Eric Weddington 2009-08-07 19:16:32 UTC

*** This bug has been marked as a duplicate of 34734 ***