<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62900>62900</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Error code generated during unit address calculation
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          joyhou-hw
      </td>
    </tr>
</table>

<pre>
     https://godbolt.org/z/68dMPbcG3

```
int check(sa *para) {
  char *pcPtEnd = NULL;
  pcPtEnd =para->ptAddr + para->ptSize;
  if ((unsigned long)para->ptAddr >= (unsigned long)pcPtEnd) {  // overfollow check
    printf("error!\n");
  }
  return 0;
}
```
The check function adds pointers and then checks for overflow.
The getelementptr node is used in the generated IR, and the offset in the node is of the int type.
After optimization, (int) ptSize is compared with 0 and the printf error branch is entered. 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsU92OszgMfRpzY7VKAxS44KLztV2t9O1qtD8PEBIDmU0TlISpZp5-FejPaPRJCAi2zzk-xiIEPViiFsoXKI-ZmOPofPvmPkY3b8Zr1jn10eIY4xQgPwA_Az8PTnXOxK3zA_DzJ_DzvlZ_vHbytxzYEdjhdt-z27UctY0oR5L_Aa-DQOCHSXgBvEGoXtYURDkKv4TkazxZhZAf8c9_f_6E_JHyJZQANpCfpnhQKtW94PPT3_qTvpTpHoHXwOvZLi0rNM4OwJvvIPkpkf4qcSW-KUZczUD3Tr53xrjrrb0bIeLktY39wsrJe-eB76D8YYFz4M0XbVAd76-e4uwtskf0Eftm5z8jrXzYz1ZG7SwKpQJOTttIPqCwCuNIds0K2Du_ajXuun1iDBTJ0IVsnKJH6xShDjgHUqhtAsCBLHkRSeHvfwH_cQdG1_eB4j3rXun65ZimHT8mujEd-kge3RT1RX-KpDYhAa-1jcnQdVypXrrLJDwpvOo4InuwrWbi4iN2Xlg5pnRKzZLaYqbaXDV5IzJqd_u6qJtqVxfZ2FY71vdUFWWpVF_nkmRZ1l1XVVRW-33TZbrljOes5AXjZVMU20qwuupYtevyPO92OygYXYQ2W2PeL-mvz3QIM7V73jCWGdGRCcsCcW7pikswzbg8Zr5NNZtuHgIUzOgQwxMl6mioPS0dyWTf02k1e20HnK2OaayeQkApjJzNYl42e9N-W0odx7nbSncBfk4Ut8dm8u6NZAR-XoSFtK5J-P8BAAD__2hvPQ0">