Backports to 8.x
diff mbox series

Message ID 20191121172657.GI4650@tucnak
State New
Headers show
Series
  • Backports to 8.x
Related show

Commit Message

Jakub Jelinek Nov. 21, 2019, 5:26 p.m. UTC
Hi!

I've backported following 16 commits from trunk to 8.x branch,
bootstrapped/regtested on x86_64-linux and i686-linux and committed for 8.4.

	Jakub
2019-11-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-11-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 277242)
+++ gcc/c/c-parser.c	(revision 277243)
@@ -14707,7 +14707,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 277242)
+++ gcc/cp/parser.c	(revision 277243)
@@ -34896,8 +34896,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 277243)
@@ -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 277243)
@@ -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-11-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 277245)
+++ gcc/optabs.c	(revision 277246)
@@ -5819,6 +5819,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 277246)
@@ -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-11-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 277247)
+++ gcc/function.c	(revision 277248)
@@ -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 277247)
+++ gcc/calls.c	(revision 277248)
@@ -1971,8 +1971,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.
@@ -2750,6 +2749,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
@@ -2762,11 +2764,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;
@@ -2893,8 +2895,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 277248)
@@ -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-11-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 277248)
+++ gcc/tree-vect-loop.c	(revision 277249)
@@ -6445,10 +6445,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 277249)
@@ -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-11-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 277255)
+++ gcc/cp/cp-gimplify.c	(revision 277256)
@@ -816,6 +816,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 277256)
@@ -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-11-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 277258)
+++ gcc/tree-object-size.c	(revision 277259)
@@ -890,6 +890,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 277259)
@@ -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);
+    }
+}
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR c++/92201
	* cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
	function pointer type, re-add cast to the original one.

	* g++.dg/other/pr92201.C: New test.

--- gcc/cp/cp-gimplify.c	(revision 277593)
+++ gcc/cp/cp-gimplify.c	(revision 277594)
@@ -820,6 +820,7 @@ cp_gimplify_expr (tree *expr_p, gimple_s
 	  && CALL_EXPR_FN (*expr_p)
 	  && cp_get_callee_fndecl_nofold (*expr_p) == NULL_TREE)
 	{
+	  tree fnptrtype = TREE_TYPE (CALL_EXPR_FN (*expr_p));
 	  enum gimplify_status t
 	    = gimplify_expr (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
 			     is_gimple_call_addr, fb_rvalue);
@@ -830,6 +831,11 @@ cp_gimplify_expr (tree *expr_p, gimple_s
 	    CALL_EXPR_FN (*expr_p)
 	      = get_initialized_tmp_var (CALL_EXPR_FN (*expr_p), pre_p,
 					 NULL);
+	  /* GIMPLE considers most pointer conversion useless, but for
+	     calls we actually care about the exact function pointer type.  */
+	  if (t != GS_ERROR && TREE_TYPE (CALL_EXPR_FN (*expr_p)) != fnptrtype)
+	    CALL_EXPR_FN (*expr_p)
+	      = build1 (NOP_EXPR, fnptrtype, CALL_EXPR_FN (*expr_p));
 	}
       if (!CALL_EXPR_FN (*expr_p))
 	/* Internal function call.  */;
--- gcc/testsuite/g++.dg/other/pr92201.C	(nonexistent)
+++ gcc/testsuite/g++.dg/other/pr92201.C	(revision 277594)
@@ -0,0 +1,7 @@
+// PR c++/92201
+
+int
+foo (void (*p) ())
+{
+  return (*reinterpret_cast<int (*)()> (p)) ();
+}
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR tree-optimization/85887
	* decl.c (expand_static_init): Drop ECF_LEAF from __cxa_guard_acquire
	and __cxa_guard_release.

--- gcc/cp/decl.c	(revision 277981)
+++ gcc/cp/decl.c	(revision 277982)
@@ -8422,14 +8422,14 @@ expand_static_init (tree decl, tree init
 	      (acquire_name, build_function_type_list (integer_type_node,
 						       TREE_TYPE (guard_addr),
 						       NULL_TREE),
-	       NULL_TREE, ECF_NOTHROW | ECF_LEAF);
+	       NULL_TREE, ECF_NOTHROW);
 	  if (!release_fn || !abort_fn)
 	    vfntype = build_function_type_list (void_type_node,
 						TREE_TYPE (guard_addr),
 						NULL_TREE);
 	  if (!release_fn)
 	    release_fn = push_library_fn (release_name, vfntype, NULL_TREE,
-					   ECF_NOTHROW | ECF_LEAF);
+					  ECF_NOTHROW);
 	  if (!abort_fn)
 	    abort_fn = push_library_fn (abort_name, vfntype, NULL_TREE,
 					ECF_NOTHROW | ECF_LEAF);
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR preprocessor/92296
	* internal.h (struct def_pragma_macro): Add is_builtin bitfield.
	(_cpp_restore_special_builtin): Declare.
	* init.c (_cpp_restore_special_builtin): New function.
	* directives.c (do_pragma_push_macro): For NT_MACRO with NODE_BUILTIN
	set is_builtin and don't try to grab definition.
	(cpp_pop_definition): Use _cpp_restore_special_builtin to restore
	builtin macros.

	* c-c++-common/cpp/pr92296-1.c: New test.
	* c-c++-common/cpp/pr92296-2.c: New test.

