+2017-04-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/80275
+ * fold-const.c (split_address_to_core_and_offset): Handle
+ POINTER_PLUS_EXPR.
+
2017-04-03 Eric Botcazou <ebotcazou@adacore.com>
* tree-nested.c (get_descriptor_type): Make sure that the alignment of
&volatilep);
core = build_fold_addr_expr_loc (loc, core);
}
+ else if (TREE_CODE (exp) == POINTER_PLUS_EXPR)
+ {
+ core = TREE_OPERAND (exp, 0);
+ STRIP_NOPS (core);
+ *pbitpos = 0;
+ *poffset = TREE_OPERAND (exp, 1);
+ if (TREE_CODE (*poffset) == INTEGER_CST)
+ {
+ offset_int tem = wi::sext (wi::to_offset (*poffset),
+ TYPE_PRECISION (TREE_TYPE (*poffset)));
+ tem <<= LOG2_BITS_PER_UNIT;
+ if (wi::fits_shwi_p (tem))
+ {
+ *pbitpos = tem.to_shwi ();
+ *poffset = NULL_TREE;
+ }
+ }
+ }
else
{
core = exp;
+2017-04-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/80275
+ * g++.dg/opt/pr80275.C: New testcase.
+
2017-04-03 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR testsuite/79356
--- /dev/null
+// { dg-do compile { target c++14 } }
+// { dg-options "-O2 -fdump-tree-optimized" }
+
+#include <algorithm>
+
+int g()
+{
+ return 1234;
+}
+
+int f2()
+{
+ return std::min({1, g(), 4});
+}
+
+// { dg-final { scan-tree-dump "return 1;" "optimized" } }