<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJylVkuT4ygM_jXORRUXBj8POfRju3ZOe5m7CwNO2HGblMFJ9_76FdhxkklS1TOTsh1A0of0IRCNkZ-bJ3DKOtA9mF6BacGMA_acGnreTTI7avyHQQnVu-4TrOODUxJarjvdb0GOCpwBqdtWDaiCEG4_OmiUl-4HI0eB6m7HezhyC-pjrwQCxPANGm1DG6UKtLUTlDDv79oBLzgtcyKJUooVslKklaTJeamYLMu0LZVKlUjyOCKvEXmavn-jD4gEHB2eJ_ZBCG5VxGadKCfzE7rqw4cLEaUv-MLBaIluIwltRMs4jiNaRex50g1C3WuHIrHjAyoqGdGXySqiT5I77vtjb_W2x-mt_k8hAkTFDAFnWUBAo-bTMxyxV-yUN1K0DqhsAWjNcKWpgy1BDd-kie-FeXEgos_4aB_EbA0Q5osyHM1eg6mPwmuCXmaJitep4T73Sqp2csf676JzEtmdGRzUNXdu0M3oVF2je_ggtfUBV9gMtdfFEeodCc9kRW_BwkS_DOat7oC5YRTuknxcV2guo8Tl0KavRxTU-H4BYpoL-B2USVSH0G6QgsoVUGAALpf2kXuT6pWDXvWd6z6wU93B1ZKVeVp4AS0nl2hFc5bhmzO_wJioQSlj10oVTdIiLVmelpPaOXdgtkivLdYJTbOKMEaDBbtI9p95mQHoZdTTSMxDNl5KDqbjTnfqKqaM4Mx13Yy6c7qvhekPanBTbqBkQfPxzVk2JQq7T1G1GBHcBTk-Cy2PjcqTUVr5XbrQ8tgiXywKWJ9Rqlu2lsWeUfMblVO6zgrlVQqF46kqfPgYy0nDk4GHgmmXaMsbWubp4iYsxKwVN48iypaI8un4mM35NepymuL5ejLEw5hmH-A_UfaCSUyXbERp9kzwbLocuQBcjqafDvJvrS8de8wWCUftdoCS9T8U1u_88OG1EM4XmrlALaUJc7PfKhvDqXhcKGFJ5L40bI2RvjrMEwzAe5xkxx0c1VLSHlWYiKa4Pf-K6JsdBH7HPR4qir9jMxWJFJh3ScZV2fC0KRThIsvbFGucpJUqEioUzdZYa8cPNGj8hn8THbo8He2whIglD2OKxX4PazN3vN8xxnJ2BOvZ2z3ZeWFa_JUkE4DLynzjblDPyA5vnafii4X6xP_CIVLdm-O8EP624KWt6TpzxN5vsPlVT36XzYY_JPNKdOay4Gzi0Tfuh5MSu-dOdevtDr7vkBN_S_r0F7HpIuRpE2bspB8Ex38oTMnOmB8Re1vJDZMVq_iKjw535kZ-jv12NQ7dZufc3oZt9obPFvfD2MSIiJ2uO5z-1uj7v5i82A33L4uNjKUkWe02QmRV0VSiSpuyaHKSC0IxVUnZ5g2t2mTV8UZ1doO7FbdGr47TFc5v5ex19ece6A0llJKEZqRKM5bEbZvwguQVIVkqWZ4jdQorYBd7nNgM29WwCZDNuLUo7LR19izkNtyXVHAYPXTadWrz3d8Pzyl4c4-dcvwX76SrEMomxPE_jZ9bWg>53401</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Test producing different output after commit a7a2860d0eee37d9e0fd0b6a8e3d884f8ee4ec16
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dyung
</td>
</tr>
</table>
<pre>
A test in one of our internal test suites recently started failing due to different output being produced than was expected. I bisected the issue to commit a7a2860d0eee37d9e0fd0b6a8e3d884f8ee4ec16.
Here is a reduced test case:
```
extern "C" void printf(...);
void init(char pred, void *data, unsigned size) {
unsigned char *bytes = (unsigned char *)data;
for (unsigned i = 0; i != size; ++i)
bytes[i] = pred + i;
}
typedef char schar;
typedef short __attribute__((ext_vector_type(2))) short2;
typedef schar __attribute__((ext_vector_type(2))) schar2;
typedef struct {
int b;
} union_uint_int;
typedef struct {
schar2 a;
} union_schar2_short;
typedef union {
short2 a;
int b;
} union_short2_int;
int main() {
short2 id38647{(short)263526363}, id38653{(short)92147483648},
id38654{(short)-1245903328};
union_schar2_short id38652;
id38652.a = 2;
volatile short2 id38650(__builtin_convertvector(id38652.a, short2));
short2 id38649(id38650 && id38653);
short2 id38648(id38649 * id38654);
short2 id38646(id38647 - id38648);
union_short2_int id38656;
union_uint_int id38658;
init(97, &id38658, sizeof(id38658));
id38656.b = id38658.b;
short2 id38645(id38646 + id38656.a);
printf("id38645:%x %x\n", id38645[0], id38645);
}
```
If compiled with `-O2 -mavx`, the output produced changes. Here is the output of a "good" compiler and what we expected:
```
$ ~/src/upstream/4c1dc65015ae8ba4b7e0ac56f4d88d29e712ce25-linux/bin/clang++ -O2 -mavx repro.cpp -o repro.good.out
$ ./repro.good.out
id38645:ffff805c 6463805c
```
But after a7a2860d0eee37d9e0fd0b6a8e3d884f8ee4ec16, the compiler is now producing the following:
```
$ ~/src/upstream/a7a2860d0eee37d9e0fd0b6a8e3d884f8ee4ec16-linux/bin/clang++ -O2 -mavx repro.cpp -o repro.bad.out
$ ./repro.bad.out
id38645:7a3c 64637a3c
```
@spatel-gh This was your commit, could you take a look?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVk2T4ygM_TXOhYoLg_HHIYfu6e3aOe1l7i5s5IQdt0kZnHT216_AjpNMkqqe6XLcYElP0kMgaqNOmxfiwDqie2J6IKYlZhxw5mDoZTfJ7KjxPxmggd51J2KdHBwo0krd6X5L1AjEGaJ028KAKgjh9qMjNXjpfjBqbFDd7WRPjtIS-NxDgwAx-U5qbcMYpUC0tRNUYz4-tCMyl6zIqKIAwHNVAm0VrTNZAFdFkbYFQApNksURfYvoy_T-G2NAJCIx4NmxT6KRFiI-60QZnZ8whU-fLokY-4Y_cjBaYdhIQhuxIo7jiJURf510g1D32qGo2ckBFUFF7NtkFbEXJZ3087G3etuje6v_A0QgUT5DkIssIKBRffIMR_wNJ8WdFK0DKl8AWjPcaOpgS1HDD1niZ8EvfojYKz7aJzFbExL8RQK_irdg6rPwmkQvXqL8bRq40x4UtFM41r8XnbPI7szgSFVJ5wZdjw6qCsPDB6mtDrjCZqi8Ln5h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