Issue 129201
Summary [alias] will bring in correctness when 2 objects part overlap
Labels new issue
Assignees
Reporter vfdff
    * test: https://godbolt.org/z/Peb3G1zWx
```
typedef struct {
    int a;
    int b;
} S;

S g_info;

__attribute__((noinline))
int foo1(S * s)
{
 int start = g_info.a;
   s->b = 0;
   int end = g_info.a;

   return end - start;
}

```

* Now both gcc and clang think **s->b** will not alias to **g_info.a**, so start and end are same value, and return 0 derectlly.
 But when &g_info  and s are part overlap, **s->b** and **g_info.a** may be point to same address ?

 - I already use -Wall to report all warning, but the **dangling pointer** is not identified by clang
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to