1/* { dg-options "-fdump-tree-sanopt" } */
2/* { dg-do compile } */
3/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
4
5extern __UINT32_TYPE__ a;
6
7void
8foo ()
9{
10  /* Instrument a with access size 5.  */
11  int d = __builtin_memcmp (&a, "12345", 4);
12  /* This should not generate a __builtin___asan_report_store4 because
13     the reference to a has been already instrumented above with access
14     size 5.  */
15  a = 1;
16}
17
18/* { dg-final { scan-tree-dump-not "& 7" "sanopt" } } */
19/* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "sanopt" } } */
20/* { dg-final { cleanup-tree-dump "sanopt" } } */
21