Re: [PATCH v3] Add --ld-path= to specify an arbitrary executable as the linker

2020-07-25 Thread Andreas Schwab
On Jul 24 2020, Fangrui Song via Gcc-patches wrote:

> This is to mimick nearly lines. collect2 should filter out options like 
> -fno-lto, -flto, -fuse-ld= before passing to ld. -f* are handled by case 'f'. 
> --ld-path needs its own `else if`.

If you handle --ld-path as -fld-path then you don't need that.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


Re: [Patch, fortran] PR 93592 - Invalid UP/DOWN rounding with EN descriptor

2020-07-25 Thread Thomas Koenig via Gcc-patches

Am 24.07.20 um 23:19 schrieb dhumieres.domini...@free.fr:

Le 2020-07-24 20:50, Thomas Koenig a écrit :

Hi Dominique,

I have committed the patch after regression-testing.


Thanks.



Dou you want to backport this, as well?


IMO it is worth the work.


OK. The patch for PR 93592 is now committed down to gcc-8.
The patch for 93567 only applied cleanly to trunk and gcc-10,
where I have also committed it there.  If you want to
backport it further and want me to commit this, I will need
a modified version of the patch.


(And if one of my e-mails bounced, you can try the other one.


What is the other one?


I currently use tkoe...@netcologne.de and t...@tkoenig.net somewhat
interchangably.  I'm not sure which one bounces your e-mails;
I hope one of them works.

Thanks a lot for taking on these bugs!

Best regards

Thomas


[PATCH] Use vec::reserve before vec_safe_grow_cleared is called

2020-07-25 Thread Martin Liška

Hello.

When inserting into fast_call_summary (or fast_function_summary), we grow
a vector to a _exact_ size based on cgraph_max_summary_id or 
edges_max_summary_id.
Problem is that it causes very many reallocation and we should rather use 
::reserve
function that selects a reasonable size of a new vector.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Fixes chromium WPA build time:
https://gist.githubusercontent.com/marxin/223890df4d8d8e490b6b2918b77dacad/raw/f766f6546739e739a273639dde90ac6179aa3077/chromium-gcc10-fixed-summary-crash.svg

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

* symbol-summary.h: Call vec_safe_reserve before grow is called
in order to grow to a reasonable size.
* vec.h (vec_safe_reserve): Add missing function for vl_ptr
type.
---
 gcc/symbol-summary.h | 13 ++---
 gcc/vec.h| 11 +++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index a38eb1db778..fa1df5c8015 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -354,8 +354,11 @@ public:
   id = this->m_symtab->assign_summary_id (node);
 
 if ((unsigned int)id >= m_vector->length ())

-  vec_safe_grow_cleared (m_vector,
-this->m_symtab->cgraph_max_summary_id);
+  {
+   int newlen = this->m_symtab->cgraph_max_summary_id;
+   vec_safe_reserve (m_vector, newlen - m_vector->length ());
+   m_vector->quick_grow_cleared (newlen);
+  }
 
 if ((*m_vector)[id] == NULL)

   (*m_vector)[id] = this->allocate_new ();
@@ -812,7 +815,11 @@ public:
   id = this->m_symtab->assign_summary_id (edge);
 
 if ((unsigned)id >= m_vector->length ())

-  vec_safe_grow_cleared (m_vector, this->m_symtab->edges_max_summary_id);
+  {
+   int newlen = this->m_symtab->edges_max_summary_id;
+   m_vector->reserve (newlen - m_vector->length ());
+   m_vector->quick_grow_cleared (newlen);
+  }
 
 if ((*m_vector)[id] == NULL)

   (*m_vector)[id] = this->allocate_new ();
diff --git a/gcc/vec.h b/gcc/vec.h
index bd7c7351dcd..3ad99b83690 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -753,6 +753,17 @@ vec_safe_grow_cleared (vec *&v,
   v->safe_grow_cleared (len PASS_MEM_STAT);
 }
 
+/* If V does not have space for NELEMS elements, call

+   V->reserve(NELEMS, EXACT).  */
+
+template
+inline bool
+vec_safe_reserve (vec *&v, unsigned nelems, bool exact = 
false
+ CXX_MEM_STAT_INFO)
+{
+  return v->reserve (nelems, exact);
+}
+
 
 /* If V is NULL return false, otherwise return V->iterate(IX, PTR).  */

 template
--
2.27.0



[committed] amdgcn: Enable TImode

2020-07-25 Thread Andrew Stubbs
This enables types __int128 et al for move, add, subtract, and logical 
operations.  At least shift, rotate, multiple, divide, and modulus are 
broken so we can expect some test failures.


This is required now because libgomp no longer builds without __int128.

An additional patch will be required to unbreak the libgfortran build, 
until TImode is completely supported.


Andrew
amdgcn: Enable TImode

This enables types __int128 et al for move, add, subtract, and logical
operations.  At least shift, rotate, multiple, divide, and modulus are broken
so we can expect some test failures.

This is required now because libgomp no longer builds without __int128.

An additional patch will be required to unbreak the libgfortran build.

gcc/ChangeLog:

	* config/gcn/gcn.c (gcn_scalar_mode_supported_p): New function.
	(TARGET_SCALAR_MODE_SUPPORTED_P): New define.

diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index babecef7888..8b3c4544dd5 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -350,6 +350,19 @@ static const struct attribute_spec gcn_attribute_table[] = {
 /* }}}  */
 /* {{{ Registers and modes.  */
 
+/* Implement TARGET_SCALAR_MODE_SUPPORTED_P.  */
+
+bool
+gcn_scalar_mode_supported_p (scalar_mode mode)
+{
+  return (mode == BImode
+	  || mode == QImode
+	  || mode == HImode /* || mode == HFmode  */
+	  || mode == SImode || mode == SFmode
+	  || mode == DImode || mode == DFmode
+	  || mode == TImode);
+}
+
 /* Implement TARGET_CLASS_MAX_NREGS.
  
Return the number of hard registers needed to hold a value of MODE in
@@ -6331,6 +6344,8 @@ gcn_dwarf_register_span (rtx rtl)
 #define TARGET_SECONDARY_RELOAD gcn_secondary_reload
 #undef  TARGET_SECTION_TYPE_FLAGS
 #define TARGET_SECTION_TYPE_FLAGS gcn_section_type_flags
+#undef  TARGET_SCALAR_MODE_SUPPORTED_P
+#define TARGET_SCALAR_MODE_SUPPORTED_P gcn_scalar_mode_supported_p
 #undef  TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P
 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P \
   gcn_small_register_classes_for_mode_p


[PATCH] libgomp: Add helper functions for memory handling.

2020-07-25 Thread y2s1982 via Gcc-patches
This patch adds few helper functions aims to improve readability of
fetching addresses, sizes, and values. It also proposes a syntax for
querying these information through the callback functions, similar to
that of LLVM implementation. The syntax format is _, or __. '_' is the
delimiter between fields. '', as currently defined in the
enum, is either gompd_query_address or gompd_query_size: the first
handles address or offset queries while the second handles the size of
the variable/member. '' refers to the variable type, and
'' refers to the data type of the member of the variable.
This code is incomplete: in particular, it currently lacks CUDA support,
as well as segment handling, and inlining of the functions.

This updated patch includes some bug fixes.

2020-07-20  Tony Sim  

libgomp/ChangeLog:

* Makefile.am (libgompd_la_SOURCES): Add ompd-helper.c.
* Makefile.in: Regenerate.
* libgompd.h (FOREACH_QUERYTYPE): Add macro for query types.
(query_type): Add enum for query types.
(gompd_getQueryStringSize): Add declaration.
(gompd_getQueryString): Add declaration.
(gompd_getAddress): Add declaration.
(gompd_getSize): Add declaration.
(gompd_getValue): Add declaration.
(gompd_getVariableAddress): Add declaration.
(gompd_getVariableSize): Add declaration.
(gompd_getVariableValue): Add declaration.
(gompd_getMemberAddress): Add declaration.
(gompd_getMemberSize): Add declaration.
(gompd_getMemberValue): Add declaration.
* ompd-helper.c: New file.

---
 libgomp/Makefile.am   |   2 +-
 libgomp/Makefile.in   |   5 +-
 libgomp/libgompd.h|  53 ++
 libgomp/ompd-helper.c | 222 ++
 4 files changed, 279 insertions(+), 3 deletions(-)
 create mode 100644 libgomp/ompd-helper.c

diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am
index fe0a92122ea..d126bc655fc 100644
--- a/libgomp/Makefile.am
+++ b/libgomp/Makefile.am
@@ -90,7 +90,7 @@ libgomp_la_SOURCES = alloc.c atomic.c barrier.c critical.c 
env.c error.c \
oacc-mem.c oacc-async.c oacc-plugin.c oacc-cuda.c priority_queue.c \
affinity-fmt.c teams.c allocator.c oacc-profiling.c oacc-target.c
 
-libgompd_la_SOURCES = ompd-lib.c ompd-proc.c
+libgompd_la_SOURCES = ompd-lib.c ompd-proc.c ompd-helper.c
 
 include $(top_srcdir)/plugin/Makefrag.am
 
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index f74d5f3ac8e..fdd488ca98e 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -235,7 +235,7 @@ am_libgomp_la_OBJECTS = alloc.lo atomic.lo barrier.lo 
critical.lo \
$(am__objects_1)
 libgomp_la_OBJECTS = $(am_libgomp_la_OBJECTS)
 libgompd_la_LIBADD =
-am_libgompd_la_OBJECTS = ompd-lib.lo ompd-proc.lo
+am_libgompd_la_OBJECTS = ompd-lib.lo ompd-proc.lo ompd-helper.lo
 libgompd_la_OBJECTS = $(am_libgompd_la_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -593,7 +593,7 @@ libgomp_la_SOURCES = alloc.c atomic.c barrier.c critical.c 
env.c \
oacc-async.c oacc-plugin.c oacc-cuda.c priority_queue.c \
affinity-fmt.c teams.c allocator.c oacc-profiling.c \
oacc-target.c $(am__append_4)
-libgompd_la_SOURCES = ompd-lib.c ompd-proc.c
+libgompd_la_SOURCES = ompd-lib.c ompd-proc.c ompd-helper.c
 
 # Nvidia PTX OpenACC plugin.
 @PLUGIN_NVPTX_TRUE@libgomp_plugin_nvptx_version_info = -version-info 
$(libtool_VERSION)
@@ -817,6 +817,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-plugin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-profiling.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oacc-target.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ompd-helper.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ompd-lib.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ompd-proc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ordered.Plo@am__quote@
diff --git a/libgomp/libgompd.h b/libgomp/libgompd.h
index 495995e00d3..9d34803797a 100644
--- a/libgomp/libgompd.h
+++ b/libgomp/libgompd.h
@@ -30,12 +30,18 @@
 #define LIBGOMPD_H 1
 
 #include "omp-tools.h"
+#include 
 
 #define ompd_stringify(x) ompd_str2(x)
 #define ompd_str2(x) #x
 
 #define OMPD_VERSION 201811
 
+#define FOREACH_QUERYTYPE(TYPE)\
+   TYPE (gompd_query_address)\
+   TYPE (gompd_query_size)\
+
+
 extern ompd_callbacks_t gompd_callbacks;
 
 typedef struct _ompd_aspace_handle {
@@ -47,4 +53,51 @@ typedef struct _ompd_aspace_handle {
   ompd_size_t ref_count;
 } ompd_address_space_handle_t;
 
+typedef enum gompd_query_type {
+#define GENERATE_ENUM(ENUM) ENUM,
+  FOREACH_QUERYTYPE (GENERATE_ENUM)
+#undef GENERATE_ENUM
+} query_type;
+
+ompd_rc_t gompd_getQueryStringSize (size_t *, query_type, const char*,
+   const char *);
+
+ompd_rc_t gompd_getQueryString (char **, query_type, const char*, const c

Re: [PATCH] config/debuginfod.m4: Use PKG_CHECK_MODULES

2020-07-25 Thread H.J. Lu via Gcc-patches
On Fri, Jul 24, 2020 at 1:04 PM Aaron Merey via Gcc-patches
 wrote:
>
> On Tue, Jul 21, 2020 at 2:11 PM Aaron Merey  wrote:
> >
> > On Tue, Jul 21, 2020 at 11:20 AM Tom Tromey  wrote:
> > >
> > > Simon> Since it's debuginfo.m4 that is using PKG_CHECK_MODULES, can you 
> > > put the include
> > > Simon> of pkg.m4 in debuginfo.m4, instead of in 
> > > {binutils,gdb}/configure.ac?
> > >
> > > Simon> Otherwise, from GDB's point of view I think it looks good, unless
> > > Simon> Tom has some things to add.
> > >
> > > I'm happy with it.  Thanks for persevering.
> >
> > Great. I can push to binutils-gdb but not gcc. Should I just push to
> > binutils-gdb for now or wait until the patch can be applied to both
> > repos at once?
>
> I'm going to go ahead and push to binutils-gdb. Since these changes
> should not affect gcc there shouldn't be any conflicts.
>

This caused:

https://sourceware.org/bugzilla/show_bug.cgi?id=26301

-- 
H.J.


Re: [Patch, fortran] PR 93592 - Invalid UP/DOWN rounding with EN descriptor

2020-07-25 Thread dhumieres . dominique

Le 2020-07-25 13:54, Thomas Koenig a écrit :

Am 24.07.20 um 23:19 schrieb dhumieres.domini...@free.fr:

Le 2020-07-24 20:50, Thomas Koenig a écrit :

Hi Dominique,

I have committed the patch after regression-testing.


Thanks.



Dou you want to backport this, as well?


IMO it is worth the work.


OK. The patch for PR 93592 is now committed down to gcc-8.
The patch for 93567 only applied cleanly to trunk and gcc-10,
where I have also committed it there.  If you want to
backport it further and want me to commit this, I will need
a modified version of the patch.


Thanks. I have closed the PRs as fixed.




(And if one of my e-mails bounced, you can try the other one.


What is the other one?


I currently use tkoe...@netcologne.de and t...@tkoenig.net somewhat
interchangably.  I'm not sure which one bounces your e-mails;
I hope one of them works.


I am trying t...@tkoenig.net.

Cheers,

Dominique



Thanks a lot for taking on these bugs!

Best regards

Thomas


[PATCH] ipa/96291: don't crash on unoptimized lto functions

2020-07-25 Thread Sergei Trofimovich via Gcc-patches
From: Sergei Trofimovich 

In PR ipa/96291 the test contained an SCC with one
unoptimized function. This tricked ipa-cp into NULL dereference.

has_undead_caller_from_outside_scc_p() did not take into account
that unoptimized funtions don't have IPA summary analysis. and
dereferenced NULL pointer causing an ICE.

PR ipa/96291
* ipa-cp.c (has_undead_caller_from_outside_scc_p): Consider
unoptimized callers as undead.
---
 gcc/ipa-cp.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index b0c8f405260..d5082576962 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -5666,9 +5666,15 @@ has_undead_caller_from_outside_scc_p (struct cgraph_node 
*node,
&& cs->caller->call_for_symbol_thunks_and_aliases
  (has_undead_caller_from_outside_scc_p, NULL, true))
   return true;
-else if (!ipa_edge_within_scc (cs)
-&& !IPA_NODE_REF (cs->caller)->node_dead)
-  return true;
+else if (!ipa_edge_within_scc (cs))
+  {
+   /* Unoptimized callers don't have IPA information.
+  Conservatively assume callers are undead.  */
+   if (!IPA_NODE_REF (cs->caller))
+ return true;
+   if (!IPA_NODE_REF (cs->caller)->node_dead)
+ return true;
+  }
   return false;
 }
 
