https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70999
Bug ID: 70999 Summary: String incorrectly placed in flash instead of RAM when building with -ffunction-sections Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: gigo121 at gmail dot com Target Milestone: --- Created attachment 38436 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38436&action=edit Test source code When building with AVR-GCC 6.1.0, -ffunction-sections and any optimization level other than -O0 then strings that are passed as a parameter to a function like puts("whatever") will be stored in flash instead of RAM. However, this will correctly store myString in RAM with -ffunction-sections: static const char myString[] = "whatever"; puts(myString); avr-gcc -mmcu=atmega328 -Wall -Wextra -O1 -ffunction-sections main.c