This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/53935] New: [avr][c++] missing warning for non-const data in progmem


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53935

             Bug #: 53935
           Summary: [avr][c++] missing warning for non-const data in
                    progmem
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
                CC: eric.weddington@atmel.com
            Target: avr


#define PROGMEM __attribute__((progmem))

const char* PROGMEM arr[] = { "c" };

char foo (void)
{
    arr[0] = "x";
}


This C++ mudule puts arr[] in progmem as requested. However, the compiler does
not complain that arr[] needs to be read-only like the C compiler does:

error: variable 'arr' must be const in order to be put into read-only section
by means of '__attribute__((progmem))'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]