[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.

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 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

[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 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] 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

[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: 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: 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 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 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 10/12] d: Don't generate a PREDICT_EXPR when assert contracts are turned off.

2021-07-30 Thread Iain Buclaw via Gcc-patches
This expression is just discarded by add_stmt, so never reaches the middle-end. gcc/d/ChangeLog: * expr.cc (ExprVisitor::visit (AssertExp *)): Don't generate PREDICT_EXPR. --- gcc/d/expr.cc | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git

[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 08/12] d: Only handle named enums in enum_initializer_decl

2021-07-30 Thread Iain Buclaw via Gcc-patches
Anonymous enums neither generate an initializer nor typeinfo symbol, so it's safe to assert that all enum declarations passed to this function always have an identifier. gcc/d/ChangeLog: * decl.cc (enum_initializer_decl): Only handle named enums. --- gcc/d/decl.cc | 7 ++- 1 file

[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 06/12] d: Factor aggregate_initializer_decl to set the sinit for aggregate declarations.

2021-07-30 Thread Iain Buclaw via Gcc-patches
The self-hosted implementation of the D front-end changes the type of `sinit' to a void pointer, which requires an explicit cast to `tree'. gcc/d/ChangeLog: * decl.cc (DeclVisitor::visit (StructDeclaration *)): Don't use sinit for declaration directly. (DeclVisitor::visit

[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 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.

[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 02/12] d: Drop any field or parameter types that got cached before conversion failed.

2021-07-30 Thread Iain Buclaw via Gcc-patches
This ensures there are no dangling references to AST members that have been freed, either explcitly or by the garbage collector. gcc/d/ChangeLog: * d-builtins.cc (build_frontend_type): Restore builtin_converted_decls length on conversion failure. --- gcc/d/d-builtins.cc | 9

[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 00/12] d: Series of refactorings to the D front-end

2021-07-30 Thread Iain Buclaw via Gcc-patches
Hi, This small series of patches are for non-mechanical refactorings of the D front-end either required to work with the self-hosted version, or were made during the port to the self-hosted compiler. Each individual change has been pulled out into its own patch, rather than lumped together into

[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] 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: 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: 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: 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: Wrong evaluation order of binary expressions (PR101640)

2021-07-28 Thread Iain Buclaw via Gcc-patches
Hi, The use of fold_build2 can in some cases swap the order of its operands if that is the more optimal thing to do. However this breaks semantic guarantee of left-to-right evaluation in D. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32. Committed to mainline, and backported

[committed] d: fix ICE at convert_expr(tree_node*, Type*, Type*) (PR101490)

2021-07-28 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a modulo by zero bug, seen in both the front-end and code generator when testing if a conversion from a static array to dynamic array was valid. Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32. Committed to mainline, and backported to the gcc-9, gcc-10, and

[committed] d: __FUNCTION__ doesn't work in core.stdc.stdio functions without cast (PR101441)

2021-07-28 Thread Iain Buclaw via Gcc-patches
Hi, This patch backports a fix from upstream to allow __FUNCTION__ and __PRETTY_FUNCTION__ to be used as C string literals. 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. Regards, Iain.

[committed] d: Compile-time reflection for supported built-ins (PR101127)

2021-07-28 Thread Iain Buclaw via Gcc-patches
Hi, In order to allow user-code to determine whether a back-end builtin is available without error, LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE has been defined to delay putting back-end builtin functions until the ISA that defines them has been declared. However in D, there is no global namespace.

[committed] d: Change in DotTemplateExp type semantics leading to regression (PR101619)

2021-07-28 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a regression introduced by PR100999. By giving dot templates a type, meant that properry resolving silently started passing for code that should never have passed. The simple fix is to provide implementations for checkType and checkValue that give an error about dot

[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

[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: 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] 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

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

[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: 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] 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

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. > *

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, 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 leaked after each full >>> gcc test-suite run. >>>

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? >

[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

[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:

[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

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] 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: 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: 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] libphobos: Add Thread/Fiber support code for Darwin (PR98058)

2021-04-19 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes the thread support when building libphobos on Darwin, this is enough to get the library built, and most tests to pass on a fairly modern platform. Testsuite hasn't been confirmed to pass cleanly on as broad a targets as I'd like, so support is still very much experimental.

[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: 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] 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] 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: 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

[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: 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: 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: 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: 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] 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] 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

[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

[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:

[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: 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

[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

[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 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

[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 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: 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: 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

[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: 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] [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] 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

[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

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] 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

[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] 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: 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] 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

<    1   2   3   4   5   6   >