Re: [patch] Fix PR 84487, large rodata increase in tonto and other programs

2019-04-13 Thread Paul Richard Thomas
Hi Thomas,

Thanks for your determination in dealing with this. It has been on my
TODO list for a long time but, like you at the outset, I had no idea
how to deal with it.

OK on the fortran side.

Paul

On Sat, 13 Apr 2019 at 19:48, Thomas Koenig  wrote:
>
> Hello world,
>
> the attached patch fixes a 8/9 regression where _def_init, an internal
> Fortran variable containing only zeros, was placed into the .rodata
> section. This led to a large increase in executable size.
>
> There should be no impact on other languages because the change to
> varasm.c is guarded by lang_GNU_Fortran ().
>
> Regarding the test case: I did find one other test which checks
> for .bss, so I suppose this is safe.
>
> Regression-tested with a full test (--enable-languages=all and
> make -j64 -k check) on POWER9.
>
> I would like to apply it to both affected branches.
>
> OK for the general and the Fortran part?
>
> Regards
>
> Thomas
>
> 2019-04-13  Thomas Koenig  
>
>  PR fortran/84487
>  * trans-decl.c (gfc_get_symbol_decl): Mark _def_init as
>  artificial.
>
> 2019-04-13  Thomas Koenig  
>
>  PR fortran/84487
>  * varasm.c (bss_initializer_p): If we are compiling Fortran, the
>  decl is artifical and it has a size larger than 255, it can be
>  put into BSS.
>
> 2019-04-13  Thomas Koenig  
>
>  PR fortran/84487
>  * gfortran.dg/def_init_1.f90: New test.
>
>


-- 
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein


[patch] Fix PR 84487, large rodata increase in tonto and other programs

2019-04-13 Thread Thomas Koenig

Hello world,

the attached patch fixes a 8/9 regression where _def_init, an internal
Fortran variable containing only zeros, was placed into the .rodata
section. This led to a large increase in executable size.

There should be no impact on other languages because the change to
varasm.c is guarded by lang_GNU_Fortran ().

Regarding the test case: I did find one other test which checks
for .bss, so I suppose this is safe.

Regression-tested with a full test (--enable-languages=all and
make -j64 -k check) on POWER9.

I would like to apply it to both affected branches.

OK for the general and the Fortran part?

Regards

Thomas

2019-04-13  Thomas Koenig  

PR fortran/84487
* trans-decl.c (gfc_get_symbol_decl): Mark _def_init as
artificial.

2019-04-13  Thomas Koenig  

PR fortran/84487
* varasm.c (bss_initializer_p): If we are compiling Fortran, the
decl is artifical and it has a size larger than 255, it can be
put into BSS.

2019-04-13  Thomas Koenig  

PR fortran/84487
* gfortran.dg/def_init_1.f90: New test.


Index: fortran/trans-decl.c
===
--- fortran/trans-decl.c	(Revision 270182)
+++ fortran/trans-decl.c	(Arbeitskopie)
@@ -1865,7 +1865,10 @@ gfc_get_symbol_decl (gfc_symbol * sym)
 
   if (sym->attr.vtab
   || (sym->name[0] == '_' && gfc_str_startswith (sym->name, "__def_init")))
-TREE_READONLY (decl) = 1;
+{
+  TREE_READONLY (decl) = 1;
+  DECL_ARTIFICIAL (decl) = 1;
+}
 
   return decl;
 }
