[committed] Fix doubled indefinite articles, mostly in comments.

2020-03-14 Thread Jakub Jelinek via Gcc-patches
Hi!

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
and committed to trunk as obvious.

2020-03-14  Jakub Jelinek  

* gimple-fold.c (gimple_fold_builtin_strncpy): Change
"a an" to "an" in a comment.
* hsa-common.h (is_a_helper): Likewise.
* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Likewise.
* config/arc/arc.c (arc600_corereg_hazard): Likewise.
* config/s390/s390.c (s390_indirect_branch_via_thunk): Likewise.

* logic.cc (formula::formula): Change "a an" to "an" in a comment.
* parser.c (cp_debug_parser): Change "a an" to "an" in a string
literal.

--- gcc/gimple-fold.c.jj2020-02-25 13:54:02.057091561 +0100
+++ gcc/gimple-fold.c   2020-03-12 17:04:12.401075393 +0100
@@ -1857,7 +1857,7 @@ gimple_fold_builtin_strncpy (gimple_stmt
   /* If the LEN parameter is zero, return DEST.  */
   if (integer_zerop (len))
 {
-  /* Avoid warning if the destination refers to a an array/pointer
+  /* Avoid warning if the destination refers to an array/pointer
 decorate with attribute nonstring.  */
   if (!nonstring)
{
--- gcc/hsa-common.h.jj 2020-01-12 11:54:36.645409908 +0100
+++ gcc/hsa-common.h2020-03-12 17:05:40.473785394 +0100
@@ -199,7 +199,7 @@ private:
   void operator delete (void *) {}
 };
 
-/* Report whether or not P is a an immediate operand.  */
+/* Report whether or not P is an immediate operand.  */
 
 template <>
 template <>
--- gcc/tree-ssa-strlen.c.jj2020-03-06 11:35:46.305074549 +0100
+++ gcc/tree-ssa-strlen.c   2020-03-12 17:05:54.426581031 +0100
@@ -3081,7 +3081,7 @@ maybe_diag_stxncpy_trunc (gimple_stmt_it
return false;
 }
 
-  /* Likewise, if the destination refers to a an array/pointer declared
+  /* Likewise, if the destination refers to an array/pointer declared
  nonstring return early.  */
   if (get_attr_nonstring_decl (dstdecl, &ref))
 return false;
--- gcc/config/arc/arc.c.jj 2020-03-03 10:41:26.572509949 +0100
+++ gcc/config/arc/arc.c2020-03-12 17:06:20.022206131 +0100
@@ -9353,7 +9353,7 @@ arc600_corereg_hazard (rtx_insn *pred, r
  continue;
}
   rtx dest = XEXP (x, 0);
-  /* Check if this sets a an extension register.  N.B. we use 61 for the
+  /* Check if this sets an extension register.  N.B. we use 61 for the
 condition codes, which is definitely not an extension register.  */
   if (REG_P (dest) && REGNO (dest) >= 32 && REGNO (dest) < 61
  /* Check if the same register is used by the PAT.  */
--- gcc/config/s390/s390.c.jj   2020-03-05 07:58:02.565137872 +0100
+++ gcc/config/s390/s390.c  2020-03-12 17:06:27.271099958 +0100
@@ -13252,7 +13252,7 @@ s390_output_mi_thunk (FILE *file, tree t
   assemble_end_function (thunk, fnname);
 }
 
-/* Output either an indirect jump or a an indirect call
+/* Output either an indirect jump or an indirect call
(RETURN_ADDR_REGNO != INVALID_REGNUM) with target register REGNO
using a branch trampoline disabling branch target prediction.  */
 
--- gcc/cp/logic.cc.jj  2020-01-12 11:54:36.486412307 +0100
+++ gcc/cp/logic.cc 2020-03-12 17:06:05.146424015 +0100
@@ -238,7 +238,7 @@ struct formula
 
   formula (tree t)
   {
-/* This should call emplace_back(). There's a an extra copy being
+/* This should call emplace_back(). There's an extra copy being
invoked by using push_back().  */
 m_clauses.push_back (t);
 m_current = m_clauses.begin ();
--- gcc/cp/parser.c.jj  2020-03-02 13:33:10.909495163 +0100
+++ gcc/cp/parser.c 2020-03-12 17:06:14.001294319 +0100
@@ -556,7 +556,7 @@ cp_debug_parser (FILE *file, cp_parser *
  parser->in_statement & IN_SWITCH_STMT);
   cp_debug_print_flag (file, "Parsing a structured OpenMP block",
  parser->in_statement & IN_OMP_BLOCK);
-  cp_debug_print_flag (file, "Parsing a an OpenMP loop",
+  cp_debug_print_flag (file, "Parsing an OpenMP loop",
  parser->in_statement & IN_OMP_FOR);
   cp_debug_print_flag (file, "Parsing an if statement",
  parser->in_statement & IN_IF_STMT);

Jakub



[PATCH] reassoc: Avoid code generation to depend on hash_map traversal [PR94166]

2020-03-14 Thread Jakub Jelinek via Gcc-patches
Hi!

On the following testcase, if there is ASLR, the compiler generates
different code each time (out of 1000 invocations 994 unique assembler
contents).  The problem is that undistribute_bitref_for_vector uses
a hash_map from a tree (SSA_NAME) to a vector and such a hash_map is
by default doing pointer hashing on the SSA_NAME rather than using
something stable (SSA_NAME_VERSION).
One possible way would be to use SSA_NAME_VERSION as hash function,
but given that we from the hash_map traversal just populate a vector
which is then sorted, I think it is easier to make the sort callback
use SSA_NAME_VERSION as secondary sorting key and thus ensure stable
sort (that is generally desirable anyway).

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2020-03-14  Jakub Jelinek  

PR tree-optimization/94166
* tree-ssa-reassoc.c (sort_by_mach_mode): Use SSA_NAME_VERSION
as secondary comparison key.

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

--- gcc/tree-ssa-reassoc.c.jj   2020-01-12 11:54:38.510381771 +0100
+++ gcc/tree-ssa-reassoc.c  2020-03-13 14:06:32.358085863 +0100
@@ -1793,8 +1793,11 @@ sort_by_mach_mode (const void *p_i, cons
 return 1;
   else if (mode1 < mode2)
 return -1;
-  else
-return 0;
+  if (SSA_NAME_VERSION (tr1) < SSA_NAME_VERSION (tr2))
+return -1;
+  else if (SSA_NAME_VERSION (tr1) > SSA_NAME_VERSION (tr2))
+return 1;
+  return 0;
 }
 
 /* Cleanup hash map for VECTOR information.  */
--- gcc/testsuite/gcc.dg/pr94166.c.jj   2020-03-13 14:36:46.382260562 +0100
+++ gcc/testsuite/gcc.dg/pr94166.c  2020-03-13 14:40:32.536916640 +0100
@@ -0,0 +1,24 @@
+/* PR tree-optimization/94166 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+typedef int __m128i __attribute__((__may_alias__, __vector_size__(4 * sizeof 
(int;
+unsigned int b[512];
+
+void
+foo (unsigned int *x, __m128i *y)
+{
+#define A(n) __m128i v##n = y[n];
+#define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) \
+A(n##8) A(n##9) A(n##a) A(n##b) A(n##c) A(n##d) A(n##e) A(n##f)
+#define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7)
+  C(0x)
+#undef A
+#define A(n) *(__m128i *) &b[4 * n] = v##n;
+  C(0x)
+#undef A
+#define A(n) + b[4 * n] + b[4 * n + 1] + b[4 * n + 2] + b[4 * n + 3]
+  *x = *x
+  C(0x)
+  ;
+}

Jakub



[PATCH] tree-inline: Fix a -fcompare-debug issue in the inliner [PR94167]

2020-03-14 Thread Jakub Jelinek via Gcc-patches
Hi!

The following testcase fails with -fcompare-debug.  The problem is that
bar is marked as address_taken only with -g and not without.
I've tracked it down to insert_init_stmt calling gimple_regimplify_operands
even on DEBUG_STMTs.  That function will just insert normal stmts before
the DEBUG_STMT if the DEBUG_STMT operand isn't gimple val or invariant.
While DCE will turn those statements into debug temporaries, it can cause
differences in SSA_NAMEs and more importantly, the ipa references are
generated from those before the DCE happens.
On the testcase, the DEBUG_STMT value is (int)bar.

We could generate DEBUG_STMTs with debug temporaries instead, but I fail to
see the reason to do that, DEBUG_STMTs allow other expressions and all we
want to ensure is that the expressions aren't too large (arbitrarily
complex), but during inlining/function versioning I don't see why something
would queue a DEBUG_STMT with arbitrarily complex expressions in there.

So, this patch just doesn't regimplify DEBUG_STMTs.  Bootstrapped/regtested
on x86_64-linux and i686-linux, ok for trunk?

2020-03-14  Jakub Jelinek  

PR debug/94167
* tree-inline.c (insert_init_stmt): Don't gimple_regimplify_operands
DEBUG_STMTs.

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

--- gcc/tree-inline.c.jj2020-03-04 12:58:35.033528551 +0100
+++ gcc/tree-inline.c   2020-03-13 16:19:04.129493354 +0100
@@ -3361,10 +3361,10 @@ insert_init_stmt (copy_body_data *id, ba
  gimple_assign_set_rhs1 (init_stmt, rhs);
}
   gsi_insert_after (&si, init_stmt, GSI_NEW_STMT);
-  gimple_regimplify_operands (init_stmt, &si);
-
   if (!is_gimple_debug (init_stmt))
{
+ gimple_regimplify_operands (init_stmt, &si);
+
  tree def = gimple_assign_lhs (init_stmt);
  insert_init_debug_bind (id, bb, def, def, init_stmt);
}
--- gcc/testsuite/gcc.dg/pr94167.c.jj   2020-03-13 16:33:34.046632902 +0100
+++ gcc/testsuite/gcc.dg/pr94167.c  2020-03-13 16:33:08.353012748 +0100
@@ -0,0 +1,33 @@
+/* PR debug/94167 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+struct S { int g, h; signed char i; int j; signed char k; int l[4]; } a, c;
+struct T { signed char g; } e;
+int *b, d;
+static void foo ();
+
+void
+bar (void)
+{
+  while (d)
+{
+  int k;
+  struct T f[3];
+  foo (bar, a);
+  for (k = 0;; k++)
+   f[k] = e;
+}
+}
+
+static inline void
+foo (int x, struct S y, struct T z)
+{
+  for (z.g = 2; z.g; z.g--)
+{
+  c = a = y;
+  *b |= 6;
+  if (y.g)
+   break;
+}
+}

Jakub



[PATCH v3] debug/93751 Generate DIEs for external variables with -g1

2020-03-14 Thread Alexey Neyman

On 2/28/20 1:50 PM, Jason Merrill wrote:

On 2/28/20 4:12 PM, Alexey Neyman wrote:

On 2/28/20 12:28 PM, Jason Merrill wrote:

On 2/28/20 2:11 PM, Alexander Monakov wrote:
Hm. So apparently at -g1 we don't emit type information for 
functions, and

gdb sees each function as 'void foo()' regardless of actual prototype.
Otherwise I would expect most of the types to be already present in 
debug info.


I wonder if it would make sense to emit defined variables in a 
similar fashion,

i.e. only address and size?

I'll see if I can modify the patch to do so.


Attached is a patch that does it: at -g1, the type attributes are not 
generated.


With that, the size increase at -g1 is more palatable. Again, using 
GLIBC 2.31 for x86_64-unknown-linux-gnu as a reference (columns are 
without this patch, with this patch and percent increase):


.debug_aranges 77712 78960 +1.6%
.debug_info 240284 259639 +8.1%
.debug_abbrev 112470 131014 +16.5%
.debug_line 647942 671588 +3.7%
.debug_str 88689 94503 +6.6%
.debug_loc 64150 64150 +0.0%
.debug_ranges 125872 125872 +0.0%
TOTAL 1357119 1425726 +5.1%


I think so. And we probably don't want function-scope or class-scope 
variables that happen to be TREE_PUBLIC.


Can you give an example of such function/class scope variables being 
TREE_PUBLIC? I tried a static variable described within a function 
scope, it was not TREE_PUBLIC.


A class static data member, or a static variable in an inline function 
or template instantiation.


Static variables inside an inline function or template instantiations 
were not reflected in the DIEs even with the previous iteration of this 
patch - because the DIE generation does not descend into 
function/template bodies if the debug level is terse.


DIEs for a static data member of a class, however, are currently 
generated. I couldn't find a way to distinguish it from a normal 
variable with an external linkage in a language-agnostic way. But I'd 
point out that -gstabs, for example, does generate debug info for such 
static class members even at -g1. If it is desired to avoid DIEs for 
static data members, I'd appreciate some pointers as to what tree 
predicates I should check.


Regards,
Alexey.
>From eae5ba4be1d574a515fa255d049327211afd8123 Mon Sep 17 00:00:00 2001
From: Alexey Neyman 
Date: Thu, 13 Feb 2020 22:01:10 -0800
Subject: [PATCH] debug/93751 DWARF DIEs for external vars with -g1

-g1 is described in the manual to generate debug info for functions and
external variables. It does that for older debugging formats but not for
DWARF. This change brings DWARF in line with the rest of the debugging
formats and with the manual.

2020-02-14  Alexey Neyman  

PR debug/93751
* dwarf2out.c (gen_decl_die): Proceed to generating the DIE if
the debug level is terse and the declaration is public. Do not
generate type info.
(dwarf2out_decl): Same.
(add_type_attribute): Return immediately if debug level is
terse.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-1: New test.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-2: New test.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-3: New test.

Signed-off-by: Alexey Neyman 
---
 gcc/dwarf2out.c   | 73 +++
 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-1.c |  6 ++
 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-2.c |  6 ++
 3 files changed, 53 insertions(+), 32 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-2.c

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index fe46c7e1eee..271a25d01a6 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -21562,6 +21562,9 @@ add_type_attribute (dw_die_ref object_die, tree type, int cv_quals,
   enum tree_code code  = TREE_CODE (type);
   dw_die_ref type_die  = NULL;
 
+  if (debug_info_level <= DINFO_LEVEL_TERSE)
+return;
+
   /* ??? If this type is an unnamed subrange type of an integral, floating-point
  or fixed-point type, use the inner type.  This is because we have no
  support for unnamed types in base_type_die.  This can happen if this is
@@ -26354,40 +26357,44 @@ gen_decl_die (tree decl, tree origin, struct vlr_context *ctx,
 case VAR_DECL:
 case RESULT_DECL:
   /* If we are in terse mode, don't generate any DIEs to represent any
-	 variable declarations or definitions.  */
-  if (debug_info_level <= DINFO_LEVEL_TERSE)
+	 variable declarations or definitions unless it is external.  */
+  if (debug_info_level < DINFO_LEVEL_TERSE
+	  || (debug_info_level == DINFO_LEVEL_TERSE
+	  && !TREE_PUBLIC(decl_or_origin)))
 	break;
 
-  /* Avoid generating stray type DIEs during late dwarf dumping.
- All types have been dumped early.  */
-  if (early_dwarf
-	  /* ???  But in LTRANS we cannot annotate early created variably
-	 modified type DIEs without copying them and adjusting all
-	 references to them.  Dump th

[PATCH] c++: Fix parsing of invalid enum specifiers [PR90995]

2020-03-14 Thread Jakub Jelinek via Gcc-patches
Hi!

The testcase shows some accepts-invalid (the ones without alignas) and
ice-on-invalid-code (the ones with alignas) cases.
If the enum doesn't have an underlying type and is not a definition,
the caller retries to parse it as elaborated type specifier.
E.g. for enum struct S s it will then pedwarn that elaborated type specifier
shouldn't have the struct/class keywords.
The problem is if the enum specifier is not followed by { when it has
underlying type.  In that case we have already called
cp_parser_parse_definitely to end the tentative parsing started at the
beginning of cp_parser_enum_specifier.  But the
cp_parser_error (parser, "expected %<;%> or %<{%>");
doesn't emit any error because the whole function is called from yet another
tentative parse and the caller starts parsing the elaborated type
specifier where the cp_parser_enum_specifier stopped (i.e. after the
underlying type token(s)).  The ultimate caller than commits the tentative
parsing (and even if it wouldn't, it wouldn't know what kind of error
to report).  I think after seeing enum {,struct,class} : type not being
followed by { or ;, there is no reason not to report it right away, as it
can't be valid C++, which is what the patch does.  Not sure if we shouldn't
also return error_mark_node instead of NULL_TREE, so that the caller doesn't
try to parse it as elaborated type specifier (the patch doesn't do that
right now).

Furthermore, while reading the code, I've noticed that
parser->colon_corrects_to_scope_p is saved and set to false at the start
of the function, but not restored back in some cases.  Don't have a testcase
where this would be a problem, but it just seems wrong.  Either we can in
the two spots replace return NULL_TREE; with { type = NULL_TREE; goto out; }
or we could perhaps abuse warning_sentinel or create a special class with
dtor to clean the flag up.

And lastly, I've fixed some formatting issues in the function while reading
it.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2020-03-14  Jakub Jelinek  

PR c++/90995
* parser.c (cp_parser_enum_specifier): Make sure to restore
parser->colon_corrects_to_scope_p in all cases.  If scoped
enum or enum with underlying type is not followed by { or ;,
call error_at rather than cp_parser_error.  Formatting fixes.

* g++.dg/cpp0x/enum40.C: New test.

--- gcc/cp/parser.c.jj  2020-03-12 18:17:58.039230033 +0100
+++ gcc/cp/parser.c 2020-03-13 21:44:20.117085594 +0100
@@ -19043,24 +19043,24 @@ cp_parser_enum_specifier (cp_parser* par
 
   push_deferring_access_checks (dk_no_check);
   nested_name_specifier
-  = cp_parser_nested_name_specifier_opt (parser,
-/*typename_keyword_p=*/true,
-/*check_dependency_p=*/false,
-/*type_p=*/false,
-/*is_declaration=*/false);
+= cp_parser_nested_name_specifier_opt (parser,
+  /*typename_keyword_p=*/true,
+  /*check_dependency_p=*/false,
+  /*type_p=*/false,
+  /*is_declaration=*/false);
 
   if (nested_name_specifier)
 {
   tree name;
 
   identifier = cp_parser_identifier (parser);
-  name =  cp_parser_lookup_name (parser, identifier,
-enum_type,
-/*is_template=*/false,
-/*is_namespace=*/false,
-/*check_dependency=*/true,
-/*ambiguous_decls=*/NULL,
-input_location);
+  name = cp_parser_lookup_name (parser, identifier,
+   enum_type,
+   /*is_template=*/false,
+   /*is_namespace=*/false,
+   /*check_dependency=*/true,
+   /*ambiguous_decls=*/NULL,
+   input_location);
   if (name && name != error_mark_node)
{
  type = TREE_TYPE (name);
@@ -19117,7 +19117,10 @@ cp_parser_enum_specifier (cp_parser* par
 
   /* At this point this is surely not elaborated type specifier.  */
   if (!cp_parser_parse_definitely (parser))
-   return NULL_TREE;
+   {
+ type = NULL_TREE;
+ goto out;
+   }
 
   if (cxx_dialect < cxx11)
 maybe_warn_cpp0x (CPP0X_SCOPED_ENUMS);
@@ -19151,17 +19154,23 @@ cp_parser_enum_specifier (cp_parser* par
   if ((scoped_enum_p || underlying_type)
  && cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
{
- cp_parser_error (parser, "expected %<;%> or %<{%>");
  if (has_underlying_type)
{

Re: [PATCH v3] debug/93751 Generate DIEs for external variables with -g1

2020-03-14 Thread Alexander Monakov via Gcc-patches
On Sat, 14 Mar 2020, Alexey Neyman wrote:
> Attached is a patch that does it: at -g1, the type attributes are not
> generated.

Two small issues I pointed out the last time are still present:
https://gcc.gnu.org/legacy-ml/gcc-patches/2020-02/msg01646.html

(I did not review the new patch on a more substantial level)

Alexander


[PATCH] rs6000/test: Fix selector in fold-vec-mule-misc.c

2020-03-14 Thread Segher Boessenkool
Run tests should use vmx_hw, not just powerpc_altivec_ok.  Committed.


Segher


gcc/testsuite/
PR target/94176
* gcc.target/powerpc/fold-vec-mule-misc.c: Use vmx_hw selector.
---
 gcc/testsuite/ChangeLog   | 5 +
 gcc/testsuite/gcc.target/powerpc/fold-vec-mule-misc.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 75d6041..0f84567 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-14  Segher Boessenkool  
+
+   PR target/94176
+   * gcc.target/powerpc/fold-vec-mule-misc.c: Use vmx_hw selector.
+
 2020-03-13  David Malcolm  
 
PR analyzer/94099
diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-mule-misc.c 
b/gcc/testsuite/gcc.target/powerpc/fold-vec-mule-misc.c
index 9b89118..7daf302 100644
--- a/gcc/testsuite/gcc.target/powerpc/fold-vec-mule-misc.c
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-mule-misc.c
@@ -1,7 +1,7 @@
 /* PR target/79941 */
 
 /* { dg-do run } */
-/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-require-effective-target vmx_hw } */
 /* { dg-options "-maltivec -O2 -save-temps" } */
 
 #include 
-- 
1.8.3.1



[PATCH libphobos] Committed merge with upstream druntime 7915b6a3

2020-03-14 Thread Iain Buclaw via Gcc-patches

Hi,

This patch merges the libphobos implementation with upstream druntime 
7915b6a3.


Includes port fixes for Musl on ARM, AArch64, and SystemZ targets.

Bootstrapped and tested on x86_64-linux-gnu, and committed to trunk.

Regards
Iain.
---

diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index b8da026ba02..0e2c5d1c139 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-5bb8ce19fa495e5f794b3c513ae1bf7aabae93ff
+7915b6a399fbb6d9c0db351eb5a8fda7e43fe8c5
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/druntime repository.
diff --git a/libphobos/libdruntime/core/stdc/errno.d b/libphobos/libdruntime/core/stdc/errno.d
index 06c2b5d94b6..80105d70de7 100644
--- a/libphobos/libdruntime/core/stdc/errno.d
+++ b/libphobos/libdruntime/core/stdc/errno.d
@@ -144,6 +144,15 @@ else version (Solaris)
 alias errno = ___errno;
 }
 }
+else version (Haiku)
+{
+// https://github.com/haiku/haiku/blob/master/headers/posix/errno.h
+extern (C)
+{
+ref int _errnop();
+alias errno = _errnop;
+}
+}
 else
 {
 ///
@@ -1709,6 +1718,325 @@ else version (Solaris)
 enum EINPROGRESS =150 /** operation now in progress */;
 enum ESTALE = 151 /** Stale NFS file handle */;
 }
+else version (Haiku)
+{
+// https://github.com/haiku/haiku/blob/master/headers/os/support/Errors.h
+// https://github.com/haiku/haiku/blob/master/headers/build/os/support/Errors.h
+import core.stdc.limits : INT_MIN;
+enum B_GENERAL_ERROR_BASE= INT_MIN;
+enum B_OS_ERROR_BASE = (B_GENERAL_ERROR_BASE + 0x1000);
+enum B_APP_ERROR_BASE= (B_GENERAL_ERROR_BASE + 0x2000);
+enum B_INTERFACE_ERROR_BASE  = (B_GENERAL_ERROR_BASE + 0x3000);
+enum B_MEDIA_ERROR_BASE  = (B_GENERAL_ERROR_BASE + 0x4000);
+/* - 0x41ff */
+enum B_TRANSLATION_ERROR_BASE= (B_GENERAL_ERROR_BASE + 0x4800);
+/* - 0x48ff */
+enum B_MIDI_ERROR_BASE   = (B_GENERAL_ERROR_BASE + 0x5000);
+enum B_STORAGE_ERROR_BASE= (B_GENERAL_ERROR_BASE + 0x6000);
+enum B_POSIX_ERROR_BASE  = (B_GENERAL_ERROR_BASE + 0x7000);
+enum B_MAIL_ERROR_BASE   = (B_GENERAL_ERROR_BASE + 0x8000);
+enum B_PRINT_ERROR_BASE  = (B_GENERAL_ERROR_BASE + 0x9000);
+enum B_DEVICE_ERROR_BASE = (B_GENERAL_ERROR_BASE + 0xa000);
+
+/* General Errors */
+enum B_NO_MEMORY = (B_GENERAL_ERROR_BASE + 0);
+enum B_IO_ERROR  = (B_GENERAL_ERROR_BASE + 1);
+enum B_PERMISSION_DENIED = (B_GENERAL_ERROR_BASE + 2);
+enum B_BAD_INDEX = (B_GENERAL_ERROR_BASE + 3);
+enum B_BAD_TYPE  = (B_GENERAL_ERROR_BASE + 4);
+enum B_BAD_VALUE = (B_GENERAL_ERROR_BASE + 5);
+enum B_MISMATCHED_VALUES = (B_GENERAL_ERROR_BASE + 6);
+enum B_NAME_NOT_FOUND= (B_GENERAL_ERROR_BASE + 7);
+enum B_NAME_IN_USE   = (B_GENERAL_ERROR_BASE + 8);
+enum B_TIMED_OUT = (B_GENERAL_ERROR_BASE + 9);
+enum B_INTERRUPTED   = (B_GENERAL_ERROR_BASE + 10);
+enum B_WOULD_BLOCK   = (B_GENERAL_ERROR_BASE + 11);
+enum B_CANCELED  = (B_GENERAL_ERROR_BASE + 12);
+enum B_NO_INIT   = (B_GENERAL_ERROR_BASE + 13);
+enum B_NOT_INITIALIZED   = (B_GENERAL_ERROR_BASE + 13);
+enum B_BUSY  = (B_GENERAL_ERROR_BASE + 14);
+enum B_NOT_ALLOWED   = (B_GENERAL_ERROR_BASE + 15);
+enum B_BAD_DATA  = (B_GENERAL_ERROR_BASE + 16);
+enum B_DONT_DO_THAT  = (B_GENERAL_ERROR_BASE + 17);
+
+enum B_ERROR = (-1);
+enum B_OK= (int(0));
+enum B_NO_ERROR  = (int(0));
+
+/* Kernel Kit Errors */
+enum B_BAD_SEM_ID= (B_OS_ERROR_BASE + 0);
+enum B_NO_MORE_SEMS  = (B_OS_ERROR_BASE + 1);
+
+enum B_BAD_THREAD_ID = (B_OS_ERROR_BASE + 0x100);
+enum B_NO_MORE_THREADS   = (B_OS_ERROR_BASE + 0x101);
+enum B_BAD_THREAD_STATE  = (B_OS_ERROR_BASE + 0x102);
+enum B_BAD_TEAM_ID   = (B_OS_ERROR_BASE + 0x103);
+enum B_NO_MORE_TEAMS = (B_OS_ERROR_BASE + 0x104);
+
+enum B_BAD_PORT_ID   = (B_OS_ERROR_BASE + 0x200);
+enum B_NO_MORE_PORTS = (B_OS_ERROR_BASE + 0x201);
+
+enum B_BAD_IMAGE_ID  = (B_OS_ERROR_BASE + 0x300);
+enum B_BAD_ADDRESS   = (B_OS_ERROR_BASE + 0x301);
+enum B_NOT_AN_EXECUTABLE = (B_OS_ERROR_BASE + 0x302);
+enum B_MISSING_LIBRARY   = (B_OS_ERROR_BASE + 0x303);
+enum B_MISSING_SYMBOL= (B_OS_ERROR_BASE + 0x304);
+

[pushed] c++: Fix CTAD with multiple-arg ctor template [93248].

2020-03-14 Thread Jason Merrill via Gcc-patches
When cp_unevaluated_operand is set, tsubst_decl thinks that if it sees a
PARM_DECL that isn't already in local_specializations, we're in a decltype
in a trailing return type or some such, and so we only want a substitution
for a single PARM_DECL.  In this case, we want the whole chain, so make sure
cp_unevaluated_operand is cleared.

Tested x86_64-pc-linux-gnu, applying to 8/9/10.

gcc/cp/ChangeLog
2020-03-14  Jason Merrill  

PR c++/93248
* pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
substituting DECL_ARGUMENTS.
---
 gcc/cp/pt.c| 5 -
 gcc/testsuite/g++.dg/cpp1z/class-deduction71.C | 6 ++
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction71.C

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 789ccdbbbd1..0f3c2ad8fec 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -28071,10 +28071,13 @@ build_deduction_guide (tree type, tree ctor, tree 
outer_args, tsubst_flags_t com
 complain, ctor);
  if (fparms == error_mark_node)
ok = false;
- fargs = tsubst (fargs, tsubst_args, complain, ctor);
  if (ci)
ci = tsubst_constraint_info (ci, tsubst_args, complain, ctor);
 
+ /* Parms are to have DECL_CHAIN tsubsted, which would be skipped if
+cp_unevaluated_operand.  */
+ cp_evaluated ev;
+ fargs = tsubst (fargs, tsubst_args, complain, ctor);
  current_template_parms = save_parms;
}
 
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction71.C 
b/gcc/testsuite/g++.dg/cpp1z/class-deduction71.C
new file mode 100644
index 000..2fc71de8d95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction71.C
@@ -0,0 +1,6 @@
+// PR c++/93248
+// { dg-do compile { target c++17 } }
+
+template  struct S
+{ template  S (T, V, long = 0); };
+using U = decltype(S{0, 4u});

base-commit: 53b28abf8e4ba37e47d3bb05476e0a80ae761567
-- 
2.18.1



[pushed] c++: Find parameter pack in typedef in lambda [92909].

2020-03-14 Thread Jason Merrill via Gcc-patches
find_parameter_packs_r doesn't look through typedefs, which is normally
correct, but that means we need to handle their declarations specially.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/cp/ChangeLog
2020-03-14  Jason Merrill  

PR c++/92909
* pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
DECL_ORIGINAL_TYPE of a typedef.
---
 gcc/cp/pt.c  | 16 
 .../g++.dg/cpp0x/lambda/lambda-variadic10.C  | 12 
 2 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 0f3c2ad8fec..bd2f9be82ea 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3916,10 +3916,18 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, 
void* data)
   return NULL_TREE;
 
 case DECL_EXPR:
-  /* Ignore the declaration of a capture proxy for a parameter pack.  */
-  if (is_capture_proxy (DECL_EXPR_DECL (t)))
-   *walk_subtrees = 0;
-  return NULL_TREE;
+  {
+   tree decl = DECL_EXPR_DECL (t);
+   /* Ignore the declaration of a capture proxy for a parameter pack.  */
+   if (is_capture_proxy (decl))
+ *walk_subtrees = 0;
+   if (is_typedef_decl (decl))
+ /* Since we stop at typedefs above, we need to look through them at
+the point of the DECL_EXPR.  */
+ cp_walk_tree (&DECL_ORIGINAL_TYPE (decl),
+   &find_parameter_packs_r, ppd, ppd->visited);
+   return NULL_TREE;
+  }
 
 case TEMPLATE_DECL:
   if (!DECL_TEMPLATE_TEMPLATE_PARM_P (t))
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C 
b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C
new file mode 100644
index 000..052283e6caa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic10.C
@@ -0,0 +1,12 @@
+// PR c++/92909
+// { dg-do compile { target c++11 } }
+
+template 
+void foo()
+{
+[]
+{
+using T = Ts;
+}();   // { dg-error "not expanded" }
+}
+template void foo<>();

base-commit: 53b28abf8e4ba37e47d3bb05476e0a80ae761567
-- 
2.18.1



[pushed] c++: Fix ICE-after-error on partial spec [92068]

2020-03-14 Thread Jason Merrill via Gcc-patches
Here the template arguments for the partial specialization are valid
arguments for the template, but not for a partial specialization, because
'd' can never be deduced to anything other than an empty pack.

Tested x86_64-pc-linux-gnu, applying to 8/9/10.

gcc/cp/ChangeLog
2020-03-14  Jason Merrill  

PR c++/92068
* pt.c (process_partial_specialization): Error rather than crash on
extra pack expansion.
---
 gcc/cp/pt.c  | 9 -
 gcc/testsuite/g++.dg/cpp0x/variadic178.C | 6 ++
 2 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic178.C

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index bd2f9be82ea..48ac48615a0 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5038,6 +5038,14 @@ process_partial_specialization (tree decl)
   return decl;
 }
 
+  else if (nargs > DECL_NTPARMS (maintmpl))
+{
+  error ("too many arguments for partial specialization %qT", type);
+  inform (DECL_SOURCE_LOCATION (maintmpl), "primary template here");
+  /* Avoid crash below.  */
+  return decl;
+}
+
   /* If we aren't in a dependent class, we can actually try deduction.  */
   else if (tpd.level == 1
   /* FIXME we should be able to handle a partial specialization of a
@@ -5064,7 +5072,6 @@ process_partial_specialization (tree decl)
 
  Also, we verify that pack expansions only occur at the
  end of the argument list.  */
-  gcc_assert (nargs == DECL_NTPARMS (maintmpl));
   tpd2.parms = 0;
   for (i = 0; i < nargs; ++i)
 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic178.C 
b/gcc/testsuite/g++.dg/cpp0x/variadic178.C
new file mode 100644
index 000..f0e65958de3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic178.C
@@ -0,0 +1,6 @@
+// PR c++/92068
+// { dg-do compile { target c++11 } }
+
+template  struct a;
+template 
+struct a { };  // { dg-error "arguments" }

base-commit: 53b28abf8e4ba37e47d3bb05476e0a80ae761567
-- 
2.18.1



[committed] wwwdocs: Slightly shorten/simplify our notes on mailing list spam.

2020-03-14 Thread Gerald Pfeifer
A mail by Jonathan made me look at that page again after a looong
while, and I noticed two simplifications.

Pushed (though the machinery to update the web site did not appear
to be working then, but I manually re-run it now).

Gerald

 patch 
commit 09a7a9579b59619ea3f601b821ec8b9dd3fe708e
Author: Gerald Pfeifer 
Date:   Sun Mar 8 00:28:23 2020 +0100

Slightly shorten/simplify our notes on mailing list spam.

diff --git a/htdocs/spam.html b/htdocs/spam.html
index f368ad9a..2196a83b 100644
--- a/htdocs/spam.html
+++ b/htdocs/spam.html
@@ -15,11 +15,7 @@ wish this would not happen, it is a fact of life on an open 
list (we do not
 want to run a list where only members can post).
 
 Some simple guidelines for how to deal with SPAM to the lists can help
-avoid creating unnecessary traffic on the list.
-
- In additional to the information provided below, you might want to check
-out https://www.abuse.net";>www.abuse.net for further information
-about SPAM.
+avoid creating unnecessary traffic:
 
 
   -  NEVER respond to SPAM, no matter *what* the message says about
@@ -54,5 +50,8 @@ about SPAM.
  email address harvested this way.
 
 
+In addition to the above you may want to check out
+https://www.abuse.net";>www.abuse.net.
+
 
 


[PATCH v4] debug/93751 Generate DIEs for external variables with -g1

2020-03-14 Thread Alexey Neyman

On 3/14/20 4:53 AM, Alexander Monakov wrote:

On Sat, 14 Mar 2020, Alexey Neyman wrote:

Attached is a patch that does it: at -g1, the type attributes are not
generated.

Two small issues I pointed out the last time are still present:
https://gcc.gnu.org/legacy-ml/gcc-patches/2020-02/msg01646.html

(I did not review the new patch on a more substantial level)


Sorry, I seem to have missed your previous email. Fixed in the attached 
patch.


- pr93751-3.c in the commit message is a remnant from v1 of the patch 
(which implemented a separate option to enable DIEs for external 
variables). Dropped the mention of it from the commit message.


- Added spaces before parentheses in macro invocations. Finger memory is 
hard to overcome.


Regards,
Alexey.

>From 17c8b252ad3b87388f1f1809d188c159911056a0 Mon Sep 17 00:00:00 2001
From: Alexey Neyman 
Date: Thu, 13 Feb 2020 22:01:10 -0800
Subject: [PATCH] debug/93751 DWARF DIEs for external vars with -g1

-g1 is described in the manual to generate debug info for functions and
external variables. It does that for older debugging formats but not for
DWARF. This change brings DWARF in line with the rest of the debugging
formats and with the manual.

2020-02-14  Alexey Neyman  

PR debug/93751
* dwarf2out.c (gen_decl_die): Proceed to generating the DIE if
the debug level is terse and the declaration is public. Do not
generate type info.
(dwarf2out_decl): Same.
(add_type_attribute): Return immediately if debug level is
terse.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-1: New test.
* gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-2: New test.

Signed-off-by: Alexey Neyman 
---
 gcc/dwarf2out.c   | 73 +++
 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-1.c |  6 ++
 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-2.c |  6 ++
 3 files changed, 53 insertions(+), 32 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-1.c
 create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/pr93751-2.c

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index fe46c7e1eee..89e52a41508 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -21562,6 +21562,9 @@ add_type_attribute (dw_die_ref object_die, tree type, int cv_quals,
   enum tree_code code  = TREE_CODE (type);
   dw_die_ref type_die  = NULL;
 
+  if (debug_info_level <= DINFO_LEVEL_TERSE)
+return;
+
   /* ??? If this type is an unnamed subrange type of an integral, floating-point
  or fixed-point type, use the inner type.  This is because we have no
  support for unnamed types in base_type_die.  This can happen if this is
@@ -26354,40 +26357,44 @@ gen_decl_die (tree decl, tree origin, struct vlr_context *ctx,
 case VAR_DECL:
 case RESULT_DECL:
   /* If we are in terse mode, don't generate any DIEs to represent any
-	 variable declarations or definitions.  */
-  if (debug_info_level <= DINFO_LEVEL_TERSE)
+	 variable declarations or definitions unless it is external.  */
+  if (debug_info_level < DINFO_LEVEL_TERSE
+	  || (debug_info_level == DINFO_LEVEL_TERSE
+	  && !TREE_PUBLIC (decl_or_origin)))
 	break;
 
-  /* Avoid generating stray type DIEs during late dwarf dumping.
- All types have been dumped early.  */
-  if (early_dwarf
-	  /* ???  But in LTRANS we cannot annotate early created variably
-	 modified type DIEs without copying them and adjusting all
-	 references to them.  Dump them again as happens for inlining
-	 which copies both the decl and the types.  */
-	  /* ???  And even non-LTO needs to re-visit type DIEs to fill
-	 in VLA bound information for example.  */
-	  || (decl && variably_modified_type_p (TREE_TYPE (decl),
-		current_function_decl)))
-	{
-	  /* Output any DIEs that are needed to specify the type of this data
-	 object.  */
-	  if (decl_by_reference_p (decl_or_origin))
-	gen_type_die (TREE_TYPE (TREE_TYPE (decl_or_origin)), context_die);
-	  else
-	gen_type_die (TREE_TYPE (decl_or_origin), context_die);
-	}
+  if (debug_info_level > DINFO_LEVEL_TERSE) {
+	/* Avoid generating stray type DIEs during late dwarf dumping.
+	   All types have been dumped early.  */
+	if (early_dwarf
+	/* ???  But in LTRANS we cannot annotate early created variably
+	   modified type DIEs without copying them and adjusting all
+	   references to them.  Dump them again as happens for inlining
+	   which copies both the decl and the types.  */
+	/* ???  And even non-LTO needs to re-visit type DIEs to fill
+	   in VLA bound information for example.  */
+	|| (decl && variably_modified_type_p (TREE_TYPE (decl),
+		  current_function_decl)))
+	  {
+	/* Output any DIEs that are needed to specify the type of this data
+	   object.  */
+	if (decl_by_reference_p (decl_or_origin))
+	  gen_type_die (TREE_TYPE (TREE_TYPE (decl_or_origin)), context_die);
+	else
+	  gen_type_die (TREE_TYPE (

[committed] tree-nested: Fix handling of *reduction clauses with C array sections [PR93566]

2020-03-14 Thread Jakub Jelinek via Gcc-patches
Hi!

tree-nested.c didn't handle C array sections in {,task_,in_}reduction clauses.

The following patch implements that, bootstrapped/regtested on x86_64-linux
and i686-linux, committed to trunk so far.

2020-03-14  Jakub Jelinek  

PR middle-end/93566
* tree-nested.c (convert_nonlocal_omp_clauses,
convert_local_omp_clauses): Handle {,in_,task_}reduction clauses
with C/C++ array sections.

* testsuite/libgomp.c/pr93566.c: New test.

--- gcc/tree-nested.c.jj2020-03-13 11:23:23.593724452 +0100
+++ gcc/tree-nested.c   2020-03-14 09:54:53.319358556 +0100
@@ -1188,7 +1188,7 @@ convert_nonlocal_omp_clauses (tree *pcla
 {
   struct nesting_info *const info = (struct nesting_info *) wi->info;
   bool need_chain = false, need_stmts = false;
-  tree clause, decl;
+  tree clause, decl, *pdecl;
   int dummy;
   bitmap new_suppress;
 
@@ -1197,6 +1197,7 @@ convert_nonlocal_omp_clauses (tree *pcla
 
   for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause))
 {
+  pdecl = NULL;
   switch (OMP_CLAUSE_CODE (clause))
{
case OMP_CLAUSE_REDUCTION:
@@ -1204,6 +1205,15 @@ convert_nonlocal_omp_clauses (tree *pcla
case OMP_CLAUSE_TASK_REDUCTION:
  if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
need_stmts = true;
+ if (TREE_CODE (OMP_CLAUSE_DECL (clause)) == MEM_REF)
+   {
+ pdecl = &TREE_OPERAND (OMP_CLAUSE_DECL (clause), 0);
+ if (TREE_CODE (*pdecl) == POINTER_PLUS_EXPR)
+   pdecl = &TREE_OPERAND (*pdecl, 0);
+ if (TREE_CODE (*pdecl) == INDIRECT_REF
+ || TREE_CODE (*pdecl) == ADDR_EXPR)
+   pdecl = &TREE_OPERAND (*pdecl, 0);
+   }
  goto do_decl_clause;
 
case OMP_CLAUSE_LASTPRIVATE:
@@ -1230,7 +1240,9 @@ convert_nonlocal_omp_clauses (tree *pcla
case OMP_CLAUSE_USE_DEVICE_ADDR:
case OMP_CLAUSE_IS_DEVICE_PTR:
do_decl_clause:
- decl = OMP_CLAUSE_DECL (clause);
+ if (pdecl == NULL)
+   pdecl = &OMP_CLAUSE_DECL (clause);
+ decl = *pdecl;
  if (VAR_P (decl)
  && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
break;
@@ -1239,7 +1251,7 @@ convert_nonlocal_omp_clauses (tree *pcla
  if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_SHARED)
OMP_CLAUSE_SHARED_READONLY (clause) = 0;
  bitmap_set_bit (new_suppress, DECL_UID (decl));
- OMP_CLAUSE_DECL (clause) = get_nonlocal_debug_decl (info, decl);
+ *pdecl = get_nonlocal_debug_decl (info, decl);
  if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_PRIVATE)
need_chain = true;
}
@@ -1909,7 +1921,7 @@ convert_local_omp_clauses (tree *pclause
 {
   struct nesting_info *const info = (struct nesting_info *) wi->info;
   bool need_frame = false, need_stmts = false;
-  tree clause, decl;
+  tree clause, decl, *pdecl;
   int dummy;
   bitmap new_suppress;
 
@@ -1918,6 +1930,7 @@ convert_local_omp_clauses (tree *pclause
 
   for (clause = *pclauses; clause ; clause = OMP_CLAUSE_CHAIN (clause))
 {
+  pdecl = NULL;
   switch (OMP_CLAUSE_CODE (clause))
{
case OMP_CLAUSE_REDUCTION:
@@ -1925,6 +1938,15 @@ convert_local_omp_clauses (tree *pclause
case OMP_CLAUSE_TASK_REDUCTION:
  if (OMP_CLAUSE_REDUCTION_PLACEHOLDER (clause))
need_stmts = true;
+ if (TREE_CODE (OMP_CLAUSE_DECL (clause)) == MEM_REF)
+   {
+ pdecl = &TREE_OPERAND (OMP_CLAUSE_DECL (clause), 0);
+ if (TREE_CODE (*pdecl) == POINTER_PLUS_EXPR)
+   pdecl = &TREE_OPERAND (*pdecl, 0);
+ if (TREE_CODE (*pdecl) == INDIRECT_REF
+ || TREE_CODE (*pdecl) == ADDR_EXPR)
+   pdecl = &TREE_OPERAND (*pdecl, 0);
+   }
  goto do_decl_clause;
 
case OMP_CLAUSE_LASTPRIVATE:
@@ -1951,7 +1973,9 @@ convert_local_omp_clauses (tree *pclause
case OMP_CLAUSE_USE_DEVICE_ADDR:
case OMP_CLAUSE_IS_DEVICE_PTR:
do_decl_clause:
- decl = OMP_CLAUSE_DECL (clause);
+ if (pdecl == NULL)
+   pdecl = &OMP_CLAUSE_DECL (clause);
+ decl = *pdecl;
  if (VAR_P (decl)
  && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
break;
@@ -1964,8 +1988,7 @@ convert_local_omp_clauses (tree *pclause
  if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_SHARED)
OMP_CLAUSE_SHARED_READONLY (clause) = 0;
  bitmap_set_bit (new_suppress, DECL_UID (decl));
- OMP_CLAUSE_DECL (clause)
-   = get_local_debug_decl (info, decl, field);
+ *pdecl = get_local_debug_decl (info, decl, field);
  need_frame = true;
}
}
--- libgomp/testsuite/libgomp.c/pr93566.c.jj2020-03-13 12:53:56.247508784 
+0100
+++ libgomp/testsuite/libgom

[PATCH PR94125]Update post order number for merged SCC

2020-03-14 Thread bin.cheng via Gcc-patches
Hi,
This simple patch fixes PR94125 by updating post order number for merged SCC.
The root cause is after computing SCC with runtime alias edges skipped, the post
order info is changed and it's possible a partition is scheduled after another 
where
should be scheduled before.  Note that updating to the minimal post order number
is safe, only partitions separated from SCC because of skipping runtime alias 
edges
can be assigned larger post oder than the original precedent one.

Bootstrap and test on x86_64, test case also added.

Thanks,
bin

2020-03-15  Bin Cheng  

PR tree-optimization/94125
* tree-loop-distribution.c
(loop_distribution::break_alias_scc_partitions): Update post ordeer
number for merged scc.

gcc/testsuite
2020-03-15  Bin Cheng  

PR tree-optimization/94125
* gcc.dg/tree-ssa/pr94125.c: New test.

0001-pr94125.patch
Description: Binary data