[committed] d: Merge upstream dmd 609c3ce2d, phobos 3dd5df686

2021-01-26 Thread Iain Buclaw via Gcc-patches
Hi, This patch merges the D front-end implementation with upstream dmd 609c3ce2d, and the Phobos standard library with upstream 3dd5df686. D front-end changes: - Contracts for pre- and postconditions are now implicitly "this" const, so that state can no longer be altered in these functions.

[committed] libphobos: Fix executables segfault on mipsel architecture

2021-01-23 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes an issue running programs linked to the shared libphobos library on MIPS. The dynamic section on MIPS is read-only, but this was not properly handled in the runtime library. Bootstrapped and regression tested on mipsel-linux-gnu, and committed to mainline with backports to

Re: [PATCH] libphobos: Allow building libphobos using Solaris/x86 assembler

2021-01-07 Thread Iain Buclaw via Gcc-patches
Excerpts from Rainer Orth's message of January 6, 2021 2:57 pm: > Hi Iain, > >>> This patch removes the disabling of libphobos when the Solaris/x86 >>> assembler is being used. >>> >>> Since r11-6373, D symbols are now compressed using back references, this >>> helped reduce the average symbol

Re: [PATCH] libphobos: Allow building libphobos using Solaris/x86 assembler

2021-01-07 Thread Iain Buclaw via Gcc-patches
Excerpts from Rainer Orth's message of January 7, 2021 5:17 pm: > Hi Iain, > >>> The Solaris assemblers don't support UTF-8 identifiers. Unless gdc can >>> encode them in some way for toolchains like this (no idea if this is >>> worth the effort), it may be possible to guard the tests with the

[committed] libphobos: Merge upstream druntime 9d0c8364, phobos 9d575282e.

2021-02-03 Thread Iain Buclaw via Gcc-patches
uage Foundation + * License: http://www.boost.org/LICENSE_1_0.txt;>Boost License 1.0. + * Authors: Iain Buclaw + */ +module core.sys.bionic.stdlib; +public import core.sys.posix.stdlib; + +version (CRuntime_Bionic): +extern (C): +nothrow: +@nogc: + +const(char)* getprogname(); +void setprognam

[committed] d: Fix junk in generated symbol on powerpc64-*-* (PR98921)

2021-02-01 Thread Iain Buclaw via Gcc-patches
Hi, This patch merges the D front-end implementation with upstream dmd 5e2a81d9c, fixing PR98921. This adds a special formatter to OutBuffer to handle formatted printing of integers, a common case. The replacement is faster and safer. In dmangle.c, it also gets rid of a number of problematic

[committed] d: foreach over a tuple doesn't work on 16-bit targets (PR100999)

2021-06-11 Thread Iain Buclaw via Gcc-patches
Hi, This patch improves semantic passes in the front-end around the `foreach' and `static foreach' statements to be more resilient to compiling in a minimal D runtime environment. Checking of the index type has been improved as well so now there won't be needless compiler errors when using 8 or

[committed] d: Fix ICE in TypeInfoDeclaration, at dmd/declaration.c (PR100967)

2021-06-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes an ICE in the constructor of TypeInfoDeclaration from within the D language front-end. Generates a stub TypeInfo class even if the root Object class is missing. The front-end will take care of issuing an error and abort the compilation when running semantic on constructed

[GCC-9][committed] PR d/90651 (ICE in FuncDeclaration::semantic3, at d/dmd/func.c:1524)

2021-06-10 Thread Iain Buclaw via Gcc-patches
Hi, When looking into fixing PR100967, I noticed that the gcc-9 release branch first needed a patch to address another issue that didn't originally get backported from GCC-10. This fixes segmentation fault in FuncDeclaration::semantic3. Bootstrapped and regression tested on

[committed] d: TypeInfo error when using slice copy on Structs (PR100964)

2021-06-09 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a compiler error when using a slice copy on structs. Known limitation: does not work for struct with postblit or dtor. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline, and backported to the gcc-9, gcc-10, and gcc-11 release branches.

[committed] d: Respect explicit align(N) type alignment (PR100935)

2021-06-09 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes the .alignof property to report the correct alignment if an explicit one was given for the type. It was previously the natural type alignment, defined as the maximum of the field alignments for an aggregate. Make sure an explicit align(N) overrides it. Bootstrapped and

[committed] libphobos: Fix static asserts on NetBSD, FreeBSD, DragonflyBSD

