Age | Commit message (Collapse) | Author | Files | Lines |
|
PR d/111650
gcc/d/ChangeLog:
* decl.cc (get_fndecl_arguments): Move generation of frame type to ...
(DeclVisitor::visit (FuncDeclaration *)): ... here, after the call to
build_closure.
gcc/testsuite/ChangeLog:
* gdc.dg/pr111650.d: New test.
|
|
On Fri, Feb 23, 2024 at 12:18:00PM +0100, Jørgen Kvalsvik wrote:
> This is a mostly straight port from the gcov-19.c tests from the C test
> suite. The only notable differences from C to D are that D flips the
> true/false outcomes for loop headers, and the D front end ties loop and
> ternary conditions to slightly different locus.
>
> The test for >64 conditions warning is disabled as it either needs
> support from the testing framework or a something similar to #pragma GCC
> diagnostic push to not cause a test failure from detecting a warning.
>
> gcc/testsuite/ChangeLog:
>
> * gdc.dg/gcov.exp: New test.
> * gdc.dg/gcov1.d: New test.
Unfortunately, this doesn't work.
I see
PASS: gdc.dg/gcov1.d execution test
ERROR: (DejaGnu) proc "run-gcov conditions { --conditions gcov1.d }" does not exist.
The error code is TCL LOOKUP COMMAND run-gcov
The info on the error is:
invalid command name "run-gcov"
while executing
"::tcl_unknown run-gcov conditions { --conditions gcov1.d }"
("uplevel" body line 1)
invoked from within
"uplevel 1 ::tcl_unknown $args"
ERROR: gdc.dg/gcov1.d : error executing dg-final: invalid command name "run-gcov"
both on x86_64-linux and i686-linux.
The problem is that the test hasn't been added to a new directory, but
to a directory already covered by a different *.exp file - dg.exp.
Now, usually either one has a test directory like gcc.misc-tests where
there are many *.exp files but each *.exp file globs for its own tests,
or there is one *.exp per directory and covers everything in there.
By having both dg.exp and gcov.exp in the same directory with dg.exp
covering all *.d files in there and gcov gcov*.d in there, the gcov*.d
tests are tested twice, once using the dg.exp driver and once using gcov.exp
driver. With the latter, they do work properly, with the former they don't
because gcov.exp lib file isn't loaded and so run-gcov isn't available.
The following patch fixes that similarly how g++.dg/modules/modules.exp,
gcc.target/s390/s390.exp or gcc.target/i386/i386.exp deal with that,
by pruning some tests based on glob patterns from the list.
2024-04-05 Jakub Jelinek <jakub@redhat.com>
* gdc.dg/dg.exp: Prune gcov*.d from the list of tests to run.
* gdc.dg/gcov.exp: Update copyright years.
|
|
This is a mostly straight port from the gcov-19.c tests from the C test
suite. The only notable differences from C to D are that D flips the
true/false outcomes for loop headers, and the D front end ties loop and
ternary conditions to slightly different locus.
The test for >64 conditions warning is disabled as it either needs
support from the testing framework or a something similar to #pragma GCC
diagnostic push to not cause a test failure from detecting a warning.
gcc/testsuite/ChangeLog:
* gdc.dg/gcov.exp: New test.
* gdc.dg/gcov1.d: New test.
|
|
The way that the target hook preferPassByRef is implemented, it relied
on the GCC "back-end" tree type to determine whether or not to use `ref'
ABI for D `in' parameters; e.g: prefer by value if it is expected that
the target will pass the type around in registers.
Building the GCC tree type depends on the AST type being complete - all
semantic processing is finished - but as this hook is called from the
front-end, this will not be the case for forward referenced or
self-referencing types.
The consensus in upstream is that `in' parameters should always be
implicitly `ref', but as the front-end does not yet support all types
being rvalue references, limit this just static arrays and structs.
PR d/112285
PR d/112290
gcc/d/ChangeLog:
* d-target.cc (Target::preferPassByRef): Return true for all static
array and struct types.
gcc/testsuite/ChangeLog:
* gdc.dg/pr112285.d: New test.
* gdc.dg/pr112290.d: New test.
|
|
PR d/114171
gcc/d/ChangeLog:
* d-codegen.cc (lower_struct_comparison): Keep alignment of original
type in reinterpret cast for comparison.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr114171.d: New test.
|
|
Some of these are part of the upstream DMD `gdc.test' testsuite, but
they had been omitted because they get mangled by the lib/gdc-utils.exp
helpers when parsing and staging the tests. Translate them over to the
gdc.dg testsuite instead.
gcc/testsuite/ChangeLog:
* gdc.dg/bom_UTF16BE.d: New test.
* gdc.dg/bom_UTF16LE.d: New test.
* gdc.dg/bom_UTF32BE.d: New test.
* gdc.dg/bom_UTF32LE.d: New test.
* gdc.dg/bom_UTF8.d: New test.
* gdc.dg/bom_characters.d: New test.
* gdc.dg/bom_error_UTF8.d: New test.
* gdc.dg/bom_infer_UTF16BE.d: New test.
* gdc.dg/bom_infer_UTF16LE.d: New test.
* gdc.dg/bom_infer_UTF32BE.d: New test.
* gdc.dg/bom_infer_UTF32LE.d: New test.
* gdc.dg/bom_infer_UTF8.d: New test.
|
|
The cause of the ICE was that TYPE_DECLs were only being generated for
structs with members, not opaque structs.
PR d/113125
gcc/d/ChangeLog:
* types.cc (TypeVisitor::visit (TypeStruct *)): Generate TYPE_DECL and
apply UDAs to opaque struct declarations.
gcc/testsuite/ChangeLog:
* gdc.dg/imports/pr113125.d: New test.
* gdc.dg/pr113125.d: New test.
|
|
When generating the argument, check the isCalleeDestroyingArgs hook, and
force a TARGET_EXPR to be created if true, so that a reference to the
live object isn't passed directly to the function that runs dtors.
When instead dealing with caller running destructors, two temporaries
were being generated, one explicit temporary generated by the D
front-end, and another implicitly by the code generator. This has been
reduced to one by setting DECL_VALUE_EXPR on the explicit temporary to
bind it to the implicit slot created for the TARGET_EXPR, as that has
the shorter lifetime of the two.
PR d/113758
gcc/d/ChangeLog:
* d-codegen.cc (d_build_call): Force a TARGET_EXPR when callee
destorys its arguments.
* decl.cc (DeclVisitor::visit (VarDeclaration *)): Set
SET_DECL_VALUE_EXPR on the temporary variable to make it a placeholder
for the TARGET_EXPR_SLOT.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr113758.d: New test.
|
|
We use the ubsan tests from both C, C++, D and Fortran.
thee sanitizer libraries link to libstdc++.
When we are using the C/gdc/gfortran driver, and the target might
require a path to the libstdc++ (e.g. for handing -static-xxxx or
for embedded runpaths), we need to add a suitable option (or we get
fails at execution time because of the missing paths).
Conversely, we do not want to add multiple instances of these
paths (since that leads to failures on tools that report warnings
for duplicate runpaths).
This patch modifies the _init function to allow a sigle parameter
that determines whether the *asan_init should add a path for
libstdc++ (yes for C driver, no for C++ driver).
gcc/testsuite/ChangeLog:
* g++.dg/ubsan/ubsan.exp:Add a parameter to init to say that
we expect the C++ driver to provide paths for libstdc++.
* gcc.dg/ubsan/ubsan.exp: Add a parameter to init to say that
we need a path added for libstdc++.
* gdc.dg/ubsan/ubsan.exp: Likewise.
* gfortran.dg/ubsan/ubsan.exp: Likewise.
* lib/ubsan-dg.exp: Handle a single parameter to init that
requests addition of a path to libstdc++ to link flags.
|
|
We use the shared asan/hwasan rom both C,C++,D and Fortran.
The sanitizer libraries link to libstdc++.
When we are using the C/gdc/gfortran driver, and the target might
require a path to the libstdc++ (e.g. for handing -static-xxxx or
for embedded runpaths), we need to add a suitable option (or we get
fails at execution time because of the missing paths).
Conversely, we do not want to add multiple instances of these
paths (since that leads to failures on tools that report warnings
for duplicate runpaths).
This patch modifies the _init function to allow a single parameter
that determines whether the *asan_init should add a path for
libstdc++ (yes for C driver, no for C++ driver).
gcc/testsuite/ChangeLog:
* g++.dg/asan/asan.exp: Add a parameter to init to say that
we expect the C++ driver to provide paths for libstdc++.
* g++.dg/hwasan/hwasan.exp: Likewise
* gcc.dg/asan/asan.exp: Add a parameter to init to say that
we need a path added for libstdc++.
* gcc.dg/hwasan/hwasan.exp: Likewise.
* gdc.dg/asan/asan.exp: Likewise.
* gfortran.dg/asan/asan.exp: Likewise.
* lib/asan-dg.exp: Handle a single parameter to init that
requests addition of a path to libstdc++ to link flags.
* lib/hwasan-dg.exp: Likewise.
|
|
|
|
D front-end changes:
- Import dmd v2.106.0-rc.1.
- New'ing multi-dimensional arrays are now are converted to a single
template call `_d_newarraymTX'.
D runtime changes:
- Import druntime v2.106.0-rc.1.
Phobos changes:
- Import phobos v2.106.0-rc.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd ff57fec515.
* dmd/VERSION: Bump version to v2.106.0-rc.1.
* expr.cc (ExprVisitor::visit (CatAssignExp *)): Update for new
front-end interface.
(ExprVisitor::visit (NewExp *)): Likewise.
* runtime.def (NEWARRAYMTX): Remove.
(NEWARRAYMITX): Remove.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime ff57fec515.
* src/MERGE: Merge upstream phobos 17bafda79.
gcc/testsuite/ChangeLog:
* gdc.dg/asm1.d: Adjust expected diagnostic.
|
|
in 'view_convert_expr')
Static arrays in D are passed around by value, rather than decaying to a
pointer. On x86_64 __builtin_va_list is an exception to this rule, but
semantically it's still treated as a static array.
This makes certain assignment operations fail due a mismatch in types.
As all examples in the test program are rejected by C/C++ front-ends,
these are now errors in D too to be consistent.
PR d/110712
gcc/d/ChangeLog:
* d-codegen.cc (d_build_call): Update call to convert_for_argument.
* d-convert.cc (is_valist_parameter_type): New function.
(check_valist_conversion): New function.
(convert_for_assignment): Update signature. Add check whether
assigning va_list is permissible.
(convert_for_argument): Likewise.
* d-tree.h (convert_for_assignment): Update signature.
(convert_for_argument): Likewise.
* expr.cc (ExprVisitor::visit (AssignExp *)): Update call to
convert_for_assignment.
gcc/testsuite/ChangeLog:
* gdc.dg/pr110712.d: New test.
|
|
This ICE was seen during stage2 on powerpc-darwin9 only. There were
still some uses of GCC's boolean_type_node in the D front-end, which
caused a type mismatch to trigger as D bool size is fixed to 1 byte on
all targets.
So two new nodes have been introduced - d_bool_false_node and
d_bool_true_node - which have replaced all remaining uses of
boolean_false_node and boolean_true_node respectively.
PR d/112270
gcc/d/ChangeLog:
* d-builtins.cc (d_build_d_type_nodes): Initialize d_bool_false_node,
d_bool_true_node.
* d-codegen.cc (build_array_struct_comparison): Use d_bool_false_node
instead of boolean_false_node.
* d-convert.cc (d_truthvalue_conversion): Use d_bool_false_node and
d_bool_true_node instead of boolean_false_node and boolean_true_node.
* d-tree.h (enum d_tree_index): Add DTI_BOOL_FALSE and DTI_BOOL_TRUE.
(d_bool_false_node): New macro.
(d_bool_true_node): New macro.
* modules.cc (build_dso_cdtor_fn): Use d_bool_false_node and
d_bool_true_node instead of boolean_false_node and boolean_true_node.
(register_moduleinfo): Use d_bool_type instead of boolean_type_node.
gcc/testsuite/ChangeLog:
* gdc.dg/pr112270.d: New test.
|
|
In the last merge of the dmd front-end with upstream (r14-4830), this
warning got removed from the semantic passes. Reimplement the warning
for the code generation pass instead, where it cannot have an effect on
conditional compilation.
gcc/d/ChangeLog:
* d-codegen.cc (call_side_effect_free_p): New function.
* d-tree.h (CALL_EXPR_WARN_IF_UNUSED): New macro.
(call_side_effect_free_p): New prototype.
* expr.cc (ExprVisitor::visit (CallExp *)): Set
CALL_EXPR_WARN_IF_UNUSED on matched call expressions.
(ExprVisitor::visit (NewExp *)): Don't dereference the result of an
allocation call here.
* toir.cc (add_stmt): Emit warning when call expression added to
statement list without being used.
gcc/testsuite/ChangeLog:
* gdc.dg/Wunused_value.d: New test.
|
|
This code fails to link:
import core.math;
real function(real) fn = &sin;
However, when called directly, the D intrinsic `sin()' is expanded by
the front-end into the GCC built-in `__builtin_sin()'. This has been
fixed to now also expand the function when a reference is taken.
As there are D intrinsics and GCC built-ins that don't have a fallback
implementation, raise an error if taking the address is not possible.
gcc/d/ChangeLog:
* d-tree.h (intrinsic_code): Update define for DEF_D_INTRINSIC.
(maybe_reject_intrinsic): New prototype.
* expr.cc (ExprVisitor::visit (SymOffExp *)): Call
maybe_reject_intrinsic.
* intrinsics.cc (intrinsic_decl): Add fallback field.
(intrinsic_decls): Update define for DEF_D_INTRINSIC.
(maybe_reject_intrinsic): New function.
* intrinsics.def (DEF_D_LIB_BUILTIN): Update.
(DEF_CTFE_BUILTIN): Update.
(INTRINSIC_BSF): Declare as library builtin.
(INTRINSIC_BSR): Likewise.
(INTRINSIC_BT): Likewise.
(INTRINSIC_BSF64): Likewise.
(INTRINSIC_BSR64): Likewise.
(INTRINSIC_BT64): Likewise.
(INTRINSIC_POPCNT32): Likewise.
(INTRINSIC_POPCNT64): Likewise.
(INTRINSIC_ROL): Likewise.
(INTRINSIC_ROL_TIARG): Likewise.
(INTRINSIC_ROR): Likewise.
(INTRINSIC_ROR_TIARG): Likewise.
(INTRINSIC_ADDS): Likewise.
(INTRINSIC_ADDSL): Likewise.
(INTRINSIC_ADDU): Likewise.
(INTRINSIC_ADDUL): Likewise.
(INTRINSIC_SUBS): Likewise.
(INTRINSIC_SUBSL): Likewise.
(INTRINSIC_SUBU): Likewise.
(INTRINSIC_SUBUL): Likewise.
(INTRINSIC_MULS): Likewise.
(INTRINSIC_MULSL): Likewise.
(INTRINSIC_MULU): Likewise.
(INTRINSIC_MULUI): Likewise.
(INTRINSIC_MULUL): Likewise.
(INTRINSIC_NEGS): Likewise.
(INTRINSIC_NEGSL): Likewise.
(INTRINSIC_TOPRECF): Likewise.
(INTRINSIC_TOPREC): Likewise.
(INTRINSIC_TOPRECL): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/builtins_reject.d: New test.
* gdc.dg/intrinsics_reject.d: New test.
|
|
-fanalyzer
The internal error in analyzer turned out to be caused by a subtly
invalid tree representation of STRING_CSTs in the D front-end, fixed by
including the terminating NULL as part of the TREE_STRING_POINTER.
When adding a first analyzer test for D, it flagged up another subtle
mismatch in one assignment in the module support routines as well, fixed
by generating the correct field type for the compiler-generated struct.
PR d/111537
gcc/d/ChangeLog:
* expr.cc (ExprVisitor::visit (StringExp *)): Include null terminator
in STRING_CST string.
* modules.cc (get_compiler_dso_type): Generate ModuleInfo** type for
the minfo fields.
gcc/testsuite/ChangeLog:
* gdc.dg/analyzer/analyzer.exp: New test.
* gdc.dg/analyzer/pr111537.d: New test.
|
|
This ICE is specific to the D front-end language version in GDC 12,
however a test has been added to mainline to catch the unlikely event of
a regression.
PR d/110959
gcc/testsuite/ChangeLog:
* gdc.dg/pr110959.d: New test.
|
|
D front-end changes:
- Import dmd v2.104.0.
- Assignment-style syntax is now allowed for `alias this'.
- Overloading `extern(C)' functions is now an error.
D runtime changes:
- Import druntime v2.104.0.
Phobos changes:
- Import phobos v2.104.0.
- Better static assert messages when instantiating
`std.algorithm.iteration.permutations' with wrong inputs.
- Added `std.system.instructionSetArchitecture' and
`std.system.ISA'.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 17ccd12af3.
* dmd/VERSION: Bump version to v2.104.0.
* Make-lang.in (D_FRONTEND_OBJS): Rename d/apply.o to
d/postordervisitor.o.
* d-codegen.cc (make_location_t): Update for new front-end interface.
(build_filename_from_loc): Likewise.
(build_assert_call): Likewise.
(build_array_bounds_call): Likewise.
(build_bounds_index_condition): Likewise.
(build_bounds_slice_condition): Likewise.
(build_frame_type): Likewise.
(get_frameinfo): Likewise.
* d-diagnostic.cc (d_diagnostic_report_diagnostic): Likewise.
* decl.cc (build_decl_tree): Likewise.
(start_function): Likewise.
* expr.cc (ExprVisitor::visit (NewExp *)): Replace code generation of
`new pointer' with front-end lowering.
* runtime.def (NEWITEMT): Remove.
(NEWITEMIT): Remove.
* toir.cc (IRVisitor::visit (LabelStatement *)): Update for new
front-end interface.
* typeinfo.cc (check_typeinfo_type): Likewise.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 17ccd12af3.
* src/MERGE: Merge upstream phobos 8d3800bee.
gcc/testsuite/ChangeLog:
* gdc.dg/asm4.d: Update test.
|
|
D front-end changes:
- Import dmd v2.104.0-beta.1.
- Better error message when attribute inference fails down the
call stack.
- Using `;' as an empty statement has been turned into an error.
- Using `in' parameters with non- `extern(D)' or `extern(C++)'
functions is deprecated.
- `in ref' on parameters has been deprecated in favor of
`-preview=in'.
- Throwing `immutable', `const', `inout', and `shared' qualified
objects is now deprecated.
- User Defined Attributes now parse Template Arguments.
D runtime changes:
- Import druntime v2.104.0-beta.1.
Phobos changes:
- Import phobos v2.104.0-beta.1.
- Better static assert messages when instantiating
`std.algorithm.comparison.clamp' with wrong inputs.
- `std.typecons.Rebindable' now supports all types.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 28a3b24c2e.
* dmd/VERSION: Bump version to v2.104.0-beta.1.
* d-codegen.cc (build_bounds_slice_condition): Update for new
front-end interface.
* d-lang.cc (d_init_options): Likewise.
(d_handle_option): Likewise.
(d_post_options): Initialize global.compileEnv.
* expr.cc (ExprVisitor::visit (CatExp *)): Replace code generation
with new front-end lowering.
(ExprVisitor::visit (LoweredAssignExp *)): New method.
(ExprVisitor::visit (StructLiteralExp *)): Don't generate static
initializer symbols for structs defined in C sources.
* runtime.def (ARRAYCATT): Remove.
(ARRAYCATNTX): Remove.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 28a3b24c2e.
* src/MERGE: Merge upstream phobos 8ab95ded5.
gcc/testsuite/ChangeLog:
* gdc.dg/rtti1.d: Move array concat testcase to ...
* gdc.dg/nogc1.d: ... here. New test.
|
|
Restrict the generating of CONST_DECLs for D manifest constants to just
scalars without pointers. It shouldn't happen that a reference to a
manifest constant has not been expanded within a function body during
codegen, but it has been found to occur in older versions of the D
front-end (PR98277), so if the decl of a non-scalar constant is
requested, just return its initializer as an expression.
PR d/108842
gcc/d/ChangeLog:
* decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
manifest constants.
(get_symbol_decl): Don't generate CONST_DECL for non-scalar manifest
constants.
* imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.
gcc/testsuite/ChangeLog:
* gdc.dg/pr98277.d: Add more tests.
* gdc.dg/pr108842.d: New test.
|
|
Seen at least on aarch64-*-darwin, the parameters used to instantiate
the shufflevector intrinsic meant the return type was __vector(int[1]),
which resulted in the error:
vector type '__vector(int[1])' is not supported on this platform.
All instantiations have now been fixed so the expected warning/error is
now given by the compiler.
gcc/testsuite/ChangeLog:
* gdc.dg/Wbuiltin_declaration_mismatch2.d: Fix failed tests.
|
|
The issue was fixed in r14-2232.
PR d/108962
gcc/testsuite/ChangeLog:
* gdc.dg/pr108962.d: New test.
|
|
The first pass of code generation in the D front-end splits up all
compound expressions and discards expressions that have no side effects.
This included calls to the `volatileLoad' intrinsic if its result was
not used, causing such calls to be eliminated from the program.
We already set TREE_THIS_VOLATILE on the expression, however the
tree documentation says if this bit is set in an expression, so is
TREE_SIDE_EFFECTS. So set TREE_SIDE_EFFECTS on the expression too.
This prevents any early discarding from occuring.
PR d/110516
gcc/d/ChangeLog:
* intrinsics.cc (expand_volatile_load): Set TREE_SIDE_EFFECTS on the
expanded expression.
(expand_volatile_store): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr110516a.d: New test.
* gdc.dg/torture/pr110516b.d: New test.
|
|
Starts setting TREE_READONLY against specific kinds of VAR_DECLs, so
that the middle-end/optimization passes can more aggressively constant
fold D code that makes use of `immutable' or `const'.
PR d/110514
gcc/d/ChangeLog:
* decl.cc (get_symbol_decl): Set TREE_READONLY on certain kinds of
const and immutable variables.
* expr.cc (ExprVisitor::visit (ArrayLiteralExp *)): Set TREE_READONLY
on immutable dynamic array literals.
gcc/testsuite/ChangeLog:
* gdc.dg/pr110514a.d: New test.
* gdc.dg/pr110514b.d: New test.
* gdc.dg/pr110514c.d: New test.
* gdc.dg/pr110514d.d: New test.
|
|
`-fno-exceptions'
The version flags for RTMI, RTTI, and exceptions was unconditionally
predefined. These are now only predefined if the feature flag is
enabled. It was noticed that there was no `-fexceptions' definition
inside d/lang.opt, so the detection of the exceptions option flag was
only partially working. Once that was fixed, a few places in the
front-end implementation were found to fall fowl of `nothrow' rules,
these have been fixed upstream and backported here as well.
Reviewed-on: https://github.com/dlang/dmd/pull/15357
https://github.com/dlang/dmd/pull/15360
PR d/110471
gcc/d/ChangeLog:
* d-builtins.cc (d_init_versions): Predefine D_ModuleInfo,
D_Exceptions, and D_TypeInfo only if feature is enabled.
* lang.opt: Add -fexceptions.
gcc/testsuite/ChangeLog:
* gdc.dg/pr110471a.d: New test.
* gdc.dg/pr110471b.d: New test.
* gdc.dg/pr110471c.d: New test.
|
|
Since r13-1104, structs have have compute_record_mode called too early
on them, causing them to return differently depending on the order that
types are generated in, and whether there are forward references.
This patch moves the call to compute_record_mode into its own function,
and calls it after all fields have been given a size.
PR d/106977
PR target/110406
gcc/d/ChangeLog:
* types.cc (finish_aggregate_mode): New function.
(finish_incomplete_fields): Call finish_aggregate_mode.
(finish_aggregate_type): Replace call to compute_record_mode with
finish_aggregate_mode.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr110406.d: New test.
|
|
Since PR96435, both boolean objects and expressions have been evaluated
in the following way.
(*(ubyte*)&obj_or_expr) & 1
It has been noted that sometimes this can cause the back-end to optimize
in non-obvious ways - in particular with __builtin_expect.
This @safe feature is now restricted to just when reading the value of a
bool field that comes from a union.
PR d/110359
gcc/d/ChangeLog:
* d-convert.cc (convert_for_rvalue): Only apply the @safe boolean
conversion to boolean fields of a union.
(convert_for_condition): Call convert_for_rvalue in the default case.
gcc/testsuite/ChangeLog:
* gdc.dg/pr110359.d: New test.
|
|
All special enums have declarations in the D runtime library, but the
compiler will recognize and treat them specially if declared in any
module. When the underlying base type of a special enum is a different
size to its matched intrinsic, then this can cause undefined behavior at
runtime. Detect and warn about when such a mismatch occurs.
gcc/d/ChangeLog:
* gdc.texi (Warnings): Document -Wextra and -Wmismatched-special-enum.
* implement-d.texi (Special Enums): Add reference to warning option
-Wmismatched-special-enum.
* lang.opt: Add -Wextra and -Wmismatched-special-enum.
* types.cc (TypeVisitor::visit (TypeEnum *)): Warn when declared
special enum size mismatches its intrinsic type.
gcc/testsuite/ChangeLog:
* gdc.dg/Wmismatched_enum.d: New test.
|
|
D front-end changes:
- Import dmd v2.103.0-beta.1.
- Using `alias this' for classes has been deprecated.
- The feature `-fpreview=dip25` is now enabled by default.
- The compile-time traits `isVirtualFunction' and
`getVirtualFunctions' have been deprecated.
D runtime changes:
- Import druntime v2.103.0-beta.1.
Phobos changes:
- Import phobos v2.103.0-beta.1.
- Updated unicode grapheme walking updated to conform to Unicode
version 15.
- Improved friendliness of error messages when instantiating
`std.algorithm.iteration.joiner' and
`std.algorithm.sorting.sort' with wrong inputs.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 4ca4140e58.
* dmd/VERSION: Bump version to v2.103.0-beta.1.
* Make-lang.in (D_FRONTEND_OBJS): Add d/errorsink.o.
* d-ctfloat.cc (CTFloat::sprint): Update signature for new front-end
interface.
* d-frontend.cc (getTypeInfoType): Likewise.
* d-lang.cc (d_handle_option): Remove handling of -fpreview=dip25 and
-frevert=dip25.
(d_post_options): Remove enabling of sealed references language
feature when scoped pointers is enabled.
* d-tree.h (create_typeinfo): Update signature.
* decl.cc (DeclVisitor::finish_vtable): Update for new front-end
interface.
(DeclVisitor::visit (VarDeclaration *)): Likewise.
(DeclVisitor::visit (FuncDeclaration *)): Check skipCodegen to see if
front-end explicitly requested not to generate code.
* expr.cc (ExprVisitor::visit (NewExp *)): Update for new front-end
interface.
* lang.opt (fpreview=dip25): Remove.
(frevert=dip25): Remove.
* modules.cc (layout_moduleinfo_fields): Update for new front-end
interface.
(layout_moduleinfo): Likewise.
* runtime.def (NEWCLASS): Remove.
* toir.cc (IRVisitor::visit (IfStatement *)): Don't generate IR for if
statement list when condition is `__ctfe'.
* typeinfo.cc (create_typeinfo): Add generate parameter.
* types.cc (layout_aggregate_members): Update for new front-end
interface.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 4ca4140e58.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/factory.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 454dff14d.
* testsuite/libphobos.hash/test_hash.d: Update test.
* testsuite/libphobos.shared/finalize.d: Update test.
* libdruntime/core/factory.d: New file.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/simd23084.d: New test.
* gdc.dg/torture/simd23085.d: New test.
* gdc.dg/torture/simd23218.d: New test.
|
|
Local variables with both non-local references and explicit alignment
did not propagate their alignment to either the closure field or closure
frame type, resulting in the closure being misaligned. This is now
correctly set-up when building the frame type.
PR d/109144
gcc/d/ChangeLog:
* d-codegen.cc (build_frame_type): Set frame field and type alignment.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr109144.d: New test.
|
|
Previously lambdas were connected to the module they were defined in.
Now they are emitted into every referencing compilation unit, and are
given one-only linkage.
PR d/109108
gcc/d/ChangeLog:
* decl.cc (function_defined_in_root_p): Remove.
(get_symbol_decl): Set DECL_LAMBDA_FUNCTION_P on function literals.
(start_function): Unconditionally unset DECL_EXTERNAL
(set_linkage_for_decl): Give lambda functions one-only linkage.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/imports/pr109108.d: New test.
* gdc.dg/torture/pr109108.d: New test.
|
|
Vector equality and comparisons are now accepted by the language
implementation, but identity wasn't. Implement it as an extra integer
comparison of the bit-casted bitmask.
PR d/108946
gcc/d/ChangeLog:
* d-target.cc (Target::isVectorOpSupported): Allow identity ops.
* expr.cc (ExprVisitor::visit (IdentityExp *)): Handle vector identity
comparisons.
gcc/testsuite/ChangeLog:
* gdc.dg/simd2a.d: Update test.
* gdc.dg/simd2b.d: Likewise.
* gdc.dg/simd2c.d: Likewise.
* gdc.dg/simd2d.d: Likewise.
* gdc.dg/simd2e.d: Likewise.
* gdc.dg/simd2f.d: Likewise.
* gdc.dg/simd2g.d: Likewise.
* gdc.dg/simd2h.d: Likewise.
* gdc.dg/simd2i.d: Likewise.
* gdc.dg/simd2j.d: Likewise.
|
|
Const and immutable types are built as variants of the type they are
derived from, and TYPE_STUB_DECL is not set for these variants.
PR d/108877
gcc/d/ChangeLog:
* imports.cc (ImportVisitor::visit (EnumDeclaration *)): Call
make_import on TYPE_MAIN_VARIANT.
(ImportVisitor::visit (AggregateDeclaration *)): Likewise.
(ImportVisitor::visit (ClassDeclaration *)): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/imports/pr108877a.d: New test.
* gdc.dg/pr108877.d: New test.
|
|
The D front-end implementation got fixed in upstream, add test to the
gdc testsuite to check we don't regress on it.
PR d/108167
gcc/testsuite/ChangeLog:
* gdc.dg/pr108167.d: New test.
|
|
When comparing two vectors, the type of vector was used as the result of
the condition result. This meant that for floating point comparisons,
each value would either be `0.0' or `-1.0' reinterpreted as an integer,
not the expected integral bitmask values `0' and `-1'.
Instead, use the comparison type determined by truth_type_for as the
result of the comparison. If a reinterpret is later required by the
final conversion for generating CmpExp, it is still only going to
reinterpret one integer kind as another.
PR d/108945
gcc/d/ChangeLog:
* d-codegen.cc (build_boolop): Evaluate vector comparison as
the truth_type_for vector type.
gcc/testsuite/ChangeLog:
* gdc.dg/pr108945.d: New test.
|
|
D front-end changes:
- Import dmd v2.102.0-beta.1
- `static assert' now supports multiple message arguments.
D runtime changes:
- Import druntime v2.102.0-beta.1
- The default `Throwable.TraceInfo' generation now is `@nogc'.
- `Object.factory' method has now been deprecated.
Phobos changes:
- Import phobos v2.102.0-beta.1
- Added float- and double-precision implementations for log
function families in std.math.
- `std.typecons.Unique' now calls `destroy` on struct types
gcc/d/ChangeLog:
* Make-lang.in (D_FRONTEND_OBJS): Add d/location.o.
* d-lang.cc (d_init_options): Update for new front-end interface.
(d_post_options): Call Loc::set after handling options.
* dmd/MERGE: Merge upstream dmd 09faa4eacd.
* dmd/VERSION: Bump version to v2.102.0-beta.1.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 09faa4eacd.
* src/MERGE: Merge upstream phobos 13ef27a56.
* testsuite/libphobos.exceptions/refcounted.d: Add test for chained
reference counted exceptions.
* testsuite/libphobos.shared/finalize.d: Add dg-warning for deprecated
factory interfaces.
* testsuite/libphobos.gc/issue22843.d: New test.
gcc/testsuite/ChangeLog:
* gdc.dg/simd2a.d: Update.
* gdc.dg/simd2b.d: Update.
* gdc.dg/simd2c.d: Update.
* gdc.dg/simd2d.d: Update.
* gdc.dg/simd2e.d: Update.
* gdc.dg/simd2f.d: Update.
* gdc.dg/simd2g.d: Update.
* gdc.dg/simd2h.d: Update.
* gdc.dg/simd2i.d: Update.
* gdc.dg/simd2j.d: Update.
|
|
As functions which have semantic analysis ran late may still require
the use of CTFE built-ins to be evaluated.
gcc/d/ChangeLog:
* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Set
doing_semantic_analysis_p before calling functionSemantic3.
gcc/testsuite/ChangeLog:
* gdc.dg/ctfeintrinsics.d: New test.
|
|
|
|
Sometimes, nested lambdas of templated functions get no code generation
due to them being marked as instantianted outside of all modules being
compiled in the current compilation unit. This despite enclosing
template instances being marked as instantiated inside the current
compilation unit. To fix, all enclosing templates are now checked in
`function_defined_in_root_p'.
Because of this change, `function_needs_inline_definition_p' has also
been fixed up to only check whether the regular function definition
itself is to be emitted in the current compilation unit.
PR d/108055
gcc/d/ChangeLog:
* decl.cc (function_defined_in_root_p): Check all enclosing template
instances for definition in a root module.
(function_needs_inline_definition_p): Replace call to
function_defined_in_root_p with test for outer module `isRoot'.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/imports/pr108055conv.d: New.
* gdc.dg/torture/imports/pr108055spec.d: New.
* gdc.dg/torture/imports/pr108055write.d: New.
* gdc.dg/torture/pr108055.d: New test.
|
|
The visitor for lowering IMPORTED_DECLs did not have an override for
dealing with importing OverloadSet symbols. This has now been
implemented in the code generator.
PR d/108050
gcc/d/ChangeLog:
* decl.cc (DeclVisitor::visit (Import *)): Handle build_import_decl
returning a TREE_LIST.
* imports.cc (ImportVisitor::visit (OverloadSet *)): New override.
gcc/testsuite/ChangeLog:
* gdc.dg/imports/pr108050/mod1.d: New.
* gdc.dg/imports/pr108050/mod2.d: New.
* gdc.dg/imports/pr108050/package.d: New.
* gdc.dg/pr108050.d: New test.
|
|
Continue labels in an unrolled loop require a unique label per
iteration. Previously this used the Statement body node for each
unrolled iteration to generate a new entry in the label hash table.
This does not work when the continue label has an identifier, as said
named label is pointing to the outer UnrolledLoopStatement node.
What would happen is that during the lowering of `continue label', an
automatic label associated with the unrolled loop would be generated,
and a jump to that label inserted, but because it was never pushed by
the visitor for the loop itself, it subsequently never gets emitted.
To fix, correctly use the UnrolledLoopStatement as the key to look up
and store the break/continue label pair, but remove the continue label
from the value entry after every loop to force a new label to be
generated by the next call to `push_continue_label'
PR d/107592
gcc/d/ChangeLog:
* toir.cc (IRVisitor::push_unrolled_continue_label): New method.
(IRVisitor::pop_unrolled_continue_label): New method.
(IRVisitor::visit (UnrolledLoopStatement *)): Use them instead of
push_continue_label and pop_continue_label.
gcc/testsuite/ChangeLog:
* gdc.dg/pr107592.d: New test.
|
|
Noticed when running on x86_64-linux-gnu with `-m32', this test
triggered other errors. Adjusted the test to use a different register
that is common between x86 and x86_64.
gcc/testsuite/ChangeLog:
* gdc.dg/attr_register2.d: Adjust test.
|
|
The front-end added semantic support to permit comparing two vector
expressions. This removes the restriction in the code generator, as
well as the intrisics that previously exposed the same operation.
gcc/d/ChangeLog:
* d-target.cc (Target::isVectorOpSupported): Remove cases for
comparison operators.
* intrinsics.cc (maybe_set_intrinsic): Remove cases for vector
comparison intrinsics.
(maybe_warn_intrinsic_mismatch): Likewise.
(expand_intrinsic_vec_cond): Remove.
(maybe_expand_intrinsic): Remove cases for vector comparison
intrinsics.
* intrinsics.def (INTRINSIC_EQUALMASK): Remove.
(INTRINSIC_NOTEQUALMASK): Remove.
(INTRINSIC_GREATERMASK): Remove.
(INTRINSIC_GREATEREQUALMASK): Remove.
libphobos/ChangeLog:
* libdruntime/gcc/simd.d (equalMask): Implement using generics.
(notEqualMask): Likewise.
(greaterMask): Likewise.
(greaterOrEqualMask): Likewise.
(notMask): Likewise.
(andAndMask): Likewise.
(orOrMask): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/Wbuiltin_declaration_mismatch2.d: Remove comparision tests.
* gdc.dg/simd2a.d: Update comparison tests.
* gdc.dg/simd2b.d: Likewise.
* gdc.dg/simd2c.d: Likewise.
* gdc.dg/simd2d.d: Likewise.
* gdc.dg/simd2e.d: Likewise.
* gdc.dg/simd2f.d: Likewise.
* gdc.dg/simd2g.d: Likewise.
* gdc.dg/simd2h.d: Likewise.
* gdc.dg/simd2i.d: Likewise.
* gdc.dg/simd2j.d: Likewise.
|
|
D front-end changes:
- Import dmd v2.101.0-beta.1.
- Add predefined version `D_Optimized' when compiling with `-O'.
- Shortened method syntax (DIP1043) is now enabled by default.
- Array literals assigned to `scope' array variables are now
allocated on the stack.
- Implement `@system' variables (DIP1035), available behind the
preview feature flag `-fpreview=systemvariables'.
D runtime changes:
- Import druntime v2.101.0-beta.1.
Phobos changes:
- Import phobos v2.101.0-beta.1.
- Added `std.typecons.SafeRefCounted', that can be used in `@safe'
code with `-fpreview=dip1000'.
gcc/d/ChangeLog:
* d-attribs.cc (apply_user_attributes): Update for new front-end
interface.
* d-builtins.cc (d_init_versions): Predefine `D_Optimized' with
compiling with optimizations enabled.
* d-lang.cc (d_handle_option): Update for new front-end interface.
Handle new option `-fpreview=systemvariables'.
* dmd/MERGE: Merge upstream dmd e4f8919591.
* dmd/VERSION: Bump version to v2.101.0-beta.1.
* expr.cc (ExprVisitor::visit (AssignExp *)): Treat construction of
static arrays from a call expression as a simple assignment.
(ExprVisitor::visit (ArrayLiteralExp *)): Handle array literals with
`scope' storage.
* gdc.texi: Update documentation of `-fpreview=' options.
* lang.opt (fpreview=shortenedmethods): Remove.
(fpreview=systemvariables): New option.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime e4f8919591.
* src/MERGE: Merge upstream phobos 3ad507b51.
gcc/testsuite/ChangeLog:
* gdc.dg/simd19630.d: Move tests with errors to ...
* gdc.dg/simd19630b.d: ... here. New test.
* gdc.dg/simd19630c.d: New test.
* gdc.dg/simd_ctfe.d: Removed.
* gdc.dg/simd18867.d: New test.
* gdc.dg/simd19788.d: New test.
* gdc.dg/simd21469.d: New test.
* gdc.dg/simd21672.d: New test.
* gdc.dg/simd23077.d: New test.
* gdc.dg/simd23084.d: New test.
* gdc.dg/simd23085.d: New test.
* gdc.dg/torture/simd19632.d: New test.
* gdc.dg/torture/simd20041.d: New test.
* gdc.dg/torture/simd21673.d: New test.
* gdc.dg/torture/simd21676.d: New test.
* gdc.dg/torture/simd22438.d: New test.
* gdc.dg/torture/simd23009.d: New test.
* gdc.dg/torture/simd23077.d: New test.
* gdc.dg/torture/simd8.d: New test.
* gdc.dg/torture/simd9.d: New test.
* gdc.dg/torture/simd_prefetch.d: New test.
|
|
gcc/ada/ChangeLog:
* exp_ch6.adb: Replace "the the" with "the".
* sem_ch6.adb: Likewise.
* sem_disp.ads: Likewise.
gcc/ChangeLog:
* ctfc.cc (ctf_add_string): Replace "the the" with "the".
* doc/md.texi: Likewise.
* gimple-range-infer.cc (non_null_loadstore): Likewise.
gcc/fortran/ChangeLog:
* gfortran.texi: Replace "the the" with "the".
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wclass-memaccess.C: Replace "the the" with "the".
* g++.dg/warn/Wconversion-real-integer2.C: Likewise.
* gcc.target/powerpc/p9-extract-1.c: Likewise.
* gcc.target/s390/s390.exp: Likewise.
* gcc.target/s390/zvector/vec-cmp-2.c: Likewise.
* gdc.dg/torture/simd_store.d: Likewise.
* gfortran.dg/actual_array_offset_1.f90: Likewise.
* gfortran.dg/pdt_15.f03: Likewise.
* gfortran.dg/pointer_array_8.f90: Likewise.
|
|
Because complex types are deprecated in the language, the new way to
expose native complex types is by defining an enum with a basetype of a
library-defined struct that is implicitly treated as-if it is native.
As casts are not implicitly added by the front-end when downcasting from
enum to its underlying type, we must insert an explicit cast during the
code generation pass.
PR d/106623
gcc/d/ChangeLog:
* d-codegen.cc (underlying_complex_expr): New function.
(d_build_call): Handle passing native complex objects as the
library-defined equivalent.
* d-tree.h (underlying_complex_expr): Declare.
* expr.cc (ExprVisitor::visit (DotVarExp *)): Call
underlying_complex_expr instead of build_vconvert.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr106623.d: New test.
|
|
Functions that are declared `pragma(inline)' should be treated as if
they are defined in every translation unit they are referenced from,
regardless of visibility protection. Ensure they always get
DECL_ONE_ONLY linkage, and start emitting them into other modules that
import them.
PR d/106563
gcc/d/ChangeLog:
* decl.cc (DeclVisitor::visit (FuncDeclaration *)): Set semanticRun
before generating its symbol.
(function_defined_in_root_p): New function.
(function_needs_inline_definition_p): New function.
(maybe_build_decl_tree): New function.
(get_symbol_decl): Call maybe_build_decl_tree before returning symbol.
(start_function): Use function_defined_in_root_p instead of inline
test for locally defined symbols.
(set_linkage_for_decl): Check for inline functions before private or
protected symbols.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/torture.exp (srcdir): New proc.
* gdc.dg/torture/imports/pr106563math.d: New test.
* gdc.dg/torture/imports/pr106563regex.d: New test.
* gdc.dg/torture/imports/pr106563uni.d: New test.
* gdc.dg/torture/pr106563.d: New test.
|
|
The type that triggers the ICE never got completed by the semantic
analysis pass. Checking for size forces it to be done, or issue a
compile-time error.
PR d/106555
gcc/d/ChangeLog:
* d-target.cc (Target::isReturnOnStack): Check for return type size.
gcc/testsuite/ChangeLog:
* gdc.dg/imports/pr106555.d: New test.
* gdc.dg/pr106555.d: New test.
|
|
Casting from vector to static array is permitted, and the frontend
generates a reinterpret cast, but casting back the other way resulted in
an error. This has been fixed to be properly handled in the code
generation pass of VectorExp, and the conversion for lvalue and rvalue
handling done in convert_expr and convert_for_rvalue respectively.
PR d/106139
gcc/d/ChangeLog:
* d-convert.cc (convert_expr): Handle casting from array to vector.
(convert_for_rvalue): Rewrite vector to array casts of the same
element type into a constructor.
(convert_for_assignment): Return calling convert_for_rvalue.
* expr.cc (ExprVisitor::visit (VectorExp *)): Handle generating a
vector expression from a static array.
* toir.cc (IRVisitor::visit (ReturnStatement *)): Call
convert_for_rvalue on return value.
gcc/testsuite/ChangeLog:
* gdc.dg/pr106139a.d: New test.
* gdc.dg/pr106139b.d: New test.
* gdc.dg/pr106139c.d: New test.
* gdc.dg/pr106139d.d: New test.
|