Issue 133579
Summary [AVR] `-mrelax` does not work for a simple LED blink program
Labels backend:AVR
Assignees benshi001
Reporter benshi001
    the following a.cc 
```
// clang --target=avr -gdwarf-4 --sysroot /data/home/bennshi/.arduino15/packages/arduino/tools/avr-gcc/ a.c -mrelax -Os -Wall -mmcu=atmega328
volatile unsigned int bas[200] = {0x20, 0x00, 60000};

void delay(unsigned int a) {
        for (volatile int i = 0; i < a; i++) {}
}

int main() {
        volatile char *p0 = (char *) 0x24;
 volatile char *p1 = (char *) 0x25;
        *p0 = 0x20;
        for (;;)  {
                delay(bas[2]);
                *p1 = bas[0];
 delay(bas[2]);
                *p1 = bas[1];
        }
 return 0;
}
```

if it is built with `-mrelax`, we can not see the LED blinking, with `-mno-relax` it works.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to