2021-05-13 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a number of static asserts that were failing on NetBSD, and the same would have been the case for FreeBSD and DragonFlyBSD as well. The function declarations were updated to use `const scope', but the static asserts were not. Bootstrapped and regression tested on

Re: [PATCH, LIBPHOBOS] Cleanup temp files in libphobos unittest at src/std/process.d

2021-05-14 Thread Iain Buclaw via Gcc-patches
Excerpts from Bernd Edlinger's message of May 14, 2021 7:19 am: > Hi, > > I've noticed that a couple temp files are leaked after each full > gcc test-suite run. > > I'd like to fix that by the following patch. > > > Bootstrapped and reg-tested on x86_64-pc-linux-gnu. > Is it OK for trunk? >

Re: [PATCH] diagnostics: Support for -finput-charset [PR93067]

2021-05-18 Thread Iain Buclaw via Gcc-patches
Excerpts from Lewis Hyatt via Gcc-patches's message of January 29, 2021 4:46 pm: > Q1: What is the input charset? > A1: > > libcpp: Whatever was passed to -finput-charset (note, for Fortran, > -finput-charset is not supported though.) > > go: Assume UTF-8. > > D: UTF-8, UTF-16,

Re: [PATCH 1/3] Come up with startswith function.

2021-05-18 Thread Iain Buclaw via Gcc-patches
Excerpts from Martin Liska's message of March 17, 2021 4:36 pm: > > gcc/d/ChangeLog: > > * d-builtins.cc (do_build_builtin_fn): Use startswith > function instead of strncmp. > * dmd/dinterpret.c (evaluateIfBuiltin): Likewise. > * dmd/dmangle.c: Likewise. > *

[committed] d: Revert "Come up with startswith function."

2021-05-18 Thread Iain Buclaw via Gcc-patches
Hi, This reverts changes to the DMD front-end in commit 6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b. Changes were incorrectly committed directly to the GCC repo instead of the master repository. Committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * dmd/dinterpret.c

[committed] d: Use startswith function instead of strncmp

2021-05-18 Thread Iain Buclaw via Gcc-patches
Hi, This patch updates TypeVisitor in types.cc to use startswith instead of strncmp. Bootstrapped and regression tested on x86_64-linux-gnu, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * types.cc (TypeVisitor::visit (TypeEnum *)): Use startswith function

[committed] d: Use filename_ncmp instead of strncmp

2021-05-18 Thread Iain Buclaw via Gcc-patches
Hi, This patch updates prefixed_path in d-incpath.cc to use filename_ncmp instead of strncmp. Bootstrapped and regression tested on x86_64-linux-gnu, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * d-incpath.cc (prefixed_path): Use filename_ncmp instead of strncmp.

[committed] libphobos: Fix visibility of std.process.searchPathFor

2021-05-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch adjusts the visibility of std.process.searchPathFor so it can be used from other modules in the phobos library. In particular, this symbol is used by std.file.thisExePath on OpenBSD. Bootstrapped and regression tested on x86_64-linux-gnu, committed to mainline and backported to

[committed] d: Fix qualifier ignored in alias definition if parentheses are not present

2021-05-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a regression where the qualifier was ignored in an alias definition if parentheses were not present. Bootstrapped and regression tested on x86_64-linux-gnu, committed to mainline and backported to releases/gcc-11. Regards, Iain. --- gcc/d/ChangeLog: * dmd/MERGE:

Re: [PATCH, LIBPHOBOS] Cleanup temp files in libphobos unittest at src/std/process.d

2021-05-14 Thread Iain Buclaw via Gcc-patches
Excerpts from Bernd Edlinger's message of May 14, 2021 12:43 pm: > Hi Iain, > > On 5/14/21 11:55 AM, Iain Buclaw wrote: >> Excerpts from Bernd Edlinger's message of May 14, 2021 7:19 am: >>> Hi, >>> >>> I've noticed that a couple temp files are lea

Re: [PATCH] wwwdocs: Add D front-end section for GCC 11 changes

2021-05-26 Thread Iain Buclaw via Gcc-patches
Excerpts from Iain Buclaw's message of May 19, 2021 5:41 pm: > Hi, > > This is a belated patch which covers some of the more notable changes > that have gone into the GCC 11 release of the D front-end. > > Ran this through the W3 validator and no new warnings are generated. > > I will go

[committed] d: Fix ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 (PR100882)

2021-06-04 Thread Iain Buclaw via Gcc-patches
Hi, Constructor calls for temporaries were reusing the TARGET_EXPR_SLOT of a TARGET_EXPR for an assignment, which later got passed to `build_assign', which stripped away the outer TARGET_EXPR, leaving a reference to a lone temporary with no declaration. This stripping away of the TARGET_EXPR

