https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105753

User99627 <user99627 at gmx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |user99627 at gmx dot com

--- Comment #10 from User99627 <user99627 at gmx dot com> ---
Created attachment 54342
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54342&action=edit
Complete Arduino compile trace after compiling the sample sketch (see comment)

I'm running Manjaro and I cannot chose which version of avr-gcc I run on my
system. It currently is avr-gcc 12.2.0. As a consequence I cannot run most
Arduino sketches either, so long as I'm using the system AVR compiler.

Here's a sample sketch that exhibits the error (see attachments):

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  enum { OPEN, CLOSE };

  static uint32_t prevMillis;  // Unsigned long, not int! ;)
  static uint16_t interval;
  static uint8_t state;        // Defaults to OPEN

  uint32_t currentMillis = millis();
  if (currentMillis - prevMillis >= interval)
  {
    prevMillis = currentMillis;
    // Could use a switch/case here:
    if (state == OPEN)
    {
      interval = random(3000, 10000);
      Serial.print("interval blink : ");
      Serial.println(interval);
      state = CLOSE;
    }
    if (state == CLOSE)
    {
      interval = 300;
      Serial.println("open");
      state = OPEN;
    }
  }
}

Reply via email to