aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
AgeCommit message (Collapse)AuthorFilesLines
2020-11-18d: Fix LHS of array concatentation evaluated before the RHS.Iain Buclaw2-1/+7
In an array append expression: array ~= fun(array); The array in the left hand side of the expression was extended before evaluating the result of the right hand side, which resulted in the newly uninitialized array index being used before set. This fixes that so that the result of the right hand side is always saved in a reusable temporary before assigning to the destination. gcc/d/ChangeLog: PR d/97843 * d-codegen.cc (build_assign): Evaluate TARGET_EXPR before use in the right hand side of an assignment. * expr.cc (ExprVisitor::visit (CatAssignExp *)): Force a TARGET_EXPR on the element to append if it is a CALL_EXPR. gcc/testsuite/ChangeLog: PR d/97843 * gdc.dg/torture/pr97843.d: New test.
2020-11-18d: Fix a couple of ICEs found in the dmd front-end (PR97842)Iain Buclaw3-1/+11
- Segmentation fault on incomplete static if. - Segmentation fault resolving typeof() expression when gagging is on. Reviewed-on: https://github.com/dlang/dmd/pull/11971 gcc/d/ChangeLog: PR d/97842 * dmd/MERGE: Merge upstream dmd b6a779e49
2020-11-14Daily bump.GCC Administrator1-0/+15
2020-11-13d: Explicitly determine which built-in copysign function to call.Iain Buclaw1-4/+7
For some targets, mathfn_built_in returns NULL as copysign is not implicitly available, causing an ICE. Now copysign is explicitly requested when expanding the intrinsic. gcc/d/ChangeLog: * intrinsics.cc (expand_intrinsic_copysign): Explicitly determine which built-in copysign function to call.
2020-11-13d: Fix ICE in finish_thunk (PR97644)Iain Buclaw6-34/+56
Because this what the upstream reference compiler did, thunks for the D front-end were associated with the class definition, so were forced code-gen even if the target function was extern. This has now been changed so there are now only generated if there is a function definition, fixing the ICE that occurred in PR 97644, which was caused by calling expand_thunk() early. gcc/d/ChangeLog: PR d/97644 * dmd/MERGE: Merge upstream dmd 95044d8e4. * d-target.cc (TargetCPP::thunkMangle): New function. * decl.cc (finish_thunk): Don't force expand thunks for external functions. (make_thunk): Emit thunks only if the function has a definition. Generate correct mangling for thunks to C++ classes. gcc/testsuite/ChangeLog: * gdc.dg/pr92216.d: Update scan-assember.
2020-11-11Daily bump.GCC Administrator1-0/+5
2020-11-10Refactor copying decl section namesStrager Neds1-1/+1
gcc/ * cgraph.h (symtab_node::get_section): Constify. (symtab_node::set_section): Declare new overload. * symtab.c (symtab_node::set_section): Define new overload. (symtab_node::copy_visibility_from): Use new overload of symtab_node::set_section. (symtab_node::resolve_alias): Same. * tree.h (set_decl_section_name): Declare new overload. * tree.c (set_decl_section_name): Define new overload. * tree-emutls.c (get_emutls_init_templ_addr): Same. * cgraphclones.c (cgraph_node::create_virtual_clone): Use new overload of symtab_node::set_section. (cgraph_node::create_version_clone_with_body): Same. * trans-mem.c (ipa_tm_create_version): Same. gcc/c * c-decl.c (merge_decls): Use new overload of set_decl_section_name. gcc/cp * decl.c (duplicate_decls): Use new overload of set_decl_section_name. * method.c (use_thunk): Same. * optimize.c (maybe_clone_body): Same. * coroutines.cc (act_des_fn): Same. gcc/d * decl.cc (finish_thunk): Use new overload of set_decl_section_name
2020-10-28Daily bump.GCC Administrator1-0/+10
2020-10-27d: Remove the d_critsec_size target hook.Iain Buclaw6-31/+9
The allocation of mutex objects for synchronized statements has been moved to the library as of merging druntime 58560d51. All support code in the compiler for getting the OS critical section size has been removed along with it. Reviewed-on: https://github.com/dlang/dmd/pull/11902 https://github.com/dlang/druntime/pull/3248 gcc/ChangeLog: * config/aarch64/aarch64-linux.h (GNU_USER_TARGET_D_CRITSEC_SIZE): Remove. * config/glibc-d.c (glibc_d_critsec_size): Likewise. (TARGET_D_CRITSEC_SIZE): Likewise. * config/i386/linux-common.h (GNU_USER_TARGET_D_CRITSEC_SIZE): Likewise. * config/sol2-d.c (solaris_d_critsec_size): Likewise. (TARGET_D_CRITSEC_SIZE): Likewise. * doc/tm.texi.in (TARGET_D_CRITSEC_SIZE): Likewise. * doc/tm.texi: Regenerate. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd bec5973b0. * d-target.cc (Target::critsecsize): Remove. * d-target.def: Remove d_critsec_size. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 58560d51.
2020-10-27d: Merge upstream dmd 0fcdaab32Iain Buclaw2-4/+64
Fixes a bug where there was undefined template references when compiling upstream dmd mainline. In `TemplateInstance::semantic`, there exists special handling of matching template instances for the same template declaration to ensure that only at most one instance gets codegen'd. If the primary instance `inst` originated from a non-root module, the `minst` field will be updated so it is now coming from a root module, however all Dsymbol `inst->members` of the instance still have their `_scope->minst` pointing at the original non-root module. We must now propagate `minst` to all members so that forward referenced dependencies that get instantiated will also be appended to the root module, otherwise there will be undefined references at link-time. This doesn't affect compilations where all modules are compiled together, as every module is a root module in that situation. What this primarily affects are cases where there is a mix of root and non-root modules, and a template was first instantiated in a non-root context, then later instantiated again in a root context. Reviewed-on: https://github.com/dlang/dmd/pull/11867 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 0fcdaab32
2020-10-24Daily bump.GCC Administrator1-0/+4
2020-10-23Move thunks out of cgraph_nodeJan Hubicka1-1/+4
this patch moves thunk_info out of cgraph_node into a symbol summary. I also moved it to separate hearder file since cgraph.h became really too fat. I plan to contiue with similar breakup in order to cleanup interfaces and reduce WPA memory footprint (symbol table now consumes more memory than trees) gcc/ChangeLog: 2020-10-23 Jan Hubicka <hubicka@ucw.cz> * Makefile.in: Add symtab-thunks.o (GTFILES): Add symtab-thunks.h and symtab-thunks.cc; remove cgraphunit.c * cgraph.c: Include symtab-thunks.h. (cgraph_node::create_thunk): Update (symbol_table::create_edge): Update (cgraph_node::dump): Update (cgraph_node::call_for_symbol_thunks_and_aliases): Update (set_nothrow_flag_1): Update (set_malloc_flag_1): Update (set_const_flag_1): Update (collect_callers_of_node_1): Update (clone_of_p): Update (cgraph_node::verify_node): Update (cgraph_node::function_symbol): Update (cgraph_c_finalize): Call thunk_info::release. (cgraph_node::has_thunk_p): Update (cgraph_node::former_thunk_p): Move here from cgraph.h; reimplement. * cgraph.h (struct cgraph_thunk_info): Rename to symtab-thunks.h. (cgraph_node): Remove thunk field; add thunk bitfield. (cgraph_node::expand_thunk): Move to symtab-thunks.h (symtab_thunks_cc_finalize): Declare. (cgraph_node::has_gimple_body_p): Update. (cgraph_node::former_thunk_p): Update. * cgraphclones.c: Include symtab-thunks.h. (duplicate_thunk_for_node): Update. (cgraph_edge::redirect_callee_duplicating_thunks): Update. (cgraph_node::expand_all_artificial_thunks): Update. (cgraph_node::create_edge_including_clones): Update. * cgraphunit.c: Include symtab-thunks.h. (vtable_entry_type): Move to symtab-thunks.c. (cgraph_node::analyze): Update. (analyze_functions): Update. (mark_functions_to_output): Update. (thunk_adjust): Move to symtab-thunks.c (cgraph_node::expand_thunk): Move to symtab-thunks.c (cgraph_node::assemble_thunks_and_aliases): Update. (output_in_order): Update. (cgraphunit_c_finalize): Do not clear vtable_entry_type. (cgraph_node::create_wrapper): Update. * gengtype.c (open_base_files): Add symtab-thunks.h * ipa-comdats.c (propagate_comdat_group): UPdate. (ipa_comdats): Update. * ipa-cp.c (determine_versionability): UPdate. (gather_caller_stats): Update. (count_callers): Update (set_single_call_flag): Update (initialize_node_lattices): Update (call_passes_through_thunk_p): Update (call_passes_through_thunk): Update (propagate_constants_across_call): Update (find_more_scalar_values_for_callers_subset): Update (has_undead_caller_from_outside_scc_p): Update * ipa-fnsummary.c (evaluate_properties_for_edge): Update. (compute_fn_summary): Update. (inline_analyze_function): Update. * ipa-icf.c: Include symtab-thunks.h. (sem_function::equals_wpa): Update. (redirect_all_callers): Update. (sem_function::init): Update. (sem_function::parse): Update. * ipa-inline-transform.c: Include symtab-thunks.h. (inline_call): Update. (save_inline_function_body): Update. (preserve_function_body_p): Update. * ipa-inline.c (inline_small_functions): Update. * ipa-polymorphic-call.c: Include alloc-pool.h, symbol-summary.h, symtab-thunks.h (ipa_polymorphic_call_context::ipa_polymorphic_call_context): Update. * ipa-pure-const.c: Include symtab-thunks.h. (analyze_function): Update. * ipa-sra.c (check_for_caller_issues): Update. * ipa-utils.c (ipa_reverse_postorder): Update. (ipa_merge_profiles): Update. * ipa-visibility.c (non_local_p): Update. (cgraph_node::local_p): Update. (function_and_variable_visibility): Update. * ipa.c (symbol_table::remove_unreachable_nodes): Update. * lto-cgraph.c: Include alloc-pool.h, symbol-summary.h and symtab-thunks.h (lto_output_edge): Update. (lto_output_node): Update. (compute_ltrans_boundary): Update. (output_symtab): Update. (verify_node_partition): Update. (input_overwrite_node): Update. (input_node): Update. * lto-streamer-in.c (fixup_call_stmt_edges): Update. * symtab-thunks.cc: New file. * symtab-thunks.h: New file. * toplev.c (toplev::finalize): Call symtab_thunks_cc_finalize. * trans-mem.c (ipa_tm_mayenterirr_function): Update. (ipa_tm_execute): Update. * tree-inline.c (expand_call_inline): Update. * tree-nested.c (create_nesting_tree): Update. (convert_all_function_calls): Update. (gimplify_all_functions): Update. * tree-profile.c (tree_profiling): Update. * tree-ssa-structalias.c (associate_varinfo_to_alias): Update. * tree.c (free_lang_data_in_decl): Update. * value-prof.c (init_node_map): Update. gcc/c-family/ChangeLog: 2020-10-23 Jan Hubicka <hubicka@ucw.cz> * c-common.c (c_common_finalize_early_debug): Update for new thunk api. gcc/d/ChangeLog: 2020-10-23 Jan Hubicka <hubicka@ucw.cz> * decl.cc (finish_thunk): Update for new thunk api. gcc/lto/ChangeLog: 2020-10-23 Jan Hubicka <hubicka@ucw.cz> * lto-partition.c (add_symbol_to_partition_1): Update for new thunk api.
2020-10-22Daily bump.GCC Administrator1-0/+5
2020-10-22Move nested function info out of cgraph_nodeJan Hubicka1-2/+3
this patch moves nested function information out of symbol table (to a summary). This saves memory (especially at WPA time) and also makes nested function support more contained. gcc/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * cgraph.c: Include tree-nested.h (cgraph_node::create): Call maybe_record_nested_function. (cgraph_node::remove): Do not remove function from nested function infos. (cgraph_node::dump): Update. (cgraph_node::unnest): Move to tree-nested.c (cgraph_node::verify_node): Update. (cgraph_c_finalize): Call nested_function_info::release. * cgraph.h (struct symtab_node): Remove nested function info. * cgraphclones.c (cgraph_node::create_clone): Do not clone nested function info. * cgraphunit.c (cgraph_node::analyze): Update. (cgraph_node::expand): Do not worry about nested functions; they are lowered. (symbol_table::finalize_compilation_unit): Call nested_function_info::release. * gimplify.c: Include tree-nested.h (unshare_body): Update. (unvisit_body): Update. * omp-offload.c (omp_discover_implicit_declare_target): Update. * tree-nested.c: Include alloc-pool.h, tree-nested.h, symbol-summary.h (nested_function_sum): New static variable. (nested_function_info::get): New member function. (nested_function_info::get_create): New member function. (unnest_function): New function. (nested_function_info::~nested_function_info): New member function. (nested_function_info::release): New function. (maybe_record_nested_function): New function. (lookup_element_for_decl): Update. (check_for_nested_with_variably_modified): Update. (create_nesting_tree): Update. (unnest_nesting_tree_1): Update. (gimplify_all_functions): Update. (lower_nested_functions): Update. * tree-nested.h (class nested_function_info): New class. (maybe_record_nested_function): Declare. (unnest_function): Declare. (first_nested_function): New inline function. (next_nested_function): New inline function. (nested_function_origin): New inline function. gcc/ada/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * gcc-interface/trans.c: Include tree-nested.h (walk_nesting_tree): Update for new nested function info. gcc/c-family/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * c-gimplify.c: Include tree-nested.h (c_genericize): Update for new nested function info. gcc/d/ChangeLog: 2020-10-22 Jan Hubicka <hubicka@ucw.cz> * decl.cc: Include tree-nested.h (get_symbol_decl): Update for new nested function info.
2020-10-13Daily bump.GCC Administrator1-0/+10
2020-10-12d: Merge upstream dmd 70aabfb51Iain Buclaw2-1/+8
Fixes a symbol resolver bug where a private alias becomes public if used before its declaration. Reviewed-on: https://github.com/dlang/dmd/pull/11831 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 70aabfb51
2020-10-12d: Merge upstream dmd 3a9790525Iain Buclaw3-8/+8
Fixes the return codes to match the documentation of Target::isVectorTypeSupported. Reviewed-on: https://github.com/dlang/dmd/pull/11830 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 3a9790525 * d-target.cc (Target::isVectorTypeSupported): Adjust return codes for invalid size and invalid base type.
2020-09-13Daily bump.GCC Administrator1-0/+20
2020-09-12d: Return promoted types in d_type_promotes_to when linkage is not DIain Buclaw3-3/+58
This enables warnings to be shown when a bad type is passed to va_arg inside an extern(C) or extern(C++) function. gcc/d/ChangeLog: PR d/97002 * d-codegen.cc (d_build_call): Set input_location on CALL_EXPR. * d-lang.cc: Include function.h. (d_type_promotes_to): Do default conversions for C and C++ functions. * intrinsics.cc (expand_intrinsic_vaarg): Use build1_loc to build VA_ARG_EXPR. gcc/testsuite/ChangeLog: PR d/97002 * gdc.dg/pr97002.d: New test.
2020-09-12d: Build TYPE_DECLs for non-numeric enum types.Iain Buclaw3-11/+24
This is done so that the DWARF pass will emit a DW_TAG_typedef where the member type of an enum can't be represented in an ENUMERAL_TYPE. gcc/d/ChangeLog: * d-builtins.cc (d_build_d_type_nodes): Call build_ctype() on all basic front-end types. * decl.cc (DeclVisitor::visit (EnumDeclaration *)): Always add decl to current binding level. (build_type_decl): Build TYPE_DECL as a typedef if not for an enum or record type. * types.cc (TypeVisitor::visit (TypeEnum *)): Set underlying type for ENUMERAL_TYPEs. Build TYPE_DECL for non-numeric enums.
2020-09-11Daily bump.GCC Administrator1-0/+16
2020-09-10d: Enable miscellaneous warnings by -Wextra flagIain Buclaw1-3/+3
These warnings are handled outside of the D core language front-end, so shouldn't be enabled by -Wall. gcc/d/ChangeLog: * lang.opt (Waddress): Enable warning by -Wextra. (Wcast-result): Likewise. (Wunknown-pragmas): Likewise.
2020-09-10d: Don't warn about variables initialized with 'void'Iain Buclaw1-22/+13
There is no problem with using `T var = void', it is if the variable remains uninitialized on first use that a warning should be issued. gcc/d/ChangeLog: * decl.cc (DeclVisitor::visit (VarDeclaration *)): Don't warn about variables initialized with 'void'.
2020-09-10d: Warn when casting from a D class to a C++ class.Iain Buclaw1-2/+2
Before, the warning was only issued when casting in the other direction. Now a warning is printed for both directions. gcc/d/ChangeLog: * d-convert.cc (convert_expr): Warn when casting from a D class to a C++ class. gcc/testsuite/ChangeLog: * gdc.dg/Waddress.d: New test. * gdc.dg/Wcastresult1.d: New test. * gdc.dg/Wcastresult2.d: New test.
2020-09-05Daily bump.GCC Administrator1-0/+6
2020-09-04d: Fix ICE in create_tmp_var, at gimple-expr.c:482Iain Buclaw1-3/+0
Array concatenate expressions were creating more SAVE_EXPRs than what was necessary. The internal error itself was the result of a forced temporary being made on a TREE_ADDRESSABLE type. gcc/d/ChangeLog: PR d/96924 * expr.cc (ExprVisitor::visit (CatAssignExp *)): Don't force temporaries needlessly. gcc/testsuite/ChangeLog: PR d/96924 * gdc.dg/simd13927b.d: Removed. * gdc.dg/pr96924.d: New test.
2020-09-03Daily bump.GCC Administrator1-0/+9
2020-09-02d: __vectors unsupported in hardware should be rejected at compile-time.Iain Buclaw2-8/+9
gcc/d/ChangeLog: PR d/96869 * d-builtins.cc (build_frontend_type): Don't expose intrinsics that use unsupported vector types. * d-target.cc (Target::isVectorTypeSupported): Restrict to supporting only if TARGET_VECTOR_MODE_SUPPORTED_P is true. Don't allow complex or boolean vector types. gcc/testsuite/ChangeLog: PR d/96869 * gdc.dg/simd.d: Removed. * gdc.dg/cast1.d: New test. * gdc.dg/gdc213.d: Compile with target vect_sizes_16B_8B. * gdc.dg/gdc284.d: Likewise. * gdc.dg/gdc67.d: Likewise. * gdc.dg/pr96869.d: New test. * gdc.dg/simd1.d: New test. * gdc.dg/simd10447.d: New test. * gdc.dg/simd12776.d: New test. * gdc.dg/simd13841.d: New test. * gdc.dg/simd13927.d: New test. * gdc.dg/simd15123.d: New test. * gdc.dg/simd15144.d: New test. * gdc.dg/simd16087.d: New test. * gdc.dg/simd16697.d: New test. * gdc.dg/simd17237.d: New test. * gdc.dg/simd17695.d: New test. * gdc.dg/simd17720a.d: New test. * gdc.dg/simd17720b.d: New test. * gdc.dg/simd19224.d: New test. * gdc.dg/simd19627.d: New test. * gdc.dg/simd19628.d: New test. * gdc.dg/simd19629.d: New test. * gdc.dg/simd19630.d: New test. * gdc.dg/simd2a.d: New test. * gdc.dg/simd2b.d: New test. * gdc.dg/simd2c.d: New test. * gdc.dg/simd2d.d: New test. * gdc.dg/simd2e.d: New test. * gdc.dg/simd2f.d: New test. * gdc.dg/simd2g.d: New test. * gdc.dg/simd2h.d: New test. * gdc.dg/simd2i.d: New test. * gdc.dg/simd2j.d: New test. * gdc.dg/simd7951.d: New test. * gdc.dg/torture/array2.d: New test. * gdc.dg/torture/array3.d: New test. * gdc.dg/torture/simd16488a.d: New test. * gdc.dg/torture/simd16488b.d: New test. * gdc.dg/torture/simd16703.d: New test. * gdc.dg/torture/simd19223.d: New test. * gdc.dg/torture/simd19607.d: New test. * gdc.dg/torture/simd3.d: New test. * gdc.dg/torture/simd4.d: New test. * gdc.dg/torture/simd7411.d: New test. * gdc.dg/torture/simd7413a.d: New test. * gdc.dg/torture/simd7413b.d: New test. * gdc.dg/torture/simd7414.d: New test. * gdc.dg/torture/simd9200.d: New test. * gdc.dg/torture/simd9304.d: New test. * gdc.dg/torture/simd9449.d: New test. * gdc.dg/torture/simd9910.d: New test.
2020-09-01Daily bump.GCC Administrator1-0/+10
2020-08-31d: Fix ICEs in the front-end when pointer size is 16-bit.Iain Buclaw5-43/+41
In the lowering of `bt*' intrinsics, some integer constants had mismatched types, and bitsize was set to the wrong value. In base_vtable_offset, the base offset value was calculated incorrectly. The TypeInfo_Class object is comprised of 18 pointers and 1 uint field, so now the internal classinfo type size is used instead. gcc/d/ChangeLog: * d-target.cc (Target::_init): Don't set classinfosize. * d-tree.h (base_vtable_offset): Move under typeinfo.cc section. * decl.cc (base_vtable_offset): Move to... * typeinfo.cc (base_vtable_offset): ...here. Get base offset from internal TypeInfo_Class type. * intrinsics.cc (expand_intrinsic_bt): Use pointer TYPE_SIZE for setting bitsize value. Build integer constants of correct type.
2020-08-27Daily bump.GCC Administrator1-0/+60
2020-08-26d: Merge upstream dmd e49192807Iain Buclaw3-53/+35
1. Removes prelude assert for constructors and destructors. To trigger these asserts one needed to construct or destruct an aggregate at the null memory location. This would crash upon any data member access, which is required for a constructor or destructor to do anything useful. 2. Disables bounds checking in foreach statements, when the array is either a static or dynamic array. If we trust the array `.length' to be correct, then all elements are between `[0 .. length]', and can't can't be out of bounds. Reviewed-on: https://github.com/dlang/dmd/pull/11623 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd e49192807
2020-08-26d: Fix no RVO when returning struct literals initialized with constructor.Iain Buclaw8-64/+131
Backports a change from upstream dmd that moves front-end NRVO checking from ReturnStatement semantic to the end of FuncDeclaration semantic. In the codegen, retStyle has been partially implemented so that only structs and static arrays return RETstack. This isn't accurate, but don't need to be for the purposes of semantic analysis. If a function either has TREE_ADDRESSABLE or must return in memory, then DECL_RESULT is set as the shidden field for the function. This is used in the codegen pass for ReturnStatement where it is now detected whether a function is returning a struct literal or a constructor function, then the DECL_RESULT is used to directly construct the return value, instead of doing so via temporaries. Reviewed-on: https://github.com/dlang/dmd/pull/11622 gcc/d/ChangeLog: PR d/96156 * d-frontend.cc (retStyle): Only return RETstack for struct and static array types. * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Use NRVO return for all TREE_ADDRESSABLE types. Set shidden to the RESULT_DECL. * expr.cc (ExprVisitor::visit (CallExp *)): Force TARGET_EXPR if the 'this' pointer reference is a CONSTRUCTOR. (ExprVisitor::visit (StructLiteralExp *)): Generate assignment to the symbol to initialize with literal. * toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returning struct literals and write directly into the RESULT_DECL. * dmd/MERGE: Merge upstream dmd fe5f388d8. gcc/testsuite/ChangeLog: PR d/96156 * gdc.dg/pr96156.d: New test.
2020-08-26d: Merge upstream dmd cb4a96faeIain Buclaw7-15/+32
Fixes both a bug where compilation would hang, and an issue where recursive template limits are hit too early. Reviewed-on: https://github.com/dlang/dmd/pull/11621 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd cb4a96fae
2020-08-26d: Use read() to load contents of stdin into memory.Iain Buclaw3-19/+31
This would be an improvement over reading one character at a time. An ICE was discovered when mixing reading from stdin with `-v', this has been fixed in upstream DMD and backported as well. Reviewed-on: https://github.com/dlang/dmd/pull/11620 gcc/d/ChangeLog: * d-lang.cc (d_parse_file): Use read() to load contents from stdin, allow the front-end to free the memory after parsing. * dmd/MERGE: Merge upstream dmd 2cc25c219.
2020-08-26d: Fix small struct literals that have non-deterministic hash valuesIain Buclaw1-2/+29
Same issue as the initial commit that addressed PR96153, only this time to fix it also for structs that are not returned in memory. Tests have been added that triggered an assertion on x86_64, however the original test was failing on SPARC 64-bit targets. gcc/d/ChangeLog: PR d/96153 * d-codegen.cc (build_address): Create a temporary for CALL_EXPRs returning trivial aggregates, pre-filling it with zeroes. (build_memset_call): Use build_zero_cst if setting the entire object. gcc/testsuite/ChangeLog: PR d/96153 * gdc.dg/pr96153.d: Add new tests.
2020-08-26d: Fix no NRVO when returning an array of a non-POD structIain Buclaw2-4/+7
TREE_ADDRESSABLE was not propagated from the RECORD_TYPE to the ARRAY_TYPE, so NRVO code generation was not being triggered. gcc/d/ChangeLog: PR d/96157 * d-codegen.cc (d_build_call): Handle TREE_ADDRESSABLE static arrays. * types.cc (make_array_type): Propagate TREE_ADDRESSABLE from base type to static array. gcc/testsuite/ChangeLog: PR d/96157 * gdc.dg/pr96157a.d: New test. * gdc.dg/pr96157b.d: New test.
2020-08-26d: Move lowering of each tree node to separate functionsIain Buclaw1-91/+119
gcc/d/ChangeLog: * d-gimplify.cc (d_gimplify_expr): Move lowering of each tree node to separate functions. (d_gimplify_modify_expr): New function. (d_gimplify_addr_expr): New function. (d_gimplify_call_expr): New function. (d_gimplify_unsigned_rshift_expr): New function.
2020-08-26d: Move d_gimplify_expr and dependencies to d-gimplify.ccIain Buclaw4-160/+191
gcc/d/ChangeLog: * Make-lang.in (D_OBJS): Add d-gimplify.o. * d-lang.cc (empty_modify_p): Move to d-gimplify.cc. (d_gimplify_expr): Likewise. * d-tree.h (d_gimplify_expr): Declare. * d-gimplify.cc: New file.
2020-08-21Daily bump.GCC Administrator1-0/+4
2020-08-21d: Merge upstream dmd 1b5a53d01.Iain Buclaw3-11/+2
Fixes an ICE in setValue at dmd/dinterpret.c:7046 This was originally seen when running the testsuite for a 16-bit target, however, it could be reproduced on 32-bit using long[] as well. Reviewed-on: https://github.com/dlang/dmd/pull/11547 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 1b5a53d01.
2020-08-19Daily bump.GCC Administrator1-0/+6
2020-08-18d: Fix ICE Segmentation fault during RTL pass: expand on armhf/armel/s390xIain Buclaw1-6/+11
gcc/d/ChangeLog: PR d/96301 * decl.cc (DeclVisitor::visit (FuncDeclaration *)): Only return non-trivial structs by invisible reference. gcc/testsuite/ChangeLog: PR d/96301 * gdc.dg/pr96301a.d: New test. * gdc.dg/pr96301b.d: New test. * gdc.dg/pr96301c.d: New test.
2020-08-05Daily bump.GCC Administrator1-0/+25
2020-08-04d: Fix struct literals that have non-deterministic hash values (PR96153)Iain Buclaw2-36/+70
Adds code generation for generating a temporary for, and pre-filling struct and array literals with zeroes before assigning, so that alignment holes don't cause objects to produce a non-deterministic hash value. A new field has been added to the expression visitor to track whether the result is being generated for another literal, so that memset() is only called once on the top-level literal expression, and not for nesting struct or arrays. gcc/d/ChangeLog: PR d/96153 * d-tree.h (build_expr): Add literalp argument. * expr.cc (ExprVisitor): Add literalp_ field. (ExprVisitor::ExprVisitor): Initialize literalp_. (ExprVisitor::visit (AssignExp *)): Call memset() on blits where RHS is a struct literal. Elide assignment if initializer is all zeroes. (ExprVisitor::visit (CastExp *)): Forward literalp_ to generation of subexpression. (ExprVisitor::visit (AddrExp *)): Likewise. (ExprVisitor::visit (ArrayLiteralExp *)): Use memset() to pre-fill object with zeroes. Set literalp in subexpressions. (ExprVisitor::visit (StructLiteralExp *)): Likewise. (ExprVisitor::visit (TupleExp *)): Set literalp in subexpressions. (ExprVisitor::visit (VectorExp *)): Likewise. (ExprVisitor::visit (VectorArrayExp *)): Likewise. (build_expr): Forward literal_p to ExprVisitor. gcc/testsuite/ChangeLog: PR d/96153 * gdc.dg/pr96153.d: New test.
2020-08-04d: Fix PR96429: Pointer subtraction uses TRUNC_DIV_EXPRIain Buclaw1-0/+12
gcc/d/ChangeLog: PR d/96429 * expr.cc (ExprVisitor::visit (BinExp*)): Use EXACT_DIV_EXPR for pointer diff expressions. gcc/testsuite/ChangeLog: PR d/96429 * gdc.dg/pr96429.d: New test.
2020-08-04Daily bump.GCC Administrator1-0/+14
2020-08-03d: Fix ICE using non-local variable: internal compiler error: Segmentation faultIain Buclaw3-22/+37
Moves no frame access error to own function, adding use of it for both when get_framedecl() cannot find a path to the outer function frame, and guarding get_decl_tree() from recursively calling itself. gcc/d/ChangeLog: PR d/96254 * d-codegen.cc (error_no_frame_access): New. (get_frame_for_symbol): Use fdparent name in error message. (get_framedecl): Replace call to assert with error. * d-tree.h (error_no_frame_access): Declare. * decl.cc (get_decl_tree): Detect recursion and error. gcc/testsuite/ChangeLog: PR d/96254 * gdc.dg/pr96254a.d: New test. * gdc.dg/pr96254b.d: New test.
2020-08-03d: Merge upstream dmd c2274e56a (PR96250).Iain Buclaw4-3/+19
1. Fixes an ICE in the front-end if a struct symbol were to appear twice in the compilation unit. 2. Fixes a rejects-valid bug in the front-end where `(symbol)' was being resolved as a `var' expression, instead of `this.var'. Reviewed-on: https://github.com/dlang/dmd/pull/11436 https://github.com/dlang/dmd/pull/11439 gcc/d/ChangeLog: PR d/96250 * dmd/MERGE: Merge upstream dmd c2274e56a.
2020-08-01Daily bump.GCC Administrator1-0/+6