-- 
2.27.0



Re: [Patch, fortran] PR 93592 - Invalid UP/DOWN rounding with EN descriptor

2020-07-25 Thread Thomas König

Hi Dominique,


I am trying t...@tkoenig.net.


That works :-)

I'll try to use that address in the future for my mails to the
fortran mailing list, so it does not bounce for you.

Best regards

Thomas


[committed] print -Wnonnull note only after warning (PR c++/96310)

2020-07-25 Thread Martin Sebor via Gcc-patches

I committed the patch below in r11-2322.

Martin

Fix PR c++/96310 - Ignoring -Wnonnull via pragma gcc diagnostics still 
produces an unwanted note.


gcc/c-family/ChangeLog:
PR c++/96310
* c-common.c (check_nonnull_arg): Print note only when warning was 
issued.

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 51ecde69f2d..e2569c65827 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5538,7 +5538,7 @@ check_nonnull_arg (void *ctx, tree param, unsigned 
HOST_WIDE_INT param_num)

 {
   warned = warning_at (loc, OPT_Wnonnull,
   "%qs pointer null", "this");
-  if (pctx->fndecl)
+  if (warned && pctx->fndecl)
inform (DECL_SOURCE_LOCATION (pctx->fndecl),
"in a call to non-static member function %qD",
pctx->fndecl);
@@ -5548,7 +5548,7 @@ check_nonnull_arg (void *ctx, tree param, unsigned 
HOST_WIDE_INT param_num)

   warned = warning_at (loc, OPT_Wnonnull,
   "argument %u null where non-null expected",
   (unsigned) param_num);
-  if (pctx->fndecl)
+  if (warned && pctx->fndecl)
inform (DECL_SOURCE_LOCATION (pctx->fndecl),
"in a call to function %qD declared %qs",
pctx->fndecl, "nonnull");
diff --git a/gcc/testsuite/g++.dg/warn/Wnonnull8.C 
b/gcc/testsuite/g++.dg/warn/Wnonnull8.C

new file mode 100644
index 000..7820b2e3b79
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wnonnull8.C
@@ -0,0 +1,20 @@
+/* PR c++/96310 - Ignoring -Wnonnull via pragma gcc diagnostics still 
produces

+   an unwanted note
+   { dg-do compile }
+   { dg-options "-Wall" } */
+
+struct C {
+  void f ();  // { dg-message "in a call" }
+  void g ();  // { dg-bogus "in a call" }
+};
+
+void f ()
+{
+  static_cast(0)->f ();   // { dg-warning "\\\[-Wnonnull" }
+}
+
+void g ()
+{
+#pragma GCC diagnostic ignored "-Wnonnull"
+  static_cast(0)->g ();
+}


[pushed] C++, testsuite: Adjust pure-virtual1.C options for Darwin.

2020-07-25 Thread Iain Sandoe
Hi,

Darwin's static linker expects, by default, that all linkage will
be satisfied (even for weak items).  This allows the two-level
namespace to work even for weak cases.

However, there's an option to make it behave in a similar manner
to ELF.  This is needed for the pure-virtual1.C testcase to pass
on Darwin.

tested on x86_64-darwin and linux,
pushed to master
thanks
Iain

gcc/testsuite/ChangeLog:

* g++.dg/abi/pure-virtual1.C: Add dynamic_lookup option
for Darwin.
---
 gcc/testsuite/g++.dg/abi/pure-virtual1.C | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/testsuite/g++.dg/abi/pure-virtual1.C 
b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
index 86cc9f63db1..538e2cb097a 100644
--- a/gcc/testsuite/g++.dg/abi/pure-virtual1.C
+++ b/gcc/testsuite/g++.dg/abi/pure-virtual1.C
@@ -2,6 +2,7 @@
 // { dg-do link }
 // { dg-require-weak }
 // { dg-additional-options "-fno-rtti -nodefaultlibs -lc" }
+// { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target 
*-*-darwin* } }
 // { dg-xfail-if "AIX weak" { powerpc-ibm-aix* } }
 
 struct A
