This testcase fails: /* { dg-do compile } */ /* { dg-options "-O2 -fno-delete-null-pointer-checks -fdump-tree-optimized" } */
int f(int *p) { int a = *p; int *null = 0; *null = 5; return *p == a; } /* { dg-final { scan-tree-dump-times " = \\\*p" 2 "optimized" } } */ /* { dg-final { scan-tree-dump-not "return 1" "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ This testcase is important because targets that are always MMU-less (like AVR) will always have -fdelete-null-pointer-checks disabled, so the wrong code bug will happen with -O2. IMO it is a P2. -- Summary: [4.2/4.3/4.4 Regression] NULL pointers always considered distinct by PTA, even with -fno-delete-null-pointer- checks Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bonzini at gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38984