In gcc.dg/Wuse-after-free-2.c we try to detect a use-after-free. The
test's while loop is converted into a rawmemchr builtin making
it impossible to determine that the pointers *p and *q are related.
Therefore, disable the tree loop distribute patterns pass for this test.
gcc/testsuite/ChangeLog:
* gcc.dg/Wuse-after-free-2.c:
Add -fno-tree-loop-distribute-patterns in order to avoid
rawmemchr.
/* PR middle-end/104232 - spurious -Wuse-after-free after conditional free
{ dg-do compile }
- { dg-options "-O2 -Wall" } */
+ { dg-options "-O2 -Wall -fno-tree-loop-distribute-patterns" } */
void free (void*);
{
char *q = p;
+ /* -fno-tree-loop-distribute-patterns ensures this does not get converted
+ into rawmemchr (making q and p unrelated). */
while (*q)
++q;