Index: varasm.c
===
--- varasm.c	(Revision 270182)
+++ varasm.c	(Arbeitskopie)
@@ -1007,9 +1007,13 @@ decode_reg_name (const char *name)
 bool
 bss_initializer_p (const_tree decl, bool named)
 {
-  /* Do not put non-common constants into the .bss section, they belong in
- a readonly section, except when NAMED is true.  */
-  return ((!TREE_READONLY (decl) || DECL_COMMON (decl) || named)
+  /* Do not put non-common constants into the .bss section, they
+ belong in a readonly section, except when NAMED is true or when
+ we are dealing with an artificial declaration, in the Fortran
+ compiler only, above a certain size.  */
+  return ((!TREE_READONLY (decl) || DECL_COMMON (decl) || named
+	   || (lang_GNU_Fortran () && DECL_ARTIFICIAL (decl)
+	   && (tree_to_uhwi (DECL_SIZE_UNIT (decl)) > 255 )))
 	  && (DECL_INITIAL (decl) == NULL
 	  /* In LTO we have no errors in program; error_mark_node is used
 	 to mark offlined constructors.  */
! { dg-do compile }
! PR 84487 - check that def_init, if it is large,
! is put into .bss.
module TYPES_MODULE

  implicit none

  type archive_type
 character(2**18) :: root_name
  end type archive_type
end module TYPES_MODULE
! { dg-final { scan-assembler "\.bss" } }


Re: [libphobos] Work around Solaris ld bug linking __tls_get_addr on 64-bit x86

2019-04-13 Thread Iain Buclaw
On Tue, 9 Apr 2019 at 21:36, Rainer Orth  wrote:
>
> Rainer Orth  writes:
>
> > Here's the patch I mentioned in
> >
> >   https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01661.html
> >
> > to work around an amd64 Solaris ld bug.  I'm just posting it for
> > reference now: until it's clear if a fix will make it into Solaris 11.5
> > or not, there's no point in applying it yet.
> >
> > Still, review comments are appreciated.
>
> With the revised patch for non-dlpi_tls_modid versions of Solaris
>
> https://gcc.gnu.org/ml/gcc-patches/2019-04/msg00354.html
>
> __tls_get_addr will always be called and thus this workaround is needed
> unconditionally, even should the ld bug be fixed in Solaris 11.5.
>
> This revision adjusts the patch accordingly and was tested together with
> the other one on Solaris 11.[345]/x86.
>
> Ok for mainline?
>

OK

-- 
Iain


Re: [PATCH v2, d] PR d/87799 Fix build on windows hosts

2019-04-13 Thread Iain Buclaw
On Mon, 25 Mar 2019 at 20:04, Johannes Pfau  wrote:
>
> diff --git a/gcc/d/d-system.h b/gcc/d/d-system.h
> index efece15f3bc..6c18b69d4df 100644
> --- a/gcc/d/d-system.h
> +++ b/gcc/d/d-system.h
> @@ -55,4 +55,10 @@
>  #undef tolower
>  #define tolower(c) TOLOWER(c)
>
> +/* We do not include direct.h as it conflicts with system.h.  */

Maybe a small nit on the comment.

/* Forward _mkdir on MinGW to mkdir in system.h.  */

Otherwise, OK.


Re: [PATCH] D support for RISC-V

2019-04-13 Thread Iain Buclaw
On Tue, 9 Apr 2019 at 11:53, David Abdurachmanov
 wrote:
>
> diff --git a/libphobos/libdruntime/rt/sections_elf_shared.d 
> b/libphobos/libdruntime/rt/sections_elf_shared.d
> index d4e1ff07699..45c1dcbc7f3 100644
> --- a/libphobos/libdruntime/rt/sections_elf_shared.d
> +++ b/libphobos/libdruntime/rt/sections_elf_shared.d
> @@ -10,6 +10,9 @@
>
>  module rt.sections_elf_shared;
>
> +version (RISCV32) version = RISCV_Any;
> +version (RISCV64) version = RISCV_Any;
> +
>  version (CRuntime_Glibc) enum SharedELF = true;
>  else version (FreeBSD) enum SharedELF = true;
>  else version (NetBSD) enum SharedELF = true;
> @@ -671,7 +674,16 @@ version (Shared)
>  if (dyn.d_tag == DT_STRTAB)
>  {
>  version (linux)
> -strtab = cast(const(char)*)dyn.d_un.d_ptr;
> +{
> +// This might change in future glibc releases (after 
> 2.29) as dynamic sections
> +// are not required to be read-only on RISC-V. This was 
> copy & pasted from MIPS while
> +// upstreaming RISC-V support. Otherwise MIPS is the 
> only arch which sets in glibc:
> +// #define DL_RO_DYN_SECTION 1
> +version (RISCV_Any)
> +strtab = cast(const(char)*)(info.dlpi_addr + 
> dyn.d_un.d_ptr); // relocate
> +else
> +strtab = cast(const(char)*)dyn.d_un.d_ptr;
> +}
>  else version (FreeBSD)
>  strtab = cast(const(char)*)(info.dlpi_addr + 
> dyn.d_un.d_ptr); // relocate
>  else version (NetBSD)

This needs to be rebased to patch gcc/sections/elf_shared.d

> diff --git 
> a/libphobos/src/std/experimental/allocator/building_blocks/region.d 
> b/libphobos/src/std/experimental/allocator/building_blocks/region.d
> index dfcecce72bd..cafe059a61f 100644
> --- a/libphobos/src/std/experimental/allocator/building_blocks/region.d
> +++ b/libphobos/src/std/experimental/allocator/building_blocks/region.d
> @@ -391,7 +391,8 @@ struct InSituRegion(size_t size, size_t minAlign = 
> platformAlignment)
>  else version (PPC) enum growDownwards = Yes.growDownwards;
>  else version (PPC64) enum growDownwards = Yes.growDownwards;
>  else version (MIPS32) enum growDownwards = Yes.growDownwards;
> -else version (MIPS64) enum growDownwards = Yes.growDownwards;
> +else version (RISCV32) enum growDownwards = Yes.growDownwards;
> +else version (RISCV64) enum growDownwards = Yes.growDownwards;
>  else version (SPARC) enum growDownwards = Yes.growDownwards;
>  else version (SystemZ) enum growDownwards = Yes.growDownwards;
>  else static assert(0, "Dunno how the stack grows on this architecture.");

This has been upstreamed and committed in r270296.

> diff --git a/libphobos/src/std/math.d b/libphobos/src/std/math.d
> index e98e746a856..9fe746501a4 100644
> --- a/libphobos/src/std/math.d
> +++ b/libphobos/src/std/math.d
> @@ -162,6 +162,8 @@ version (AArch64)   version = ARM_Any;
>  version (ARM)   version = ARM_Any;
>  version (SPARC) version = SPARC_Any;
>  version (SPARC64)   version = SPARC_Any;
> +version (RISCV32)   version = RISCV_Any;
> +version (RISCV64)   version = RISCV_Any;
>
>  version (D_InlineAsm_X86)
>  {

Apart from the asm { } code, same with this as well.

Everything else is OK.

-- 
Iain


Re: [libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)

2019-04-13 Thread Iain Buclaw
On Tue, 29 Jan 2019 at 11:25, Rainer Orth  wrote:
>
> I've successfully been using a late prototype of an implementation of
> the dlpi_tls_modid field of struct dl_phdr_info on Solaris 11.5 Beta.
> This allowed me to get pretty reasonable test results using
> sections_elf_shared.d on Solaris.
>
> This pretty straightforward patch implements this.  Only a few points
> are worth mentioning:
>
> * libdruntime/rt/bss_sections.c refers to __bss_start, which only gld
>   defines.  Unfortunately, it's marked weak, so the absence with Solaris
>   ld went unnoticed at first.  Lacking an exact equivalent, I'm using
>   _edata instead, which is pretty close modulo section alignment.
>
> * As detailed in the PR, not dlclose()ing the handle in handleForName is
>   necessary to avoid an assertion failure.
>
> * I'm removing sections_solaris.d since it wouldn't even compile and
>   seems pretty useless.
>
> This patch gave me the following testsuite results on Solaris 11.5/x86
> (a few more minor testsuite fixes were included, too):
>
> === gdc tests ===
>
>
> Running target unix
> FAIL: gdc.test/runnable/nulltype.d   execution test
> FAIL: gdc.test/runnable/nulltype.d -O2   execution test
> FAIL: gdc.test/runnable/nulltype.d -O2 -shared-libphobos   execution test
> FAIL: gdc.test/runnable/nulltype.d -g   execution test
> FAIL: gdc.test/runnable/nulltype.d -g -O2   execution test
> FAIL: gdc.test/runnable/nulltype.d -g -O2 -shared-libphobos   execution test
> FAIL: gdc.test/runnable/nulltype.d -g -shared-libphobos   execution test
> FAIL: gdc.test/runnable/nulltype.d -shared-libphobos   execution test
>
> === gdc Summary for unix ===
>
> # of expected passes30785
> # of unexpected failures8
>
> Running target unix/-m64
>
> === gdc Summary for unix/-m64 ===
>
> # of expected passes30793
>
> === gdc Summary ===
>
> # of expected passes61578
> # of unexpected failures8
> /var/gcc/gcc-9.0.1-20190128/11.5-gcc-gas-libphobos/gcc/gdc  version 9.0.1 
> 20190128 (experimental) [trunk revision 268335] (GCC)
>
> === libphobos tests ===
>
>
> Running target unix
> FAIL: libphobos.shared/load.d -shared-libphobos -ldl execution test
> FAIL: libphobos.shared/load_13414.d -shared-libphobos -ldl execution test
> FAIL: libphobos.shared/finalize.d -shared-libphobos -ldl execution test
> FAIL: libphobos.shared/linkD.c lib.so -ldl -pthread execution test
> FAIL: libphobos.unittests/druntime/shared/core.sync.mutex
> FAIL: libphobos.unittests/druntime/shared/core.time
>
> === libphobos Summary for unix ===
>
> # of expected passes119
> # of unexpected failures6
>
> Running target unix/-m64
> FAIL: libphobos.shared/load.d -shared-libphobos -ldl execution test
> FAIL: libphobos.shared/load_13414.d -shared-libphobos -ldl execution test
> FAIL: libphobos.shared/finalize.d -shared-libphobos -ldl execution test
> FAIL: libphobos.shared/linkD.c lib.so -ldl -pthread execution test
> FAIL: libphobos.unittests/druntime/shared/ld.so.1:
> FAIL: libphobos.unittests/druntime/shared/unittest:
> FAIL: libphobos.unittests/druntime/shared/fatal:
> FAIL: libphobos.unittests/druntime/shared/libgdruntime_t.so.0:
> FAIL: libphobos.unittests/druntime/shared/open
> FAIL: libphobos.unittests/druntime/shared/failed:
> FAIL: libphobos.unittests/druntime/shared/No
> FAIL: libphobos.unittests/druntime/shared/such
> FAIL: libphobos.unittests/druntime/shared/file
> FAIL: libphobos.unittests/druntime/shared/or
> FAIL: libphobos.unittests/druntime/shared/directory
>
> === libphobos Summary for unix/-m64 ===
>
> # of expected passes78
> # of unexpected failures15
>
> === libphobos Summary ===
>
> # of expected passes197
> # of unexpected failures21
>
> The 32-bit nulltype.d failures occur on Linux, too (PR d/87824), and the
> 64-bit libphobos.unittests/druntime/shared failures happen because
> libgdruntime_t.so.0 is only built for the default multilib.  The
> libphobos.shared failures clearly bear investigating.
>
> For the amd64 results, I needed a separate patch to workaround an ld
> bug, to be submitted shortly.
>
> While I did run a sparc-sun-solaris2.11 bootstrap, too, results are
> pretty useless due to PR d/88462 (the minfo alignment issue).
>

Hi,

Sorry for the belated response, this has been delayed by myself
sorting out moving the sections code out of upstream tree.
bss_sections.c is now gone, and the patch should be rebased to target
gcc/sections/elf_shared.d.  I think only core/sys/solaris/link.d is
left to be upstreamed, otherwise this is OK.

-- 
Iain


Re: [libphobos] Work around lack of dlpi_tls_modid before Solaris 11.5

2019-04-13 Thread Iain Buclaw
On Tue, 9 Apr 2019 at 21:27, Rainer Orth  wrote:
>
> Rainer Orth  writes:
>
> > Before Solaris 11.5, struct dl_phdr_info lacked the dlpi_tls_modid
> > member.  While the support might be backported to Solaris 11.4, it
> > certainly won't to previous Solaris releases.  To work around this, I've
> > used the following patch.  Again, it's pretty straightforward.
> >
> > Point of note:
> >
> > * On Solaris, FreeBSD and NetBSD, dl_phdr_info is always visible in
> >   , while on Linux one needs to define _GNU_SOURCE.
> >   AC_USE_SYSTEM_EXTENSION takes care of this, but needs to be called
> >   early (i.e. not in DRUNTIME_OS_DLPI_TLS_MODID) to avoid an autoconf
> >   warning:
> >
> > configure.ac:129: warning: AC_COMPILE_IFELSE was called before 
> > AC_USE_SYSTEM_EXTENSIONS
> > m4/druntime/os.m4:190: DRUNTIME_OS_DLPI_TLS_MODID is expanded from...
> > configure.ac:129: the top level
> >
> > Tested on i386-pc-solaris2.11 (Solaris 11.4) and x86_64-pc-linux-gnu.
> >
> > Not unexpectedly, there are a couple of regressions compared to the
> > Solaris 11.5/x86 results:
> >
> > +FAIL: gdc.test/runnable/testaa.d   execution test
> > +FAIL: gdc.test/runnable/testaa.d -fPIC   execution test
> > +FAIL: gdc.test/runnable/testaa.d -fPIC -shared-libphobos   execution test
> > +FAIL: gdc.test/runnable/testaa.d -shared-libphobos   execution test
> >
> >   32 and 64-bit
> >
> > +FAIL: gdc.test/runnable/xtest55.d   execution test
> > +FAIL: gdc.test/runnable/xtest55.d -shared-libphobos   execution test
> >
> >   64-bit only
> >
> > +FAIL: libphobos.shared/link_linkdep.d 
> > -I/vol/gcc/src/hg/trunk/local/libphobos/t
> > estsuite/libphobos.shared liblinkdep.so lib.so -shared-libphobos execution 
> > test
> >
> > +FAIL: libphobos.shared/load_linkdep.d -shared-libphobos -ldl execution test
> > +FAIL: libphobos.shared/load_loaddep.d -shared-libphobos -ldl execution test
> >
> > +FAIL: libphobos.shared/linkDR.c -shared-libphobos -ldl -pthread execution 
> > test
> > +FAIL: libphobos.shared/host.c -ldl -pthread execution test
> > +FAIL: libphobos.shared/loadDR.c -ldl -pthread -g execution test
> >
> >   32 and 64-bit
> >
> > +FAIL: libphobos.shared/link.d 
> > -I/vol/gcc/src/hg/trunk/local/libphobos/testsuite/libphobos.shared lib.so 
> > -shared-libphobos execution test
> >
> >   64-bit only
> >
> > I haven't looked much closer yet, just posting this to see if anything
> > along those lines could be acceptable at all.
>
> Fortunately, Iain just discovered a way better way to work around the
> lack of dlpi_tls_modid: dlinfo(RTLD_DI_LINKMAP) returns not only a
> pointer to a Link_map * as documented in the man page, but rather a
> pointer to a struct Rt_map which also includes a rt_tlsmodid member.
> It has been this way since at least Solaris 9 and the Solaris/Illumos
> sources ($SRC/cmd/sgs/include/rtld.h) explicitly have a comment around
> the start of the structure stateing
>
> Exposed to rtld_db - don't move, don't delete
>
> which pretty much guarantees that this can be relied on.
>
> The only other quirk of note is that before dlpi_tls_modid got added,
> tlsmodid started at 0 for the main executable, not 1 as the glibc spec
> required and libdruntime assumes.  I account for this by adjusting
> _tlsMod on dlinfo and undoing the adjustment before passing it to
> __tls_get_adddr, the only consumer.
>
> With the revised patch below, I get clean gdc testresults on Solaris
> 11.3 and 11.4 (and still on 11.5 which uses the dlpi_tls_modid path),
> and almost identical libphobos testresults on all three versions.
>
> I hope this is good to go in (the sections_elf_shared.d part via
> upstream, the rest directly) now?
>
> Thanks a lot to Iain for discovering this.
>

I've finally managed to get around to moving the guts of rt.sections_*
to gcc.sections.*, with the patch amended to apply to
gcc/sections/elf_shared.d, this is OK.

-- 
Iain


[PATCH, libphobos] Committed move rt.sections modules to gcc.sections

2019-04-13 Thread Iain Buclaw
Hi,

This patch moved all rt.sections modules to a gcc.sections package.

These modules depend on a mixture between how the compiler emits
run-time module information, and what functions are exposed by the
platform to inquire about loaded global and thread-local data
sections.

As the upstream implementation is written to work only with how the
reference D compiler writes out data, much of what is present does not
apply to the GCC D front-end.  So it has been moved to a non-upstream
location in the source tree, where most of it will be rewritten once
each port has been completed.

The only tested module sections/elf_shared.d has been cleaned up so
that all deprecated declarations have been removed, as well as the
brittle module collision checking, which required bss_sections.c.  All
other ports have been left unchanged apart from a commonizing of
attributes.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r270341.

-- 
Iain
---
libphobos/ChangeLog:

2019-04-13  Iain Buclaw  

* libdruntime/Makefile.am (DRUNTIME_CSOURCES): Remove bss_sections.c.
(DRUNTIME_DSOURCES): Rename rt/sections_* modules to gcc/sections/*.
* libdruntime/Makefile.in: Regenerate.
* libdruntime/gcc/sections/android.d: New file.
* libdruntime/gcc/sections/elf_shared.d: New file.
* libdruntime/gcc/sections/osx.d: New file.
* libdruntime/gcc/sections/package.d: New file.
* libdruntime/gcc/sections/solaris.d: New file.
* libdruntime/gcc/sections/win32.d: New file.
* libdruntime/gcc/sections/win64.d: New file.
* libdruntime/rt/bss_section.c: Remove.
* libdruntime/rt/sections.d: Publicly import gcc.sections.
* libdruntime/rt/sections_android.d: Remove.
* libdruntime/rt/sections_elf_shared.d: Remove.
* libdruntime/rt/sections_osx.d: Remove.
* libdruntime/rt/sections_solaris.d: Remove.
* libdruntime/rt/sections_win32.d: Remove.
* libdruntime/rt/sections_win64.d: Remove.

---
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index abefb435dc7..8e36ce21449 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -122,7 +122,7 @@ DRUNTIME_DSOURCES_GENERATED = gcc/config.d gcc/libbacktrace.d
 # https://www.gnu.org/software/automake/manual/html_node/Wildcards.html
 DRUNTIME_SSOURCES = core/threadasm.S
 
-DRUNTIME_CSOURCES = core/stdc/errno_.c rt/bss_section.c
+DRUNTIME_CSOURCES = core/stdc/errno_.c
 
 DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \
 	core/checkedint.d core/cpuid.d core/demangle.d core/exception.d \
@@ -140,14 +140,14 @@ DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \
 	core/sync/config.d core/sync/exception.d core/sync/mutex.d \
 	core/sync/rwmutex.d core/sync/semaphore.d core/thread.d core/time.d \
 	core/vararg.d gcc/attribute.d gcc/backtrace.d gcc/builtins.d gcc/deh.d \
-	gcc/unwind/arm.d gcc/unwind/arm_common.d gcc/unwind/c6x.d \
-	gcc/unwind/generic.d gcc/unwind/package.d gcc/unwind/pe.d object.d \
-	rt/aApply.d rt/aApplyR.d rt/aaA.d rt/adi.d rt/arrayassign.d \
-	rt/arraycast.d rt/arraycat.d rt/cast_.d rt/config.d rt/critical_.d \
-	rt/deh.d rt/dmain2.d rt/invariant.d rt/lifetime.d rt/memory.d \
-	rt/minfo.d rt/monitor_.d rt/obj.d rt/qsort.d rt/sections.d \
-	rt/sections_android.d rt/sections_elf_shared.d rt/sections_osx.d \
-	rt/sections_solaris.d rt/sections_win32.d rt/sections_win64.d \
+	gcc/sections/android.d gcc/sections/elf_shared.d gcc/sections/osx.d \
+	gcc/sections/package.d gcc/sections/solaris.d gcc/sections/win32.d \
+	gcc/sections/win64.d gcc/unwind/arm.d gcc/unwind/arm_common.d \
+	gcc/unwind/c6x.d gcc/unwind/generic.d gcc/unwind/package.d \
+	gcc/unwind/pe.d object.d rt/aApply.d rt/aApplyR.d rt/aaA.d rt/adi.d \
+	rt/arrayassign.d rt/arraycast.d rt/arraycat.d rt/cast_.d rt/config.d \
+	rt/critical_.d rt/deh.d rt/dmain2.d rt/invariant.d rt/lifetime.d \
+	rt/memory.d rt/minfo.d rt/monitor_.d rt/obj.d rt/qsort.d rt/sections.d \
 	rt/switch_.d rt/tlsgc.d rt/typeinfo/ti_Acdouble.d \
 	rt/typeinfo/ti_Acfloat.d rt/typeinfo/ti_Acreal.d \
 	rt/typeinfo/ti_Adouble.d rt/typeinfo/ti_Afloat.d rt/typeinfo/ti_Ag.d \
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 4bfd04c3db5..0a27afac545 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -194,7 +194,10 @@ am__objects_1 = core/atomic.lo core/attribute.lo core/bitop.lo \
 	core/sync/exception.lo core/sync/mutex.lo core/sync/rwmutex.lo \
 	core/sync/semaphore.lo core/thread.lo core/time.lo \
 	core/vararg.lo gcc/attribute.lo gcc/backtrace.lo \
-	gcc/builtins.lo gcc/deh.lo gcc/unwind/arm.lo \
+	gcc/builtins.lo gcc/deh.lo gcc/sections/android.lo \
+	gcc/sections/elf_shared.lo gcc/sections/osx.lo \
+	gcc/sections/package.lo gcc/sections/solaris.lo \
+	gcc/sections/win32.lo gcc/sections/win64.lo gcc/unwind/arm.lo \
 	

Re: [patch] PR 79842 - i18n: subword translation in "Can't use the same %smodule"

2019-04-13 Thread Dominique d'Humières
Committed as revision r270338.

Dominique

> Le 11 avr. 2019 à 11:54, Dominique d'Humières  a écrit :
> 
> Hi all,
> 
> I am planning to commit the following patch
> 
> --- ../_clean/gcc/fortran/module.c2019-03-21 20:46:46.0 +0100
> +++ gcc/fortran/module.c  2019-04-11 10:28:37.0 +0200
> @@ -7144,8 +7144,12 @@ gfc_use_module (gfc_use_list *module)
>   for (p = gfc_state_stack; p; p = p->previous)
> if ((p->state == COMP_MODULE || p->state == COMP_SUBMODULE)
>&& strcmp (p->sym->name, module_name) == 0)
> -  gfc_fatal_error ("Cannot USE the same %smodule we're building",
> -p->state == COMP_SUBMODULE ? "sub" : "");
> +  {
> + if (p->state == COMP_SUBMODULE)
> +   gfc_fatal_error ("Cannot USE a submodule that is currently built");
> + else
> +   gfc_fatal_error ("Cannot USE a module that is currently built");
> +  }
> 
>   init_pi_tree ();
>   init_true_name_tree ();
> 
> While testing it I did not find any coverage of these errors in the test 
> suite.
> 
> TIA
> 
> Dominique
> 



[C++ PATCH] PR60531 - Wrong error about unresolved overloaded function

2019-04-13 Thread Harald van Dijk

Hi,

For PR60531, GCC wrongly rejects function templates with explicitly
specified template arguments as overloaded. They are resolved by
resolve_nondeduced_context, which is normally called by
cp_default_conversion through decay_conversion, but the latter have
extra effects making them unusable here. Calling the former directly
does work.

Bootstrapped on x86_64-pc-linux-gnu on top of r270264 with
--enable-languages=all; make check shows no regressions.

Does this look okay?

This is my first code contribution to GCC, please let me know if
anything is missing. I have not signed any copyright disclaimer or
copyright assignment;  says that is not necessary
for small changes, which I trust this is. If it is needed after all,
please let me know what specifically will be required.

Cheers,
Harald van Dijk

PR c++/60531
* typeck.c (cp_build_binary_op): See if overload can be resolved.
(cp_build_unary_op): Ditto.

* g++.dg/template/operator15.C: New test.

diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 03b14024738..e1ffe88ce2c 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4384,10 +4384,6 @@ cp_build_binary_op (const op_location_t ,
   /* True if both operands have arithmetic type.  */
   bool arithmetic_types_p;

-  /* Apply default conversions.  */
-  op0 = orig_op0;
-  op1 = orig_op1;
-
   /* Remember whether we're doing / or %.  */
   bool doing_div_or_mod = false;

@@ -4397,6 +4393,10 @@ cp_build_binary_op (const op_location_t ,
   /* Tree holding instrumentation expression.  */
   tree instrument_expr = NULL_TREE;

+  /* Apply default conversions.  */
+  op0 = resolve_nondeduced_context (orig_op0, complain);
+  op1 = resolve_nondeduced_context (orig_op1, complain);
+
   if (code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
   || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
   || code == TRUTH_XOR_EXPR)
@@ -6204,11 +6204,13 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool 
noconvert,
   if (!arg || error_operand_p (arg))
 return error_mark_node;

+  arg = resolve_nondeduced_context (arg, complain);
+
   if ((invalid_op_diag
= targetm.invalid_unary_op ((code == UNARY_PLUS_EXPR
? CONVERT_EXPR
: code),
-  TREE_TYPE (xarg
+  TREE_TYPE (arg
 {
   if (complain & tf_error)
error (invalid_op_diag);
diff --git a/gcc/testsuite/g++.dg/template/operator15.C 
b/gcc/testsuite/g++.dg/template/operator15.C
new file mode 100644
index 000..755442266bb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/operator15.C
@@ -0,0 +1,6 @@
+// PR c++/60531
+
+template < class T > T foo ();
+
+bool b1 = foo == foo;
+int (*fp1)() = +foo;