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

    <tr>
        <th>Summary</th>
        <td>
            [sanitizers] [ASAN] False negative on global OOB
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          pskrgag
      </td>
    </tr>
</table>

<pre>
    Consider following code:

```c
char global[100];

void foo(void)
{
   global[101] = 10;
}
```

I'd expect to see ASAN report in such case, since there is obvious global OOB access. Suddenly, llvm does not insert any instrumentation for such access on x86, but inserts it on arm64. I tracked down it to `AddressSanitizer::isSafeAccess` function which optimizes away store instrumentation, since it think that access is in bounds. 

This is caused by the fact that `globalq var on x86 ends up having align 16, but on arm64 it has align 1. After aligning up 100 to 16, access is indeed becomes in-bound, but it's not really obvious. 

Alignment difference is caused by `LargeArrayMinWidth` being equal to 128 on x86 (even with `-mno-sse`).

Is it expected behavior? Since from my perspective it seems a bit odd...

(reproduced on trunk https://godbolt.org/z/vKd3fjWYK)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcVMGO2zgM_RrlQowhy4njHHzINAhQdHd7yALFHmWJttWxJVeUk6Zfv6CTdDIFglgCzfceH2lqItd5xFpsXsXmsNJz6kOsJ3qLne5WTbDX-lPw5CxGaMMwhIvzHZhgURR7IQ9CPv5LefuZ2930OkI3hEYPYvOaSyk2B1G8Pqecg7PQhiBUxUehdvfo9v4awDNCLjYHEMUBcvkOtD38Qf9M8FmorQX8OaFJkAIQIuxP-38g4hRiAueBZtOD0YRCfQJy3iCkHiOCIwjN2YWZ7hrg69dX0MYgUQan2Vr0w5WzhuE8gg1I4ANjEsYE2l_5mOI8ok86ueChDfHGd0OB4OFnVTJEMz8SCVzigI5juc7gM6SozRtasOHiOZYCiFLurY1IdNLeJfcLIzej2Ds66Rb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