-- 
2.24.1




config/mmix/mmix.c (TARGET_ASM_OUTPUT_IDENT): Override.

2020-07-25 Thread Hans-Peter Nilsson
Funny that default_asm_output_ident_directive isn't the default...
Anyway, since dot-pseudos like .ident are treated as comments by
mmixal, there's nothing lost compatibilitywise by supporting it.
If mmix-knuth-mmixware had included elfos.h this'd have been the
default.  There might be enough reason to do that; relocatable objects
are ELF but (by default) links to produce mmo.  Fixes
c-c++-common/ident-1b.c and 2b in C and C++ testing.  Committed.

gcc:
* config/mmix/mmix.c (TARGET_ASM_OUTPUT_IDENT): Override the default
with default_asm_output_ident_directive.

diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index b7263a31190..4c4fb2117fc 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -220,6 +220,9 @@ static HOST_WIDE_INT mmix_starting_frame_offset (void);
 #undef TARGET_ASM_OUTPUT_SOURCE_FILENAME
 #define TARGET_ASM_OUTPUT_SOURCE_FILENAME mmix_asm_output_source_filename

+#undef TARGET_ASM_OUTPUT_IDENT
+#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
+
 #undef TARGET_INIT_LIBFUNCS
 #define TARGET_INIT_LIBFUNCS mmix_init_libfuncs



