The following fixes points-to analysis which ignores the fact that
volatile qualified refs can result in any pointer.
* tree-ssa-structalias.cc (get_constraint_for_1): For
volatile referenced or decls use ANYTHING.
* gcc.dg/tree-ssa/alias-38.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int x;
+int y;
+
+int main ()
+{
+ int *volatile p = &x;
+ return (p != &y);
+}
+
+/* { dg-final { scan-tree-dump " != &y" "optimized" } } */
+/* { dg-final { scan-tree-dump-not "return 1;" "optimized" } } */
}
case tcc_reference:
{
+ if (TREE_THIS_VOLATILE (t))
+ /* Fall back to anything. */
+ break;
+
switch (TREE_CODE (t))
{
case MEM_REF:
}
case tcc_declaration:
{
+ if (VAR_P (t) && TREE_THIS_VOLATILE (t))
+ /* Fall back to anything. */
+ break;
get_constraint_for_ssa_var (t, results, address_p);
return;
}