From c1d69df30ac8fd4ace480e289c639914b5653b80 Mon Sep 17 00:00:00 2001
From: Victor Oliveira <rhapsodyv@gmail.com>
Date: Sun, 6 Dec 2020 17:36:36 -0300
Subject: [PATCH] Avoid invalid memory optimizations (#20389)

When building for AVR, merge-all-constants can incorrectly combine constants stored in flash with constants stored in RAM. These have different access requirements, leading to undefined behavior during execution.
Co-authored-by: ellensp <ellensp@hotmail.com>
---
 platformio.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platformio.ini b/platformio.ini
index 0cff2dac606eb..237634a4546ca 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -203,7 +203,7 @@ extra_scripts      =
   pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
   pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py
   post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py
-build_flags        = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-all-constants
+build_flags        = -fmax-errors=5 -g -D__MARLIN_FIRMWARE__ -fmerge-constants
 lib_deps           =
 
 #