diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2019-06-18 20:42:10 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-11-30 16:53:28 +0100 |
commit | 5fee5ec362f7a243f459e6378fd49dfc89dc9fb5 (patch) | |
tree | 61d1bdbca854a903c0860406f457f06b2040be7a /gcc/testsuite/gdc.dg | |
parent | b3f60112edcb85b459e60f66c44a55138b1cef49 (diff) | |
download | gcc-5fee5ec362f7a243f459e6378fd49dfc89dc9fb5.zip gcc-5fee5ec362f7a243f459e6378fd49dfc89dc9fb5.tar.gz gcc-5fee5ec362f7a243f459e6378fd49dfc89dc9fb5.tar.bz2 |
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
The D front-end is now itself written in D, in order to build GDC, you
will need a working GDC compiler (GCC version 9.1 or later).
GCC changes:
- Add support for bootstrapping the D front-end.
These add the required components in order to have a D front-end written
in D itself. Because the compiler front-end only depends on the core
runtime modules, only libdruntime is built for the bootstrap stages.
D front-end changes:
- Import dmd v2.098.0-beta.1.
Druntime changes:
- Import druntime v2.098.0-beta.1.
Phobos changes:
- Import phobos v2.098.0-beta.1.
The jump from v2.076.1 to v2.098.0 covers nearly 4 years worth of
development on the D programming language and run-time libraries.
ChangeLog:
* Makefile.def: Add bootstrap to libbacktrace, libphobos, zlib, and
libatomic.
* Makefile.in: Regenerate.
* Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Fix command for GDC.
(STAGE1_CONFIGURE_FLAGS): Add --with-libphobos-druntime-only if
target-libphobos-bootstrap.
(STAGE2_CONFIGURE_FLAGS): Likewise.
* configure: Regenerate.
* configure.ac: Add support for bootstrapping D front-end.
config/ChangeLog:
* acx.m4 (ACX_PROG_GDC): New m4 function.
gcc/ChangeLog:
* Makefile.in (GDC): New variable.
(GDCFLAGS): New variable.
* configure: Regenerate.
* configure.ac: Add call to ACX_PROG_GDC. Substitute GDCFLAGS.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd b8384668f.
* Make-lang.in (d-warn): Use strict warnings.
(DMD_WARN_CXXFLAGS): Remove.
(DMD_COMPILE): Remove.
(CHECKING_DFLAGS): Define.
(WARN_DFLAGS): Define.
(ALL_DFLAGS): Define.
(DCOMPILE.base): Define.
(DCOMPILE): Define.
(DPOSTCOMPILE): Define.
(DLINKER): Define.
(DLLINKER): Define.
(D_FRONTEND_OBJS): Add new dmd front-end objects.
(D_GENERATED_SRCS): Remove.
(D_GENERATED_OBJS): Remove.
(D_ALL_OBJS): Remove D_GENERATED_OBJS.
(d21$(exeext)): Build using DLLINKER and -static-libphobos.
(d.tags): Remove dmd/*.c and dmd/root/*.c.
(d.mostlyclean): Remove D_GENERATED_SRCS, d/idgen$(build_exeext),
d/impcnvgen$(build_exeext).
(D_INCLUDES): Include $(srcdir)/d/dmd/res.
(CFLAGS-d/id.o): Remove.
(CFLAGS-d/impcnvtab.o): Remove.
(d/%.o): Build using DCOMPILE and DPOSTCOMPILE. Update dependencies
from d/dmd/%.c to d/dmd/%.d.
(d/idgen$(build_exeext)): Remove.
(d/impcnvgen$(build_exeext)): Remove.
(d/id.c): Remove.
(d/id.h): Remove.
(d/impcnvtab.c): Remove.
(d/%.dmdgen.o): Remove.
(D_SYSTEM_H): Remove.
(d/idgen.dmdgen.o): Remove.
(d/impcnvgen.dmdgen.o): Remove.
* config-lang.in (boot_language): New variable.
* d-attribs.cc: Include dmd/expression.h.
* d-builtins.cc: Include d-frontend.h.
(build_frontend_type): Update for new front-end interface.
(d_eval_constant_expression): Likewise.
(d_build_builtins_module): Likewise.
(maybe_set_builtin_1): Likewise.
(d_build_d_type_nodes): Likewise.
* d-codegen.cc (d_decl_context): Likewise.
(declaration_reference_p): Likewise.
(declaration_type): Likewise.
(parameter_reference_p): Likewise.
(parameter_type): Likewise.
(get_array_length): Likewise.
(build_delegate_cst): Likewise.
(build_typeof_null_value): Likewise.
(identity_compare_p): Likewise.
(lower_struct_comparison): Likewise.
(build_filename_from_loc): Likewise.
(build_assert_call): Remove LIBCALL_SWITCH_ERROR.
(build_bounds_index_condition): Call LIBCALL_ARRAYBOUNDS_INDEXP on
bounds error.
(build_bounds_slice_condition): Call LIBCALL_ARRAYBOUNDS_SLICEP on
bounds error.
(array_bounds_check): Update for new front-end interface.
(checkaction_trap_p): Handle CHECKACTION_context.
(get_function_type): Update for new front-end interface.
(d_build_call): Likewise.
* d-compiler.cc: Remove include of dmd/scope.h.
(Compiler::genCmain): Remove.
(Compiler::paintAsType): Update for new front-end interface.
(Compiler::onParseModule): Likewise.
* d-convert.cc (convert_expr): Remove call to LIBCALL_ARRAYCAST.
(convert_for_rvalue): Update for new front-end interface.
(convert_for_assignment): Likewise.
(convert_for_condition): Likewise.
(d_array_convert): Likewise.
* d-diagnostic.cc (error): Remove.
(errorSupplemental): Remove.
(warning): Remove.
(warningSupplemental): Remove.
(deprecation): Remove.
(deprecationSupplemental): Remove.
(message): Remove.
(vtip): New.
* d-frontend.cc (global): Remove.
(Global::_init): Remove.
(Global::startGagging): Remove.
(Global::endGagging): Remove.
(Global::increaseErrorCount): Remove.
(Loc::Loc): Remove.
(Loc::toChars): Remove.
(Loc::equals): Remove.
(isBuiltin): Update for new front-end interface.
(eval_builtin): Likewise.
(getTypeInfoType): Likewise.
(inlineCopy): Remove.
* d-incpath.cc: Include d-frontend.h.
(add_globalpaths): Call d_gc_malloc to allocate Strings.
(add_filepaths): Likewise.
* d-lang.cc: Include dmd/id.h, dmd/root/file.h, d-frontend.h. Remove
include of dmd/mars.h, id.h.
(entrypoint_module): Remove.
(entrypoint_root_module): Remove.
(deps_write_string): Update for new front-end interface.
(deps_write): Likewise.
(d_init_options): Call rt_init. Remove setting global params that are
default initialized by the front-end.
(d_handle_option): Handle OPT_fcheckaction_, OPT_fdump_c___spec_,
OPT_fdump_c___spec_verbose, OPT_fextern_std_, OPT_fpreview,
OPT_revert, OPT_fsave_mixins_, and OPT_ftransition.
(d_post_options): Propagate dip1021 and dip1000 preview flags to
dip25, and flag_diagnostics_show_caret to printErrorContext.
(d_add_entrypoint_module): Remove.
(d_parse_file): Update for new front-end interface.
(d_type_promotes_to): Likewise.
(d_types_compatible_p): Likewise.
* d-longdouble.cc (CTFloat::zero): Remove.
(CTFloat::one): Remove.
(CTFloat::minusone): Remove.
(CTFloat::half): Remove.
* d-system.h (POSIX): Remove.
(realpath): Remove.
(isalpha): Remove.
(isalnum): Remove.
(isdigit): Remove.
(islower): Remove.
(isprint): Remove.
(isspace): Remove.
(isupper): Remove.
(isxdigit): Remove.
(tolower): Remove.
(_mkdir): Remove.
(INT32_MAX): Remove.
(INT32_MIN): Remove.
(INT64_MIN): Remove.
(UINT32_MAX): Remove.
(UINT64_MAX): Remove.
* d-target.cc: Include calls.h.
(target): Remove.
(define_float_constants): Remove initialization of snan.
(Target::_init): Update for new front-end interface.
(Target::isVectorTypeSupported): Likewise.
(Target::isVectorOpSupported): Remove cases for unordered operators.
(TargetCPP::typeMangle): Update for new front-end interface.
(TargetCPP::parameterType): Likewise.
(Target::systemLinkage): Likewise.
(Target::isReturnOnStack): Likewise.
(Target::isCalleeDestroyingArgs): Define.
(Target::preferPassByRef): Define.
* d-tree.h (d_add_entrypoint_module): Remove.
* decl.cc (gcc_attribute_p): Update for new front-end interface.
(apply_pragma_crt): Define.
(DeclVisitor::visit(PragmaDeclaration *)): Handle pragmas
crt_constructor and crt_destructor.
(DeclVisitor::visit(TemplateDeclaration *)): Update for new front-end
interface.
(DeclVisitor::visit): Likewise.
(DeclVisitor::finish_vtable): Likewise.
(get_symbol_decl): Error if template has more than one nesting
context. Update for new front-end interface.
(make_thunk): Update for new front-end interface.
(get_vtable_decl): Likewise.
* expr.cc (ExprVisitor::visit): Likewise.
(build_return_dtor): Likewise.
* imports.cc (ImportVisitor::visit): Likewise.
* intrinsics.cc: Include dmd/expression.h. Remove include of
dmd/mangle.h.
(maybe_set_intrinsic): Update for new front-end interface.
* intrinsics.def (INTRINSIC_ROL): Update intrinsic signature.
(INTRINSIC_ROR): Likewise.
(INTRINSIC_ROR_TIARG): Likewise.
(INTRINSIC_TOPREC): Likewise.
(INTRINSIC_TOPRECL): Likewise.
(INTRINSIC_TAN): Update intrinsic module and signature.
(INTRINSIC_ISNAN): Likewise.
(INTRINSIC_ISFINITE): Likewise.
(INTRINSIC_COPYSIGN): Define intrinsic.
(INTRINSIC_COPYSIGNI): Define intrinsic.
(INTRINSIC_EXP): Update intrinsic module.
(INTRINSIC_EXPM1): Likewise.
(INTRINSIC_EXP2): Likewise.
(INTRINSIC_LOG): Likewise.
(INTRINSIC_LOG2): Likewise.
(INTRINSIC_LOG10): Likewise.
(INTRINSIC_POW): Likewise.
(INTRINSIC_ROUND): Likewise.
(INTRINSIC_FLOORF): Likewise.
(INTRINSIC_FLOOR): Likewise.
(INTRINSIC_FLOORL): Likewise.
(INTRINSIC_CEILF): Likewise.
(INTRINSIC_CEIL): Likewise.
(INTRINSIC_CEILL): Likewise.
(INTRINSIC_TRUNC): Likewise.
(INTRINSIC_FMIN): Likewise.
(INTRINSIC_FMAX): Likewise.
(INTRINSIC_FMA): Likewise.
(INTRINSIC_VA_ARG): Update intrinsic signature.
(INTRINSIC_VASTART): Likewise.
* lang.opt (fcheck=): Add alternate aliases for contract switches.
(fcheckaction=): New option.
(check_action): New Enum and EnumValue entries.
(fdump-c++-spec-verbose): New option.
(fdump-c++-spec=): New option.
(fextern-std=): New option.
(extern_stdcpp): New Enum and EnumValue entries
(fpreview=): New options.
(frevert=): New options.
(fsave-mixins): New option.
(ftransition=): Update options.
* modules.cc (get_internal_fn): Replace Prot with Visibility.
(build_internal_fn): Likewise.
(build_dso_cdtor_fn): Likewise.
(build_module_tree): Remove check for __entrypoint module.
* runtime.def (P5): Define.
(ARRAYBOUNDS_SLICEP): Define.
(ARRAYBOUNDS_INDEXP): Define.
(NEWTHROW): Define.
(ADCMP2): Remove.
(ARRAYCAST): Remove.
(SWITCH_STRING): Remove.
(SWITCH_USTRING): Remove.
(SWITCH_DSTRING): Remove.
(SWITCH_ERROR): Remove.
* toir.cc (IRVisitor::visit): Update for new front-end interface.
(IRVisitor::check_previous_goto): Remove checks for case and default
statements.
(IRVisitor::visit(SwitchStatement *)): Remove handling of string
switch conditions.
* typeinfo.cc: Include d-frontend.h.
(get_typeinfo_kind): Update for new front-end interface.
(make_frontend_typeinfo): Likewise.
(TypeInfoVisitor::visit): Likewise.
(builtin_typeinfo_p): Likewise.
(get_typeinfo_decl): Likewise.
(build_typeinfo): Likewise.
* types.cc (valist_array_p): Likewise.
(make_array_type): Likewise.
(merge_aggregate_types): Likewise.
(TypeVisitor::visit(TypeBasic *)): Likewise.
(TypeVisitor::visit(TypeFunction *)): Likewise.
(TypeVisitor::visit(TypeStruct *)): Update comment.
* verstr.h: Removed.
* d-frontend.h: New file.
gcc/po/ChangeLog:
* EXCLUDES: Remove d/dmd sources from list.
gcc/testsuite/ChangeLog:
* gdc.dg/Wcastresult2.d: Update test.
* gdc.dg/asm1.d: Likewise.
* gdc.dg/asm2.d: Likewise.
* gdc.dg/asm3.d: Likewise.
* gdc.dg/gdc282.d: Likewise.
* gdc.dg/imports/gdc170.d: Likewise.
* gdc.dg/intrinsics.d: Likewise.
* gdc.dg/pr101672.d: Likewise.
* gdc.dg/pr90650a.d: Likewise.
* gdc.dg/pr90650b.d: Likewise.
* gdc.dg/pr94777a.d: Likewise.
* gdc.dg/pr95250.d: Likewise.
* gdc.dg/pr96869.d: Likewise.
* gdc.dg/pr98277.d: Likewise.
* gdc.dg/pr98457.d: Likewise.
* gdc.dg/simd1.d: Likewise.
* gdc.dg/simd2a.d: Likewise.
* 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.
* gdc.dg/simd7951.d: Likewise.
* gdc.dg/torture/gdc309.d: Likewise.
* gdc.dg/torture/pr94424.d: Likewise.
* gdc.dg/torture/pr94777b.d: Likewise.
* lib/gdc-utils.exp (gdc-convert-args): Handle new compiler options.
(gdc-convert-test): Handle CXXFLAGS, EXTRA_OBJC_SOURCES, and ARG_SETS
test directives.
(gdc-do-test): Only import modules in the test run directory.
* gdc.dg/pr94777c.d: New test.
* gdc.dg/pr96156b.d: New test.
* gdc.dg/pr96157c.d: New test.
* gdc.dg/simd_ctfe.d: New test.
* gdc.dg/torture/simd17344.d: New test.
* gdc.dg/torture/simd20052.d: New test.
* gdc.dg/torture/simd6.d: New test.
* gdc.dg/torture/simd7.d: New test.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime e6caaab9.
* libdruntime/Makefile.am (D_EXTRA_FLAGS): Build libdruntime with
-fpreview=dip1000, -fpreview=fieldwise, and -fpreview=dtorfields.
(ALL_DRUNTIME_SOURCES): Add DRUNTIME_DSOURCES_STDCXX.
(DRUNTIME_DSOURCES): Update list of C binding modules.
(DRUNTIME_DSOURCES_STDCXX): Likewise.
(DRUNTIME_DSOURCES_LINUX): Likewise.
(DRUNTIME_DSOURCES_OPENBSD): Likewise.
(DRUNTIME_DISOURCES): Remove __entrypoint.di.
* libdruntime/Makefile.in: Regenerated.
* libdruntime/__entrypoint.di: Removed.
* libdruntime/gcc/deh.d (_d_isbaseof): Update signature.
(_d_createTrace): Likewise.
(__gdc_begin_catch): Remove reference to the exception.
(_d_throw): Increment reference count of thrown object before unwind.
(__gdc_personality): Chain exceptions with Throwable.chainTogether.
* libdruntime/gcc/emutls.d: Update imports.
* libdruntime/gcc/sections/elf.d: Update imports.
(DSO.moduleGroup): Update signature.
* libdruntime/gcc/sections/macho.d: Update imports.
(DSO.moduleGroup): Update signature.
* libdruntime/gcc/sections/pecoff.d: Update imports.
(DSO.moduleGroup): Update signature.
* src/MERGE: Merge upstream phobos 5ab9ad256.
* src/Makefile.am (D_EXTRA_DFLAGS): Add -fpreview=dip1000 and
-fpreview=dtorfields flags.
(PHOBOS_DSOURCES): Update list of std modules.
* src/Makefile.in: Regenerate.
* testsuite/lib/libphobos.exp (libphobos-dg-test): Handle assembly
compile types.
(dg-test): Override.
(additional_prunes): Define.
(libphobos-dg-prune): Filter any additional_prunes set by tests.
* testsuite/libphobos.aa/test_aa.d: Update test.
* testsuite/libphobos.druntime/druntime.exp (version_flags): Add
-fversion=CoreUnittest.
* testsuite/libphobos.druntime_shared/druntime_shared.exp
(version_flags): Add -fversion=CoreUnittest -fversion=Shared.
* testsuite/libphobos.exceptions/unknown_gc.d: Update test.
* testsuite/libphobos.hash/test_hash.d: Update test.
* testsuite/libphobos.phobos/phobos.exp (version_flags): Add
-fversion=StdUnittest
* testsuite/libphobos.phobos_shared/phobos_shared.exp (version_flags):
Likewise.
* testsuite/libphobos.shared/host.c: Update test.
* testsuite/libphobos.shared/load.d: Update test.
* testsuite/libphobos.shared/load_13414.d: Update test.
* testsuite/libphobos.thread/fiber_guard_page.d: Update test.
* testsuite/libphobos.thread/tlsgc_sections.d: Update test.
* testsuite/testsuite_flags.in: Add -fpreview=dip1000 to --gdcflags.
* testsuite/libphobos.shared/link_mod_collision.d: Removed.
* testsuite/libphobos.shared/load_mod_collision.d: Removed.
* testsuite/libphobos.betterc/betterc.exp: New test.
* testsuite/libphobos.config/config.exp: New test.
* testsuite/libphobos.gc/gc.exp: New test.
* testsuite/libphobos.imports/imports.exp: New test.
* testsuite/libphobos.lifetime/lifetime.exp: New test.
* testsuite/libphobos.unittest/unittest.exp: New test.
Diffstat (limited to 'gcc/testsuite/gdc.dg')
38 files changed, 361 insertions, 284 deletions
diff --git a/gcc/testsuite/gdc.dg/Wcastresult2.d b/gcc/testsuite/gdc.dg/Wcastresult2.d index 56d2dd2..83d189a 100644 --- a/gcc/testsuite/gdc.dg/Wcastresult2.d +++ b/gcc/testsuite/gdc.dg/Wcastresult2.d @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-Wcast-result" } +// { dg-options "-Wcast-result -Wno-deprecated" } void test() { diff --git a/gcc/testsuite/gdc.dg/asm1.d b/gcc/testsuite/gdc.dg/asm1.d index dce3676..1b249ee 100644 --- a/gcc/testsuite/gdc.dg/asm1.d +++ b/gcc/testsuite/gdc.dg/asm1.d @@ -24,9 +24,9 @@ void parse3() { asm { "" [; } // { dg-error "expression expected, not ';'" "" { target *-*-* } .-1 } - // { dg-error "found 'EOF' when expecting ','" "" { target *-*-* } .-2 } - // { dg-error "found 'EOF' when expecting ']'" "" { target *-*-* } .-3 } - // { dg-error "found 'EOF' when expecting ';'" "" { target *-*-* } .-4 } + // { dg-error "found 'End of File' when expecting ','" "" { target *-*-* } .-2 } + // { dg-error "found 'End of File' when expecting ']'" "" { target *-*-* } .-3 } + // { dg-error "found 'End of File' when expecting ';'" "" { target *-*-* } .-4 } } void parse4() @@ -46,8 +46,8 @@ void semantic1() ; } asm { "" : : : : L1, L2; } - // { dg-error "goto skips declaration of variable asm1.semantic1.one" "" { target *-*-* } .-1 } - // { dg-error "goto skips declaration of variable asm1.semantic1.two" "" { target *-*-* } .-2 } + // { dg-error "'goto' skips declaration of variable 'asm1.semantic1.one'" "" { target *-*-* } .-1 } + // { dg-error "'goto' skips declaration of variable 'asm1.semantic1.two'" "" { target *-*-* } .-2 } { int two; L2: @@ -58,19 +58,19 @@ void semantic1() void semantic2a(X...)(X expr) { alias X[0] var1; - asm { "%0" : "=m" (var1); } // { dg-error "double 'double' is a type, not an lvalue" } + asm { "%0" : "=m" (var1); } // { dg-error "double' is a 'double' definition and cannot be modified" } } void semantic2() { - semantic2a(3.6); // { dg-error "template instance asm1.semantic2a!double error instantiating" } + semantic2a(3.6); // { dg-error "template instance 'asm1.semantic2a!double' error instantiating" } } void semantic3() { asm { - unknown; // { dg-error "undefined identifier" } + unknown; // { dg-error "undefined identifier 'unknown'" } } } @@ -86,6 +86,6 @@ void semantic4() { asm { - "%0" : : "m" (S4.foo); // { dg-error "template instance opDispatch!\"foo\" has no value" } + "%0" : : "m" (S4.foo); // { dg-error "template instance 'opDispatch!\"foo\"' has no value" } } } diff --git a/gcc/testsuite/gdc.dg/asm2.d b/gcc/testsuite/gdc.dg/asm2.d index bce0e41..5b86e35 100644 --- a/gcc/testsuite/gdc.dg/asm2.d +++ b/gcc/testsuite/gdc.dg/asm2.d @@ -3,6 +3,6 @@ module asm2; void test() { - asm const shared { } // { dg-error "const/immutable/shared/inout attributes are not allowed on asm blocks" } + asm const shared { } // { dg-error "'const'/'immutable'/'shared'/'inout' attributes are not allowed on 'asm' blocks" } } diff --git a/gcc/testsuite/gdc.dg/asm3.d b/gcc/testsuite/gdc.dg/asm3.d index 333d83e..d792b24 100644 --- a/gcc/testsuite/gdc.dg/asm3.d +++ b/gcc/testsuite/gdc.dg/asm3.d @@ -2,23 +2,23 @@ // { dg-options "-Wall -Wdeprecated -Werror" } module asm3; -void test1() nothrow // { dg-error "nothrow function 'asm3.test1' may throw" } +void test1() nothrow { - asm { } // { dg-error "asm statement is assumed to throw - mark it with 'nothrow' if it does not" } + asm { } // { dg-error "'asm' statement is assumed to throw - mark it with 'nothrow' if it does not" } } void test2() pure { - asm { } // { dg-error "asm statement is assumed to be impure - mark it with 'pure' if it is not" } + asm { } // { dg-error "'asm' statement is assumed to be impure - mark it with 'pure' if it is not" } } void test3() @nogc { - asm { } // { dg-error "asm statement is assumed to use the GC - mark it with '@nogc' if it does not" } + asm { } // { dg-error "'asm' statement is assumed to use the GC - mark it with '@nogc' if it does not" } } void test4() @safe { - asm { } // { dg-error "asm statement is assumed to be @system - mark it with '@trusted' if it is not" } + asm { } // { dg-error "'asm' statement is assumed to be '@system' - mark it with '@trusted' if it is not" } } diff --git a/gcc/testsuite/gdc.dg/gdc282.d b/gcc/testsuite/gdc.dg/gdc282.d index ce84050..93e11fa 100644 --- a/gcc/testsuite/gdc.dg/gdc282.d +++ b/gcc/testsuite/gdc.dg/gdc282.d @@ -12,7 +12,7 @@ class C282a { } - void f282() // { dg-error "conflicts with gdc282.C282a.f282" } + void f282() // { dg-error "conflicts with previous declaration" } { } } @@ -27,7 +27,7 @@ class C282b { } - void f282() // { dg-error "conflicts with gdc282.C282b.f282" } + void f282() // { dg-error "conflicts with previous declaration" } { } } @@ -42,7 +42,7 @@ class C282c { } - void f282() // { dg-error "conflicts with gdc282.C282c.f282" } + void f282() // { dg-error "conflicts with previous declaration" } { } } diff --git a/gcc/testsuite/gdc.dg/imports/gdc170.d b/gcc/testsuite/gdc.dg/imports/gdc170.d index f9fea1f..aedef60 100644 --- a/gcc/testsuite/gdc.dg/imports/gdc170.d +++ b/gcc/testsuite/gdc.dg/imports/gdc170.d @@ -7,12 +7,12 @@ class bar(T) template foo(T) { - bar!T foo1(T2)() if (true) body { return null; } + bar!T foo1(T2)() if (true) do { return null; } bar!T foo2(T2)() { return null; } - bar!T foo3(T2 = void)() if (true) body { return null; } + bar!T foo3(T2 = void)() if (true) do { return null; } bar!T foo4(T2 = void)() { return null; } - void foo5(T2)(bar!T x) if (true) body {} + void foo5(T2)(bar!T x) if (true) do {} void foo6(T2)(bar!T x) {} - void foo7(T2 = void)(bar!T x) if (true) body {} + void foo7(T2 = void)(bar!T x) if (true) do {} void foo8(T2 = void)(bar!T x) {} } diff --git a/gcc/testsuite/gdc.dg/intrinsics.d b/gcc/testsuite/gdc.dg/intrinsics.d index d9ccc0e..dca40d2 100644 --- a/gcc/testsuite/gdc.dg/intrinsics.d +++ b/gcc/testsuite/gdc.dg/intrinsics.d @@ -35,22 +35,6 @@ ulong test_bswap(ulong a) { return bswap(a); } int test_popcnt(uint a) { return popcnt(a); } // { dg-final { scan-tree-dump " __builtin_popcount(l|ll) " "original" } } int test_popcnt(ulong a) { return popcnt(a); } -// { dg-final { scan-tree-dump "\\(volatile ubyte \\*\\) a;" "original" } } -ubyte test_volatileLoad(ubyte *a) { return volatileLoad(a); } -// { dg-final { scan-tree-dump "\\(volatile ushort \\*\\) a;" "original" } } -ushort test_volatileLoad(ushort *a) { return volatileLoad(a); } -// { dg-final { scan-tree-dump "\\(volatile uint \\*\\) a;" "original" } } -uint test_volatileLoad(uint *a) { return volatileLoad(a); } -// { dg-final { scan-tree-dump "\\(volatile ulong \\*\\) a;" "original" } } -ulong test_volatileLoad(ulong *a) { return volatileLoad(a); } -// { dg-final { scan-tree-dump "\\(volatile ubyte \\*\\) a = b" "original" } } -void test_volatileStore(ubyte *a, ubyte b) { return volatileStore(a, b); } -// { dg-final { scan-tree-dump "\\(volatile ushort \\*\\) a = b" "original" } } -void test_volatileStore(ushort *a, ushort b) { return volatileStore(a, b); } -// { dg-final { scan-tree-dump "\\(volatile uint \\*\\) a = b" "original" } } -void test_volatileStore(uint *a, uint b) { return volatileStore(a, b); } -// { dg-final { scan-tree-dump "\\(volatile ulong \\*\\) a = b" "original" } } -void test_volatileStore(ulong *a, ulong b) { return volatileStore(a, b); } // { dg-final { scan-tree-dump " a r<< b;" "original" } } ubyte test_rol(ubyte a, uint b) { return rol!ubyte(a, b); } // { dg-final { scan-tree-dump " a r>> 31;" "original" } } @@ -141,6 +125,26 @@ real test_toPrecl(double a) { return toPrec!real(a); } real test_toPrecl(real a) { return toPrec!real(a); } ////////////////////////////////////////////////////// +// core.volatile + +// { dg-final { scan-tree-dump "\\(volatile ubyte \\*\\) a;" "original" } } +ubyte test_volatileLoad(ubyte *a) { return volatileLoad(a); } +// { dg-final { scan-tree-dump "\\(volatile ushort \\*\\) a;" "original" } } +ushort test_volatileLoad(ushort *a) { return volatileLoad(a); } +// { dg-final { scan-tree-dump "\\(volatile uint \\*\\) a;" "original" } } +uint test_volatileLoad(uint *a) { return volatileLoad(a); } +// { dg-final { scan-tree-dump "\\(volatile ulong \\*\\) a;" "original" } } +ulong test_volatileLoad(ulong *a) { return volatileLoad(a); } +// { dg-final { scan-tree-dump "\\(volatile ubyte \\*\\) a = b" "original" } } +void test_volatileStore(ubyte *a, ubyte b) { return volatileStore(a, b); } +// { dg-final { scan-tree-dump "\\(volatile ushort \\*\\) a = b" "original" } } +void test_volatileStore(ushort *a, ushort b) { return volatileStore(a, b); } +// { dg-final { scan-tree-dump "\\(volatile uint \\*\\) a = b" "original" } } +void test_volatileStore(uint *a, uint b) { return volatileStore(a, b); } +// { dg-final { scan-tree-dump "\\(volatile ulong \\*\\) a = b" "original" } } +void test_volatileStore(ulong *a, ulong b) { return volatileStore(a, b); } + +////////////////////////////////////////////////////// // core.stdc.stdarg // { dg-final { scan-tree-dump-not " va_arg " "original" } } diff --git a/gcc/testsuite/gdc.dg/pr101672.d b/gcc/testsuite/gdc.dg/pr101672.d index 292fd76..8b337a4 100644 --- a/gcc/testsuite/gdc.dg/pr101672.d +++ b/gcc/testsuite/gdc.dg/pr101672.d @@ -8,7 +8,7 @@ interface I101672 static int i101672; } -class A101672 : I101672 // { dg-error "class object.A101672 missing or corrupt object.d" } +class A101672 : I101672 { static int a101672; } diff --git a/gcc/testsuite/gdc.dg/pr90650a.d b/gcc/testsuite/gdc.dg/pr90650a.d index 57228ca..62b7994 100644 --- a/gcc/testsuite/gdc.dg/pr90650a.d +++ b/gcc/testsuite/gdc.dg/pr90650a.d @@ -10,5 +10,5 @@ class c void g () { - if (0 & [0] & c.f()) {} // { dg-error "array operation \\\[0\\\] & 0 & f\\(\\) without destination memory not allowed" } + if (0 & [0] & c.f()) {} // { dg-error "array operation .\\\[0\\\] & 0 & f\\(\\). without destination memory not allowed" } } diff --git a/gcc/testsuite/gdc.dg/pr90650b.d b/gcc/testsuite/gdc.dg/pr90650b.d index 2b3192e..11a0225 100644 --- a/gcc/testsuite/gdc.dg/pr90650b.d +++ b/gcc/testsuite/gdc.dg/pr90650b.d @@ -9,5 +9,5 @@ class c } void g () { - if ([0] & c.f()) {} // { dg-error "array operation \\\[0\\\] & f\\(\\) without destination memory not allowed" } + if ([0] & c.f()) {} // { dg-error "array operation .\\\[0\\\] & f\\(\\). without destination memory not allowed" } } diff --git a/gcc/testsuite/gdc.dg/pr94777a.d b/gcc/testsuite/gdc.dg/pr94777a.d index a58fa55..d0cb556 100644 --- a/gcc/testsuite/gdc.dg/pr94777a.d +++ b/gcc/testsuite/gdc.dg/pr94777a.d @@ -11,5 +11,5 @@ void f94777() this(this) { } } auto var = S94777(0); - variadic(var, S94777(1)); + variadic(var, S94777(1)); // { dg-error "cannot pass types with postblits or copy constructors as variadic arguments" } } diff --git a/gcc/testsuite/gdc.dg/pr94777c.d b/gcc/testsuite/gdc.dg/pr94777c.d new file mode 100644 index 0000000..9b725c0 --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr94777c.d @@ -0,0 +1,62 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94777 +// { dg-additional-options "-funittest" } +// { dg-do compile } + +void testVariadic(T)(int nargs, ...) +{ + import core.stdc.stdarg; + foreach(i; 0 .. nargs) + { + auto arg = va_arg!T(_argptr); + static if (__traits(compiles, arg.value)) + { + assert(arg.value == i); + } + else static if (__traits(compiles, arg[0])) + { + foreach (value; arg) + assert(value == i); + } + else + { + assert(arg == T.init); + } + } +} + +/******************************************/ + +struct Postblit +{ + static int count = 0; + int value; + this(this) { count++; } +} + +unittest +{ + auto a0 = Postblit(0); + auto a1 = Postblit(1); + auto a2 = Postblit(2); + testVariadic!Postblit(3, a0, a1, a2); // { dg-error "cannot pass types with postblits or copy constructors as variadic arguments" } + assert(Postblit.count == 3); +} + +/******************************************/ + +struct CopyConstructor +{ + static int count = 0; + int value; + this(int v) { this.value = v; } + this(ref typeof(this) other) { count++; this.value = other.value; } +} + +unittest +{ + auto a0 = CopyConstructor(0); + auto a1 = CopyConstructor(1); + auto a2 = CopyConstructor(2); + testVariadic!CopyConstructor(3, a0, a1, a2); // { dg-error "cannot pass types with postblits or copy constructors as variadic arguments" } + assert(CopyConstructor.count == 3); +} diff --git a/gcc/testsuite/gdc.dg/pr95250.d b/gcc/testsuite/gdc.dg/pr95250.d index dfb8abb..ba0adea 100644 --- a/gcc/testsuite/gdc.dg/pr95250.d +++ b/gcc/testsuite/gdc.dg/pr95250.d @@ -15,4 +15,4 @@ void* f(T)(T a, T b) } static assert(is(typeof(f!(void*)(null, null)) == void*)); -// { dg-error "static assert \(.*\) is false" "" { target *-*-* } .-1 } +// { dg-error "static assert: \(.*\) is false" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/gdc.dg/pr96156b.d b/gcc/testsuite/gdc.dg/pr96156b.d new file mode 100644 index 0000000..ae79d56 --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr96156b.d @@ -0,0 +1,17 @@ +@safe unittest +{ + struct CustomString + { + @safe: + string _impl; + @property bool empty() const { return !_impl.length; } + } + + CustomString find(CustomString a, CustomString b) + { + return CustomString.init; + } + + auto r = find(CustomString("a"), CustomString("b")); + assert(r.empty); +} diff --git a/gcc/testsuite/gdc.dg/pr96157c.d b/gcc/testsuite/gdc.dg/pr96157c.d new file mode 100644 index 0000000..8f48cbd --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr96157c.d @@ -0,0 +1,40 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157 +// { dg-options "-fno-moduleinfo -fno-rtti" } +// { dg-do compile } + +struct CodepointSet +{ + CowArray!string data; +} + +struct CowArray(SP) +{ + ~this() + { + if (data.length) + refCount; + } + @property refCount() { return data[$-1]; } + + uint[] data; +} + +int ucmp() { return 1; } + +bool loadProperty () { + + CodepointSet target; + if (ucmp) + CodepointSet(); + else if (ucmp|| ucmp) + target = CodepointSet(); + else if (ucmp|| ucmp) + target = CodepointSet(); + else if (ucmp|| ucmp) + target = CodepointSet(); + else if (ucmp) + target = CodepointSet(); + else if (ucmp) + target = CodepointSet(); + return true; +} diff --git a/gcc/testsuite/gdc.dg/pr96869.d b/gcc/testsuite/gdc.dg/pr96869.d index c4ace30..348da1b 100644 --- a/gcc/testsuite/gdc.dg/pr96869.d +++ b/gcc/testsuite/gdc.dg/pr96869.d @@ -2,31 +2,31 @@ // { dg-do compile } __vector(float[0]) var01; -// { dg-error "0 byte vector type __vector\\\(float\\\[0\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "0 byte vector type '__vector\\\(float\\\[0\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(float[3]) var02; -// { dg-error "12 byte vector type __vector\\\(float\\\[3\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "12 byte vector type '__vector\\\(float\\\[3\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(float[][4]) var03; -// { dg-error "vector type __vector\\\(float\\\[\\\]\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(float\\\[\\\]\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(float[4][4]) var04; -// { dg-error "vector type __vector\\\(float\\\[4\\\]\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(float\\\[4\\\]\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(float[float][4]) var05; -// { dg-error "vector type __vector\\\(float\\\[float\\\]\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(float\\\[float\\\]\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(float function()[4]) var06; -// { dg-error "vector type __vector\\\(float function\\\(\\\)\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(float function\\\(\\\)\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(float delegate()[4]) var07; -// { dg-error "vector type __vector\\\(float delegate\\\(\\\)\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(float delegate\\\(\\\)\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } enum E { a, b, c } __vector(E[4]) var08; -// { dg-error "vector type __vector\\\(E\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(E\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } struct S { float a; } __vector(S[4]) var09; -// { dg-error "vector type __vector\\\(S\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(S\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } class C { float a; } __vector(C[4]) var10; -// { dg-error "vector type __vector\\\(C\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(C\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(cfloat[4]) var11; -// { dg-error "vector type __vector\\\(cfloat\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(cfloat\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(bool[4]) var12; -// { dg-error "vector type __vector\\\(bool\\\[4\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(bool\\\[4\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } __vector(real[128]) var13; -// { dg-error "vector type __vector\\\(real\\\[128\\\]\\\) is not supported on this platform" "" { target *-*-* } .-1 } +// { dg-error "vector type '__vector\\\(real\\\[128\\\]\\\)' is not supported on this platform" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/gdc.dg/pr98277.d b/gcc/testsuite/gdc.dg/pr98277.d index d3b859f..0dff142 100644 --- a/gcc/testsuite/gdc.dg/pr98277.d +++ b/gcc/testsuite/gdc.dg/pr98277.d @@ -7,7 +7,7 @@ enum Side right } -ref int getSide(Side side, ref int left, ref int right) +ref int getSide(Side side, return ref int left, return ref int right) { return side == Side.left ? left : right; } diff --git a/gcc/testsuite/gdc.dg/pr98457.d b/gcc/testsuite/gdc.dg/pr98457.d index bc0d8af..0cc83ac 100644 --- a/gcc/testsuite/gdc.dg/pr98457.d +++ b/gcc/testsuite/gdc.dg/pr98457.d @@ -3,7 +3,7 @@ void main() { - writef!"%s"; // { dg-error "template instance writef!\"%s\" template .writef. is not defined" } - writef!"`%s"; // { dg-error "template instance writef!\"`%s\" template .writef. is not defined" } - writef!"%%s`"; // { dg-error "template instance writef!\"%%s`\" template .writef. is not defined" } + writef!"%s"; // { dg-error "template instance .writef!\"%s\". template .writef. is not defined" } + writef!"`%s"; // { dg-error "template instance .writef!\"`%s\". template .writef. is not defined" } + writef!"%%s`"; // { dg-error "template instance .writef!\"%%s`\". template .writef. is not defined" } } diff --git a/gcc/testsuite/gdc.dg/simd1.d b/gcc/testsuite/gdc.dg/simd1.d index 374dcae..b25b99e 100644 --- a/gcc/testsuite/gdc.dg/simd1.d +++ b/gcc/testsuite/gdc.dg/simd1.d @@ -26,14 +26,6 @@ void test1() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); static assert(!__traits(compiles, v1 << 1)); static assert(!__traits(compiles, v1 >> 1)); static assert(!__traits(compiles, v1 >>> 1)); diff --git a/gcc/testsuite/gdc.dg/simd2a.d b/gcc/testsuite/gdc.dg/simd2a.d index b630a47..0fb391c 100644 --- a/gcc/testsuite/gdc.dg/simd2a.d +++ b/gcc/testsuite/gdc.dg/simd2a.d @@ -24,14 +24,6 @@ void test2a() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2b.d b/gcc/testsuite/gdc.dg/simd2b.d index 35c4288..41a4eb3 100644 --- a/gcc/testsuite/gdc.dg/simd2b.d +++ b/gcc/testsuite/gdc.dg/simd2b.d @@ -24,14 +24,6 @@ void test2b() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2c.d b/gcc/testsuite/gdc.dg/simd2c.d index 2f19e75..a995709 100644 --- a/gcc/testsuite/gdc.dg/simd2c.d +++ b/gcc/testsuite/gdc.dg/simd2c.d @@ -24,14 +24,6 @@ void test2c() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2d.d b/gcc/testsuite/gdc.dg/simd2d.d index 9d378e4..d578734 100644 --- a/gcc/testsuite/gdc.dg/simd2d.d +++ b/gcc/testsuite/gdc.dg/simd2d.d @@ -24,14 +24,6 @@ void test2d() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2e.d b/gcc/testsuite/gdc.dg/simd2e.d index 30d7c1a..d33574a 100644 --- a/gcc/testsuite/gdc.dg/simd2e.d +++ b/gcc/testsuite/gdc.dg/simd2e.d @@ -24,14 +24,6 @@ void test2e() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2f.d b/gcc/testsuite/gdc.dg/simd2f.d index f844880..5845249 100644 --- a/gcc/testsuite/gdc.dg/simd2f.d +++ b/gcc/testsuite/gdc.dg/simd2f.d @@ -24,14 +24,6 @@ void test2f() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2g.d b/gcc/testsuite/gdc.dg/simd2g.d index 8e8bc15..ce438f2 100644 --- a/gcc/testsuite/gdc.dg/simd2g.d +++ b/gcc/testsuite/gdc.dg/simd2g.d @@ -24,14 +24,6 @@ void test2g() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2h.d b/gcc/testsuite/gdc.dg/simd2h.d index f7542e8..c631c76 100644 --- a/gcc/testsuite/gdc.dg/simd2h.d +++ b/gcc/testsuite/gdc.dg/simd2h.d @@ -24,14 +24,6 @@ void test2h() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); v1 = v2 << 1; v1 = v2 >> 1; v1 = v2 >>> 1; diff --git a/gcc/testsuite/gdc.dg/simd2i.d b/gcc/testsuite/gdc.dg/simd2i.d index 2e3587d..6946c79 100644 --- a/gcc/testsuite/gdc.dg/simd2i.d +++ b/gcc/testsuite/gdc.dg/simd2i.d @@ -24,14 +24,6 @@ void test2i() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); static assert(!__traits(compiles, v1 << 1)); static assert(!__traits(compiles, v1 >> 1)); static assert(!__traits(compiles, v1 >>> 1)); diff --git a/gcc/testsuite/gdc.dg/simd2j.d b/gcc/testsuite/gdc.dg/simd2j.d index 7b60784..ecfdbf3 100644 --- a/gcc/testsuite/gdc.dg/simd2j.d +++ b/gcc/testsuite/gdc.dg/simd2j.d @@ -24,14 +24,6 @@ void test2j() static assert(!__traits(compiles, v1 > v2)); static assert(!__traits(compiles, v1 <= v2)); static assert(!__traits(compiles, v1 >= v2)); - static assert(!__traits(compiles, v1 <> v2)); - static assert(!__traits(compiles, v1 !< v2)); - static assert(!__traits(compiles, v1 !> v2)); - static assert(!__traits(compiles, v1 !<> v2)); - static assert(!__traits(compiles, v1 <>= v2)); - static assert(!__traits(compiles, v1 !<= v2)); - static assert(!__traits(compiles, v1 !>= v2)); - static assert(!__traits(compiles, v1 !<>= v2)); static assert(!__traits(compiles, v1 << 1)); static assert(!__traits(compiles, v1 >> 1)); static assert(!__traits(compiles, v1 >>> 1)); diff --git a/gcc/testsuite/gdc.dg/simd7951.d b/gcc/testsuite/gdc.dg/simd7951.d index 99ce151..4e467ef 100644 --- a/gcc/testsuite/gdc.dg/simd7951.d +++ b/gcc/testsuite/gdc.dg/simd7951.d @@ -19,4 +19,5 @@ void test7951_2() f1.array = v1; f2.array = v2; f3 = f1 + f2; + assert((cast(float[4])f3)[2] == 6); } diff --git a/gcc/testsuite/gdc.dg/simd_ctfe.d b/gcc/testsuite/gdc.dg/simd_ctfe.d new file mode 100644 index 0000000..b254cf3 --- /dev/null +++ b/gcc/testsuite/gdc.dg/simd_ctfe.d @@ -0,0 +1,87 @@ +// { dg-do compile } +import core.simd; + +// https://issues.dlang.org/show_bug.cgi?id=19627 +enum int[4] fail19627 = cast(int[4])int4(0); + +// https://issues.dlang.org/show_bug.cgi?id=19628 +enum ice19628a = int4.init[0]; +enum ice19628b = int4.init.array[0]; +enum ice19628c = (cast(int[4])int4.init.array)[0]; +enum ice19628d = (cast(int[4])int4.init)[0]; + +// https://issues.dlang.org/show_bug.cgi?id=19629 +enum fail19629a = int4(0)[0]; +enum fail19629b = int4(0).array[0]; +enum fail19629c = (cast(int[4])int4(0).array)[0]; +enum fail19628d = (cast(int[4])int4(0))[0]; + +// https://issues.dlang.org/show_bug.cgi?id=19630 +enum fail19630a = int4.init[1..2]; +enum fail19630b = int4.init.array[1..2]; +enum fail19630c = (cast(int[4])int4.init.array)[1..2]; +enum fail19630d = int4(0)[1..2]; +enum fail19630e = int4(0).array[1..2]; +enum fail19630f = (cast(int[4])int4(0).array)[1..2]; +enum fail19630g = (cast(int[4])int4.init)[1..2]; +enum fail19630h = (cast(int[4])int4(0))[1..2]; + +// Same tests as above, but use access via enum. +enum int4 V1 = int4.init; +enum int[4] V2 = int4.init.array; +enum int[4] V3 = cast(int[4])int4.init; +enum int[4] V4 = cast(int[4])int4.init.array; +enum int4 V5 = int4(0); +enum int[4] V6 = int4(0).array; +enum int[4] V7 = cast(int[4])int4(0); +enum int[4] V8 = cast(int[4])int4(0).array; + +// CTFE index tests +enum I1 = V1[0]; static assert(I1 == 0); +enum I2 = V2[0]; static assert(I2 == 0); +enum I3 = V3[0]; static assert(I3 == 0); +enum I4 = V4[0]; static assert(I4 == 0); +enum I5 = V5[0]; static assert(I5 == 0); +enum I6 = V6[0]; static assert(I6 == 0); +enum I7 = V7[0]; static assert(I7 == 0); +enum I8 = V8[0]; static assert(I8 == 0); + +// CTFE slice tests +enum S1 = V1[1..2]; static assert(S1 == [0]); +enum S2 = V2[1..2]; static assert(S2 == [0]); +enum S3 = V3[1..2]; static assert(S3 == [0]); +enum S4 = V4[1..2]; static assert(S4 == [0]); +enum S5 = V5[1..2]; static assert(S5 == [0]); +enum S6 = V6[1..2]; static assert(S6 == [0]); +enum S7 = V7[1..2]; static assert(S7 == [0]); +enum S8 = V8[1..2]; static assert(S8 == [0]); + +// Same tests as above, but use access via immutable. +//immutable int4 v1 = int4.init; // Cannot cast to immutable at compile time +immutable int[4] v2 = int4.init.array; +immutable int[4] v3 = cast(int[4])int4.init; +immutable int[4] v4 = cast(int[4])int4.init.array; +//immutable int4 v5 = int4(0); // Cannot cast to immutable at compile time +immutable int[4] v6 = int4(0).array; +immutable int[4] v7 = cast(int[4])int4(0); +immutable int[4] v8 = cast(int[4])int4(0).array; + +// CTFE index tests +//immutable i1 = v1[0]; static assert(i1 == 0); +immutable i2 = v2[0]; static assert(i2 == 0); +immutable i3 = v3[0]; static assert(i3 == 0); +immutable i4 = v4[0]; static assert(i4 == 0); +//immutable i5 = v5[0]; static assert(i5 == 0); +immutable i6 = v6[0]; static assert(i6 == 0); +immutable i7 = v7[0]; static assert(i7 == 0); +immutable i8 = v8[0]; static assert(i8 == 0); + +// CTFE slice tests +//immutable s1 = v1[1..2]; static assert(s1 == [0]); +immutable s2 = v2[1..2]; static assert(s2 == [0]); +immutable s3 = v3[1..2]; static assert(s3 == [0]); +immutable s4 = v4[1..2]; static assert(s4 == [0]); +//immutable s5 = v5[1..2]; static assert(s5 == [0]); +immutable s6 = v6[1..2]; static assert(s6 == [0]); +immutable s7 = v7[1..2]; static assert(s7 == [0]); +immutable s8 = v8[1..2]; static assert(s8 == [0]); diff --git a/gcc/testsuite/gdc.dg/torture/gdc309.d b/gcc/testsuite/gdc.dg/torture/gdc309.d index d14634a..acda2bb 100644 --- a/gcc/testsuite/gdc.dg/torture/gdc309.d +++ b/gcc/testsuite/gdc.dg/torture/gdc309.d @@ -1,4 +1,5 @@ // https://bugzilla.gdcproject.org/show_bug.cgi?id=309 +// { dg-additional-options "-Wno-deprecated" } // { dg-do run } // { dg-skip-if "needs gcc/config.d" { ! d_runtime } } diff --git a/gcc/testsuite/gdc.dg/torture/pr94424.d b/gcc/testsuite/gdc.dg/torture/pr94424.d index 2910c9a..dc30639 100644 --- a/gcc/testsuite/gdc.dg/torture/pr94424.d +++ b/gcc/testsuite/gdc.dg/torture/pr94424.d @@ -17,3 +17,19 @@ assert(__cmp([c2, c2], [c1, c1]) > 0); assert(__cmp([c2, c2], [c2, c1]) > 0); } + +@safe unittest +{ + struct C + { + char i; + this(char i) { this.i = i; } + } + + auto c1 = C(1); + auto c2 = C(2); + + assert(__cmp([c1, c1][], [c2, c2][]) < 0); + assert(__cmp([c2, c2], [c1, c1]) > 0); + assert(__cmp([c2, c2], [c2, c1]) > 0); +} diff --git a/gcc/testsuite/gdc.dg/torture/pr94777b.d b/gcc/testsuite/gdc.dg/torture/pr94777b.d index 2f0f9d9..e9da63f 100644 --- a/gcc/testsuite/gdc.dg/torture/pr94777b.d +++ b/gcc/testsuite/gdc.dg/torture/pr94777b.d @@ -27,42 +27,6 @@ void testVariadic(T)(int nargs, ...) /******************************************/ -struct Constructor -{ - static int count; - int value; - this(int v) { count++; this.value = v; } -} - -unittest -{ - auto a0 = Constructor(0); - auto a1 = Constructor(1); - auto a2 = Constructor(2); - testVariadic!Constructor(3, a0, a1, a2); - assert(Constructor.count == 3); -} - -/******************************************/ - -struct Postblit -{ - static int count = 0; - int value; - this(this) { count++; } -} - -unittest -{ - auto a0 = Postblit(0); - auto a1 = Postblit(1); - auto a2 = Postblit(2); - testVariadic!Postblit(3, a0, a1, a2); - assert(Postblit.count == 3); -} - -/******************************************/ - struct Destructor { static int count = 0; @@ -80,102 +44,3 @@ unittest } assert(Destructor.count == 3); } - -/******************************************/ - -struct CopyConstructor -{ - static int count = 0; - int value; - this(int v) { this.value = v; } - this(ref typeof(this) other) { count++; this.value = other.value; } -} - -unittest -{ - auto a0 = CopyConstructor(0); - auto a1 = CopyConstructor(1); - auto a2 = CopyConstructor(2); - testVariadic!CopyConstructor(3, a0, a1, a2); - // NOTE: Cpctors are not implemented yet. - assert(CopyConstructor.count == 0 || CopyConstructor.count == 3); -} - -/******************************************/ - -unittest -{ - struct Nested - { - int value; - } - - auto a0 = Nested(0); - auto a1 = Nested(1); - auto a2 = Nested(2); - testVariadic!Nested(3, a0, a1, a2); -} - -/******************************************/ - -unittest -{ - struct Nested2 - { - int value; - } - - void testVariadic2(int nargs, ...) - { - import core.stdc.stdarg; - foreach(i; 0 .. nargs) - { - auto arg = va_arg!Nested2(_argptr); - assert(arg.value == i); - } - } - - auto a0 = Nested2(0); - auto a1 = Nested2(1); - auto a2 = Nested2(2); - testVariadic2(3, a0, a1, a2); -} - -/******************************************/ - -struct EmptyStruct -{ -} - -unittest -{ - auto a0 = EmptyStruct(); - auto a1 = EmptyStruct(); - auto a2 = EmptyStruct(); - testVariadic!EmptyStruct(3, a0, a1, a2); -} - -/******************************************/ - -alias StaticArray = int[4]; - -unittest -{ - StaticArray a0 = 0; - StaticArray a1 = 1; - StaticArray a2 = 2; - // XBUG: Front-end rewrites static arrays as dynamic arrays. - //testVariadic!StaticArray(3, a0, a1, a2); -} - -/******************************************/ - -alias EmptyArray = void[0]; - -unittest -{ - auto a0 = EmptyArray.init; - auto a1 = EmptyArray.init; - auto a2 = EmptyArray.init; - testVariadic!EmptyArray(3, a0, a1, a2); -} diff --git a/gcc/testsuite/gdc.dg/torture/simd17344.d b/gcc/testsuite/gdc.dg/torture/simd17344.d new file mode 100644 index 0000000..fd5ffbe --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/simd17344.d @@ -0,0 +1,11 @@ +// https://issues.dlang.org/show_bug.cgi?id=17344 +// { dg-additional-options "-mavx" { target avx_runtime } } +// { dg-do run { target { avx_runtime || vect_sizes_16B_8B } } } +// { dg-skip-if "needs gcc/config.d" { ! d_runtime } } + +void main() +{ + __vector(int[4]) vec1 = 2, vec2 = vec1++; + assert(cast(int[4])vec1 == [3, 3, 3, 3]); + assert(cast(int[4])vec2 == [2, 2, 2, 2]); +} diff --git a/gcc/testsuite/gdc.dg/torture/simd20052.d b/gcc/testsuite/gdc.dg/torture/simd20052.d new file mode 100644 index 0000000..4587351 --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/simd20052.d @@ -0,0 +1,17 @@ +// { dg-additional-options "-mavx2" { target avx2_runtime } } +// { dg-do run { target { avx2_runtime || vect_sizes_32B_16B } } } +// { dg-skip-if "needs gcc/config.d" { ! d_runtime } } +import core.simd; + +auto test20052() +{ + struct S { long4 v; } + S s; + return s; +} + +void main() +{ + test20052(); +} + diff --git a/gcc/testsuite/gdc.dg/torture/simd6.d b/gcc/testsuite/gdc.dg/torture/simd6.d new file mode 100644 index 0000000..d8de02e --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/simd6.d @@ -0,0 +1,26 @@ +// { dg-additional-options "-mavx2" { target avx2_runtime } } +// { dg-do run { target { avx2_runtime || vect_sizes_32B_16B } } } +// { dg-skip-if "needs gcc/config.d" { ! d_runtime } } +import core.simd; + +void test6a() +{ + // stack occasionally misaligned + float f = 0; + long4 v; + assert((cast(size_t)&v) % 32 == 0); + v += 1; +} + +void test6b() +{ + struct S {long4 v;} + S s; + assert((cast(size_t)&s) % 32 == 0); +} + +void main() +{ + test6a(); + test6b(); +} diff --git a/gcc/testsuite/gdc.dg/torture/simd7.d b/gcc/testsuite/gdc.dg/torture/simd7.d new file mode 100644 index 0000000..6e890de --- /dev/null +++ b/gcc/testsuite/gdc.dg/torture/simd7.d @@ -0,0 +1,18 @@ +// { dg-additional-options "-mavx2" { target avx2_runtime } } +// { dg-do run { target { avx2_runtime || vect_sizes_32B_16B } } } +// { dg-skip-if "needs gcc/config.d" { ! d_runtime } } +import core.simd; + +double4 test7r(double4 v) +{ + return v; +} + +void main() +{ + // 32 bytes sliced down to 16 bytes + double4 v = 1; + double4 r = test7r(v); + assert(v[2] == r[2]); + assert(v[3] == r[3]); +} |