(Solved) Strange behavior in IDE for STM32F103

I am using the STM32F103 (aka "Blue Pill") in the Arduino IDE (1.8.9 running Win 10). I've been using the STM32-patched Arduino IDE for several months now and it works well. However, I've had the following strange behavior:

int SWRValue;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  int VSWR100 = SWRValue * 100;
  // static float SWRValueOld = SWRValue;
  // static int whichBandOption;
  float SWRValueOld = SWRValue;
  int whichBandOption;
}

The code above compiles to 13028 bytes of flash. When you uncomment the static versions of the data definitions and comment out the non-static definitions, the code size jumps to 78376 bytes. Does anyone have a reason why this might happen??

I found that adding back the static modifier to the whichBandOption does not bloat the code size. So the culprit is the static float SWRValueOld definition. So, I can "fix" the problem, but the problem is no solved because I don't know why the problem exists in the first place.

It appears that the STM32 views a local static as evidence that the application is going to use threading so it pulls in the entire libstdc++ library automatically.

While it is true that initialization of local static variables happens in a thread-safe manner, I'm surprised that it makes such a huge difference.

Does it still do that if you compile with "--disable-threads"?

Pieter

Have not tried...I'm so far behind I need to catch up!