http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54362
Bug #: 54362 Summary: COND_EXPR not understood by either alias or ITM Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: pins...@gcc.gnu.org Take this slightly modified gcc.dg/tm/memopt-12.c : /* { dg-do compile } */ /* { dg-options "-fgnu-tm -O3 -fdump-tree-tmmark" } */ extern int test(void) __attribute__((transaction_safe)); extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe)); struct large { int foo[500]; }; int f(int j) { int *p1, *p2, *p3; p1 = malloc (sizeof (*p1)*5000); __transaction_atomic { _Bool t; int i = 1; *p1 = 0; p2 = malloc (sizeof (*p2)*6000); *p2 = 1; t = test(); for (i = 0;i < j;i++) { /* p3 = PHI (p1, p2) */ if (t) p3 = p1; else p3 = p2; /* Since both p1 and p2 are thread-private, we can inherit the logging already done. No ITM_W* instrumentation necessary. */ *p3 = 555; } } return p3[something()]; } /* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */ /* { dg-final { cleanup-tree-dump "tmmark" } } */ --- CUT --- It currently fails because the aliasing code does not understand that p3 cannot alias only local memory. I found this while adding support to phiopt to convert some phi's into COND_EXPR.