[committed] d: RHS value lost when a target_expr modifies LHS in a cond_expr (PR101282)

2021-07-02 Thread Iain Buclaw via Gcc-patches
Hi, This patch forces a target_expr on the RHS of an assignment when it is a non-POD type. To prevent the RHS of an assignment modifying the LHS before the assignment proper, a target_expr is forced so that function calls that return with slot optimization modify the temporary instead. This

[committed] d: Missed RVO optimization with non-POD structs

2021-07-03 Thread Iain Buclaw via Gcc-patches
Hi, The D front-end semantic pass sometimes declares a temporary inside a return expression. This is now detected with the RESULT_DECL replacing the temporary, allowing for RVO to be done. Patch regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline and backported to

[PATCH] wwwdocs: Add D front-end section for GCC 11 changes

2021-05-19 Thread Iain Buclaw via Gcc-patches
Hi, This is a belated patch which covers some of the more notable changes that have gone into the GCC 11 release of the D front-end. Ran this through the W3 validator and no new warnings are generated. I will go through it a few more times to see if there's anything more that can be made more

[committed] d: Merge upstream dmd 46133f761, druntime 0fd4364c

2021-02-04 Thread Iain Buclaw via Gcc-patches
Hi, This patch merges the D front-end implementation with upstream dmd 46133f761, and the D runtime library with upstream druntime 0fd4364c. Backports built-in function handling from upstream, adding a new intrinsic `byteswap(ushort)`. Intrinsic modules have been updated accordingly in the

[committed] d: Remove the expansion of intrinsic and built-in codes from the DEF_D_INTRINSIC macro

2021-02-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch is a small tidy-up of the intrinsics.def file to make it clear that the parameters refer to INTRINSIC and BUILT_IN codes. Bootstrapped and regression tested on x86_64-linux-gnu, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * d-tree.h (DEF_D_INTRINSIC):

[committed] libphobos: Build all modules with -fversion=Shared when configured with --enable-shared

2021-03-26 Thread Iain Buclaw via Gcc-patches
Hi, The libgdruntime_convenience library was built with `-fversion=Shared', but the libphobos part wasn't when creating the static library. As there are no issues compiling in Shared code into the static library, to avoid mismatches the flag is now always present when --enable-shared is turned

[committed] [freebsd] d: Fix build failures on sparc64-*-freebsd*

2021-03-26 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a build issue on sparc64-freebsd targets, all platforms that could run on SPARC should include this header in order to avoid errors from memmodel being used in sparc-protos.h. Bootstrapped on x86_64-freebsd12 and committed to mainline. Regards Iain --- gcc/ChangeLog:

[committed] d: Define IN_TARGET_CODE in all machine-specific D language files.

2021-03-26 Thread Iain Buclaw via Gcc-patches
Hi, This patch defines IN_TARGET_CODE in all D language support files in the back-end, to be consistent with other machine-specific files. Bootstrapped and regression tested on x86_64-linux-gnu, and committed to mainline as obvious. Regards, Iain. --- gcc/ChangeLog: *

[committed] d: Don't create gdc.test symlink in the gdc testsuite directory

2021-03-28 Thread Iain Buclaw via Gcc-patches
Hi, This patch removes the symlink added by the fix for PR88041, to support filesystems where "file link" fails. Instead, tests are copied from the source tree (i.e: $srcdir/compilable) into the test base directory ($base_dir/compilable). A dejagnu test file with all translated test directives

[committed] d: Predefine the D_PIE version condition when flag_pie is set.

2021-03-28 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds D_PIE to the list of predefined version conditions when flag_pie is default, or set by the command-line. Same as the D_PIC version condition. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog:

[committed] d: Define language hook for LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE

2021-03-28 Thread Iain Buclaw via Gcc-patches
Hi, This patch defines LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE for the D front-end, the underlying base type for enumerals are always present in TREE_TYPE. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline. Regards, Iain --- gcc/d/ChangeLog: *

[committed] d: Don't generate per-module wrapper for calling DSO constructor/destructor.

2021-03-28 Thread Iain Buclaw via Gcc-patches
Hi, This patch removes the per-module wrapper function for calling the DSO constructor and destructor. The static constructor/destructor list only ever has one function to call in it, so mark the gdc.dso_ctor and gdc.dso_dtor functions as static ctor/dtor directly instead. Bootstrapped and

[committed] d: Use COMPILER_FOR_BUILD to build all D front-end generator programs

2021-03-28 Thread Iain Buclaw via Gcc-patches
Hi, It was noticed that the wrong headers were being included for the generator programs built for the D front-end. Now COMPILER_FOR_BUILD and BUILD_COMPILERFLAGS are used to compile them, so that GENERATOR_FILE will be correctly defined. Bootstrapped on x86_64-linux-gnu, and committed to

[PATCH 1/3] d: Add TARGET_D_HAS_STDCALL_CONVENTION

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds TARGET_D_HAS_STDCALL_CONVENTION as a new D front-end target hook. It replaces the use of the D front-end `is64bit' parameter in determining whether to insert the "stdcall" function attribute. It is also used to determine whether `extern(System)' should be the same as