gcc.dg/torture/pr59330.c: Disable for mmix

2020-07-25 Thread Hans-Peter Nilsson
Committed.

With the dejagnu status-wrapper, there's a reference to write in
each executable, which for mmix in newlib has a reference to a
variable defined in open, which for mmix in newlib has a
reference to sprintf (oops!) and the dependency-chain goes on;
ad finitum there's a reference to malloc, which in default
newlib is colocated with free; the same file
newlib/libc/stdlib/malloc.c.

Not being compiled with -ffunction-sections, they're emitted in
the same section (.text) and thus inseparable: you can't
override just one of them as in this test, or else you'll get:

/pre/mmix/bin/ld: /gccobj/mmix/./newlib/libc.a(lib_a-malloc.o): in 
function `free':
/gcc/newlib/libc/stdlib/malloc.c:169: multiple definition of `free'; 
/tmp/ccvRA0zb.o:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: gcc.dg/torture/pr59330.c   -O0  (test for excess errors)

I'm using a dg-skip-if here instead of starting a hardly
scalable dg-do target selector.  I'm not keying on
effective-target unwrapped because the dependency-chain is
target-specific rather than dejagnu status-wrapper-specific.

gcc/testsuite:
* gcc.dg/torture/pr59330.c: Disable for mmix.

