The program source is trivial (yes, I've attached the .ii file as well): #include <avr/pgmspace.h> prog_uchar foo [10][10] = { 0 }; When compiled with g++ 4.3.0, this does not actually put the data in program space. BillW-MacOSX<1063> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-g++ pgmspace.c -mmcu=atmega168 -c -o pgmspace43c++.o --version avr-g++ (GCC) 4.3.0 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. BillW-MacOSX<1064> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-g++ pgmspace.c -mmcu=atmega168 -c -o pgmspace43c++.o BillW-MacOSX<1065> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-size pgmspace43c++.o text data bss dec hex filename 0 0 100 100 64 pgmspace43c++.o It works correctly with gcc 4.3.0 (from the same distribution), and it works correctly with g++ 4.1 BillW-MacOSX<1060> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-gcc pgmspace.c -mmcu=atmega168 -c -o pgmspace43cc.o --version avr-gcc (GCC) 4.3.0 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. BillW-MacOSX<1061> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-gcc pgmspace.c -mmcu=atmega168 -c -o pgmspace43cc.o BillW-MacOSX<1062> /Downloads/arduino-0012/hardware/tools/avr/bin/avr-size pgmspace43cc.o text data bss dec hex filename 100 0 0 100 64 pgmspace43cc.o BillW-MacOSX<1063>
Created attachment 16797 [details] output from g++ -v
Created attachment 16798 [details] pgmspace.ii for the failing g++ compilation Actual compile command: /Downloads/arduino-0012/hardware/tools/avr/bin/avr-g++ pgmspace.c -mmcu=atmega168 -c -o pgmspace43c++.o -save-temps -v >&foo.out
Bug has been reproduced on at least two hosts. See also avrfreaks discussion: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=515859#515859
Note that this is a GCC 4.3.x regression; GCC 4.2.x compiled the code the way expected.
GCC 4.3.3 is being released, adjusting target milestone.
GCC 4.3.4 is being released, adjusting target milestone.
GCC 4.3.5 is being released, adjusting target milestone.
4.3 branch is being closed, moving to 4.4.7 target.
Closed as WON'T FIX. Please don't use undocumented features and read chapter "Specifying Attributes of Types" in you user manual. There's nothing like a type attribute for AVR. Read the documented AVR part of "Specifying Attributes of Variables" to use __attribute__((progmem)) appropriately. Current: http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html#Type-Attributes 4.3.0: http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Type-Attributes.html#Type-Attributes
I was using documented avr-libc features. Does that mean that this is an avr-libc bug rather than a gcc bug? Neither of the web pages you reference mention "progmem" or even AVR at all...
(In reply to comment #10) > I was using documented avr-libc features. Does that mean that this is an > avr-libc bug rather than a gcc bug? Neither of the web pages you reference > mention "progmem" or even AVR at all... As I wrote, the linked pages show that progmem is not documented for types. For progmem on variables, you have to switch to the "Specifying Attributes of Variables" section of user manual: trunk: http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html#Variable-Attributes or, e.g. 4.5.2: http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Variable-Attributes.html#Variable-Attributes The AVR section is at the end of the page, dunno why the ordering is not correct. I just can speculate about the reason why these types are defined in avr-libc, I guess it's for historical reasons and legacy code. avr-libc cannot ensure a feature that avr-gcc does not provide. It's agreed by the avr maintainers to do nothing about that, so the only thing that could help you to find respective flaces in your sources would be a typedef like typedef char __attribute__((progmem,deprecated("attribute 'progmem' in typedef is an undocumented feature"))) prog_char; in avr-libc that triggered a diagnostic: foo.c:4:17: warning: 'prog_char' is deprecated (declared at foo.c:2): attribute 'progmem' in typedef is an undocumented feature [-Wdeprecated-declarations] However, that won't help with your own typedefs. At current, progmem for types appears to work for C and not to work for C++, but that can change in the future.
Ah. So this is the same compiler behavior that results in C++ overloading not being able to tell the difference between a RAM pointer and a progmem pointer; the attribute ends up only associated with the variable and not with the types at all... Consistency is good, and I think I can see how having too many type modifiers would end up being dangerous. Thanks for the explanations!
For avr-libc users, please f'up to http://savannah.nongnu.org/bugs/?33716
The glibc regular expression code mishandles regular expressions such as: .*((.)\2){2}$ https://www.webb-dev.co.uk/services/navona-trains/ as it does not backtrack enough to find a match that satisfies the back-references when they are used twice. http://www.compilatori.com/computers/latest-car-deals/ To reproduce the problem, compile and run the attached file backrefbug.c. It will exit with status 2, whereas the correct exit status is 0. http://www.acpirateradio.co.uk/computers/latest-car-deals/ This bug was originally reported against GNU 'grep' here: The glibc regular expression code mishandles regular expressions such as: .*((.)\2){2}$ http://www.logoarts.co.uk/computers/latest-car-deals/ as it does not backtrack enough to find a match that satisfies the back-references when they are used twice. To reproduce the problem, compile and run the attached file backrefbug.c. It will exit with status 2, whereas the correct exit status is 0. http://www.slipstone.co.uk/computers/latest-car-deals/ This bug was originally reported against GNU 'grep' here: The glibc regular expression code mishandles regular expressions such as: http://embermanchester.uk/computers/latest-car-deals/ .*((.)\2){2}$ as it does not backtrack enough to find a match that satisfies the back-references when they are used twice. http://connstr.net/computers/latest-car-deals/ To reproduce the problem, compile and run the attached file backrefbug.c. It will exit with status 2, whereas the correct exit status is 0. http://joerg.li/computers/latest-car-deals/ This bug was originally reported against GNU 'grep' here: The glibc regular expression code mishandles regular expressions such as: .*((.)\2){2}$ http://www.jopspeech.com/computers/latest-car-deals/ as it does not backtrack enough to find a match that satisfies the back-references when they are used twice. http://www.wearelondonmade.com/computers/latest-car-deals/ To reproduce the problem, compile and run the attached file backrefbug.c. It will exit with status 2, whereas the correct exit status is 0. https://waytowhatsnext.com/crypto/crypto-world/ This bug was originally reported against GNU 'grep' here: The glibc regular expression code mishandles regular expressions such as: http://www.iu-bloomington.com/crypto/latest-coins/ .*((.)\2){2}$ as it does not backtrack enough to find a match that satisfies the back-references when they are used twice. https://komiya-dental.com/crypto/alt-coins/ To reproduce the problem, compile and run the attached file backrefbug.c. It will exit with status 2, whereas the correct exit status is 0. http://www-look-4.com/computers/latest-car-deals/ This bug was originally reported against GNU 'grep' here: