<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69328>69328</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bug in mips64el: Varied Output by Clang Optimization Levels
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
godjhh
</td>
</tr>
</table>
<pre>
## Proof of Concept
```
#include <stdio.h>
long long var_0 = 9129318035724831661LL;
unsigned long long var_6 = 15327265744474054469ULL;
int var_14 = 0;
unsigned int var_17 = 1;
unsigned int arr_0 [8];
unsigned char arr_1 [8] = { 0 };
unsigned long long arr_9 [8] [8] ;
unsigned long long var_24 = 1;
signed char arr_4 [8] [8];
unsigned int arr_22 [20] [20] ;
void test(unsigned long long var_6, int var_14, unsigned int var_17, unsigned int arr_0 [8] , unsigned char arr_1 [8]) {
for (unsigned int i_0 = var_14; i_0 < ((((unsigned int) var_0)) - (1626475429U))/*8*/; i_0 += 4)
{
printf("var0: %d\n", ((unsigned int)(var_0)-(1626475429U)));
arr_4[i_0][i_0] = arr_1 [i_0];
for (int i_1 = (int)((( arr_0 [i_0])) - (2482776649ULL))/*2*/; i_1 < 4; i_1 += 2)
{
printf("i_1: %llu\n", ((size_t)(2482776651U))-(2482776649ULL));
}
}
var_24 = (int) ((var_6));
for (long long int i_4 = 0; i_4 < 20; i_4 += 4)
{
arr_22 [i_4] [i_4] = var_17;
}
}
int main() {
for (size_t i_0 = 0; i_0 < 8; ++i_0)
arr_0 [i_0] = 2482776651U;
test(var_6, var_14, var_17, arr_0 , arr_1 );
printf("var_24 value: %llu\n", var_24);
}
```
### Expected Behavior
In the first for loop, the result of the condition expression `((((unsigned int) var_0)) - (1626475429U))` is 8. This is verified through the output of the following printf() function, which consequently determines the number of loop iterations.
In the second for loop, the calculation `(int)((( arr_0 [i_0])) - (2482776649ULL))` results in a value of 2 for i_1. This is also confirmed through the output of the printf() function, which aids in determining the number of times the loop will execute.
This code also performs unknown behavior.
Can you tell me why these results are coming out?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykls2O4ygQx5-GXFBHdvn7kEMnmZZWGmn2sLPXFrFxzCyGLOB09zz9qjCxnY_eOUwUpcGuKv78qgqaWSuOivMNybYk26_Y4DptNkfd_Oi61UE3HxsS7Un0fPULCYGE_mm0bqlu6U6rmp9ceJlH4XuxFaqWQ8MpSXbWNUKvO5J8WcaTWh2p_zkz8xpRkuxpFUOVxGWUZAWkZRLnefz1K0m2o8egvOyGXrvm3jXOEiggz4o0TYs0ytI0r74vnIVy3jpOvXl0H3WyKMaAjy2Y8WKzbUmy_b1J3THjbeKLjQ9Gii2NKCkeeMybQbdqdpvcP_fweiG90XsrJb2N-fnOANAGomAcBhfz8fesRUMdt45A-VlKCOxmninOHmC-e3zFll69vudKoEKsoyZKKW21oUtJGFGEwgo6km14skPL6bt0wbC-IAlUOH5CyziHPC2yFKrv42MCLwSeSwLPOLqEhS2ulXplk6xZ48kI5Vq_JJyZiUjyTAlkDcl2igDgfh_qIVBeFD09FlNNKRoTTrKteMXcTQNPYeIXXl7nlYZP4Djii8fy9dNRyvidcxViLWhBWkJR5HnqG3DBC5a8Yp-GdJqM8OAa3ucAxWsc-Ek53BG04id_DYIvcrI48Hr6ROPEEPt0kb_FZNFvE5OwZKj760gzzrlBRrDzMRQmOwrz7BeVFD5zxwrM-X45uhR9cSWGFPsQcNrWfDz2TCi_l8eNNTKdWipadlOJE1QNvh7ucnhTLT7AMi_3lRgOmOk0mU-S-fAIUcMIa-ga_U3DYebOTA78YeGMBssQM6Kb221xH-KV-OX9xGvHG7rlHTsLbe4vzz8UdR2nrTDWeZ5S6xOuik8Nt4N0eKfirNaqEU5oRfn7yXBrcYhr_96BlUdUWFqu6V-dsDg8cyNawRvqOqOHY-cX14M7DZOUVkup34Q6LklWtB1UjQJR_1sn6g41W_7vwJWTH7ThjpteKG59EDX0B24wJ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