[committed] Backports to gcc-9-branch
diff mbox series

Message ID 20191021115239.GV2116@tucnak
State New
Headers show
Series
  • [committed] Backports to gcc-9-branch
Related show

Commit Message

Jakub Jelinek Oct. 21, 2019, 11:52 a.m. UTC
Hi!

I've backported following 18 patches (20 trunk commits in total)
from trunk to gcc-9-branch, bootstrapped/regtested on x86_64-linux and
i686-linux and committed to gcc-9-branch.

	Jakub
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-08-02  Jakub Jelinek  <jakub@redhat.com>

	* quadmath.h (M_Eq, M_LOG2Eq, M_LOG10Eq, M_LN2q, M_LN10q, M_PIq,
	M_PI_2q, M_PI_4q, M_1_PIq, M_2_PIq, M_2_SQRTPIq, M_SQRT2q,
	M_SQRT1_2q): Use two more decimal places.
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-08-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/91401
	* c-parser.c (c_parser_omp_clause_dist_schedule): Fix up typos in the
	check_no_duplicate_clause call.  Comment it out, instead emit a
	warning for duplicate dist_schedule clauses.

	* parser.c (cp_parser_omp_clause_dist_schedule): Comment out the
	check_no_duplicate_clause call, instead emit a warning for duplicate
	dist_schedule clauses.

	* c-c++-common/gomp/pr91401-1.c: New test.
	* c-c++-common/gomp/pr91401-2.c: New test.

--- gcc/c/c-parser.c	(revision 274225)
+++ gcc/c/c-parser.c	(revision 274226)
@@ -14811,7 +14811,10 @@ c_parser_omp_clause_dist_schedule (c_par
     c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
 			       "expected %<,%> or %<)%>");
 
-  check_no_duplicate_clause (list, OMP_CLAUSE_SCHEDULE, "schedule");
+  /* check_no_duplicate_clause (list, OMP_CLAUSE_DIST_SCHEDULE,
+				"dist_schedule"); */
+  if (omp_find_clause (list, OMP_CLAUSE_DIST_SCHEDULE))
+    warning_at (loc, 0, "too many %qs clauses", "dist_schedule");
   if (t == error_mark_node)
     return list;
 
--- gcc/cp/parser.c	(revision 274225)
+++ gcc/cp/parser.c	(revision 274226)
@@ -35258,8 +35258,10 @@ cp_parser_omp_clause_dist_schedule (cp_p
   else if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_COMMA_CLOSE_PAREN))
     goto resync_fail;
 
-  check_no_duplicate_clause (list, OMP_CLAUSE_DIST_SCHEDULE, "dist_schedule",
-			     location);
+  /* check_no_duplicate_clause (list, OMP_CLAUSE_DIST_SCHEDULE,
+				"dist_schedule", location); */
+  if (omp_find_clause (list, OMP_CLAUSE_DIST_SCHEDULE))
+    warning_at (location, 0, "too many %qs clauses", "dist_schedule");
   OMP_CLAUSE_CHAIN (c) = list;
   return c;
 
--- gcc/testsuite/c-c++-common/gomp/pr91401-1.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/gomp/pr91401-1.c	(revision 274226)
@@ -0,0 +1,10 @@
+/* PR c/91401 */
+
+void
+foo (void)
+{
+  int i;
+  #pragma omp distribute parallel for schedule (static) dist_schedule (static)
+  for (i = 0; i < 64; i++)
+    ;
+}
--- gcc/testsuite/c-c++-common/gomp/pr91401-2.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/gomp/pr91401-2.c	(revision 274226)
@@ -0,0 +1,15 @@
+#pragma omp declare target
+void f0 (void);
+
+void
+f1 (void)
+{
+  int i;
+  #pragma omp distribute dist_schedule(static) dist_schedule(static)	/* { dg-warning "too many 'dist_schedule' clauses" } */
+  for (i = 0; i < 8; ++i)
+    f0 ();
+  #pragma omp distribute dist_schedule(static,2) dist_schedule(static,4) /* { dg-warning "too many 'dist_schedule' clauses" } */
+  for (i = 0; i < 8; ++i)
+    f0 ();
+}
+#pragma omp end declare target
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-02  Jakub Jelinek  <jakub@redhat.com>

	PR go/91617
	* fold-const.c (range_check_type): For enumeral and boolean
	type, pass 1 to type_for_size langhook instead of
	TYPE_UNSIGNED (etype).  Return unsigned_type_for result whenever
	etype isn't TYPE_UNSIGNED INTEGER_TYPE.
	(build_range_check): Don't call unsigned_type_for for pointer types.
	* match.pd (X / C1 op C2): Don't call unsigned_type_for on
	range_check_type result.

	2019-08-29  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/91351
	* tree-cfg.c (generate_range_test): Use range_check_type instead of
	unsigned_type_for.
	* tree-cfgcleanup.c (convert_single_case_switch): Punt if
	range_check_type returns NULL.
	* tree-switch-conversion.c (switch_conversion::build_one_array):
	Use range_check_type instead of unsigned_type_for, don't perform
	linear opt if it returns NULL.
	(bit_test_cluster::find_bit_tests): Formatting fix.
	(bit_test_cluster::emit): Use range_check_type instead of
	unsigned_type_for.
	(switch_decision_tree::try_switch_expansion): Punt if range_check_type
	returns NULL.

	* g++.dg/opt/pr91351.C: New test.

