Summary: | AVR: String incorrectly placed in flash instead of RAM when building with -ffunction-sections | ||
---|---|---|---|
Product: | gcc | Reporter: | ZK <zakkemble> |
Component: | target | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | gjl |
Priority: | P3 | ||
Version: | 6.1.0 | ||
Target Milestone: | --- | ||
Host: | Target: | avr | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | ||
Attachments: | Test source code |
Created attachment 38436 [details] 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