https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106692
--- Comment #16 from anlauf at gcc dot gnu.org --- (In reply to anlauf from comment #15) > I have tried replacing TREE_VOLATILE by TREE_STATIC, i.e. > > + // Hack: prevent optimization of comparison of Cray pointers > (PR106692) > + if (expr->value.op.op1->expr_type == EXPR_VARIABLE > + && expr->value.op.op1->ts.type == BT_INTEGER > + && expr->value.op.op1->symtree > + && expr->value.op.op1->symtree->n.sym->attr.cray_pointer) > + TREE_STATIC (lse.expr) = 1; > [...] > > and this works too. The optimized dump shows that the above if () is > still optimized away at -Og and higher, unless there is a PRINT statement > in between. (Another missed optimization around PRINT statements?). Arghh. TREE_STATIC does NOT work. Commenting all PRINT statements breaks the code again... :-(