--- gcc/tree-cfgcleanup.c	(revision 275025)
+++ gcc/tree-cfgcleanup.c	(revision 275026)
@@ -101,6 +101,8 @@ convert_single_case_switch (gswitch *swt
   if (high)
     {
       tree lhs, rhs;
+      if (range_check_type (TREE_TYPE (index)) == NULL_TREE)
+	return false;
       generate_range_test (bb, index, low, high, &lhs, &rhs);
       cond = gimple_build_cond (LE_EXPR, lhs, rhs, NULL_TREE, NULL_TREE);
     }
--- gcc/tree-switch-conversion.c	(revision 275025)
+++ gcc/tree-switch-conversion.c	(revision 275026)
@@ -605,7 +605,9 @@ switch_conversion::build_one_array (int
   vec<constructor_elt, va_gc> *constructor = m_constructors[num];
   wide_int coeff_a, coeff_b;
   bool linear_p = contains_linear_function_p (constructor, &coeff_a, &coeff_b);
-  if (linear_p)
+  tree type;
+  if (linear_p
+      && (type = range_check_type (TREE_TYPE ((*constructor)[0].value))))
     {
       if (dump_file && coeff_a.to_uhwi () > 0)
 	fprintf (dump_file, "Linear transformation with A = %" PRId64
@@ -613,13 +615,12 @@ switch_conversion::build_one_array (int
 		 coeff_b.to_shwi ());
 
       /* We must use type of constructor values.  */
-      tree t = unsigned_type_for (TREE_TYPE ((*constructor)[0].value));
       gimple_seq seq = NULL;
-      tree tmp = gimple_convert (&seq, t, m_index_expr);
-      tree tmp2 = gimple_build (&seq, MULT_EXPR, t,
-				wide_int_to_tree (t, coeff_a), tmp);
-      tree tmp3 = gimple_build (&seq, PLUS_EXPR, t, tmp2,
-				wide_int_to_tree (t, coeff_b));
+      tree tmp = gimple_convert (&seq, type, m_index_expr);
+      tree tmp2 = gimple_build (&seq, MULT_EXPR, type,
+				wide_int_to_tree (type, coeff_a), tmp);
+      tree tmp3 = gimple_build (&seq, PLUS_EXPR, type, tmp2,
+				wide_int_to_tree (type, coeff_b));
       tree tmp4 = gimple_convert (&seq, TREE_TYPE (name), tmp3);
       gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
       load = gimple_build_assign (name, tmp4);
@@ -1351,7 +1352,7 @@ bit_test_cluster::find_bit_tests (vec<cl
 						  entire));
 	}
       else
-	for (int i = end - 1; i >=  start; i--)
+	for (int i = end - 1; i >= start; i--)
 	  output.safe_push (clusters[i]);
 
       end = start;
@@ -1484,7 +1485,7 @@ bit_test_cluster::emit (tree index_expr,
   unsigned int i, j, k;
   unsigned int count;
 
-  tree unsigned_index_type = unsigned_type_for (index_type);
+  tree unsigned_index_type = range_check_type (index_type);
 
   gimple_stmt_iterator gsi;
   gassign *shift_stmt;
@@ -1794,7 +1795,8 @@ switch_decision_tree::try_switch_expansi
   tree index_type = TREE_TYPE (index_expr);
   basic_block bb = gimple_bb (m_switch);
 
-  if (gimple_switch_num_labels (m_switch) == 1)
+  if (gimple_switch_num_labels (m_switch) == 1
+      || range_check_type (index_type) == NULL_TREE)
     return false;
 
   /* Find the default case target label.  */
--- gcc/tree-cfg.c	(revision 275025)
+++ gcc/tree-cfg.c	(revision 275026)
@@ -9221,7 +9221,7 @@ generate_range_test (basic_block bb, tre
 		     tree *lhs, tree *rhs)
 {
   tree type = TREE_TYPE (index);
-  tree utype = unsigned_type_for (type);
+  tree utype = range_check_type (type);
 
   low = fold_convert (utype, low);
   high = fold_convert (utype, high);
--- gcc/fold-const.c	(revision 275298)
+++ gcc/fold-const.c	(revision 275299)
@@ -4938,10 +4938,9 @@ range_check_type (tree etype)
   /* First make sure that arithmetics in this type is valid, then make sure
      that it wraps around.  */
   if (TREE_CODE (etype) == ENUMERAL_TYPE || TREE_CODE (etype) == BOOLEAN_TYPE)
-    etype = lang_hooks.types.type_for_size (TYPE_PRECISION (etype),
-					    TYPE_UNSIGNED (etype));
+    etype = lang_hooks.types.type_for_size (TYPE_PRECISION (etype), 1);
 
-  if (TREE_CODE (etype) == INTEGER_TYPE && !TYPE_OVERFLOW_WRAPS (etype))
+  if (TREE_CODE (etype) == INTEGER_TYPE && !TYPE_UNSIGNED (etype))
     {
       tree utype, minv, maxv;
 
@@ -4959,6 +4958,8 @@ range_check_type (tree etype)
       else
 	return NULL_TREE;
     }
+  else if (POINTER_TYPE_P (etype))
+    etype = unsigned_type_for (etype);
   return etype;
 }
 
@@ -5049,9 +5050,6 @@ build_range_check (location_t loc, tree
   if (etype == NULL_TREE)
     return NULL_TREE;
 
-  if (POINTER_TYPE_P (etype))
-    etype = unsigned_type_for (etype);
-
   high = fold_convert_loc (loc, etype, high);
   low = fold_convert_loc (loc, etype, low);
   exp = fold_convert_loc (loc, etype, exp);
--- gcc/match.pd	(revision 275298)
+++ gcc/match.pd	(revision 275299)
@@ -1569,8 +1569,6 @@ (define_operator_list COND_TERNARY
 	tree etype = range_check_type (TREE_TYPE (@0));
 	if (etype)
 	  {
-	    if (! TYPE_UNSIGNED (etype))
-	      etype = unsigned_type_for (etype);
 	    hi = fold_convert (etype, hi);
 	    lo = fold_convert (etype, lo);
 	    hi = const_binop (MINUS_EXPR, etype, hi, lo);
--- gcc/testsuite/g++.dg/opt/pr91351.C	(nonexistent)
+++ gcc/testsuite/g++.dg/opt/pr91351.C	(revision 275026)
@@ -0,0 +1,38 @@
+// PR tree-optimization/91351
+// { dg-do run }
+// { dg-options "-O2 -fstrict-enums" }
+
+enum E { e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12,
+	 e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25 };
+
+__attribute__((noipa)) void
+foo ()
+{
+  __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+bar ()
+{
+}
+
+__attribute__((noipa)) void
+baz (E e)
+{
+  switch (e)
+    {
+    case e11:
+    case e12:
+    case e13: foo (); break;
+    case e24: break;
+    case e14:
+    case e15: break;
+    default: bar (); break;
+    }
+}
+
+int
+main ()
+{
+  baz (e3);
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-01  Jakub Jelinek  <jakub@redhat.com>

	PR lto/91572
	* tree.c (find_decls_types_in_node): Also walk TREE_PURPOSE of
	GIMPLE_ASM TREE_LIST operands.

	* g++.dg/lto/pr91572_0.C: New test.

--- gcc/tree.c	(revision 275265)
+++ gcc/tree.c	(revision 275266)
@@ -6142,6 +6142,13 @@ find_decls_types_in_node (struct cgraph_
 	    {
 	      tree arg = gimple_op (stmt, i);
 	      find_decls_types (arg, fld);
+	      /* find_decls_types doesn't walk TREE_PURPOSE of TREE_LISTs,
+		 which we need for asm stmts.  */
+	      if (arg
+		  && TREE_CODE (arg) == TREE_LIST
+		  && TREE_PURPOSE (arg)
+		  && gimple_code (stmt) == GIMPLE_ASM)
+		find_decls_types (TREE_PURPOSE (arg), fld);
 	    }
 	}
     }
--- gcc/testsuite/g++.dg/lto/pr91572_0.C	(nonexistent)
+++ gcc/testsuite/g++.dg/lto/pr91572_0.C	(revision 275266)
@@ -0,0 +1,12 @@
+// PR lto/91572
+// { dg-lto-do link }
+// { dg-lto-options { { -O -fPIC -flto } } }
+// { dg-require-effective-target shared }
+// { dg-require-effective-target fpic }
+// { dg-extra-ld-options "-shared" }
+
+void foo (char);
+namespace N {
+  class A { A (); };
+  A::A () { asm ("" : : "g" (0)); }
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-01  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/91623
	* optabs.c (expand_vec_cond_expr): If op0 is a VECTOR_CST and only
	EQ_EXPR/NE_EXPR is supported, verify that op0 only contains
	zeros or negative elements and use NE_EXPR instead of LT_EXPR against
	zero vector.

	* gcc.target/i386/pr91623.c: New test.

--- gcc/optabs.c	(revision 275266)
+++ gcc/optabs.c	(revision 275267)
@@ -5868,6 +5868,25 @@ expand_vec_cond_expr (tree vec_cond_type
   icode = get_vcond_icode (mode, cmp_op_mode, unsignedp);
   if (icode == CODE_FOR_nothing)
     {
+      if (tcode == LT_EXPR
+	  && op0a == op0
+	  && TREE_CODE (op0) == VECTOR_CST)
+	{
+	  /* A VEC_COND_EXPR condition could be folded from EQ_EXPR/NE_EXPR
+	     into a constant when only get_vcond_eq_icode is supported.
+	     Verify < 0 and != 0 behave the same and change it to NE_EXPR.  */
+	  unsigned HOST_WIDE_INT nelts;
+	  if (!VECTOR_CST_NELTS (op0).is_constant (&nelts))
+	    {
+	      if (VECTOR_CST_STEPPED_P (op0))
+		return 0;
+	      nelts = vector_cst_encoded_nelts (op0);
+	    }
+	  for (unsigned int i = 0; i < nelts; ++i)
+	    if (tree_int_cst_sgn (vector_cst_elt (op0, i)) == 1)
+	      return 0;
+	  tcode = NE_EXPR;
+	}
       if (tcode == EQ_EXPR || tcode == NE_EXPR)
 	icode = get_vcond_eq_icode (mode, cmp_op_mode);
       if (icode == CODE_FOR_nothing)
--- gcc/testsuite/gcc.target/i386/pr91623.c	(nonexistent)
+++ gcc/testsuite/gcc.target/i386/pr91623.c	(revision 275267)
@@ -0,0 +1,32 @@
+/* PR middle-end/91623 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -msse4.1 -mno-sse4.2" } */
+
+typedef long long V __attribute__((__vector_size__(16)));
+V e, h;
+int d;
+const int i;
+
+void foo (void);
+
+void
+bar (int k, int l)
+{
+  if (d && 0 <= k - 1 && l)
+    foo ();
+}
+
+void
+baz (void)
+{
+  V n = (V) { 1 };
+  V g = (V) {};
+  V o = g;
+  for (int f = 0; f < i; ++f)
+    {
+      V a = o == n;
+      h = a;
+      bar (f, i);
+      o = e;
+    }
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-02  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/91632
	* gcc.c-torture/execute/pr91632.c: New test.

--- gcc/testsuite/gcc.c-torture/execute/pr91632.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/execute/pr91632.c	(revision 275318)
@@ -0,0 +1,30 @@
+/* PR tree-optimization/91632 */
+/* { dg-additional-options "-fwrapv" } */
+
+static int
+__attribute__((noipa))
+foo (char x)
+{
+  switch (x)
+    {
+    case '"':
+    case '<':
+    case '>':
+    case '\\':
+    case '^':
+    case '`':
+    case '{':
+    case '|':
+    case '}':
+      return 0;
+    }
+  return 1;
+}
+
+int
+main ()
+{
+  if (foo ('h') == 0)
+    __builtin_abort ();
+  return 0;
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-06  Jakub Jelinek  <jakub@redhat.com>

	* function.c (assign_parm_find_data_types): Use RECORD_OR_UNION_TYPE_P
	before testing TYPE_TRANSPARENT_AGGR.
	* calls.c (initialize_argument_information, load_register_parameters):
	Likewise.

	2019-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/91001
	PR middle-end/91105
	PR middle-end/91106
	* calls.c (load_register_parameters): For TYPE_TRANSPARENT_AGGR
	types, use type of their first field instead of type of
	args[i].tree_value.

	* gcc.c-torture/compile/pr91001.c: New test.

--- gcc/function.c	(revision 275471)
+++ gcc/function.c	(revision 275472)
@@ -2449,8 +2449,7 @@ assign_parm_find_data_types (struct assi
   /* If the parm is to be passed as a transparent union or record, use the
      type of the first field for the tests below.  We have already verified
      that the modes are the same.  */
-  if ((TREE_CODE (passed_type) == UNION_TYPE
-       || TREE_CODE (passed_type) == RECORD_TYPE)
+  if (RECORD_OR_UNION_TYPE_P (passed_type)
       && TYPE_TRANSPARENT_AGGR (passed_type))
     passed_type = TREE_TYPE (first_field (passed_type));
 
--- gcc/calls.c	(revision 275407)
+++ gcc/calls.c	(revision 275472)
@@ -1991,8 +1991,7 @@ initialize_argument_information (int num
       /* If TYPE is a transparent union or record, pass things the way
 	 we would pass the first field of the union or record.  We have
 	 already verified that the modes are the same.  */
-      if ((TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == RECORD_TYPE)
-	   && TYPE_TRANSPARENT_AGGR (type))
+      if (RECORD_OR_UNION_TYPE_P (type) && TYPE_TRANSPARENT_AGGR (type))
 	type = TREE_TYPE (first_field (type));
 
       /* Decide where to pass this arg.
@@ -2771,6 +2770,9 @@ load_register_parameters (struct arg_dat
 	  poly_int64 size = 0;
 	  HOST_WIDE_INT const_size = 0;
 	  rtx_insn *before_arg = get_last_insn ();
+	  tree type = TREE_TYPE (args[i].tree_value);
+	  if (RECORD_OR_UNION_TYPE_P (type) && TYPE_TRANSPARENT_AGGR (type))
+	    type = TREE_TYPE (first_field (type));
 	  /* Set non-negative if we must move a word at a time, even if
 	     just one word (e.g, partial == 4 && mode == DFmode).  Set
 	     to -1 if we just use a normal move insn.  This value can be
@@ -2783,11 +2785,11 @@ load_register_parameters (struct arg_dat
 	      gcc_assert (partial % UNITS_PER_WORD == 0);
 	      nregs = partial / UNITS_PER_WORD;
 	    }
-	  else if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode)
+	  else if (TYPE_MODE (type) == BLKmode)
 	    {
 	      /* Variable-sized parameters should be described by a
 		 PARALLEL instead.  */
-	      const_size = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
+	      const_size = int_size_in_bytes (type);
 	      gcc_assert (const_size >= 0);
 	      nregs = (const_size + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
 	      size = const_size;
@@ -2914,8 +2916,7 @@ load_register_parameters (struct arg_dat
 	  if (GET_CODE (reg) == PARALLEL)
 	    use_group_regs (call_fusage, reg);
 	  else if (nregs == -1)
-	    use_reg_mode (call_fusage, reg,
-			  TYPE_MODE (TREE_TYPE (args[i].tree_value)));
+	    use_reg_mode (call_fusage, reg, TYPE_MODE (type));
 	  else if (nregs > 0)
 	    use_regs (call_fusage, REGNO (reg), nregs);
 	}
--- gcc/testsuite/gcc.c-torture/compile/pr91001.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/compile/pr91001.c	(revision 275408)
@@ -0,0 +1,31 @@
+/* PR middle-end/91001 */
+/* PR middle-end/91105 */
+/* PR middle-end/91106 */
+
+struct __attribute__((packed)) S { short b; char c; };
+struct T { short b, c, d; };
+struct __attribute__((packed)) R { int b; char c; };
+union __attribute__((aligned(128), transparent_union)) U { struct S c; } u;
+union __attribute__((aligned(32), transparent_union)) V { struct T c; } v;
+union __attribute__((aligned(32), transparent_union)) W { struct R c; } w;
+void foo (union U);
+void bar (union V);
+void baz (union W);
+
+void
+qux (void)
+{
+  foo (u);
+}
+
+void
+quux (void)
+{
+  bar (v);
+}
+
+void
+corge (void)
+{
+  baz (w);
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-07  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/91665
	* tree-vect-loop.c (vectorizable_reduction): Punt if base has type
	incompatible with the type of PHI result.

	* gcc.dg/vect/pr91665.c: New test.

--- gcc/tree-vect-loop.c	(revision 275485)
+++ gcc/tree-vect-loop.c	(revision 275486)
@@ -6656,10 +6656,13 @@ vectorizable_reduction (stmt_vec_info st
 	  gcc_assert (TREE_CODE (base) == INTEGER_CST
 		      && TREE_CODE (step) == INTEGER_CST);
 	  cond_reduc_val = NULL_TREE;
+	  tree res = PHI_RESULT (STMT_VINFO_STMT (cond_stmt_vinfo));
+	  if (!types_compatible_p (TREE_TYPE (res), TREE_TYPE (base)))
+	    ;
 	  /* Find a suitable value, for MAX_EXPR below base, for MIN_EXPR
 	     above base; punt if base is the minimum value of the type for
 	     MAX_EXPR or maximum value of the type for MIN_EXPR for now.  */
-	  if (tree_int_cst_sgn (step) == -1)
+	  else if (tree_int_cst_sgn (step) == -1)
 	    {
 	      cond_reduc_op_code = MIN_EXPR;
 	      if (tree_int_cst_sgn (base) == -1)
--- gcc/testsuite/gcc.dg/vect/pr91665.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/vect/pr91665.c	(revision 275486)
@@ -0,0 +1,15 @@
+/* PR tree-optimization/91665 */
+/* { dg-do compile } */
+/* { dg-additional-options "-Ofast" } */
+
+short int v;
+
+void
+foo (short int x, short int y)
+{
+  short int *p = &v;
+
+  x = 1;
+  while (x != 0)
+    x += ++y || (*p = x);
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-11  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/91723
	* tree-vect-stmts.c (vectorizable_call): Use types_compatible_p check
	instead of pointer equality when checking if argument vectypes are
	the same.

	* gcc.dg/vect/vect-fma-3.c: New test.

--- gcc/tree-vect-stmts.c	(revision 275633)
+++ gcc/tree-vect-stmts.c	(revision 275634)
@@ -3308,7 +3308,7 @@ vectorizable_call (stmt_vec_info stmt_in
       if (!vectype_in)
 	vectype_in = vectypes[i];
       else if (vectypes[i]
-	       && vectypes[i] != vectype_in)
+	       && !types_compatible_p (vectypes[i], vectype_in))
 	{
 	  if (dump_enabled_p ())
 	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
--- gcc/testsuite/gcc.dg/vect/vect-fma-3.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/vect/vect-fma-3.c	(revision 275634)
@@ -0,0 +1,17 @@
+/* PR tree-optimization/91723 */
+/* { dg-do compile { target { scalar_all_fma || { i?86-*-* x86_64-*-* } } } } */
+/* { dg-additional-options "-mfma" { target { i?86-*-* x86_64-*-* } } } */
+
+void
+foo (double *restrict r, const double *restrict a,
+     const double *restrict b, const double *restrict c)
+{
+  for (int i = 0; i < 1024; i++)
+    {
+      double x = __builtin_fma (a[i], b[i], c[i]);
+      x = __builtin_fma (a[i], b[i], x);
+      r[i] = x;
+    }
+}
+
+/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" { target vect_double } } } */
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-11  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/89435
	PR rtl-optimization/89795
	PR rtl-optimization/91720
	* gcc.dg/pr89435.c: New test.
	* gcc.dg/pr89795.c: New test.
	* gcc.dg/pr91720.c: New test.

--- gcc/testsuite/gcc.dg/pr91720.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr91720.c	(revision 275642)
@@ -0,0 +1,22 @@
+/* PR rtl-optimization/91720 */
+/* { dg-do run } */
+/* { dg-options "-Og -fno-forward-propagate -frerun-cse-after-loop -fno-tree-fre" } */
+
+unsigned a, b;
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8
+  unsigned c = 1;
+  unsigned long long d = 0;
+  unsigned char e = 0;
+  e = __builtin_sub_overflow (d, e, &a) ? 0 : 0x80;
+  e = e << 7 | e >> c;
+  __builtin_memmove (&d, &a, 2);
+  b = e;
+  if (b != 0x40)
+    __builtin_abort ();
+#endif
+  return 0;
+}
--- gcc/testsuite/gcc.dg/pr89435.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr89435.c	(revision 275642)
@@ -0,0 +1,21 @@
+/* PR rtl-optimization/89435 */
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-forward-propagate -fno-tree-forwprop -fno-tree-ccp" } */
+
+unsigned short a;
+unsigned int b, c, d, e, f;
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4
+  unsigned char g = e = __builtin_mul_overflow_p (5, 542624702, 0);
+  d = __builtin_bswap64 (a);
+  b = __builtin_sub_overflow ((unsigned char) -e, (unsigned int) d, &g);
+  e = __builtin_mul_overflow (b, c, &a);
+  f = g + e;
+  if (f != 0xff)
+    __builtin_abort ();
+#endif
+  return 0;
+}
--- gcc/testsuite/gcc.dg/pr89795.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr89795.c	(revision 275642)
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/89795 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-dce -fno-forward-propagate -fno-sched-pressure" } */
+
+unsigned char a;
+unsigned b, c, d;
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8
+  unsigned x;
+  int e, f;
+  unsigned char g;
+  e = __builtin_bswap32 (a);
+  f = __builtin_ffs (~(unsigned short) e);
+  a = __builtin_mul_overflow ((unsigned char) 0xf7, f, &g);
+  a |= __builtin_sub_overflow_p (c, 0, (unsigned char) 0);
+  d = g + b;
+  x = d;
+  if (x != 0xf7)
+    __builtin_abort ();
+#endif
+  return 0;
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/91920
	* gimplify.c (omp_default_clause): Predetermine DECL_IN_CONSTANT_POOL
	variables as shared.

	* c-c++-common/gomp/pr91920.c: New test.

--- gcc/gimplify.c	(revision 276210)
+++ gcc/gimplify.c	(revision 276211)
@@ -7132,6 +7132,8 @@ omp_default_clause (struct gimplify_omp_
   kind = lang_hooks.decls.omp_predetermined_sharing (decl);
   if (kind != OMP_CLAUSE_DEFAULT_UNSPECIFIED)
     default_kind = kind;
+  else if (VAR_P (decl) && TREE_STATIC (decl) && DECL_IN_CONSTANT_POOL (decl))
+    default_kind = OMP_CLAUSE_DEFAULT_SHARED;
 
   switch (default_kind)
     {
--- gcc/testsuite/c-c++-common/gomp/pr91920.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/gomp/pr91920.c	(revision 276211)
@@ -0,0 +1,19 @@
+/* PR middle-end/91920 */
+
+void bar (float *);
+
+void
+foo (void)
+{
+  int i;
+  float f[3] = { 0.0f, 0.0f, 0.0f };
+#pragma omp parallel for default(none) reduction(+:f[:3])
+  for (i = 0; i < 1000; i++)
+    {
+      int j;
+      float k[3] = { 0.25f, 0.5f, 0.75f };
+      for (j = 0; j < 3; j++)
+	f[j] += k[j];
+    }
+  bar (f);
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-27  Jakub Jelinek  <jakub@redhat.com>

	PR c++/88203
	* c-common.h (c_omp_predefined_variable): Declare.
	* c-omp.c (c_omp_predefined_variable): New function.
	(c_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED
	for predefined variables.

	* c-parser.c (c_parser_predefined_identifier): New function.
	(c_parser_postfix_expression): Use it.
	(c_parser_omp_variable_list): Parse predefined identifiers.
	* c-typeck.c (c_finish_omp_clauses): Allow predefined variables
	in shared and firstprivate clauses, even when they are predetermined
	shared.

	* parser.c (cp_parser_omp_var_list_no_open): Parse predefined
	variables.
	* semantics.c (finish_omp_clauses): Allow predefined variables in
	shared and firstprivate clauses, even when they are predetermined
	shared.
	* cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
	OMP_CLAUSE_DEFAULT_SHARED for predefined variables.

	* c-c++-common/gomp/pr88203-1.c: New test.
	* c-c++-common/gomp/pr88203-2.c: New test.
	* c-c++-common/gomp/pr88203-3.c: New test.

--- gcc/c-family/c-omp.c	(revision 276211)
+++ gcc/c-family/c-omp.c	(revision 276212)
@@ -2083,6 +2083,25 @@ c_omp_declare_simd_clauses_to_decls (tre
       }
 }
 
+/* Return true for __func__ and similar function-local predefined
+   variables (which are in OpenMP predetermined shared, allowed in
+   shared/firstprivate clauses).  */
+
+bool
+c_omp_predefined_variable (tree decl)
+{
+  if (VAR_P (decl)
+      && DECL_ARTIFICIAL (decl)
+      && TREE_READONLY (decl)
+      && TREE_STATIC (decl)
+      && DECL_NAME (decl)
+      && (DECL_NAME (decl) == ridpointers[RID_C99_FUNCTION_NAME]
+	  || DECL_NAME (decl) == ridpointers[RID_FUNCTION_NAME]
+	  || DECL_NAME (decl) == ridpointers[RID_PRETTY_FUNCTION_NAME]))
+    return true;
+  return false;
+}
+
 /* True if OpenMP sharing attribute of DECL is predetermined.  */
 
 enum omp_clause_default_kind
@@ -2096,5 +2115,8 @@ c_omp_predetermined_sharing (tree decl)
       && INTEGRAL_TYPE_P (TREE_TYPE (decl)))
     return OMP_CLAUSE_DEFAULT_SHARED;
 
+  if (c_omp_predefined_variable (decl))
+    return OMP_CLAUSE_DEFAULT_SHARED;
+
   return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
 }
--- gcc/c-family/c-common.h	(revision 276211)
+++ gcc/c-family/c-common.h	(revision 276212)
@@ -1187,6 +1187,7 @@ extern void c_omp_split_clauses (locatio
 				 tree, tree *);
 extern tree c_omp_declare_simd_clauses_to_numbers (tree, tree);
 extern void c_omp_declare_simd_clauses_to_decls (tree, tree);
+extern bool c_omp_predefined_variable (tree);
 extern enum omp_clause_default_kind c_omp_predetermined_sharing (tree);
 
 /* Return next tree in the chain for chain_next walking of tree nodes.  */
--- gcc/c/c-parser.c	(revision 276211)
+++ gcc/c/c-parser.c	(revision 276212)
@@ -8049,6 +8049,41 @@ enum tgmath_parm_kind
     tgmath_fixed, tgmath_real, tgmath_complex
   };
 
+/* Helper function for c_parser_postfix_expression.  Parse predefined
+   identifiers.  */
+
+static struct c_expr
+c_parser_predefined_identifier (c_parser *parser)
+{
+  location_t loc = c_parser_peek_token (parser)->location;
+  switch (c_parser_peek_token (parser)->keyword)
+    {
+    case RID_FUNCTION_NAME:
+      pedwarn (loc, OPT_Wpedantic, "ISO C does not support %qs predefined "
+	       "identifier", "__FUNCTION__");
+      break;
+    case RID_PRETTY_FUNCTION_NAME:
+      pedwarn (loc, OPT_Wpedantic, "ISO C does not support %qs predefined "
+	       "identifier", "__PRETTY_FUNCTION__");
+      break;
+    case RID_C99_FUNCTION_NAME:
+      pedwarn_c90 (loc, OPT_Wpedantic, "ISO C90 does not support "
+		   "%<__func__%> predefined identifier");
+      break;
+    default:
+      gcc_unreachable ();
+    }
+
+  struct c_expr expr;
+  expr.original_code = ERROR_MARK;
+  expr.original_type = NULL;
+  expr.value = fname_decl (loc, c_parser_peek_token (parser)->keyword,
+			   c_parser_peek_token (parser)->value);
+  set_c_expr_source_range (&expr, loc, loc);
+  c_parser_consume_token (parser);
+  return expr;
+}
+
 /* Parse a postfix expression (C90 6.3.1-6.3.2, C99 6.5.1-6.5.2,
    C11 6.5.1-6.5.2).  Compound literals aren't handled here; callers have to
    call c_parser_postfix_expression_after_paren_type on encountering them.
@@ -8269,31 +8304,9 @@ c_parser_postfix_expression (c_parser *p
       switch (c_parser_peek_token (parser)->keyword)
 	{
 	case RID_FUNCTION_NAME:
-	  pedwarn (loc, OPT_Wpedantic,  "ISO C does not support "
-		   "%<__FUNCTION__%> predefined identifier");
-	  expr.value = fname_decl (loc,
-				   c_parser_peek_token (parser)->keyword,
-				   c_parser_peek_token (parser)->value);
-	  set_c_expr_source_range (&expr, loc, loc);
-	  c_parser_consume_token (parser);
-	  break;
 	case RID_PRETTY_FUNCTION_NAME:
-	  pedwarn (loc, OPT_Wpedantic,  "ISO C does not support "
-		   "%<__PRETTY_FUNCTION__%> predefined identifier");
-	  expr.value = fname_decl (loc,
-				   c_parser_peek_token (parser)->keyword,
-				   c_parser_peek_token (parser)->value);
-	  set_c_expr_source_range (&expr, loc, loc);
-	  c_parser_consume_token (parser);
-	  break;
 	case RID_C99_FUNCTION_NAME:
-	  pedwarn_c90 (loc, OPT_Wpedantic,  "ISO C90 does not support "
-		   "%<__func__%> predefined identifier");
-	  expr.value = fname_decl (loc,
-				   c_parser_peek_token (parser)->keyword,
-				   c_parser_peek_token (parser)->value);
-	  set_c_expr_source_range (&expr, loc, loc);
-	  c_parser_consume_token (parser);
+	  expr = c_parser_predefined_identifier (parser);
 	  break;
 	case RID_VA_ARG:
 	  {
@@ -11997,15 +12010,9 @@ c_parser_omp_variable_list (c_parser *pa
 {
   auto_vec<c_token> tokens;
   unsigned int tokens_avail = 0;
+  bool first = true;
 
-  if (kind != OMP_CLAUSE_DEPEND
-      && (c_parser_next_token_is_not (parser, CPP_NAME)
-	  || c_parser_peek_token (parser)->id_kind != C_ID_ID))
-    c_parser_error (parser, "expected identifier");
-
-  while (kind == OMP_CLAUSE_DEPEND
-	 || (c_parser_next_token_is (parser, CPP_NAME)
-	     && c_parser_peek_token (parser)->id_kind == C_ID_ID))
+  while (1)
     {
       bool array_section_p = false;
       if (kind == OMP_CLAUSE_DEPEND)
@@ -12026,6 +12033,7 @@ c_parser_omp_variable_list (c_parser *pa
 		break;
 
 	      c_parser_consume_token (parser);
+	      first = false;
 	      continue;
 	    }
 
@@ -12076,16 +12084,35 @@ c_parser_omp_variable_list (c_parser *pa
 	  parser->tokens_avail = tokens.length ();
 	}
 
-      tree t = lookup_name (c_parser_peek_token (parser)->value);
+      tree t = NULL_TREE;
 
-      if (t == NULL_TREE)
+      if (c_parser_next_token_is (parser, CPP_NAME)
+	  && c_parser_peek_token (parser)->id_kind == C_ID_ID)
 	{
-	  undeclared_variable (c_parser_peek_token (parser)->location,
-			       c_parser_peek_token (parser)->value);
-	  t = error_mark_node;
-	}
+	  t = lookup_name (c_parser_peek_token (parser)->value);
 
-      c_parser_consume_token (parser);
+	  if (t == NULL_TREE)
+	    {
+	      undeclared_variable (c_parser_peek_token (parser)->location,
+	      c_parser_peek_token (parser)->value);
+	      t = error_mark_node;
+	    }
+
+	  c_parser_consume_token (parser);
+	}
+      else if (c_parser_next_token_is (parser, CPP_KEYWORD)
+	       && (c_parser_peek_token (parser)->keyword == RID_FUNCTION_NAME
+		   || (c_parser_peek_token (parser)->keyword
+		       == RID_PRETTY_FUNCTION_NAME)
+		   || (c_parser_peek_token (parser)->keyword
+		       == RID_C99_FUNCTION_NAME)))
+	t = c_parser_predefined_identifier (parser).value;
+      else
+	{
+	  if (first)
+	    c_parser_error (parser, "expected identifier");
+	  break;
+	}
 
       if (t == error_mark_node)
 	;
@@ -12223,6 +12250,7 @@ c_parser_omp_variable_list (c_parser *pa
 	break;
 
       c_parser_consume_token (parser);
+      first = false;
     }
 
   return list;
--- gcc/c/c-typeck.c	(revision 276211)
+++ gcc/c/c-typeck.c	(revision 276212)
@@ -14822,6 +14822,13 @@ c_finish_omp_clauses (tree clauses, enum
 		case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
 		  break;
 		case OMP_CLAUSE_DEFAULT_SHARED:
+		  if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED
+		       || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE)
+		      && c_omp_predefined_variable (t))
+		    /* The __func__ variable and similar function-local
+		       predefined variables may be listed in a shared or
+		       firstprivate clause.  */
+		    break;
 		  share_name = "shared";
 		  break;
 		case OMP_CLAUSE_DEFAULT_PRIVATE:
--- gcc/cp/cp-gimplify.c	(revision 276211)
+++ gcc/cp/cp-gimplify.c	(revision 276212)
@@ -2055,6 +2055,9 @@ cxx_omp_predetermined_sharing_1 (tree de
       tree ctx = CP_DECL_CONTEXT (decl);
       if (TYPE_P (ctx) && MAYBE_CLASS_TYPE_P (ctx))
 	return OMP_CLAUSE_DEFAULT_SHARED;
+
+      if (c_omp_predefined_variable (decl))
+	return OMP_CLAUSE_DEFAULT_SHARED;
     }
 
   /* this may not be specified in data-sharing clauses, still we need
--- gcc/cp/semantics.c	(revision 276211)
+++ gcc/cp/semantics.c	(revision 276212)
@@ -7967,6 +7967,13 @@ finish_omp_clauses (tree clauses, enum c
 	    case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
 	      break;
 	    case OMP_CLAUSE_DEFAULT_SHARED:
+	      if ((OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED
+		   || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE)
+		  && c_omp_predefined_variable (t))
+		/* The __func__ variable and similar function-local predefined
+		   variables may be listed in a shared or firstprivate
+		   clause.  */
+		break;
 	      if (VAR_P (t)
 		  && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE
 		  && TREE_STATIC (t)
--- gcc/cp/parser.c	(revision 276211)
+++ gcc/cp/parser.c	(revision 276212)
@@ -32736,6 +32736,14 @@ cp_parser_omp_var_list_no_open (cp_parse
 	    decl = TREE_OPERAND (decl, 0);
 	  cp_lexer_consume_token (parser->lexer);
 	}
+      else if (cp_parser_is_keyword (token, RID_FUNCTION_NAME)
+	       || cp_parser_is_keyword (token, RID_PRETTY_FUNCTION_NAME)
+	       || cp_parser_is_keyword (token, RID_C99_FUNCTION_NAME))
+	{
+	  cp_id_kind idk;
+	  decl = cp_parser_primary_expression (parser, false, false, false,
+					       &idk);
+	}
       else
 	{
 	  name = cp_parser_id_expression (parser, /*template_p=*/false,
--- gcc/testsuite/c-c++-common/gomp/pr88203-1.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/gomp/pr88203-1.c	(revision 276212)
@@ -0,0 +1,61 @@
+/* PR c++/88203 */
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c99" { target c } } */
+/* { dg-additional-options "-std=c++11" { target c++ } } */
+
+void foo (const char *);
+#pragma omp declare target to (foo)
+
+void
+f1 (void)
+{
+  #pragma omp parallel default(none)
+  foo (__func__);
+}
+
+void
+f2 (void)
+{
+  #pragma omp parallel default(none) shared(__func__)
+  foo (__func__);
+}
+
+void
+f3 (void)
+{
+  #pragma omp parallel default(none) firstprivate(__func__)
+  foo (__func__);
+}
+
+void
+f4 (void)
+{
+  foo (__func__);
+  #pragma omp parallel default(none)
+  foo (__func__);
+}
+
+void
+f5 (void)
+{
+  foo (__func__);
+  #pragma omp parallel default(none) shared(__func__)
+  foo (__func__);
+}
+
+void
+f6 (void)
+{
+  foo (__func__);
+  #pragma omp parallel default(none) firstprivate(__func__)
+  foo (__func__);
+}
+
+void
+f7 (void)
+{
+  #pragma omp target map(to: __func__)
+  foo (__func__);
+  #pragma omp task depend(inout:__func__)
+  foo (__func__);
+}
--- gcc/testsuite/c-c++-common/gomp/pr88203-2.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/gomp/pr88203-2.c	(revision 276212)
@@ -0,0 +1,65 @@
+/* PR c++/88203 */
+/* { dg-do compile } */
+/* { dg-additional-options "-std=gnu99" { target c } } */
+/* { dg-additional-options "-std=gnu++11" { target c++ } } */
+
+void foo (const char *, const char *);
+#pragma omp declare target to (foo)
+
+void
+f1 (void)
+{
+  #pragma omp parallel default(none)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+}
+
+void
+f2 (void)
+{
+  #pragma omp parallel default(none) shared(__FUNCTION__, __PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+  #pragma omp parallel default(none) shared(__FUNCTION__) firstprivate(__PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+}
+
+void
+f3 (void)
+{
+  #pragma omp parallel default(none) firstprivate(__FUNCTION__, __PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+  #pragma omp parallel default(none) firstprivate(__FUNCTION__), shared(__PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+}
+
+void
+f4 (void)
+{
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+  #pragma omp parallel default(none)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+}
+
+void
+f5 (void)
+{
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+  #pragma omp parallel default(none) shared(__FUNCTION__, __PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+}
+
+void
+f6 (void)
+{
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+  #pragma omp parallel default(none) firstprivate(__FUNCTION__, __PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+}
+
+void
+f7 (void)
+{
+  #pragma omp target map(to: __FUNCTION__, __PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+  #pragma omp task depend(inout:__FUNCTION__, __PRETTY_FUNCTION__)
+  foo (__FUNCTION__, __PRETTY_FUNCTION__);
+}
--- gcc/testsuite/c-c++-common/gomp/pr88203-3.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/gomp/pr88203-3.c	(revision 276212)
@@ -0,0 +1,28 @@
+/* PR c++/88203 */
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c99" { target c } } */
+/* { dg-additional-options "-std=c++11" { target c++ } } */
+
+void foo (const char *);
+#pragma omp declare target to (foo)
+
+void
+f1 (void)
+{
+  #pragma omp parallel for lastprivate (__func__)	/* { dg-error "'__func__' is predetermined 'shared' for 'lastprivate'" } */
+  for (int i = 0; i < 2; i++)
+    foo (__func__);
+  #pragma omp parallel private (__func__)		/* { dg-error "'__func__' is predetermined 'shared' for 'private'" } */
+  foo (__func__);
+}
+
+void
+f2 (void)
+{
+  foo (__func__);
+  #pragma omp parallel default(none) private (__func__)		/* { dg-error "'__func__' is predetermined 'shared' for 'private'" } */
+  foo (__func__);
+  #pragma omp parallel for default(none) lastprivate (__func__)	/* { dg-error "'__func__' is predetermined 'shared' for 'lastprivate'" } */
+  for (int i = 0; i < 2; i++)
+    foo (__func__);
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-09-29  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/90543
	* optc-save-gen.awk: Fix up printing string option differences.

--- gcc/optc-save-gen.awk	(revision 276267)
+++ gcc/optc-save-gen.awk	(revision 276268)
@@ -332,7 +332,7 @@ for (i = 0; i < n_opt_string; i++) {
 	print "             indent_to, \"\",";
 	print "             \"" name "\",";
 	print "             ptr1->x_" name " ? ptr1->x_" name " : \"(null)\",";
-	print "             ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");";
+	print "             ptr2->x_" name " ? ptr2->x_" name " : \"(null)\");";
 	print "";
 }
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-10-01  Jakub Jelinek  <jakub@redhat.com>

	PR c++/91925
	* c-warn.c (check_alignment_of_packed_member): Ignore FIELD_DECLs
	with NULL DECL_FIELD_OFFSET.

	* g++.dg/conversion/packed2.C: New test.

--- gcc/c-family/c-warn.c	(revision 276414)
+++ gcc/c-family/c-warn.c	(revision 276415)
@@ -2798,6 +2798,8 @@ check_alignment_of_packed_member (tree t
   /* Check alignment of the data member.  */
   if (TREE_CODE (field) == FIELD_DECL
       && (DECL_PACKED (field) || TYPE_PACKED (TREE_TYPE (field)))
+      /* Ignore FIELDs not laid out yet.  */
+      && DECL_FIELD_OFFSET (field)
       && (!rvalue || TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE))
     {
       /* Check the expected alignment against the field alignment.  */
--- gcc/testsuite/g++.dg/conversion/packed2.C	(nonexistent)
+++ gcc/testsuite/g++.dg/conversion/packed2.C	(revision 276415)
@@ -0,0 +1,15 @@
+// PR c++/91925
+// { dg-do compile { target c++11 } }
+// { dg-options "-fpack-struct" }
+
+struct A {};
+int foo (A);
+struct B {
+  A a;
+  decltype (foo (a)) p;
+};
+template <typename T> T bar (T);
+class C {
+  A a;
+  decltype (bar (a)) p;
+};
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-10-04  Jakub Jelinek  <jakub@redhat.com>

	PR c++/91974
	* cp-gimplify.c (cp_gimplify_expr) <case CALL_EXPR>: For
	-fstrong-eval-order ensure CALL_EXPR_FN side-effects are evaluated
	before any arguments.  Additionally, ensure CALL_EXPR_FN that isn't
	invariant nor OBJ_TYPE_REF nor SSA_NAME is forced into a temporary.

	* g++.dg/cpp1z/eval-order5.C: New test.

--- gcc/cp/cp-gimplify.c	(revision 276561)
+++ gcc/cp/cp-gimplify.c	(revision 276562)
@@ -818,6 +818,21 @@ cp_gimplify_expr (tree *expr_p, gimple_s
 
     case CALL_EXPR:
       ret = GS_OK;
+      if (flag_strong_eval_order == 2
+	  && CALL_EXPR_FN (*expr_p)
+	  && cp_get_callee_fndecl_nofold (*expr_p) == NULL_TREE)
+	{
+	  enum gimplify_status t
+	    = gimplify_expr (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
+			     is_gimple_call_addr, fb_rvalue);
+	  if (t == GS_ERROR)
+	    ret = GS_ERROR;
+	  else if (is_gimple_variable (CALL_EXPR_FN (*expr_p))
+		   && TREE_CODE (CALL_EXPR_FN (*expr_p)) != SSA_NAME)
+	    CALL_EXPR_FN (*expr_p)
+	      = get_initialized_tmp_var (CALL_EXPR_FN (*expr_p), pre_p,
+					 NULL);
+	}
       if (!CALL_EXPR_FN (*expr_p))
 	/* Internal function call.  */;
       else if (CALL_EXPR_REVERSE_ARGS (*expr_p))
--- gcc/testsuite/g++.dg/cpp1z/eval-order5.C	(nonexistent)
+++ gcc/testsuite/g++.dg/cpp1z/eval-order5.C	(revision 276562)
@@ -0,0 +1,31 @@
+// PR c++/91974
+// { dg-do run }
+// { dg-options "-fstrong-eval-order" }
+
+extern "C" void abort ();
+
+bool ok = false;
+
+void
+foo (int x)
+{
+  if (x != 0)
+    abort ();
+  ok = true;
+}
+
+void
+bar (int)
+{
+  abort ();
+}
+
+int
+main ()
+{
+  typedef void (*T) (int);
+  T fn = foo;
+  fn ((fn = bar, 0));
+  if (fn != bar || !ok)
+    abort ();
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-10-05  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/91734
	* generic-match-head.c: Include fold-const-call.h.
	* match.pd (sqrt(x) cmp c): Check the boundary value and
	in case inexact computation of c*c affects comparison of the boundary,
	turn LT_EXPR into LE_EXPR, GE_EXPR into GT_EXPR, LE_EXPR into LT_EXPR
	or GT_EXPR into GE_EXPR.  Punt for sqrt comparisons against NaN and
	for -frounding-math.  For c2, try the next smaller or larger floating
	point constant depending on comparison code and if it has the same
	sqrt as c2, use it instead of c2.

	* gcc.dg/pr91734.c: New test.

--- gcc/generic-match-head.c	(revision 276620)
+++ gcc/generic-match-head.c	(revision 276621)
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3.
 #include "ssa.h"
 #include "cgraph.h"
 #include "fold-const.h"
+#include "fold-const-call.h"
 #include "stor-layout.h"
 #include "tree-dfa.h"
 #include "builtins.h"
--- gcc/match.pd	(revision 276620)
+++ gcc/match.pd	(revision 276621)
@@ -3726,8 +3726,7 @@ (define_operator_list COND_TERNARY
      (cmp { tem; } @1)))))
 
  /* Fold comparisons against built-in math functions.  */
- (if (flag_unsafe_math_optimizations
-      && ! flag_errno_math)
+ (if (flag_unsafe_math_optimizations && ! flag_errno_math)
   (for sq (SQRT)
    (simplify
     (cmp (sq @0) REAL_CST@1)
@@ -3762,56 +3761,108 @@ (define_operator_list COND_TERNARY
 	  if x is negative or NaN.  Due to -funsafe-math-optimizations,
 	  the results for other x follow from natural arithmetic.  */
        (cmp @0 @1)))
-     (if (cmp == GT_EXPR || cmp == GE_EXPR)
+     (if ((cmp == LT_EXPR
+	   || cmp == LE_EXPR
+	   || cmp == GT_EXPR
+	   || cmp == GE_EXPR)
+	  && !REAL_VALUE_ISNAN (TREE_REAL_CST (@1))
+	  /* Give up for -frounding-math.  */
+	  && !HONOR_SIGN_DEPENDENT_ROUNDING (TREE_TYPE (@0)))
       (with
        {
-         REAL_VALUE_TYPE c2;
+	 REAL_VALUE_TYPE c2;
+	 enum tree_code ncmp = cmp;
+	 const real_format *fmt
+	   = REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (@0)));
 	 real_arithmetic (&c2, MULT_EXPR,
 			  &TREE_REAL_CST (@1), &TREE_REAL_CST (@1));
-	 real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2);
+	 real_convert (&c2, fmt, &c2);
+	 /* See PR91734: if c2 is inexact and sqrt(c2) < c (or sqrt(c2) >= c),
+	    then change LT_EXPR into LE_EXPR or GE_EXPR into GT_EXPR.  */
+	 if (!REAL_VALUE_ISINF (c2))
+	   {
+	     tree c3 = fold_const_call (CFN_SQRT, TREE_TYPE (@0),
+					build_real (TREE_TYPE (@0), c2));
+	     if (c3 == NULL_TREE || TREE_CODE (c3) != REAL_CST)
+	       ncmp = ERROR_MARK;
+	     else if ((cmp == LT_EXPR || cmp == GE_EXPR)
+		      && real_less (&TREE_REAL_CST (c3), &TREE_REAL_CST (@1)))
+	       ncmp = cmp == LT_EXPR ? LE_EXPR : GT_EXPR;
+	     else if ((cmp == LE_EXPR || cmp == GT_EXPR)
+		      && real_less (&TREE_REAL_CST (@1), &TREE_REAL_CST (c3)))
+	       ncmp = cmp == LE_EXPR ? LT_EXPR : GE_EXPR;
+	     else
+	       {
+		 /* With rounding to even, sqrt of up to 3 different values
+		    gives the same normal result, so in some cases c2 needs
+		    to be adjusted.  */
+		 REAL_VALUE_TYPE c2alt, tow;
+		 if (cmp == LT_EXPR || cmp == GE_EXPR)
+		   tow = dconst0;
+		 else
+		   real_inf (&tow);
+		 real_nextafter (&c2alt, fmt, &c2, &tow);
+		 real_convert (&c2alt, fmt, &c2alt);
+		 if (REAL_VALUE_ISINF (c2alt))
+		   ncmp = ERROR_MARK;
+		 else
+		   {
+		     c3 = fold_const_call (CFN_SQRT, TREE_TYPE (@0),
+					   build_real (TREE_TYPE (@0), c2alt));
+		     if (c3 == NULL_TREE || TREE_CODE (c3) != REAL_CST)
+		       ncmp = ERROR_MARK;
+		     else if (real_equal (&TREE_REAL_CST (c3),
+					  &TREE_REAL_CST (@1)))
+		       c2 = c2alt;
+		   }
+	       }
+	   }
        }
-       (if (REAL_VALUE_ISINF (c2))
-	/* sqrt(x) > y is x == +Inf, when y is very large.  */
-	(if (HONOR_INFINITIES (@0))
-	 (eq @0 { build_real (TREE_TYPE (@0), c2); })
-	 { constant_boolean_node (false, type); })
-	/* sqrt(x) > c is the same as x > c*c.  */
-	(cmp @0 { build_real (TREE_TYPE (@0), c2); }))))
-     (if (cmp == LT_EXPR || cmp == LE_EXPR)
-      (with
-       {
-       	 REAL_VALUE_TYPE c2;
-	 real_arithmetic (&c2, MULT_EXPR,
-			  &TREE_REAL_CST (@1), &TREE_REAL_CST (@1));
-	 real_convert (&c2, TYPE_MODE (TREE_TYPE (@0)), &c2);
-       }
-       (if (REAL_VALUE_ISINF (c2))
-        (switch
-	 /* sqrt(x) < y is always true, when y is a very large
-	    value and we don't care about NaNs or Infinities.  */
-	 (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0))
-	  { constant_boolean_node (true, type); })
-	 /* sqrt(x) < y is x != +Inf when y is very large and we
-	    don't care about NaNs.  */
-	 (if (! HONOR_NANS (@0))
-	  (ne @0 { build_real (TREE_TYPE (@0), c2); }))
-	 /* sqrt(x) < y is x >= 0 when y is very large and we
-	    don't care about Infinities.  */
-	 (if (! HONOR_INFINITIES (@0))
-	  (ge @0 { build_real (TREE_TYPE (@0), dconst0); }))
-	 /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large.  */
-	 (if (GENERIC)
-	  (truth_andif
-	   (ge @0 { build_real (TREE_TYPE (@0), dconst0); })
-	   (ne @0 { build_real (TREE_TYPE (@0), c2); }))))
-	/* sqrt(x) < c is the same as x < c*c, if we ignore NaNs.  */
-	(if (! HONOR_NANS (@0))
-	 (cmp @0 { build_real (TREE_TYPE (@0), c2); })
-	 /* sqrt(x) < c is the same as x >= 0 && x < c*c.  */
-	 (if (GENERIC)
-	  (truth_andif
-	   (ge @0 { build_real (TREE_TYPE (@0), dconst0); })
-	   (cmp @0 { build_real (TREE_TYPE (@0), c2); })))))))))
+       (if (cmp == GT_EXPR || cmp == GE_EXPR)
+	(if (REAL_VALUE_ISINF (c2))
+	 /* sqrt(x) > y is x == +Inf, when y is very large.  */
+	 (if (HONOR_INFINITIES (@0))
+	  (eq @0 { build_real (TREE_TYPE (@0), c2); })
+	  { constant_boolean_node (false, type); })
+	 /* sqrt(x) > c is the same as x > c*c.  */
+	 (if (ncmp != ERROR_MARK)
+	  (if (ncmp == GE_EXPR)
+	   (ge @0 { build_real (TREE_TYPE (@0), c2); })
+	   (gt @0 { build_real (TREE_TYPE (@0), c2); }))))
+	/* else if (cmp == LT_EXPR || cmp == LE_EXPR)  */
+	(if (REAL_VALUE_ISINF (c2))
+	 (switch
+	  /* sqrt(x) < y is always true, when y is a very large
+	     value and we don't care about NaNs or Infinities.  */
+	  (if (! HONOR_NANS (@0) && ! HONOR_INFINITIES (@0))
+	   { constant_boolean_node (true, type); })
+	  /* sqrt(x) < y is x != +Inf when y is very large and we
+	     don't care about NaNs.  */
+	  (if (! HONOR_NANS (@0))
+	   (ne @0 { build_real (TREE_TYPE (@0), c2); }))
+	  /* sqrt(x) < y is x >= 0 when y is very large and we
+	     don't care about Infinities.  */
+	  (if (! HONOR_INFINITIES (@0))
+	   (ge @0 { build_real (TREE_TYPE (@0), dconst0); }))
+	  /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large.  */
+	  (if (GENERIC)
+	   (truth_andif
+	    (ge @0 { build_real (TREE_TYPE (@0), dconst0); })
+	    (ne @0 { build_real (TREE_TYPE (@0), c2); }))))
+	 /* sqrt(x) < c is the same as x < c*c, if we ignore NaNs.  */
+	 (if (ncmp != ERROR_MARK && ! HONOR_NANS (@0))
+	  (if (ncmp == LT_EXPR)
+	   (lt @0 { build_real (TREE_TYPE (@0), c2); })
+	   (le @0 { build_real (TREE_TYPE (@0), c2); }))
+	  /* sqrt(x) < c is the same as x >= 0 && x < c*c.  */
+	  (if (ncmp != ERROR_MARK && GENERIC)
+	   (if (ncmp == LT_EXPR)
+	    (truth_andif
+	     (ge @0 { build_real (TREE_TYPE (@0), dconst0); })
+	     (lt @0 { build_real (TREE_TYPE (@0), c2); }))
+	    (truth_andif
+	     (ge @0 { build_real (TREE_TYPE (@0), dconst0); })
+	     (le @0 { build_real (TREE_TYPE (@0), c2); })))))))))))
    /* Transform sqrt(x) cmp sqrt(y) -> x cmp y.  */
    (simplify
     (cmp (sq @0) (sq @1))
--- gcc/testsuite/gcc.dg/pr91734.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr91734.c	(revision 276621)
@@ -0,0 +1,97 @@
+/* PR tree-optimization/91734 */
+/* { dg-do run } */
+/* { dg-add-options ieee } */
+/* { dg-additional-options "-O2 -std=gnu99" } */
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f1 (float x)
+{
+  return __builtin_sqrtf (x) < __FLT_MIN__;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f2 (float x)
+{
+  return __builtin_sqrtf (x) < 0x1.2dd3d0p-65f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f3 (float x)
+{
+  return __builtin_sqrtf (x) >= 0x1.2dd3d0p-65f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f4 (float x)
+{
+  return __builtin_sqrtf (x) >= 0x1.5642e6p+54f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f5 (float x)
+{
+  return __builtin_sqrtf (x) > 0x1.5642e6p+54f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f6 (float x)
+{
+  return __builtin_sqrtf (x) < 0x1.4da1cp-19f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f7 (float x)
+{
+  return __builtin_sqrtf (x) <= 0x1.4da1cp-19f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f8 (float x)
+{
+  return __builtin_sqrtf (x) < 0x1.50cb62p-65f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f9 (float x)
+{
+  return __builtin_sqrtf (x) <= 0x1.4fc00cp-73f;
+}
+
+__attribute__((noipa, optimize ("Ofast"))) int
+f10 (float x)
+{
+  return __builtin_sqrtf (x) < 0x1.001002p+0f;
+}
+
+int
+main ()
+{
+  if (__FLT_RADIX__ != 2
+      || __FLT_MANT_DIG__ != 24
+      || __FLT_MIN_EXP__ != -125
+      || __FLT_MAX_EXP__ != 128
+      || __FLT_HAS_DENORM__ != 1
+      || __FLT_HAS_INFINITY__ != 1)
+    return 0;
+  if (!f1 (0.0f) || f1 (0x1.0p-149f))
+    __builtin_abort ();
+  if (!f2 (0x1.63dbc0p-130f))
+    __builtin_abort ();
+  if (f3 (0x1.63dbc0p-130f))
+    __builtin_abort ();
+  if (!f4 (0x1.c996d0p+108f) || !f4 (0x1.c996cep+108f) || f4 (0x1.c996ccp+108f))
+    __builtin_abort ();
+  if (f5 (0x1.c996d0p+108f) || f5 (0x1.c996d2p+108f) || !f5 (0x1.c996d4p+108f))
+    __builtin_abort ();
+  if (!f6 (0x1.b2ce3p-38f) || f6 (0x1.b2ce32p-38f) || f6 (0x1.b2ce34p-38f))
+    __builtin_abort ();
+  if (!f7 (0x1.b2ce3p-38f) || !f7 (0x1.b2ce34p-38f) || !f7 (0x1.b2ce36p-38f) || f7 (0x1.b2ce38p-38f))
+    __builtin_abort ();
+  if (!f8 (0x1.bb166p-130f) || !f8 (0x1.bb168p-130f) || f8 (0x1.bb16ap-130f) || f8 (0x1.bb16cp-130f))
+    __builtin_abort ();
+  if (!f9 (0x1.8p-146f) || !f9 (0x1.ap-146f) || f9 (0x1.cp-146f) || f9 (0x1.ep-146f))
+    __builtin_abort ();
+  if (f10 (0x1.002004p+0f))
+    __builtin_abort ();
+  return 0;
+}
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-10-17  Jakub Jelinek  <jakub@redhat.com>

	PR fortran/87752
	* gfortran.dg/gomp/pr87752.f90: New test.

--- gcc/testsuite/gfortran.dg/gomp/pr87752.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/gomp/pr87752.f90	(revision 277091)
@@ -0,0 +1,12 @@
+! PR fortran/87752
+! { dg-do compile }
+! { dg-additional-options "-Ofast" }
+
+subroutine foo (n, u, v)
+  integer :: n
+  real, pointer :: u(:), v(:)
+  !$omp parallel do simd
+  do i = 1, n
+    u(:) = v(:)
+  end do
+end
2019-10-21  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2019-10-17  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/92056
	* tree-object-size.c (cond_expr_object_size): Return early if then_
	processing resulted in unknown size.

	* gcc.c-torture/compile/pr92056.c: New test.

--- gcc/tree-object-size.c	(revision 277092)
+++ gcc/tree-object-size.c	(revision 277093)
@@ -903,6 +903,9 @@ cond_expr_object_size (struct object_siz
   else
     expr_object_size (osi, var, then_);
 
+  if (object_sizes[object_size_type][varno] == unknown[object_size_type])
+    return reexamine;
+
   if (TREE_CODE (else_) == SSA_NAME)
     reexamine |= merge_object_sizes (osi, var, else_, 0);
   else
--- gcc/testsuite/gcc.c-torture/compile/pr92056.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/compile/pr92056.c	(revision 277093)
@@ -0,0 +1,18 @@
+/* PR tree-optimization/92056 */
+
+const char *d;
+
+void
+foo (int c, char *e, const char *a, const char *b)
+{
+  switch (c)
+    {
+    case 33:
+      for (;; d++)
+        if (__builtin_strcmp (b ? : "", d))
+          return;
+      break;
+    case 4:
+      __builtin_sprintf (e, a);
+    }
+}

Patch
diff mbox series

--- libquadmath/quadmath.h	(revision 273996)
+++ libquadmath/quadmath.h	(revision 273997)
@@ -1,5 +1,5 @@ 
 /* GCC Quad-Precision Math Library
-   Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
    Written by Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
 This file is part of the libquadmath library.
@@ -165,19 +165,19 @@  extern int quadmath_snprintf (char *str,
    (floating constant exceeds range of ‘__float128’)  */
 /* #define HUGE_VALQ (__extension__ 0x1.0p32767Q) */
 
-#define M_Eq		2.7182818284590452353602874713526625Q  /* e */
-#define M_LOG2Eq	1.4426950408889634073599246810018921Q  /* log_2 e */
-#define M_LOG10Eq	0.4342944819032518276511289189166051Q  /* log_10 e */
-#define M_LN2q		0.6931471805599453094172321214581766Q  /* log_e 2 */
-#define M_LN10q		2.3025850929940456840179914546843642Q  /* log_e 10 */
-#define M_PIq		3.1415926535897932384626433832795029Q  /* pi */
-#define M_PI_2q		1.5707963267948966192313216916397514Q  /* pi/2 */
-#define M_PI_4q		0.7853981633974483096156608458198757Q  /* pi/4 */
-#define M_1_PIq		0.3183098861837906715377675267450287Q  /* 1/pi */
-#define M_2_PIq		0.6366197723675813430755350534900574Q  /* 2/pi */
-#define M_2_SQRTPIq	1.1283791670955125738961589031215452Q  /* 2/sqrt(pi) */
-#define M_SQRT2q	1.4142135623730950488016887242096981Q  /* sqrt(2) */
-#define M_SQRT1_2q	0.7071067811865475244008443621048490Q  /* 1/sqrt(2) */
+#define M_Eq		2.718281828459045235360287471352662498Q  /* e */
+#define M_LOG2Eq	1.442695040888963407359924681001892137Q  /* log_2 e */
+#define M_LOG10Eq	0.434294481903251827651128918916605082Q  /* log_10 e */
+#define M_LN2q		0.693147180559945309417232121458176568Q  /* log_e 2 */
+#define M_LN10q		2.302585092994045684017991454684364208Q  /* log_e 10 */
+#define M_PIq		3.141592653589793238462643383279502884Q  /* pi */
+#define M_PI_2q		1.570796326794896619231321691639751442Q  /* pi/2 */
+#define M_PI_4q		0.785398163397448309615660845819875721Q  /* pi/4 */
+#define M_1_PIq		0.318309886183790671537767526745028724Q  /* 1/pi */
+#define M_2_PIq		0.636619772367581343075535053490057448Q  /* 2/pi */
+#define M_2_SQRTPIq	1.128379167095512573896158903121545172Q  /* 2/sqrt(pi) */
+#define M_SQRT2q	1.414213562373095048801688724209698079Q  /* sqrt(2) */
+#define M_SQRT1_2q	0.707106781186547524400844362104849039Q  /* 1/sqrt(2) */
 
 #define __quadmath_extern_inline \
   extern inline __attribute__ ((__gnu_inline__))