Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
(PR102185)
This gets re-added by the ExprVisitor when lowering StringExp back into a
STRING_CST during the code generator pass.
PR d/102185
gcc/d/ChangeLog:
* d-builtins.cc (d_eval_constant_expression): Don't include
terminating null pointer in string expression conversion.
gcc/testsuite/ChangeLog:
* gdc.dg/pr102185.d: New test.
|
|
|
|
gcc/d/ChangeLog:
* d-codegen.cc: Include dmd/module.h.
(build_filename_from_loc): New function.
(d_assert_call): Rename to...
(build_assert_call): ...this.
(build_array_bounds_call): Call arrayboundsp variant of the array
bounds failure callback.
(build_bounds_condition): Rename to...
(build_bounds_index_condition): ...this. Update signature.
(build_bounds_slice_condition): New function.
(checkaction_trap_p): New function.
(d_assert_call): Call assertp variant of assert failure callback.
* d-tree.h (class IndexExp): Declare.
(class SliceExp): Declare.
(build_bounds_condition): Remove.
(build_assert_call): Declare.
(build_bounds_index_condition): Declare.
(build_bounds_slice_condition): Declare.
(checkaction_trap_p): Declare.
(d_assert_call): Remove.
* expr.cc (ExprVisitor::visit(IndexExp *)): Call
build_bounds_index_condition.
(ExprVisitor::visit(SliceExp *)): Call build_bounds_slice_condition.
(ExprVisitor::visit(AssertExp *)): Update setting of libcall.
* runtime.cc (enum d_libcall_type): Add LCT_IMMUTABLE_CHARPTR.
(get_libcall_type): Handle LCT_IMMUTABLE_CHARPTR.
* runtime.def (ASSERT): Rename to...
(ASSERTP): ...this. Update signature.
(UNITTEST): Rename to...
(UNITTESTP): ...this. Update signature.
(ARRAY_BOUNDS): Rename to...
(ARRAYBOUNDSP): ...this. Updates signature.
* toir.cc (IRVisitor::visit(SwitchErrorStatement *)): Update call.
|
|
gcc/d/ChangeLog:
* typeinfo.cc (class TypeInfoVisitor::layout_base): Update comment.
|
|
gcc/d/ChangeLog:
* typeinfo.cc (TypeInfoVisitor::visit(TypeInfoClassDeclaration *)):
Use int to store type flags.
(TypeInfoVisitor::visit(TypeInfoStructDeclaration *)): Likewise.
|
|
gcc/d/ChangeLog:
* types.cc (TypeVisitor::visit(TypeEnum*)): Get wchar_t type from
build_frontend_type.
|
|
gcc/d/ChangeLog:
* d-convert.cc (convert_for_rvalue): Convert switch statement into if
condition.
|
|
gcc/d/ChangeLog:
* d-builtins.cc (d_init_versions): Use POINTER_SIZE for testing
whether to predefine D_LP64.
|
|
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.
PR d/102094
gcc/d/ChangeLog:
* d-codegen.cc (build_frame_type): Set TYPE_CXX_ODR_P.
gcc/testsuite/ChangeLog:
* gdc.dg/lto/pr102094_0.d: New test.
|
|
|
|
Adds the logic to handle -finput-charset in layout_get_source_line(), so that
source lines are converted from their input encodings prior to being output by
diagnostics machinery. Also adds the ability to strip a UTF-8 BOM similarly.
gcc/c-family/ChangeLog:
PR other/93067
* c-opts.c (c_common_input_charset_cb): New function.
(c_common_post_options): Call new function
diagnostic_initialize_input_context().
gcc/d/ChangeLog:
PR other/93067
* d-lang.cc (d_input_charset_callback): New function.
(d_init): Call new function
diagnostic_initialize_input_context().
gcc/fortran/ChangeLog:
PR other/93067
* cpp.c (gfc_cpp_post_options): Call new function
diagnostic_initialize_input_context().
gcc/ChangeLog:
PR other/93067
* coretypes.h (typedef diagnostic_input_charset_callback): Declare.
* diagnostic.c (diagnostic_initialize_input_context): New function.
* diagnostic.h (diagnostic_initialize_input_context): Declare.
* input.c (default_charset_callback): New function.
(file_cache::initialize_input_context): New function.
(file_cache_slot::create): Added ability to convert the input
according to the input context.
(file_cache::file_cache): Initialize the new input context.
(class file_cache_slot): Added new m_alloc_offset member.
(file_cache_slot::file_cache_slot): Initialize the new member.
(file_cache_slot::~file_cache_slot): Handle potentially offset buffer.
(file_cache_slot::maybe_grow): Likewise.
(file_cache_slot::needs_read_p): Handle NULL fp, which is now possible.
(file_cache_slot::get_next_line): Likewise.
* input.h (class file_cache): Added input context member.
libcpp/ChangeLog:
PR other/93067
* charset.c (init_iconv_desc): Adapt to permit PFILE argument to
be NULL.
(_cpp_convert_input): Likewise. Also move UTF-8 BOM logic to...
(cpp_check_utf8_bom): ...here. New function.
(cpp_input_conversion_is_trivial): New function.
* files.c (read_file_guts): Allow PFILE argument to be NULL. Add
INPUT_CHARSET argument as an alternate source of this information.
(read_file): Pass the new argument to read_file_guts.
(cpp_get_converted_source): New function.
* include/cpplib.h (struct cpp_converted_source): Declare.
(cpp_get_converted_source): Declare.
(cpp_input_conversion_is_trivial): Declare.
(cpp_check_utf8_bom): Declare.
gcc/testsuite/ChangeLog:
PR other/93067
* gcc.dg/diagnostic-input-charset-1.c: New test.
* gcc.dg/diagnostic-input-utf8-bom.c: New test.
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
declarations.
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 (ClassDeclaration *)): Likewise.
(aggregate_initializer_decl): Likewise. Set sinit after creating.
|
|
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.
|
|
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.
(layout_cpp_typeinfo): Likewise. Don't emit vtable unless
have_typeinfo_p.
|
|
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:
* d-lang.cc (deps_add_target): Insert null terminator in buffer.
(deps_write): Likewise.
(d_parse_file): Likewise.
|
|
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.
|
|
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.
(get_framedecl): Likewise.
|
|
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 occur.
PR d/101672
gcc/d/ChangeLog:
* typeinfo.cc (make_frontend_typeinfo): Generate Object class if it
doesn't exist.
(check_typeinfo_type): Don't warn if there's no location.
gcc/testsuite/ChangeLog:
* gdc.dg/pr100967.d: Update test.
* gdc.dg/pr101672.d: New test.
|
|
C++ constructors return void, even though the 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.
PR d/101664
gcc/d/ChangeLog:
* expr.cc (ExprVisitor::visit (CallExp *)): Use object expression as
result for C++ constructor calls.
gcc/testsuite/ChangeLog:
* gdc.dg/extern-c++/extern-c++.exp: New.
* gdc.dg/extern-c++/pr101664.d: New test.
* gdc.dg/extern-c++/pr101664_1.cc: New test.
|
|
If casting from bool, the result is either 0 or 1, any other value
violates @safe code, so enforce that it is never invalid.
PR d/96435
gcc/d/ChangeLog:
* d-convert.cc (convert_for_rvalue): New function.
* d-tree.h (convert_for_rvalue): Declare.
* expr.cc (ExprVisitor::visit (CastExp *)): Use convert_for_rvalue.
(build_return_dtor): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr96435.d: New test.
|
|
If an error occurs later during compilation, remember that we generated
the headers, so that they can be removed before exit.
PR d/101657
gcc/d/ChangeLog:
* d-lang.cc (d_parse_file): Remove generated D header files on error.
gcc/testsuite/ChangeLog:
* gdc.dg/pr101657.d: New test.
|
|
If the format string is enclosed by two '`' characters, then don't
escape the first and laster characters.
PR d/101656
gcc/d/ChangeLog:
* d-diagnostic.cc (escape_d_format): Don't escape quoted format
strings.
|
|
|
|
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.
PR d/101640
gcc/d/ChangeLog:
* expr.cc (binary_op): Use build2 instead of fold_build2.
gcc/testsuite/ChangeLog:
* gdc.dg/pr96429.d: Update test.
* gdc.dg/pr101640.d: New test.
|
|
Both the front-end and code generator had a modulo by zero bug when testing if
a conversion from a static array to dynamic array was valid.
PR d/101490
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 27e388b4c.
* d-codegen.cc (build_array_index): Handle void arrays same as byte.
* d-convert.cc (convert_expr): Handle converting to zero-sized arrays.
gcc/testsuite/ChangeLog:
* gdc.dg/pr101490.d: New test.
|
|
(PR101441)
Backports fix from upstream to allow __FUNCTION__ and
__PRETTY_FUNCTION__ to be used as C string literals.
Reviewed-on: https://github.com/dlang/dmd/pull/12923
PR d/101441
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd f8c1ca928.
|
|
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. All builtins get pushed
into the `gcc.builtins' module, which is constructed during the semantic
analysis pass, which has already finished by the time target attributes
are evaluated. So builtins are not pushed by the new langhook because
they would be ultimately ignored. Builtins exposed to D code then can
now only be altered by the command-line.
PR d/101127
gcc/d/ChangeLog:
* d-builtins.cc (d_builtin_function_ext_scope): New function.
* d-lang.cc (LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE): Define.
* d-tree.h (d_builtin_function_ext_scope): Declare.
gcc/testsuite/ChangeLog:
* gdc.dg/pr101127a.d: New test.
* gdc.dg/pr101127b.d: New test.
|
|
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 templates having neither a value nor type.
Reviewed-on: https://github.com/dlang/dmd/pull/12920
PR d/101619
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 1d8386a63.
|
|
|
|
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.
PR d/101273
gcc/d/ChangeLog:
* toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returns that
use a temporary, and replace with return value.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr101273.d: New test.
|
|
|
|
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 did
not work for conditional expressions however, to give one example. So
now the RHS is always forced to a temporary.
PR d/101282
gcc/d/ChangeLog:
* d-codegen.cc (build_assign): Force target_expr on RHS for non-POD
assignment expressions.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr101282.d: New test.
|
|
|
|
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 16-bit integers as index types when the size fits the
expected loop range.
gcc/d/ChangeLog:
PR d/100999
* dmd/MERGE: Merge upstream dmd 7a3808254.
libphobos/ChangeLog:
PR d/100999
* src/MERGE: Merge upstream phobos 55bb17543.
|
|
|
|
Generate 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 TypeInfo objects.
The errors issued by the code generation pass relating to missing or
disabled RTTI has been consolidated into a single function, so that a
meaningful error will be emitted before the front-end terminates.
gcc/d/ChangeLog:
PR d/100967
* d-frontend.cc (getTypeInfoType): Move TypeInfo checks to
check_typeinfo_type and call new function.
* d-tree.h (check_typeinfo_type): Declare.
* typeinfo.cc: Include dmd/scope.h.
(create_frontend_tinfo_types): Generate front-end types even if Object
is missing.
(build_typeinfo): Move TypeInfo checks to check_typeinfo_type and call
new function.
(check_typeinfo_type): New function.
gcc/testsuite/ChangeLog:
PR d/100967
* gdc.dg/pr100967.d: New test.
|
|
|
|
Known limitation: does not work for struct with postblit or dtor.
Reviewed-on: https://github.com/dlang/dmd/pull/12648
gcc/d/ChangeLog:
PR d/100964
* dmd/MERGE: Merge upstream dmd 4a4e46a6f.
|
|
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.
Reviewed-on: https://github.com/dlang/dmd/pull/12646
gcc/d/ChangeLog:
PR d/100935
* dmd/MERGE: Merge upstream dmd f3fdeb578.
|
|
|
|
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 also discarded any cleanups that
may have been assigned to the expression as well.
So now the reuse of TARGET_EXPR_SLOT has been removed, and
`build_assign' now constructs assignments inside the TARGET_EXPR_INITIAL
slot. This has also been extended to `return_expr', to deal with
possibility of a TARGET_EXPR being returned.
gcc/d/ChangeLog:
PR d/100882
* d-codegen.cc (build_assign): Construct initializations inside
TARGET_EXPR_INITIAL.
(compound_expr): Remove intermediate expressions that have no
side-effects.
(return_expr): Construct returns inside TARGET_EXPR_INITIAL.
* expr.cc (ExprVisitor::visit (CallExp *)): Remove useless assignment
to TARGET_EXPR_SLOT.
gcc/testsuite/ChangeLog:
PR d/100882
* gdc.dg/pr100882a.d: New test.
* gdc.dg/pr100882b.d: New test.
* gdc.dg/pr100882c.d: New test.
* gdc.dg/torture/pr100882.d: New test.
|
|
|