--- gcc/gcc/testsuite/gcc.dg/torture/pr59330.c.orig Sun Jul 26 02:05:57 2020
+++ gcc/gcc/testsuite/gcc.dg/torture/pr59330.c  Sun Jul 26 02:19:29 2020
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-skip-if "free inseparable from malloc when wrapped" { 
mmix-knuth-mmixware } } */

 void free(void *ptr)
 {


gcc.dg/tree-ssa/forwprop-36.c: Adjust for mmix

2020-07-25 Thread Hans-Peter Nilsson
Committed.

The label of interest here is "b.0_2" for
e.g. x86_64-pc-linux-gnu but "b::1_2" for mmix-knuth-mmixware.
The test seems to be of some interest for mmix (hey, gcc
open-coded 128-bit integer support behind my back!) so I didn't
want to just disable it.  I also didn't want to obscure the
matching pattern by generalizing it, so instead I added a
separate matching pattern.

gcc/testsuite:
* gcc.dg/tree-ssa/forwprop-36.c: Adjust for mmix.

--- gcc/gcc/testsuite/gcc.dg/tree-ssa/forwprop-36.c.origMon Jan 13 
22:30:47 2020
+++ gcc/gcc/testsuite/gcc.dg/tree-ssa/forwprop-36.c Sun Jul 26 03:14:43 2020
@@ -21,4 +21,5 @@ main ()
   return 0;
 }