[PATCH 2/3] d: Add TARGET_D_REGISTER_CPU_TARGET_INFO

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds TARGET_D_REGISTER_CPU_TARGET_INFO as a new D front-end target hook, implementing `__traits(getTargetInfo, "floatAbi")' for all targets that have D support files. This trait was added earlier in the front-end as a stub, however the target-specific implementation was left out

[PATCH 3/3] d: Add TARGET_D_REGISTER_OS_TARGET_INFO

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds TARGET_D_REGISTER_OS_TARGET_INFO as a new D front-end target hook, implementing `__traits(getTargetInfo, "objectFormat")' for all targets that have D support files. This trait was added earlier in the front-end as a stub, however the target-specific implementation was left

[committed 2/3] d: Merge upstream dmd 3b808e838 (D2 testsuite)

2021-04-03 Thread Iain Buclaw via Gcc-patches
Hi, This patch is part of merging the D front-end implementation with upstream dmd 3b808e838. These changes are specific to the D2 testsuite in testsuite/gdc.test, and cover all fixes issues. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32 and committed to mainline. Regards,

[committed] d: Use weak linkage for template symbols instead of gnu.linkonce (PR99914)

2021-04-05 Thread Iain Buclaw via Gcc-patches
Hi, This patch changes the default linkage of templates in the D language to be DECL_WEAK instead of DECL_ONE_ONLY, if supported. This better matches the expected override semantics of template symbols compiled to object code. For example: module rt.config; template rt_flag() {

[committed] d: Fix missing call to va_end in getMatchError [PR99917]

2021-04-06 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a missing call to va_end in getMatchError in the front-end, merged from upstream dmd d16195406. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32 and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: PR d/99917 * dmd/MERGE: Merge

[committed] d: Use Array::find to get index of element

2021-04-06 Thread Iain Buclaw via Gcc-patches
Hi, This patch refactors some code in the code generator to use the Array::find method to get the index of an element, instead of looping over the array ourselves. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32 and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog:

[committed] d: Increment gaggedWarnings if warning or deprecation message was suppressed

2021-04-06 Thread Iain Buclaw via Gcc-patches
Hi, This patch increments gaggedWarnings count if a warning or deprecation message was suppressed. Used by the front-end to catch potential errors in code that is being compiled in a speculative context. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32 and committed to

[committed] d: Merge upstream dmd 5cc71ff83, druntime 1134b710

2021-04-06 Thread Iain Buclaw via Gcc-patches
Hi, This patch merges the D front-end implementation with upstream dmd 5cc71ff83, and the Phobos standard library with druntime 1134b710. D front-end changes: - Fix ICEs that occurred when using opaque enums. - Update `pragma(printf)' checking code to work on 16-bit targets. Phobos change:

[PATCH] libiberty: d: Add support for `typeof(*null)' and function literal symbols.

2021-04-06 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds support for demangling function literals as template value parameters, as well as adding the new bottom type `typeof(*null)'. Null types were incorrectly being demangled as `none', this has been fixed to be `typeof(null)'. Bootstrapped and regression tested on

[PATCH] Fix ICE: in function_and_variable_visibility, at ipa-visibility.c:795 (PR99466)

2021-03-13 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes an ICE caused by emutls routines generating a weak, non-public symbol for storing the initializer of a weak TLS variable. In get_emutls_init_templ_addr, only declarations that were DECL_ONE_ONLY would get a public initializer symbol, ignoring variables that were declared

Re: [PATCH] Fix ICE: in function_and_variable_visibility, at ipa-visibility.c:795 (PR99466)

2021-03-14 Thread Iain Buclaw via Gcc-patches
Excerpts from Iain Sandoe's message of March 13, 2021 6:09 pm: > Hi Iain, > > Iain Buclaw via Gcc-patches wrote: > >> This patch fixes an ICE caused by emutls routines generating a weak, >> non-public symbol for storing the initializer of a weak TLS variable. >> &g

[PATCH] d: Add openbsd support for D compiler (PR99691)

2021-03-21 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds necessary backend support for OpenBSD targets so that all relevant predefined version conditions are available, a prerequesite for building most parts of libphobos. Tested gdc by building x86_64-pc-openbsd as a cross compiler, and I've been doing some preliminary testing on

[PATCH] d: Add windows support for D compiler (PR91595)

2021-03-21 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds necessary backend support for MinGW/Cygwin targets so that all relevant predefined version conditions are available, a prerequesite for building most parts of libphobos. Tested gdc by building x86_64-pc-mingw64 as a cross compiler, before I commit it to mainline, is there

[committed] d: Fix heap-buffer-overflow in checkModFileAlias [PR 99337]

2021-03-03 Thread Iain Buclaw via Gcc-patches
Hi, This patch merges the D front-end implementation with upstream dmd, fixing a heap-buffer-overflow in checkModFileAlias. The code wrongly assumed memcmp did not read past the mismatch. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline, and backported to

[committed] d: Don't set default flag_complex_method.

2021-03-06 Thread Iain Buclaw via Gcc-patches
Hi, This patch removes the default initializing of flag_complex_method in the D front-end. D doesn't need C99-like requirements for complex multiply and divide, the default set by common.opt is sufficient enough. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed

[committed] libphobos: Add section support code for MACHO and PE/COFF

2021-04-10 Thread Iain Buclaw via Gcc-patches
Hi, This replaces the original and untested support for Windows and OSX, and is the 90% of the work needed to support libphobos on those targets. The core.thread interface has been updated to accomodate for the same function might be implemented by any of the platform-dependent modules.

[committed] libphobos: Explicitly use -static-libphobos in druntime and phobos tests

2021-04-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch updates the default flags to explicitly use `-static-libphobos' in the druntime.exp and phobos.exp test scripts. Linking to libphobos statically is the default in the driver, however this may change in future. Be explicit that the static libphobos is what's being tested.

[committed] libphobos: Build runtime library with -ffunction-sections -fdata-sections

2021-04-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch updates libphobs build files to compile with `-ffunction-sections -fdata-sections' where supported, and sets SECTION_FLAGS accordingly, to take advantage of the smaller executables that can be had with `--gc-sections'. Bootstrapped and regression tested on

[committed] libphobos: Remove is-effective-target static from druntime and phobos tests

2021-04-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch removes is-effective-target from the druntime.exp and phobos.exp test scripts. These tests aren't compiling with `-static', they're there to verify that the libphobos is functional when linked in statically. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and

[committed] d: Merge upstream dmd 0450061c8

2021-04-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch merges the D front-end implementation with upstream dmd 0450061c8. D front-end changes: - Fix ICE in forward referenced type members of structs. - Fix ICE passing a member template mixin identifier as alias argument. - Fix ICE when `__traits' prints error involving a

[committed] libphobos: Re-add -fno-moduleinfo flag to dg-runtest [PR99812]

2021-04-10 Thread Iain Buclaw via Gcc-patches
Hi, This patch partially reverts a previous change that removed these flags, just to satisfy running tests on Solaris. The fix isn't really correct, what should really be done is that the test modules are compiled in a way that doesn't conflict with the release library, which would also allow

[committed] libphobos: Add D runtime support code for MinGW (PR99794)

2021-04-19 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes libphobos support when building on MinGW, this is enough to get the library built, and most tests to pass. Testsuite haven't been confirmed to pass cleanly, so support is still very much experimental. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, as

[committed] libphobos: Add section support code for OpenBSD (PR99691)

2021-04-19 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes the section support code for libphobos on OpenBSD, this is enough to get the library built, and most tests will pass now. Testsuite hasn't been confirmed to pass cleanly just yet, so support for libphobos on OpenBSD is still considered experimental. Bootstrapped and

[committed] d: Fix ICE in when formating a string with '%' or '`' characters (PR98457)

2021-04-19 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes an ICE that occurred in the D front-end diagnostic handlers. The percentage character was being confused for a format specifier in pp_format(), whilst the backtick character was confused for the beginning of a quoted string in expand_d_format(). Both are now properly

[committed] libphobos: Merge upstream druntime 89f870b7, phobos e6907ff3e

2021-04-19 Thread Iain Buclaw via Gcc-patches
Hi, This patch merges the D runtime library with upstream druntime 89f870b7, and phobos e6907ff3e. Synchronizes the C bindings with the latest port fixes in upstream druntime, and adds a Config.stderrPassThrough enum member to std.process (fixing PR98494). Bootstrapped and regression tested on

[committed] libphobos: Add Thread/Fiber support code for Darwin (PR98058)

2021-04-19 Thread Iain Buclaw via Gcc-patches
ACH__) && defined(__x86_64__) && !defined(__ILP32__) */ + +# endif /* defined (__MACH__) */ + +#endif /* !defined(__CET__) */ diff --git a/libphobos/libdruntime/core/sys/darwin/config.d b/libphobos/libdruntime/core/sys/darwin/config.d new file mode 100644 index 000..87f3f