--- libcpp/directives.c	(revision 277986)
+++ libcpp/directives.c	(revision 277987)
@@ -1574,6 +1574,8 @@ do_pragma_push_macro (cpp_reader *pfile)
   node = _cpp_lex_identifier (pfile, c->name);
   if (node->type == NT_VOID)
     c->is_undef = 1;
+  else if (node->type == NT_MACRO && (node->flags & NODE_BUILTIN))
+    c->is_builtin = 1;
   else
     {
       defn = cpp_macro_definition (pfile, node);
@@ -2504,6 +2506,11 @@ cpp_pop_definition (cpp_reader *pfile, s
   cpp_hashnode *node = _cpp_lex_identifier (pfile, c->name);
   if (node == NULL)
     return;
+  if (c->is_builtin)
+    {
+      _cpp_restore_special_builtin (pfile, c);
+      return;
+    }
 
   if (pfile->cb.before_define)
     pfile->cb.before_define (pfile);
--- libcpp/init.c	(revision 277986)
+++ libcpp/init.c	(revision 277987)
@@ -488,6 +488,26 @@ cpp_init_special_builtins (cpp_reader *p
     }
 }
 
+/* Restore macro C to builtin macro definition.  */
+
+void
+_cpp_restore_special_builtin (cpp_reader *pfile, struct def_pragma_macro *c)
+{
+  size_t len = strlen (c->name);
+
+  for (const struct builtin_macro *b = builtin_array;
+       b < builtin_array + ARRAY_SIZE (builtin_array); b++)
+    if (b->len == len && memcmp (c->name, b->name, len + 1) == 0)
+      {
+	cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
+	hp->type = NT_MACRO;
+	hp->flags |= NODE_BUILTIN;
+	if (b->always_warn_if_redefined)
+	  hp->flags |= NODE_WARN;
+	hp->value.builtin = (enum cpp_builtin_type) b->value;
+      }
+}
+
 /* Read the builtins table above and enter them, and language-specific
    macros, into the hash table.  HOSTED is true if this is a hosted
    environment.  */
--- libcpp/internal.h	(revision 277986)
+++ libcpp/internal.h	(revision 277987)
@@ -380,6 +380,8 @@ struct def_pragma_macro {
 
   /* Mark if we save an undefined macro.  */
   unsigned int is_undef : 1;
+  /* Nonzero if it was a builtin macro.  */
+  unsigned int is_builtin : 1;
 };
 
 /* A cpp_reader encapsulates the "state" of a pre-processor run.
@@ -712,6 +714,8 @@ extern void *_cpp_commit_buff (cpp_reade
 /* In init.c.  */
 extern void _cpp_maybe_push_include_file (cpp_reader *);
 extern const char *cpp_named_operator2name (enum cpp_ttype type);
+extern void _cpp_restore_special_builtin (cpp_reader *pfile,
+					  struct def_pragma_macro *);
 
 /* In directives.c */
 extern int _cpp_test_assertion (cpp_reader *, unsigned int *);
--- gcc/testsuite/c-c++-common/cpp/pr92296-1.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/cpp/pr92296-1.c	(revision 277987)
@@ -0,0 +1,32 @@
+/* PR preprocessor/92296 */
+/* { dg-do preprocess } */
+
+#pragma push_macro("__TIMESTAMP__")
+#pragma pop_macro("__TIMESTAMP__")
+
+#pragma push_macro("__TIME__")
+#pragma pop_macro("__TIME__")
+
+#pragma push_macro("__DATE__")
+#pragma pop_macro("__DATE__")
+
+#pragma push_macro("__FILE__")
+#pragma pop_macro("__FILE__")
+
+#pragma push_macro("__BASE_FILE__")
+#pragma pop_macro("__BASE_FILE__")
+
+#pragma push_macro("__LINE__")
+#pragma pop_macro("__LINE__")
+
+#pragma push_macro("__INCLUDE_LEVEL__")
+#pragma pop_macro("__INCLUDE_LEVEL__")
+
+#pragma push_macro("__COUNTER__")
+#pragma pop_macro("__COUNTER__")
+
+#pragma push_macro("__has_attribute")
+#pragma pop_macro("__has_attribute")
+
+#pragma push_macro("__has_cpp_attribute")
+#pragma pop_macro("__has_cpp_attribute")
--- gcc/testsuite/c-c++-common/cpp/pr92296-2.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/cpp/pr92296-2.c	(revision 277987)
@@ -0,0 +1,73 @@
+/* PR preprocessor/92296 */
+/* { dg-do preprocess } */
+/* { dg-options "-Wno-builtin-macro-redefined" } */
+
+#pragma push_macro("__TIMESTAMP__")
+#undef __TIMESTAMP__
+#define __TIMESTAMP__ "Thu Oct 31 12:00:00 2019"
+timestamp1 = __TIMESTAMP__
+#pragma pop_macro("__TIMESTAMP__")
+timestamp2 = __TIMESTAMP__
+
+#pragma push_macro("__TIME__")
+#undef __TIME__
+#define __TIME__ "12:00:00"
+time1 = __TIME__
+#pragma pop_macro("__TIME__")
+time2 = __TIME__
+
+#pragma push_macro("__DATE__")
+#undef __DATE__
+#define __DATE__ "Oct 31 2019"
+date1 = __DATE__
+#pragma pop_macro("__DATE__")
+date2 = __DATE__
+
+#pragma push_macro("__FILE__")
+#undef __FILE__
+#define __FILE__ "pr92296-3.c"
+file1 = __FILE__	/* { dg-final { scan-file pr92296-2.i "file1 = \"pr92296-3.c\"" } } */
+#pragma pop_macro("__FILE__")
+file2 = __FILE__	/* { dg-final { scan-file-not pr92296-2.i "file2 = \"pr92296-3.c\"" } } */
+
+#pragma push_macro("__BASE_FILE__")
+#undef __BASE_FILE__
+#define __BASE_FILE__ "pr92296-4.c"
+filebase1 = __BASE_FILE__	/* { dg-final { scan-file pr92296-2.i "filebase1 = \"pr92296-4.c\"" } } */
+#pragma pop_macro("__BASE_FILE__")
+filebase2 = __BASE_FILE__	/* { dg-final { scan-file-not pr92296-2.i "filebase2 = \"pr92296-4.c\"" } } */
+
+#pragma push_macro("__LINE__")
+#undef __LINE__		/* { dg-warning "undefining" } */
+#define __LINE__ 142
+line1 = __LINE__	/* { dg-final { scan-file pr92296-2.i "line1 = 142" } } */
+#pragma pop_macro("__LINE__")
+line2 = __LINE__	/* { dg-final { scan-file pr92296-2.i "line2 = 45" } } */
+
+#pragma push_macro("__INCLUDE_LEVEL__")
+#undef __INCLUDE_LEVEL__	/* { dg-warning "undefining" } */
+#define __INCLUDE_LEVEL__ 42
+includelevel1 = __INCLUDE_LEVEL__	/* { dg-final { scan-file pr92296-2.i "includelevel1 = 42" } } */
+#pragma pop_macro("__INCLUDE_LEVEL__")
+includelevel2 = __INCLUDE_LEVEL__	/* { dg-final { scan-file pr92296-2.i "includelevel2 = 0" } } */
+
+#pragma push_macro("__COUNTER__")
+#undef __COUNTER__	/* { dg-warning "undefining" } */
+#define __COUNTER__ 172
+counter1 = __COUNTER__	/* { dg-final { scan-file pr92296-2.i "counter1 = 172" } } */
+#pragma pop_macro("__COUNTER__")
+counter2 = __COUNTER__	/* { dg-final { scan-file-not pr92296-2.i "counter2 = 172" } } */
+
+#pragma push_macro("__has_attribute")
+#undef __has_attribute	/* { dg-warning "undefining" } */
+#define __has_attribute(x) 0
+hasattr1 = __has_attribute(noreturn)	/* { dg-final { scan-file pr92296-2.i "hasattr1 = 0" } } */
+#pragma pop_macro("__has_attribute")
+hasattr2 = __has_attribute(noreturn)	/* { dg-final { scan-file-not pr92296-2.i "hasattr2 = 0" } } */
+
+#pragma push_macro("__has_cpp_attribute")
+#undef __has_cpp_attribute	/* { dg-warning "undefining" } */
+#define __has_cpp_attribute(x) 0
+hasattrcpp1 = __has_cpp_attribute(noreturn)	/* { dg-final { scan-file pr92296-2.i "hasattrcpp1 = 0" } } */
+#pragma pop_macro("__has_cpp_attribute")
+hasattrcpp2 = __has_cpp_attribute(noreturn)	/* { dg-final { scan-file-not pr92296-2.i "hasattrcpp2 = 0" } } */
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR c++/92384
	* function.c (assign_parm_setup_block, assign_parm_setup_stack): Don't
	copy TYPE_EMPTY_P arguments from data->entry_parm to data->stack_parm
	slot.
	(assign_parms): For TREE_ADDRESSABLE parms with TYPE_EMPTY_P type
	force creation of a unique data.stack_parm slot.

	* g++.dg/torture/pr92384.C: New test.

--- gcc/function.c	(revision 277988)
+++ gcc/function.c	(revision 277989)
@@ -3078,7 +3078,7 @@ assign_parm_setup_block (struct assign_p
 	move_block_from_reg (REGNO (entry_parm), mem,
 			     size_stored / UNITS_PER_WORD);
     }
-  else if (data->stack_parm == 0)
+  else if (data->stack_parm == 0 && !TYPE_EMPTY_P (data->passed_type))
     {
       push_to_sequence2 (all->first_conversion_insn, all->last_conversion_insn);
       emit_block_move (stack_parm, data->entry_parm, GEN_INT (size),
@@ -3454,7 +3454,9 @@ assign_parm_setup_stack (struct assign_p
       dest = validize_mem (copy_rtx (data->stack_parm));
       src = validize_mem (copy_rtx (data->entry_parm));
 
-      if (MEM_P (src))
+      if (TYPE_EMPTY_P (data->passed_type))
+	/* Empty types don't really need to be copied.  */;
+      else if (MEM_P (src))
 	{
 	  /* Use a block move to handle potentially misaligned entry_parm.  */
 	  if (!to_conversion)
@@ -3610,6 +3612,16 @@ assign_parms (tree fndecl)
 	{
 	  assign_parm_find_stack_rtl (parm, &data);
 	  assign_parm_adjust_entry_rtl (&data);
+	  /* For arguments that occupy no space in the parameter
+	     passing area, have non-zero size and have address taken,
+	     force creation of a stack slot so that they have distinct
+	     address from other parameters.  */
+	  if (TYPE_EMPTY_P (data.passed_type)
+	      && TREE_ADDRESSABLE (parm)
+	      && data.entry_parm == data.stack_parm
+	      && MEM_P (data.entry_parm)
+	      && int_size_in_bytes (data.passed_type))
+	    data.stack_parm = NULL_RTX;
 	}
       /* Record permanently how this parm was passed.  */
       if (data.passed_pointer)
--- gcc/testsuite/g++.dg/torture/pr92384.C	(nonexistent)
+++ gcc/testsuite/g++.dg/torture/pr92384.C	(revision 277989)
@@ -0,0 +1,38 @@
+// PR c++/92384
+// { dg-do run }
+
+struct S {};
+struct T : public S { S a, b, c, d, e, f, g, h, i, j, k, l, m; };
+struct U { long long a, b, c; };
+
+U
+foo (S, S, S, T, T, T, U g)
+{
+  return g;
+}
+
+__attribute__((noipa)) bool
+bar (S a, S b, S c, T d, T e, T f, U g, void **h)
+{
+  h[0] = (void *) &a;
+  h[1] = (void *) &b;
+  h[2] = (void *) &c;
+  h[3] = (void *) &d;
+  h[4] = (void *) &e;
+  h[5] = (void *) &f;
+  h[6] = (void *) &g;
+  asm volatile ("" : : "r" (h) : "memory");
+  return (h[0] != h[1] && h[1] != h[2] && h[2] != h[3]
+	  && h[3] != h[4] && h[4] != h[5] && h[5] != h[6]);
+}
+
+int
+main ()
+{
+  S a;
+  T b;
+  U c = { 1, 2, 3 };
+  void *d[7];
+  if (!bar (a, a, a, b, b, b, c, d))
+    __builtin_abort ();
+}
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR middle-end/91450
	* internal-fn.c (expand_mul_overflow): For s1 * s2 -> ur, if one
	operand is negative and one non-negative, compare the non-negative
	one against 0 rather than comparing s1 & s2 against 0.  Otherwise,
	don't compare (s1 & s2) == 0, but compare separately both s1 == 0
	and s2 == 0, unless one of them is known to be negative.  Remove
	tem2 variable, use tem where tem2 has been used before.

	* gcc.c-torture/execute/pr91450-1.c: New test.
	* gcc.c-torture/execute/pr91450-2.c: New test.

--- gcc/internal-fn.c	(revision 278437)
+++ gcc/internal-fn.c	(revision 278438)
@@ -1407,7 +1407,7 @@ expand_mul_overflow (location_t loc, tre
   /* s1 * s2 -> ur  */
   if (!uns0_p && !uns1_p && unsr_p)
     {
-      rtx tem, tem2;
+      rtx tem;
       switch (pos_neg0 | pos_neg1)
 	{
 	case 1: /* Both operands known to be non-negative.  */
@@ -1437,10 +1437,8 @@ expand_mul_overflow (location_t loc, tre
 	      ops.op2 = NULL_TREE;
 	      ops.location = loc;
 	      res = expand_expr_real_2 (&ops, NULL_RTX, mode, EXPAND_NORMAL);
-	      tem = expand_binop (mode, and_optab, op0, op1, NULL_RTX, false,
-				  OPTAB_LIB_WIDEN);
-	      do_compare_rtx_and_jump (tem, const0_rtx, EQ, true, mode,
-				       NULL_RTX, NULL, done_label,
+	      do_compare_rtx_and_jump (pos_neg0 == 1 ? op0 : op1, const0_rtx, EQ,
+				       true, mode, NULL_RTX, NULL, done_label,
 				       profile_probability::very_likely ());
 	      goto do_error_label;
 	    }
@@ -1471,16 +1469,23 @@ expand_mul_overflow (location_t loc, tre
 	  arg1 = error_mark_node;
 	  emit_jump (do_main_label);
 	  emit_label (after_negate_label);
-	  tem2 = expand_binop (mode, xor_optab, op0, op1, NULL_RTX, false,
-			       OPTAB_LIB_WIDEN);
-	  do_compare_rtx_and_jump (tem2, const0_rtx, GE, false, mode, NULL_RTX,
-				   NULL, do_main_label, profile_probability::very_likely ());
+	  tem = expand_binop (mode, xor_optab, op0, op1, NULL_RTX, false,
+			      OPTAB_LIB_WIDEN);
+	  do_compare_rtx_and_jump (tem, const0_rtx, GE, false, mode, NULL_RTX,
+				   NULL, do_main_label,
+				   profile_probability::very_likely ());
 	  /* One argument is negative here, the other positive.  This
 	     overflows always, unless one of the arguments is 0.  But
 	     if e.g. s2 is 0, (U) s1 * 0 doesn't overflow, whatever s1
 	     is, thus we can keep do_main code oring in overflow as is.  */
-	  do_compare_rtx_and_jump (tem, const0_rtx, EQ, true, mode, NULL_RTX,
-				   NULL, do_main_label, profile_probability::very_likely ());
+	  if (pos_neg0 != 2)
+	    do_compare_rtx_and_jump (op0, const0_rtx, EQ, true, mode, NULL_RTX,
+				     NULL, do_main_label,
+				     profile_probability::very_unlikely ());
+	  if (pos_neg1 != 2)
+	    do_compare_rtx_and_jump (op1, const0_rtx, EQ, true, mode, NULL_RTX,
+				     NULL, do_main_label,
+				     profile_probability::very_unlikely ());
 	  expand_arith_set_overflow (lhs, target);
 	  emit_label (do_main_label);
 	  goto do_main;
--- gcc/testsuite/gcc.c-torture/execute/pr91450-1.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/execute/pr91450-1.c	(revision 278438)
@@ -0,0 +1,88 @@
+/* PR middle-end/91450 */
+
+__attribute__((noipa)) unsigned long long
+foo (int a, int b)
+{
+  unsigned long long r;
+  if (!__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  return r;
+}
+
+__attribute__((noipa)) unsigned long long
+bar (int a, int b)
+{
+  unsigned long long r;
+  if (a >= 0)
+    return 0;
+  if (!__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  return r;
+}
+
+__attribute__((noipa)) unsigned long long
+baz (int a, int b)
+{
+  unsigned long long r;
+  if (b >= 0)
+    return 0;
+  if (!__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  return r;
+}
+
+__attribute__((noipa)) unsigned long long
+qux (int a, int b)
+{
+  unsigned long long r;
+  if (a >= 0)
+    return 0;
+  if (b < 0)
+    return 0;
+  if (!__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  return r;
+}
+
+__attribute__((noipa)) unsigned long long
+quux (int a, int b)
+{
+  unsigned long long r;
+  if (a < 0)
+    return 0;
+  if (b >= 0)
+    return 0;
+  if (!__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  return r;
+}
+
+int
+main ()
+{
+  if (foo (-4, 2) != -8ULL)
+    __builtin_abort ();
+  if (foo (2, -4) != -8ULL)
+    __builtin_abort ();
+  if (bar (-4, 2) != -8ULL)
+    __builtin_abort ();
+  if (baz (2, -4) != -8ULL)
+    __builtin_abort ();
+  if (qux (-4, 2) != -8ULL)
+    __builtin_abort ();
+  if (quux (2, -4) != -8ULL)
+    __builtin_abort ();
+  if (foo (-2, 1) != -2ULL)
+    __builtin_abort ();
+  if (foo (1, -2) != -2ULL)
+    __builtin_abort ();
+  if (bar (-2, 1) != -2ULL)
+    __builtin_abort ();
+  if (baz (1, -2) != -2ULL)
+    __builtin_abort ();
+  if (qux (-2, 1) != -2ULL)
+    __builtin_abort ();
+  if (quux (1, -2) != -2ULL)
+    __builtin_abort ();
+  return 0;
+}
--- gcc/testsuite/gcc.c-torture/execute/pr91450-2.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/execute/pr91450-2.c	(revision 278438)
@@ -0,0 +1,76 @@
+/* PR middle-end/91450 */
+
+__attribute__((noipa)) void
+foo (int a, int b)
+{
+  unsigned long long r;
+  if (__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  if (r != 0)
+    __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+bar (int a, int b)
+{
+  unsigned long long r;
+  if (a >= 0)
+    return;
+  if (__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  if (r != 0)
+    __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+baz (int a, int b)
+{
+  unsigned long long r;
+  if (b >= 0)
+    return;
+  if (__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  if (r != 0)
+    __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+qux (int a, int b)
+{
+  unsigned long long r;
+  if (a >= 0)
+    return;
+  if (b < 0)
+    return;
+  if (__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  if (r != 0)
+    __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+quux (int a, int b)
+{
+  unsigned long long r;
+  if (a < 0)
+    return;
+  if (b >= 0)
+    return;
+  if (__builtin_mul_overflow (a, b, &r))
+    __builtin_abort ();
+  if (r != 0)
+    __builtin_abort ();
+}
+
+int
+main ()
+{
+  foo (-4, 0);
+  foo (0, -4);
+  foo (0, 0);
+  bar (-4, 0);
+  baz (0, -4);
+  qux (-4, 0);
+  quux (0, -4);
+  return 0;
+}
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR c/90898
	* tree-ssa-ccp.c (insert_clobber_before_stack_restore): Remove
	assertion.
	(insert_clobbers_for_var): Fix a typo in function comment.

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

--- gcc/tree-ssa-ccp.c	(revision 278488)
+++ gcc/tree-ssa-ccp.c	(revision 278489)
@@ -2082,8 +2082,6 @@ insert_clobber_before_stack_restore (tre
 					   visited);
     else if (chkp_gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
       continue;
-    else
-      gcc_assert (is_gimple_debug (stmt));
 }
 
 /* Advance the iterator to the previous non-debug gimple statement in the same
@@ -2108,9 +2106,9 @@ gsi_prev_dom_bb_nondebug (gimple_stmt_it
 /* Find a BUILT_IN_STACK_SAVE dominating gsi_stmt (I), and insert
    a clobber of VAR before each matching BUILT_IN_STACK_RESTORE.
 
-   It is possible that BUILT_IN_STACK_SAVE cannot be find in a dominator when a
-   previous pass (such as DOM) duplicated it along multiple paths to a BB.  In
-   that case the function gives up without inserting the clobbers.  */
+   It is possible that BUILT_IN_STACK_SAVE cannot be found in a dominator when
+   a previous pass (such as DOM) duplicated it along multiple paths to a BB.
+   In that case the function gives up without inserting the clobbers.  */
 
 static void
 insert_clobbers_for_var (gimple_stmt_iterator i, tree var)
--- gcc/testsuite/gcc.dg/pr90898.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr90898.c	(revision 278489)
@@ -0,0 +1,16 @@
+/* PR c/90898 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void *p;
+int bar (void);
+void baz (int *);
+
+void
+foo (void)
+{
+  p = __builtin_stack_save ();
+  int a[(bar (), 2)];
+  baz (a);
+  __builtin_stack_restore (p);
+}
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR target/90867
	* config/i386/i386.c (ix86_valid_target_attribute_tree): Don't
	clear opts->x_ix86_isa_flags{,2} here...
	(ix86_valid_target_attribute_inner_p): ... but here when seeing
	arch=.  Also clear opts->x_ix86_isa_flags{,2}_explicit.

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

--- gcc/config/i386/i386.c	(revision 278489)
+++ gcc/config/i386/i386.c	(revision 278490)
@@ -5423,7 +5423,25 @@ ix86_valid_target_attribute_inner_p (tre
 	      ret = false;
 	    }
 	  else
-	    p_strings[opt] = xstrdup (p + opt_len);
+	    {
+	      p_strings[opt] = xstrdup (p + opt_len);
+	      if (opt == IX86_FUNCTION_SPECIFIC_ARCH)
+		{
+		  /* If arch= is set,  clear all bits in x_ix86_isa_flags,
+		     except for ISA_64BIT, ABI_64, ABI_X32, and CODE16
+		     and all bits in x_ix86_isa_flags2.  */
+		  opts->x_ix86_isa_flags &= (OPTION_MASK_ISA_64BIT
+					     | OPTION_MASK_ABI_64
+					     | OPTION_MASK_ABI_X32
+					     | OPTION_MASK_CODE16);
+		  opts->x_ix86_isa_flags_explicit &= (OPTION_MASK_ISA_64BIT
+						      | OPTION_MASK_ABI_64
+						      | OPTION_MASK_ABI_X32
+						      | OPTION_MASK_CODE16);
+		  opts->x_ix86_isa_flags2 = 0;
+		  opts->x_ix86_isa_flags2_explicit = 0;
+		}
+	    }
 	}
 
       else if (type == ix86_opt_enum)
@@ -5498,18 +5516,8 @@ ix86_valid_target_attribute_tree (tree a
       /* If we are using the default tune= or arch=, undo the string assigned,
 	 and use the default.  */
       if (option_strings[IX86_FUNCTION_SPECIFIC_ARCH])
-	{
-	  opts->x_ix86_arch_string
-	    = ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]);
-
-	  /* If arch= is set,  clear all bits in x_ix86_isa_flags,
-	     except for ISA_64BIT, ABI_64, ABI_X32, and CODE16.  */
-	  opts->x_ix86_isa_flags &= (OPTION_MASK_ISA_64BIT
-				     | OPTION_MASK_ABI_64
-				     | OPTION_MASK_ABI_X32
-				     | OPTION_MASK_CODE16);
-	  opts->x_ix86_isa_flags2 = 0;
-	}
+	opts->x_ix86_arch_string
+	  = ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]);
       else if (!orig_arch_specified)
 	opts->x_ix86_arch_string = NULL;
 
--- gcc/testsuite/gcc.target/i386/pr90867.c	(nonexistent)
+++ gcc/testsuite/gcc.target/i386/pr90867.c	(revision 278490)
@@ -0,0 +1,30 @@
+/* PR target/90867 */
+/* { dg-do run { target lp64 } } */
+/* { dg-options "-O2 -msse2" } */
+
+unsigned long long freq = 3600000000UL;   /* 3.6 GHz = 3600.0 MHz */
+
+__attribute__((noipa)) void
+bar (double x)
+{
+  static double d = 3600000000.0;
+  if (x != d)
+    __builtin_abort ();
+  d /= 1000.0;
+}
+
+__attribute__ ((target ("arch=x86-64"))) int
+foo ()
+{
+  bar ((double) freq);
+  bar (1e-3 * freq);
+  bar (1e-6 * freq);
+  bar (1e-9 * freq);
+  return 0;
+}
+
+int
+main ()
+{
+  return foo ();
+}
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

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

	PR middle-end/90840
	* expmed.c (store_bit_field_1): Handle the case where op0 is not a MEM
	and has a mode that doesn't have corresponding integral type.

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

--- gcc/expmed.c	(revision 278490)
+++ gcc/expmed.c	(revision 278491)
@@ -838,6 +838,27 @@ store_bit_field_1 (rtx str_rtx, poly_uin
       if (MEM_P (op0))
 	op0 = adjust_bitfield_address_size (op0, op0_mode.else_blk (),
 					    0, MEM_SIZE (op0));
+      else if (!op0_mode.exists ())
+	{
+	  if (ibitnum == 0
+	      && known_eq (ibitsize, GET_MODE_BITSIZE (GET_MODE (op0)))
+	      && MEM_P (value)
+	      && !reverse)
+	    {
+	      value = adjust_address (value, GET_MODE (op0), 0);
+	      emit_move_insn (op0, value);
+	      return true;
+	    }
+	  if (!fallback_p)
+	    return false;
+	  rtx temp = assign_stack_temp (GET_MODE (op0),
+					GET_MODE_SIZE (GET_MODE (op0)));
+	  emit_move_insn (temp, op0);
+	  store_bit_field_1 (temp, bitsize, bitnum, 0, 0, fieldmode, value,
+			     reverse, fallback_p);
+	  emit_move_insn (op0, temp);
+	  return true;
+	}
       else
 	op0 = gen_lowpart (op0_mode.require (), op0);
     }
--- gcc/testsuite/gcc.c-torture/compile/pr90840.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/compile/pr90840.c	(revision 278491)
@@ -0,0 +1,19 @@
+/* PR middle-end/90840 */
+struct S { long long a; int b; };
+struct S foo (void);
+struct __attribute__((packed)) T { long long a; char b; };
+struct T baz (void);
+
+void
+bar (void)
+{
+  _Complex long double c;
+  *(struct S *) &c = foo ();
+}
+
+void
+qux (void)
+{
+  _Complex long double c;
+  *(struct T *) &c = baz ();
+}
2019-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/91355
	* tree-ssa-sink.c (select_best_block): Use >= rather than >
	for early_bb scaled count with best_bb count comparison.

	* g++.dg/torture/pr91355.C: New test.

--- gcc/tree-ssa-sink.c	(revision 278550)
+++ gcc/tree-ssa-sink.c	(revision 278551)
@@ -229,7 +229,7 @@ select_best_block (basic_block early_bb,
       /* If result of comparsion is unknown, preffer EARLY_BB.
 	 Thus use !(...>=..) rather than (...<...)  */
       && !(best_bb->count.apply_scale (100, 1)
-	   > (early_bb->count.apply_scale (threshold, 1))))
+	   >= early_bb->count.apply_scale (threshold, 1)))
     return best_bb;
 
   /* No better block found, so return EARLY_BB, which happens to be the
--- gcc/testsuite/g++.dg/torture/pr91355.C	(nonexistent)
+++ gcc/testsuite/g++.dg/torture/pr91355.C	(revision 278551)
@@ -0,0 +1,28 @@
+// PR tree-optimization/91355
+// { dg-do run }
+// { dg-options "-std=c++14" }
+
+unsigned int d = 0;
+
+struct S {
+  S () { d++; }
+  S (const S &) { d++; }
+  ~S () { d--; }
+};
+
+void
+foo (int i) throw (int) // { dg-warning "dynamic exception specifications are deprecated" }
+{
+  if (i == 0)
+    throw 3;
+  S d;
+  throw 3;
+}
+
+int
+main ()
+{
+  try { foo (1); } catch (...) {}
+  if (d)
+    __builtin_abort ();
+}

Patch
diff mbox series

--- libquadmath/quadmath.h	(revision 277241)
+++ libquadmath/quadmath.h	(revision 277242)
@@ -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__))