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

    <tr>
        <th>Summary</th>
        <td>
            [macOs][M1] localtime_r asan failed
        </td>
    </tr>

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

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

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

<pre>
    I have a quite small self-contained repro. See attached code in the bottom. 

It is quite interesting the code has no issue on Linux (both x86_64 and arm) and macOS (x86_64). So it is not clear to me whether this is due to M1 specific reason or clang asan support on that platform. 

```
// to repro on macOS M1
// $ clang -fsanitize=address -g main.c && ASAN_OPTIONS=detect_leaks=1 ./a.out
#include <time.h>

int main() {
        time_t t = 1553711518;
        struct tm r;
        localtime_r(&t, &r);
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkU91u8zYMfRr6hohhSf7LhS_azwtQYG0HZPeBLDOxOlnKJLrt9vSDnWzrOsPwHw_POaRJnZK9eKIOqkeo-kwvPIXYfVp6-8iGMP7RPeGk3wk1_r5YJkyzdg4TufPOBM_aehox0jWGHI9EqJm1mWhEE0ZC65EnwiEwhzlHKHooHm7XJ0ab7qTWM0VKbP1lw2-5k07oA9qUFsLg8Wfrl08E2Q6BJ_xs61NdovYj6jiD3G-PszavxxVzC4Pc53gMaDctHxiNIx2RA86EHxPxRBF5smmNjwutkWeB6UrGnq3BSDoFjyGicdpfUCftMS3Xa4i8euJJM16d5nOI3-qDurift1d5AHlY-bdmrck3s8_iPwCQ5V1rd07aW7Z_Eqhej2OklHB3wVlbnxsEWYOs8eH48HJ6_eXXp9eXI6h-JCbDJ0f6twSqF5iDPOg8LPy3irLeuGUkBPWD7Uz5BOqnr8at500DZLu2FZrH23e8H2vSiZERVI-iqlQjRCVaUN9wieNiGHnG-L-YC0a7jShuMjWD_LGWFEHu_0FD03_rZTZ2atyrvc6oE3Ujy0qoQmRTJ8jIQqjmrAuqi6Yqq_PY1KIt66oQqh4y28lCSiGVKETZSpErKutSDFKX-7qp2wHKgmZtXe7c-5yHeMm2yeuqfVO1mdMDubRtiZSePm5jCVKuSxO7NWc3LJcEZeFs4vQvC1t223qtvztB1UP1-Cyg6r824TZYZ20djdkSXTcxXxOo-1RcLE_LkJswgzyszPfb7hrDGxkGedj8JJCHze9fAQAA__8psyj0">