[committed] libphobos: Fix SIGBUS in read_encoded_value_with_base on sparc-sun-solaris (PR98584)

2021-04-19 Thread Iain Buclaw via Gcc-patches
Hi, This patch adjusts the `read_encoded_value_with_base' function in libphobos to correctly handle unaligned loads. Instead of unsafe pointer dereferencing, use memcpy() to read encoded values from memory. The function `read_encoded_value' has been updated to accept a ref parameter, this

[committed] d: Remove setting of target-specific global.params flags from front-end

2021-04-14 Thread Iain Buclaw via Gcc-patches
Hi, This patch removes the setting of all target-specific global.params flags from the D front-end. Now that all dependencies on these flags have been removed, there's no need to test and set them. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline.

[committed] d: Move call to set_linkage_for_decl to declare_extern_var.

2021-04-14 Thread Iain Buclaw via Gcc-patches
Hi, This patch moves the call to the newly introduced set_linkage_for_decl in the D front-end from d_finish_decl to declare_extern_var. This both prevents against it being called twice for declarations that are defined, and fixes an issue where variables defined in the compilation get one kind

Re: [PATCH] libphobos: Fix build fails for powerpc-linux

2021-04-20 Thread Iain Buclaw via Gcc-patches
Excerpts from Iain Buclaw's message of April 21, 2021 1:35 am: > Hi, > > This patch addresses the raised issue in the RC thread (haven't seen a > bugzilla PR for it?) > > As register names are required for darwin, but not accepted by gas > unless you use `-mregnames', they have been

[PATCH] libphobos: Fix build fails for powerpc-linux

2021-04-20 Thread Iain Buclaw via Gcc-patches
Hi, This patch addresses the raised issue in the RC thread (haven't seen a bugzilla PR for it?) As register names are required for darwin, but not accepted by gas unless you use `-mregnames', they have been conditionally removed on non-darwin targets. To avoid duplicating large blocks of almost

