<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/133579>133579</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AVR] `-mrelax` does not work for a simple LED blink program
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AVR
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
benshi001
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
benshi001
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVEGPszYQ_TXDZUQ0jGEDBw5kU06VKvXQng044K7BkW2S3X9fmZDd_dqvp1oooNG89_xe7JHe63FRqobiBMydWvykiTJghuKcyDVM1tWf5aSzw0cdJoUXa4y962VEeeh7BGrghfaHGuAWuMXeyGXENA3SjSqAOMubw3Qc7tJd0hzT1H94Z21A4HaQQQK3k50VcNupJUoCtwfphlUvNiuA26vs3-SoPHC7l4HbYK3ZKjeXjn0fheWhx3R2ysh3TH_zmP4pjcF0nvs17iLMapSCS6DmZo0M2ihcly2JAfUSsJMeihMTQXFGEGeE44nemYBfkd5pe78QEcHxDOIUHUcqPeCgjPwALn-gk8BVpABqcF8X6xC4_JSPbXqTIhCn7fMV5fYJfNqeB8XxHNUev9RE2Cz1Alz-W-OTvJ9kVGuu9DDD5bMSQfTO-cPETxDZfyCKHbGvL_ItJvETq7EoNhv_2OZzPaPbw4fiDFz9SPVd7rGzR3P8n_bO_8GSfbE8O7ac0amwugV3X3v43487NfqCOqD22K3aBLzrMCG80H4IYxu_4l1hLxdcbECvFMZ79OsvZ-yMXt70Mm4tn8DFpk9spL5b9-YPyVCLoRKVTFSdHXPBBWUiT6a6E0OnuDiWfMmPVXbJ5UDVkbl8EYKzi0h0zcQFCa4yprLID_SSF1VRFsRDlQ8XgpzULLU5GHObD9aNifZ-VXUmRHGsEiM7ZfxzTsj-TS0DiKb54_d9Vrg6AtNuHT3kZLQP_osq6GC2IRP74536Hg0OVvktlWhyOy8SvZ6v5ls-eHV2dHJOVmfqKYSrB7HPmVGHae0OvZ2B2yi5v9Krs3-pPgC3m5U4JHY3t5r_DgAA__-HNGXk">