-/* { dg-final { scan-tree-dump "if \\(b.0_\[0-9\]+ != 0\\)" "cddce1" } } */
+/* { dg-final { scan-tree-dump "if \\(b.0_\[0-9\]+ != 0\\)" "cddce1" { target 
{ ! mmix-knuth-mmixware } } } } */
+/* { dg-final { scan-tree-dump "if \\(b::1_\[0-9\]+ != 0\\)" "cddce1" { target 
{ mmix-knuth-mmixware } } } } */


[Patch, committed] libgfortran: configure - skip integer(kind=16) for libgfortran for AMDGN (PR96306)

2020-07-25 Thread Tobias Burnus

OpenMP requires an integer kind for omp_depend_kind
and libgomp uses twice the pointer size – hence, one
needs on 64bit systems kind=16 integers or __int128.
See PR and links in it.

AMDGCN did not expose TI and, hence, failed to build
libgomp. For AMDGCN, initial support has been added via
https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550663.html
but it still does not support all features needed by libgfortran.
Hence, it then failed to build libgfortran.

The attached patch disables HAVE_INTEGER16 for AMDGCN for now,
and has been committed to mainline.

Thus, libgomp + libgfortran now build for AMDGCN. (And there
is some but very limited support for kind=16/__int128
operations see link above.)