[committed] d: Update language attribute support, and implement gcc.attributes

2021-04-08 Thread Iain Buclaw via Gcc-patches
This patch updates the GCC attribute support in the D front-end to have a baseline parity with the LLVM D compiler's own `ldc.attributes'. The handler that extracts GCC attributes from a list of UDAs has been improved to take care of some mistakes that could have been warnings. UDAs attached to

[committed] d: Implement __traits(getTargetInfo, "objectFormat")

2021-04-17 Thread Iain Buclaw via Gcc-patches
Hi, Following on from adding TARGET_D_REGISTER_OS_TARGET_INFO, this adds the required handlers to implement `__traits(getTargetInfo, "objectFormat")' for all platforms that have D support files. Some back-ends (i386, rs6000, and pa) have some awarenes of the what object format they are compiling

[committed] d: Add TARGET_D_TEMPLATES_ALWAYS_COMDAT

2021-04-17 Thread Iain Buclaw via Gcc-patches
Hi, Following up on the fix for PR99914, when testing on MinGW, it was found not to support weak in the same way as on ELF or Mach-O targets. So the linkage has been reverted back to COMDAT for that target, however in order to properly support overriding functions and variables, all declarations

[committed] libphobos: Update comment for DRUNTIME_OS_SOURCES

2021-09-01 Thread Iain Buclaw via Gcc-patches
Hi, This patch updates the comment for DRUNTIME_OS_SOURCES to reflect new conditionals that have been added since it was introduced. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline. Regards, Iain. --- libphobos/ChangeLog: *

[committed] libphobos: Don't add zlib when ENABLE_LIBDRUNTIME_ONLY

2021-09-01 Thread Iain Buclaw via Gcc-patches
Hi, The D run-time library does not depend on zlib, so only include it in the library when Phobos is being built as well. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline. Regards, Iain. --- libphobos/ChangeLog: * src/Makefile.am: Don't add

[committed] d: Get __c_wchar_t type from build_frontend_type

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi This patch uses build_frontend_type to get the underlying type for __c_wchar_t. The previous field has been removed from the upstream D implementation of the D front-end. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline. Regards, Iain ---

[committed] d: Use `int` to store class and struct flags

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch replaces ClassFlags and StructFlags with an int. In the D implementation of the D front-end, this type has been changed to an `enum class`. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline. Regards, Iain --- gcc/d/ChangeLog: *

[committed] d: Convert convert_for_rvalue switch statement into if condition

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch replaces the switch statement in convert_for_rvalue with an if condition. In the D implementation of the D front-end, the condition value has been changed to an `enum class` type. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline. Regards,

[committed] d: Use POINTER_SIZE for testing whether to predefine D_LP64

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch removes uses of global.params to get information about the target. Using POINTER_SIZE is assumed to be reliably set at the point where predefined version conditions are inserted into the compilation. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to

[committed] d: ICE in gimple_register_canonical_type_1, at lto/lto-common.c:430 (PR102094)

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, User defined types have the TYPE_CXX_ODR_P flag set, but closure frames did not. This mismatch led to an ICE in the conflict detection for ODR and interoperable non-ODR types. As a given closure frame is tied explicitly to a function, it already conforms to ODR. Bootstrapped and regression

[committed] d: Call the assertp and boundsp variants for assert and array contract failures.

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch updates the code generator to call _d_assertp or _d_arrayboundsp when an assert or array bounds check fails respectively. These functions accept an `immutable(char)*` instead of an `immutable(char)[]`. The subtle difference being that the length of the string no longer has to be

[committed] d: Update comment for TypeInfoVisitor::layout_base

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch updates the comment for TypeInfoVisitor::layout_base to reflect a recent change that made the emission of a __monitor optional. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, committed to mainline. Regards, Iain --- gcc/d/ChangeLog: * typeinfo.cc

[PATCH 2/3] libiberty: Add support for demangling D function literals as template value parameters

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, The D language now allows instantiating templates using struct literals that have function literal fields as a value argument. Bootstrapped and regression tested on x86_64-linux-gnu. OK for mainline? Regards, Iain. --- libiberty/ChangeLog: * d-demangle.c

[PATCH 3/3] libiberty: Add support for demangling local D template declarations

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, The D language now allows multiple different template declarations in the same function that have the same mangled name. To make the mangled names unique, a fake parent in the form `__Sddd' is added to the symbol. This information is not important for the user, so the demangler now handles

