marlin "If Z_MAX is set to a negative value, and Z_DUAL_STEPPER_DRIVERS is enabled, the compiler complains about undeclared variable.

The user do not wants to use Z_MAX, but instead uses two Z_MIN endstops.In this situation, enabling Z_DUAL_STEPPER_DRIVERS which by default enables Z_DUAL_ENDSTOPS leads to a compiler error due to two variables that are uninitialized. Issue 1911: https://github.com/MarlinFirmware/Marlin/issues/1911"
Bug fixed by commit 7336e6df070
Type UndeclaredIdentifier
Config "Z_DUAL_STEPPER_DRIVERS" (1st degree)
Fix-in mapping
Location movement/
#include <stdbool.h>
#include <stdio.h>

#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define Z_STEP_PIN 1
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN))

#define WRITE {printf("making pin high or low");}

#ifdef Z_DUAL_STEPPER_DRIVERS

  #define Z_DUAL_ENDSTOPS

  #ifdef Z_DUAL_ENDSTOPS
    #define Z_MIN 1
    #define Z_MAX -1
  #endif

#endif // Z_DUAL_STEPPER_DRIVERS

#ifdef Z_DUAL_ENDSTOPS
  locked_z_motor = false, 
  locked_z2_motor = false;
#endif

#if HAS_Z_MIN
  static bool old_z_min_endstop = false;
#endif

#if HAS_Z_MAX
  static bool old_z_max_endstop = false;
#endif

#ifdef Z_DUAL_ENDSTOPS
  static bool old_z2_min_endstop = false;
  static bool old_z2_max_endstop = false;
#endif

void function() 
{
#ifdef Z_DUAL_STEPPER_DRIVERS
  #ifdef Z_DUAL_ENDSTOPS
    if (!old_z_max_endstop && !locked_z_motor) WRITE;
    if (!old_z2_max_endstop && !locked_z2_motor) WRITE;
  #endif
#endif
}

void main(){}
diff --git a/simple/7336e6d.c b/simple/7336e6d.c
--- a/simple/7336e6d.c
+++ b/simple/7336e6d.c
@@ -24,13 +24,8 @@
   locked_z2_motor = false;
 #endif
 
-#if HAS_Z_MIN
   static bool old_z_min_endstop = false;
-#endif
-
-#if HAS_Z_MAX
   static bool old_z_max_endstop = false;
-#endif
 
 #ifdef Z_DUAL_ENDSTOPS
   static bool old_z2_min_endstop = false;
#include <stdbool.h>
#include <stdio.h>

#define PIN_EXISTS(PN) (defined(PN##_PIN) && PN##_PIN >= 0)
#define Z_STEP_PIN 1
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN))

#define WRITE {printf("%s", "making pin high or low");}

#ifdef Z_DUAL_STEPPER_DRIVERS

  #define Z_DUAL_ENDSTOPS

  #ifdef Z_DUAL_ENDSTOPS
    #define Z_MIN 1
    #define Z_MAX -1
  #endif

#endif // Z_DUAL_STEPPER_DRIVERS

void main()
{
#ifdef Z_DUAL_ENDSTOPS
  locked_z_motor = false, 
  locked_z2_motor = false;
#endif

#if HAS_Z_MIN
  static bool old_z_min_endstop = false;
#endif

#if HAS_Z_MAX
  static bool old_z_max_endstop = false;
#endif

#ifdef Z_DUAL_ENDSTOPS
  static bool old_z2_min_endstop = false;
  static bool old_z2_max_endstop = false;
#endif

#ifdef Z_DUAL_STEPPER_DRIVERS
  #ifdef Z_DUAL_ENDSTOPS
    if (!old_z_max_endstop && !locked_z_motor) WRITE;
    if (!old_z2_max_endstop && !locked_z2_motor) WRITE;
  #endif
#endif
}
. call  stepper.cpp:701:  AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN,0); // Function macro
. 166: ERROR: if (!(old_z_max_endstop && (count_direction[Z_AXIS] > 0)) && !locked_z_motor) Z_STEP_WRITE(v); \