Tobias

-
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter
commit 2e764ae1d666002b136726e6548481013527197d
Author: Tobias Burnus 
Date:   Sun Jul 26 07:20:24 2020 +0200

libgfortran: Skip integer-kind=16 check for amdgcn

libgfortran/ChangeLog:

PR target/96306
* configure.ac: Add LIBGOMP_CHECKED_INT_KINDS and
LIBGOMP_CHECKED_REAL_KINDS and use it for to skip
integer kind=16 checks for amdgcn.
* Makefile.am (kinds.h, selected_int_kind.inc,
selected_real_kind.inc): Pass them on.
* mk-kinds-h.sh: Takes to-be-check kinds as argument.
* mk-sik-inc.sh: Likewise.
* mk-srk-inc.sh: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.

 libgfortran/Makefile.am   |  6 +++---
 libgfortran/Makefile.in   |  8 +---
 libgfortran/configure | 19 +--
 libgfortran/configure.ac  | 13 +
 libgfortran/mk-kinds-h.sh | 15 +--
 libgfortran/mk-sik-inc.sh | 13 ++---
 libgfortran/mk-srk-inc.sh | 13 ++---
 7 files changed, 67 insertions(+), 20 deletions(-)
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 36b204e1aa3..61bf05dd40d 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -1054,7 +1054,7 @@ I_M4_DEPS8=$(I_M4_DEPS) m4/ifindloc1.m4
 I_M4_DEPS9=$(I_M4_DEPS) m4/ifindloc2.m4
 
 kinds.h: $(srcdir)/mk-kinds-h.sh
-	$(SHELL) $(srcdir)/mk-kinds-h.sh '$(FCCOMPILE)' > $@ || rm $@
+	$(SHELL) $(srcdir)/mk-kinds-h.sh '@LIBGOMP_CHECKED_INT_KINDS@' '@LIBGOMP_CHECKED_REAL_KINDS@' '$(FCCOMPILE)' > $@ || rm $@
 
 kinds.inc: kinds.h
 	grep '^#' < kinds.h > $@
@@ -1063,10 +1063,10 @@ c99_protos.inc: $(srcdir)/c99_protos.h
 	grep '^#' < $(srcdir)/c99_protos.h > $@
 
 selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh
-	$(SHELL) $(srcdir)/mk-sik-inc.sh '$(FCCOMPILE)' > $@ || rm $@
+	$(SHELL) $(srcdir)/mk-sik-inc.sh '@LIBGOMP_CHECKED_INT_KINDS@' '$(FCCOMPILE)' > $@ || rm $@
 
 selected_real_kind.inc: $(srcdir)/mk-srk-inc.sh
-	$(SHELL) $(srcdir)/mk-srk-inc.sh '$(FCCOMPILE)' > $@ || rm $@
+	$(SHELL) $(srcdir)/mk-srk-inc.sh '@LIBGOMP_CHECKED_REAL_KINDS@' '$(FCCOMPILE)' > $@ || rm $@
 
 fpu-target.h: $(srcdir)/$(FPU_HOST_HEADER)
 	cp $(srcdir)/$(FPU_HOST_HEADER) $@
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 4109d0fefae..8961e314d82 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -216,6 +216,19 @@ AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun])
 
 AM_CONDITIONAL(LIBGFOR_MINIMAL, [test "x${target_cpu}" = xnvptx])
 
+# Some compiler target support may have limited support for integer
+# or floating point numbers – or may want to reduce the libgfortran size
+# although they do have the support.
+LIBGOMP_CHECKED_INT_KINDS="1 2 4 8 16"
+LIBGOMP_CHECKED_REAL_KINDS="4 8 10 16"
+
+if test "x${target_cpu}" = xamdgcn; then
+  # amdgcn only has limited support for __int128.
+  LIBGOMP_CHECKED_INT_KINDS="1 2 4 8"
+fi
+AC_SUBST(LIBGOMP_CHECKED_INT_KINDS)
+AC_SUBST(LIBGOMP_CHECKED_REAL_KINDS)
+
 # Figure out whether the compiler supports "-ffunction-sections -fdata-sections",
 # similarly to how libstdc++ does it
 ac_test_CFLAGS="${CFLAGS+set}"
diff --git a/libgfortran/mk-kinds-h.sh b/libgfortran/mk-kinds-h.sh
index 98a95ab54a7..249619061c6 100755
--- a/libgfortran/mk-kinds-h.sh
+++ b/libgfortran/mk-kinds-h.sh
@@ -2,12 +2,15 @@
 LC_ALL=C
 export LC_ALL
 
-compile="$1"
-
-# Possible types must be listed in ascending order
-possible_integer_kinds="1 2 4 8 16"
-possible_real_kinds="4 8 10 16"
+if test "$#" -ne 3; then
+  echo "Usage $0 int_kinds real_kinds compile"
+  exit 1
+fi
 
+# Possible kinds must be listed in ascending order
+possible_integer_kinds="$1"
+possible_real_kinds="$2"
+compile="$3"
 
 largest=""
 smallest=""
@@ -112,7 +115,7 @@ for k in $possible_real_kinds; do
 done
 
 
-# After this, we include a header that can override some of the 
+# After this, we include a header that can override some of the
 # autodetected settings.
 echo '#include "kinds-override.h"'
 
diff --git a/libgfortran/mk-sik-inc.

Re: [PATCH v3] Add --ld-path= to specify an arbitrary executable as the linker

2020-07-25 Thread Fāng-ruì Sòng via Gcc-patches
On Sat, Jul 25, 2020 at 12:09 AM Andreas Schwab  wrote:
>
> On Jul 24 2020, Fangrui Song via Gcc-patches wrote:
>
> > This is to mimick nearly lines. collect2 should filter out options like 
> > -fno-lto, -flto, -fuse-ld= before passing to ld. -f* are handled by case 
> > 'f'. --ld-path needs its own `else if`.
>
> If you handle --ld-path as -fld-path then you don't need that.
>

--ld-path is a deliberate design choice. -f* is not suitable
(https://sourceware.org/pipermail/gcc/2020-July/233089.html )
clang has several other --*-path= (e.g. --cuda-path)