Re: [PATCH 1/3] libiberty: Add support for D `typeof(*null)' types

2021-08-29 Thread Iain Buclaw via Gcc-patches
Excerpts from Jeff Law's message of August 29, 2021 10:55 pm: > > > On 8/29/2021 12:46 PM, Iain Buclaw via Gcc-patches wrote: >> Hi, >> >> The D language has a new bottom type `typeof(*null)'. Null types were >> also incorrectly being demangled as `none', thi

[PATCH 1/3] libiberty: Add support for D `typeof(*null)' types

2021-08-29 Thread Iain Buclaw via Gcc-patches
Hi, The D language has a new bottom type `typeof(*null)'. Null types were also incorrectly being demangled as `none', this has been fixed to be `typeof(null)'. Bootstrapped and regression tested on x86_64-linux-gnu. OK for mainline? Regards, Iain. --- libiberty/ChangeLog: *

[committed] libphobos: Compile configure tests with -fno-druntime

2021-08-30 Thread Iain Buclaw via Gcc-patches
Hi, This patch changes WITH_LOCAL_DRUNTIME to build with `-fno-druntime'. The D tests done at configure-time for libphobos don't require a functional D run-time, so don't enable any run-time features. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline.

[committed] d: Don't include terminating null pointer in string expression conversion (PR102185)

2021-09-12 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes an issue with the routine that converts STRING_CST to a StringExp for the dmd front-end to use during the semantic pass. The null terminator gets re-added by the ExprVisitor when lowering StringExp back into a STRING_CST during the code generator pass. Bootstrapped and

[committed] d: Don't escape quoted format strings in escape_d_format (PR101656)

2021-07-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch prepares the escape_d_format function to handle being given a quoted string. Something that the self-hosted D front-end does with a new format helper for symbols. If the format string is enclosed by two '`' characters, then don't escape the first and laster characters. There are

[committed] d: Remove generated D header files on error (PR101657)

2021-07-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds a clean-up for removing any generated DI header files created before semantic analysis was ran. If an error occurs later during compilation, remember that we generated the headers, so that they can be removed before exit. Bootstrapped and regression tested on

[committed] d: Ensure casting from bool results in either 0 or 1 (PR96435)

