aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
AgeCommit message (Collapse)AuthorFilesLines
2025-04-30Daily bump.GCC Administrator1-0/+17
2025-04-29d: Use __builtin_clear_padding for zeroing alignment holes after setIain Buclaw4-70/+30
In an earlier change, a wrapper function was added to set CONSTRUCTOR_ZERO_PADDING_BITS on all CONSTRUCTOR nodes. This removes all the old generated calls to built-in memset and memcpy as zero padding is now taken care of by the middle-end. The remaining constructors that weren't getting zero padded was ARRAY_TYPEs, so now `__builtin_clear_padding' is used to fill in all alignment holes in constructed array literals where required. PR d/103044 gcc/d/ChangeLog: * d-tree.h (build_clear_padding_call): New prototype. * d-codegen.cc (build_clear_padding_call): New function. (build_memset_call): Remove generated call to __builtin_memcpy. (build_address): Replace generated call to __builtin_memset with __builtin_clear_padding. (build_array_from_exprs): Likewise. * expr.cc (ExprVisitor::visit (AssignExp *)): Remove generated call to __builtin_memset. (ExprVisitor::visit (ArrayLiteralExp *)): Likewise. Insert call to __builtin_clear_padding after copying array into GC memory. (ExprVisitor::visit (StructLiteralExp *)): Remove generated call to __builtin_memset. * toir.cc (IRVisitor::visit (ReturnStatement *)): Likewise.
2025-04-18Daily bump.GCC Administrator1-0/+4
2025-04-17d: Fix infinite loop regression in CTFEIain Buclaw2-4/+4
An infinite loop was introduced by a previous refactoring in the semantic pass for DeclarationExp nodes. Ensure the loop properly terminates and add tests cases. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 956e73d64e. gcc/testsuite/ChangeLog: * gdc.test/fail_compilation/test21247.d: New test. * gdc.test/fail_compilation/test21247b.d: New test. Reviewed-on: https://github.com/dlang/dmd/pull/21248
2025-04-16Daily bump.GCC Administrator1-0/+19
2025-04-16d: Fix ICE: type variant differs by TYPE_MAX_VALUE with -g [PR119826]Iain Buclaw1-0/+20
Forward referenced enum types were never fixed up after the main ENUMERAL_TYPE was finished. All flags set are now propagated to all variants after its mode, size, and alignment has been calculated. PR d/119826 gcc/d/ChangeLog: * types.cc (TypeVisitor::visit (TypeEnum *)): Propagate flags of main enum types to all forward-referenced variants. gcc/testsuite/ChangeLog: * gdc.dg/debug/imports/pr119826b.d: New test. * gdc.dg/debug/pr119826.d: New test.
2025-04-15d: Fix internal compiler error: in visit, at d/decl.cc:838 [PR119799]Iain Buclaw1-5/+10
This was caused by a check in the D front-end disallowing static VAR_DECLs with a size `0'. While empty structs in D are give the size `1', the same symbol coming from ImportC modules do infact have no size, so allow C variables to pass the check as well as array objects. PR d/119799 gcc/d/ChangeLog: * decl.cc (DeclVisitor::visit (VarDeclaration *)): Check front-end type size before building the VAR_DECL. Allow C symbols to have a size of `0'. gcc/testsuite/ChangeLog: * gdc.dg/import-c/pr119799.d: New test. * gdc.dg/import-c/pr119799c.c: New test.
2025-04-15d: Fix ICE in dwarf2out_imported_module_or_decl, at dwarf2out.cc:27676 ↵Iain Buclaw1-1/+5
[PR119817] The ImportVisitor method for handling the importing of overload sets was pushing NULL_TREE to the array of import decls, which in turn got passed to `debug_hooks->imported_module_or_decl', triggering the observed internal compiler error. NULL_TREE is returned from `build_import_decl' when the symbol was ignored for being non-trivial to represent in debug, for example, template or tuple declarations. So similarly "skip" adding the symbol when this is the case for overload sets too. PR d/119817 gcc/d/ChangeLog: * imports.cc (ImportVisitor::visit (OverloadSet *)): Don't push NULL_TREE to vector of import symbols. gcc/testsuite/ChangeLog: * gdc.dg/debug/imports/m119817/a.d: New test. * gdc.dg/debug/imports/m119817/b.d: New test. * gdc.dg/debug/imports/m119817/package.d: New test. * gdc.dg/debug/pr119817.d: New test.
2025-04-13Daily bump.GCC Administrator1-0/+18
2025-04-12d: Add option to include imported modules in the compilation [PR109023]Iain Buclaw5-2/+67
Adds the ability to include imported modules in the compilation, as if they were given on the command line. When this option is enabled, all imported modules are compiled except those that are part of libphobos. PR d/109023 gcc/d/ChangeLog: * d-compiler.cc: Include dmd/errors.h. (Compiler::onImport): Implement. * d-lang.cc (d_handle_option): Handle -finclude-imports. (d_parse_file): Run semantic on included imports. * gdc.texi: Document -finclude-imports. * lang.opt: Add finclude-imports. * lang.opt.urls: Regenerate. gcc/testsuite/ChangeLog: * gdc.dg/torture/imports/pr109023.d: New test. * gdc.dg/torture/pr109023.d: New test.
2025-04-12d: Fix -fonly= argument only matches when including full path [PR119758]Iain Buclaw2-26/+30
Using `strcmp' to match the `-fonly=' argument with the input source file made the feature inflexible to use. By mistake, the driver was also found to omit all other modules on the command line as well, which differed from the documentation on the flag: Tell the compiler to parse and run semantic analysis on all modules on the command line, but only generate code for the given argument. New tests added to check the feature, which didn't exist before. PR d/119758 gcc/d/ChangeLog: * d-lang.cc (d_parse_file): Use endswith in test for -fonly= argument. * d-spec.cc (lang_specific_driver): Rework -fonly= and pass all input files to the front-end compiler when the option is seen. gcc/testsuite/ChangeLog: * gdc.dg/driver_fonly1.d: New test. * gdc.dg/driver_fonly2.d: New test. * gdc.dg/driver_fonly3.d: New test. * gdc.dg/imports/fonly.d: New test.
2025-04-12Daily bump.GCC Administrator1-0/+4
2025-04-11d: Merge upstream dmd 1b34fea478, phobos 40ffbb364Iain Buclaw5-15/+31
D front-end changes: - Import latest fixes from dmd v2.111.1-rc.1. Phobos changes: - Import latest fixes from phobos v2.111.1-rc.1. - Restore compatibility with older Linux platforms where `getrandom' is unavailable. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 1b34fea478. libphobos/ChangeLog: * src/MERGE: Merge upstream phobos 40ffbb364. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Call DRUNTIME_OS_FEATURES. * libdruntime/Makefile.am (AM_DFLAGS): Add OS_DFLAGS. * libdruntime/Makefile.in: Regenerate. * m4/druntime/os.m4 (DRUNTIME_OS_FEATURES): Define. * src/Makefile.am: Add OS_DFLAGS. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * testsuite/testsuite_flags.in: Add OS_DFLAGS.
2025-04-10Daily bump.GCC Administrator1-0/+30
2025-04-09d: Fix forward referenced enums missing type names in debug info [PR118309]Iain Buclaw2-13/+11
Calling `rest_of_type_compilation' as the D types were built meant that debug info was being emitted before all forward references were resolved, resulting in DW_AT_name's to be missing. Instead, defer outputting type debug information until all modules have been parsed and generated in `d_finish_compilation'. PR d/118309 gcc/d/ChangeLog: * modules.cc: Include debug.h (d_finish_compilation): Call debug_hooks->type_decl on all TYPE_DECLs. * types.cc: Remove toplev.h include. (finish_aggregate_type): Don't call rest_of_type_compilation or rest_of_decl_compilation on type. (TypeVisitor::visit (TypeEnum *)): Likewise. gcc/testsuite/ChangeLog: * gdc.dg/debug/dwarf2/pr118309.d: New test.
2025-04-09d: Use CONSTRUCTOR_ZERO_PADDING_BITS in the D FE [PR117832]Iain Buclaw7-28/+45
Adds a new wrapper function for `build_constructor', and calls it instead to ensure that all CONSTRUCTOR nodes explicitly created by the front-end have CONSTRUCTOR_ZERO_PADDING_BITS set. Some places may not be necessary as it's guaranteed for there to be no padding in the type, such as D dynamic arrays. Other places this gets turned into a double-memset when optimizations are turned off, as the front-end already generates a memset call to zero out all padding on initializing a variable. The optimizer sees through this so will correctly clear all bits once, so this can be improved later as-needed. PR d/117832 gcc/d/ChangeLog: * d-tree.h (build_padded_constructor): New prototype. * d-codegen.cc (build_padded_constructor): New function. (d_array_value): Call it. (build_memset_call): Likewise. (build_struct_literal): Likewise. (underlying_complex_expr): Likewise. (build_array_from_val): Likewise. (build_array_from_exprs): Likewise. (d_build_call): Likewise. (get_frame_for_symbol): Likewise. * d-convert.cc (convert_for_rvalue): Likewise. (convert_for_assignment): Likewise. * decl.cc (class DeclVisitor): Likewise. * expr.cc (class ExprVisitor): Likewise. * modules.cc (layout_moduleinfo): Likewise. * typeinfo.cc (class TypeInfoVisitor): Likewise.
2025-04-09Daily bump.GCC Administrator1-0/+4
2025-04-08d: Fix infinite loop in isAliasThisTupleIain Buclaw2-14/+18
This reverts a change in the upstream D implementation of the compiler, as the refactoring introduced a regression. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 51816cd01d. Reviewed-on: https://github.com/dlang/dmd/pull/21155
2025-04-07Daily bump.GCC Administrator1-0/+4
2025-04-06Doc: make regenerate-opt-urlsSandra Loosemore1-0/+3
I keep forgetting to do this.... :-( gcc/c-family/ChangeLog * c.opt.urls: Regenerate. gcc/d/ChangeLog * lang.opt.urls: Regenerate.
2025-04-03Daily bump.GCC Administrator1-0/+4
2025-04-02d: Fix error using UFCS in a speculative contextIain Buclaw2-9/+4
This reverts a change in the upstream D implementation of the compiler, as it is no longer necessary since another fix for opDispatch got applied in the same area (merged in r12-6003-gfd43568cc54e17). gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd ed17b3e95d. Reviewed-on: https://github.com/dlang/dmd/pull/21132
2025-04-01Daily bump.GCC Administrator1-0/+14
2025-03-31d: Bump front-end language version to v2.111.0Iain Buclaw129-255/+255
Merges the front-end language implementation and runtime library with upstream dmd c6863be720, and the standard library with phobos 60034b56e. Synchronizing with the upstream release of v2.111.0. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd c6863be720. * dmd/VERSION: Bump version to v2.111.0. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime c6863be720. * src/MERGE: Merge upstream phobos 60034b56e.
2025-03-31d: Fix error with -Warray-bounds and -O2 [PR117002]Iain Buclaw3-1/+10
The record layout of class types in D don't get any tail padding, so it is possible for the `classInstanceSize' to not be a multiple of the `classInstanceAlignment'. Rather than setting the instance alignment on the underlying RECORD_TYPE, instead give the type an alignment of 1, which will mark it as TYPE_PACKED. The value of `classInstanceAlignment' is instead applied to the DECL_ALIGN of both the static `init' symbol, and the stack allocated variable used when generating `new' for a `scope' class. PR d/117002 gcc/d/ChangeLog: * decl.cc (aggregate_initializer_decl): Set explicit decl alignment of class instance. * expr.cc (ExprVisitor::visit (NewExp *)): Likewise. * types.cc (TypeVisitor::visit (TypeClass *)): Mark the record type of classes as packed. gcc/testsuite/ChangeLog: * gdc.dg/torture/pr117002.d: New test.
2025-03-31Daily bump.GCC Administrator1-0/+4
2025-03-30Docs: make regenerate-opt-urlsSandra Loosemore1-1/+1
gcc/c-family/ChangeLog * c.opt.urls: Regenerate. gcc/d/ChangeLog * lang.opt.urls: Regenerate. gcc/m2/ChangeLog * lang.opt.urls: Regenerate.
2025-03-27Daily bump.GCC Administrator1-0/+4
2025-03-26d: import __stdin causes compilation to pause while reading from stdinIain Buclaw5-59/+8
Moves the special handling of reading from stdin out of the language semantic routines. All references to `__stdin.d` have also been removed from the front-end implementation. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 02a64d2e13.
2025-03-24Daily bump.GCC Administrator1-0/+5
2025-03-23d: Fix ICE type variant differs by TYPE_PACKED [PR117621]Iain Buclaw1-1/+1
Introduced by r13-1104-gf4c3ce32fa54c1, which had an accidental self assignment of TYPE_PACKED when it should have been assigned to the type's variants. PR d/117621 gcc/d/ChangeLog: * types.cc (finish_aggregate_type): Propagate TYPE_PACKED to variants. gcc/testsuite/ChangeLog: * gdc.dg/pr117621.d: New test.
2025-03-23Daily bump.GCC Administrator1-0/+24
2025-03-22d: Bump front-end language version to v2.111.0-rc.1.Iain Buclaw2-2/+2
gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 032e24446b. * dmd/VERSION: Bump version to v2.111.0-rc.1.
2025-03-22d: Improve UFCS/property error messageIain Buclaw2-4/+12
Improves on the speller suggestions for UFCS by using the location of the suggested symbol, and considering that local functions aren't eligible for UFCS instead of making a nonsensical suggestion, such as "no property foo, did you mean foo?". gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 9d2f034398. Reviewed-on: https://github.com/dlang/dmd/pull/21046
2025-03-22d: Add C++23 to CppStdRevision enumIain Buclaw6-2/+10
D front-end changes: - The compiler now accepts `-fextern-std=c++23' gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 94950cae58. * d-lang.cc (d_handle_option): Add case for CppStdRevisionCpp23. * gdc.texi: Document -fextern-std=c++23. * lang.opt (fextern-std=): Add c++23. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 94950cae58. Reviewed-on: https://github.com/dlang/dmd/pull/21043
2025-03-22d: Indexing a cast(AA) yields no lvalue anymoreIain Buclaw2-1/+2
gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 8db14cf846. Reviewed-on: https://github.com/dlang/dmd/pull/21029
2025-03-22libphobos: Add module declaration to rt.invariantIain Buclaw1-2/+2
This prevents conflicts with a user-provided `invariant.d' module. gcc/d/ChangeLog: * runtime.def (INVARIANT): Update signature of run-time function. libphobos/ChangeLog: * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Rename rt/invariant.d to rt/invariant_.d. * libdruntime/Makefile.in: Regenerate. * libdruntime/rt/invariant.d: Move to... * libdruntime/rt/invariant_.d: ...here.
2025-03-21Daily bump.GCC Administrator1-0/+5
2025-03-21d: Fix quoted command-line options to match lang.opt [PR118545]Iain Buclaw1-3/+3
It was noticed that not all D language options get a url in diagnostics. These have been checked and fixed as necessary. PR d/118545 gcc/d/ChangeLog: * d-lang.cc (d_handle_option): Adjust quoted options.
2025-03-19Daily bump.GCC Administrator1-0/+8
2025-03-18d: Add missing Declaration bitfield setters/gettersIain Buclaw3-3/+7
gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd fde0f8c40a. Reviewed-on: https://github.com/dlang/dmd/pull/21014
2025-03-18d: Update the copyright years of dmd sources to 2025Iain Buclaw171-172/+172
gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 51be8bb729. Reviewed-on: https://github.com/dlang/dmd/pull/20958
2025-03-17Daily bump.GCC Administrator1-0/+46
2025-03-16d: Merge upstream dmd, druntime 603225372bIain Buclaw65-1279/+1480
D front-end changes: - Import dmd v2.111.0-beta.1. - Added placement `new' expressions. D runtime changes: - Import druntime v2.111.0-beta.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 603225372b. * dmd/VERSION: Bump version to v2.111.0-beta.1. * d-builtins.cc (build_frontend_type): Update for new front-end interface. * decl.cc (Class DeclVisitor): Likewise. (maybe_build_decl_tree): Likewise. (get_vtable_decl): Likewise. (layout_class_initializer): Likewise. * expr.cc (class ExprVisitor): Likewise. (ExprVisitor::visit (NewExp *)): Implement placement new for class, struct, and pointer types. * modules.cc (get_internal_fn): Update for new front-end interface. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 603225372b.
2025-03-16d: Merge upstream dmd, druntime 53a1cc8d13Iain Buclaw44-454/+665
D front-end changes: - Typesafe variadic class parameters have been deprecated. D runtime changes: - Added `entry' field to TypeInfo_AssociativeArray. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 53a1cc8d13. * d-tree.h (create_typeinfo): Change second parameter to Scope *. (speculative_type_p): Remove prototype. * d-frontend.cc (getTypeInfoType): Adjust. * decl.cc: Include dmd/typinf.h. (DeclVisitor::visit (TypeInfoDeclaration *)): Update for new front-end interface. * typeinfo.cc (create_typeinfo): Likewise. (class SpeculativeTypeVisitor): Remove class. (speculative_type_p): Remove function. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 53a1cc8d13. gcc/testsuite/ChangeLog: * gdc.dg/pr100967.d: Adjust error message.
2025-03-16d: Merge upstream dmd, druntime ffbad272b6Iain Buclaw78-827/+1018
D front-end changes: - Import latest fixes from dmd. D runtime changes: - Import latest fixes from druntime. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd ffbad272b6. * d-tree.h (make_location_t): Add overload taking a const SourceLoc &. * d-codegen.cc (make_location_t): Likewise. * d-diagnostic.cc (d_diagnostic_report_diagnostic): Change first parameter type to const SourceLoc &. (verrorReport): Update for new front-end interface. (verrorReportSupplemental): Likewise. * d-frontend.cc (eval_builtin): Likewise. (getTypeInfoType): Likewise. * d-lang.cc (d_parse_file): Likewise. * d-target.cc (Target::va_listType): Likewise. (Target::getTargetInfo): Likewise. * decl.cc (build_decl_tree): Likewise. * imports.cc (ImportVisitor::visit (Module *)): Likewise. * modules.cc (get_internal_fn): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime ffbad272b6.
2025-03-16Daily bump.GCC Administrator1-0/+11
2025-03-15d: Merge upstream dmd, druntime d29e3eca45Iain Buclaw53-845/+859
D front-end changes: - Error messages related to operator overloading have been improved. D runtime changes: - Import latest fixes from druntime. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd d29e3eca45. * d-codegen.cc (can_elide_copy_p): Update for new front-end interface. * d-lang.cc (d_handle_option): Likewise. * expr.cc (class ExprVisitor): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime d29e3eca45.
2025-03-15d: Merge upstream dmd, druntime b7e3b3b617Iain Buclaw23-1714/+1079
D front-end changes: - `delete' is no longer a keyword. - Initializing a field with itself has been deprecated. D runtime changes: - Add Windows BCrypt bindings under `core.sys.windows.bcrypt'. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream b7e3b3b617. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream b7e3b3b617. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/bcrypt.d. * libdruntime/Makefile.in: Regenerate. * libdruntime/gcc/sections/elf.d (sizeofTLS): Give function the same mangling as gcc.sections.sizeofTLS. * libdruntime/gcc/sections/package.d: Import core.internal.traits. (pinLoadedLibraries): Mangle as function from rt.sections_elf_shared. (unpinLoadedLibraries): Likewise. (inheritLoadedLibraries): Likewise. (cleanupLoadedLibraries): Likewise. (sizeOfTLS): Add forward declaration.
2025-03-12Daily bump.GCC Administrator1-0/+6