2021-07-29 Thread Iain Buclaw via Gcc-patches
Hi, When casting from bool, the result is either 0 or 1, any other value violates @safe code, so enforce that it is never invalid. This patch does that by lowering rvalue reads into `(bool & 1)'. Bootstrapped and regression tested on x86_64-linux-gnu/-mx32/-m32, committed to mainline, and

[committed] d: Return the correct value for C++ constructor calls (PR101664)

2021-07-29 Thread Iain Buclaw via Gcc-patches
Hi, C++ constructors return void, even though the D front-end semantic treats them as implicitly returning `this'. To handle this correctly, the object reference is cached and used as the result of the expression. Bootstrapped and regression tested on x86_64-linux-gnu/-mx32/-m32, committed to

[committed] d: Generate Object class if it doesn't exist during TypeInfo emission (PR101672)

2021-07-29 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds a check to make_frontend_typeinfo to generate a stub Object class if one doesn't exist in the run-time library. Having a stub will prevent errors from occuring when compiling D code with an empty object.d. Though if it were to actually be used implicitly then an error should

[committed 01/12] d: Factor d_nested_class and d_nested_struct into single function.

2021-07-30 Thread Iain Buclaw via Gcc-patches
Both do the exact same operation, just on different AST nodes. gcc/d/ChangeLog: * d-codegen.cc (d_nested_class): Rename to ... (get_outer_function): ... this. Handle all aggregate declarations. (d_nested_struct): Remove. (find_this_tree): Use get_outer_function.

[committed 05/12] d: Use Identifier::idPool to generate anonymous field name.

2021-07-30 Thread Iain Buclaw via Gcc-patches
The self-hosted implementation of the D front-end does not export Identifier::generateId, so handle name generation inline instead. gcc/d/ChangeLog: * d-builtins.cc (build_frontend_type): Use Identifier::idPool to generate anonymous field name. --- gcc/d/d-builtins.cc | 10

[committed 07/12] d: Set COMDAT and visibility of thunks only if they are public.

2021-07-30 Thread Iain Buclaw via Gcc-patches
It is not expected to have a member function that can be non-public, but this guards against any internal errors that might occur should that ever change in the front-end. gcc/d/ChangeLog: * decl.cc (make_thunk): Set COMDAT and visibility of thunks only if they are public. ---

[committed 11/12] d: Always layout initializer for the m_RTInfo field in TypeInfo_Class

2021-07-30 Thread Iain Buclaw via Gcc-patches
Makes it explicit that the default value is set to NULL. gcc/d/ChangeLog: * typeinfo.cc (TypeInfoVisitor::visit (TypeInfoClassDeclaration *)): Always layout initializer for the m_RTInfo field. --- gcc/d/typeinfo.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git

[committed 12/12] d: Remove dead code from binary_op.

2021-07-30 Thread Iain Buclaw via Gcc-patches
The front-end ensures that both sides have been casted to the same type before being given to the lowering pass. gcc/d/ChangeLog: * expr.cc (binary_op): Remove dead code. --- gcc/d/expr.cc | 8 1 file changed, 8 deletions(-) diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index

[committed 00/12] d: Series of refactorings to the D front-end

2021-07-30 Thread Iain Buclaw via Gcc-patches
into one big commit. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32, and committed to mainline. Regards, Iain. Iain Buclaw (12): d: Factor d_nested_class and d_nested_struct into single function. d: Drop any field or parameter types that got cached before conversion failed

[committed 03/12] d: Insert null terminator in obstack buffers

2021-07-30 Thread Iain Buclaw via Gcc-patches
Covers cases where functions that handle the extracted strings ignore the explicit length. This isn't something that's known to happen in the current front-end, but the self-hosted front-end has been observed to do this in its conversions between D and C-style strings. gcc/d/ChangeLog:

[committed 09/12] d: Clarify comment for generating static array assignment with literal.

2021-07-30 Thread Iain Buclaw via Gcc-patches
The code block is done as an optimization to elide a call to the runtime library helpers _d_arrayctor or _d_arrayassign. gcc/d/ChangeLog: * expr.cc (ExprVisitor::visit (AssignExp *)): Clarify comment for generating static array assignment with literal. --- gcc/d/expr.cc | 6

[committed 04/12] d: Use hasMonitor to determine whether to emit a __monitor field in D classes

2021-07-30 Thread Iain Buclaw via Gcc-patches
This helper introduced by the front-end is a better gate, and allows the front-end to change rules for what gets a monitor in the future. gcc/d/ChangeLog: * types.cc (layout_aggregate_type): Call hasMonitor. * typeinfo.cc (TypeInfoVisitor::layout_base): Likewise.

<    3   4   5   6   7   8   9   10   11   >