Commit graph

40501 commits

Author SHA1 Message Date
Walter Bright
0b29c8a5bd
start on prolog_saveregs() and epilog_restoreregs() (#21130) 2025-04-01 16:02:46 +08:00
Walter Bright
dd2fc8c8bb
load floating point with * operator (#21129) 2025-04-01 16:01:56 +08:00
Samrendra Pratap Singh
869266c2ef
Improve error message when cl.exe is missing on Windows (#21120) 2025-04-01 07:15:15 +08:00
Walter Bright
bd670444c7
redundate add of Voffset, disassembler correction (#21128) 2025-04-01 06:57:54 +08:00
Dennis
4d0934d37f
merge stable (#21127)
* bump VERSION to v2.110.0

* purge changelog

* bump VERSION to v2.111.0-beta.1

* Accept __rvalue attribute on ref functions; which will force the result to be treated as __rvalue. (#20946)

This is essential to implement `move`, `forward`, etc.

* memoryerror.d: Fix AnySupported version condition (#20983)

* Fix #20982 - wrong line number in iasmgcc (#20993)

* Move genCfunc to cxxfrontend (#20992)

* druntime: Fix compilation of rt.cover on Android (#21015)

* Expose SourceLoc to C++ interface (#20980)

* [stable] C++ header fixes for declaration, expression, and typinf (#21016)

Seen either from compilation errors or missing symbols at link time.

* C++ headers: Add 3 Declaration bitfield setters/getters required by LDC

* druntime: Add module declaration to rt.invariant, to prevent conflicts with user-provided invariant.d (#21017)

* Fix #21020 - Indexing a *cast* AA yields no lvalue anymore (#21029)

* Add C++23 to CppStdRevision enum (#21043)

* Improve UFCS/property error message (#21046)

* bump VERSION to v2.111.0-rc.1

* Fix #21045 - import __stdin causes compilation to pause while reading from stdin (#21047)

Moves the special handling of reading from stdin out of the semantic
routines to the DMD driver itself. All references to `__stdin.d` have
also been removed from the frontend implementation.

* Update source code and coverage links (#21111)

* Fix #21024 - Optimize x^^c expressions (#21082)

* Fix #21024 - Optimize x^^c expressions

Reason for the *magic* constraint c<8 on inlining x^^c:

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/fpu/e_powl.S;h=47f129f34d368d7c67b8e5f2462b36b0bebb7621;hb=HEAD#l136

* Fix poor assumption about expression state

* Restrict optimization to floating point expressions

* Generalize optimization to any scalar data type

* Fix segfault on x^^c where x is a single member anonymous enum

DMD segfaulted on compiling the unittests in std/algorithm/sorting.o, the
unittest that caused the segfault can be reduced to:

    enum real Two = 2.0;
    auto _ = Two^^3;

I'm not sure why copying the anonymous enum into a `const` variable causes
the compiler to segfault.

* Add tests to x^^c inlining optimization

* Fix missing type for e1 ^^ -1 to 1 / e1 rewrite

* Move rewrites from constant folding to expression semantic and restrict them to [-1, 2]

* Improve error message for the x^^2 rewrite.

Before:
    ex.d(4): Error: can implicitly convert expression `(const const(double) __powtmp2 = x + 5.0;) , __powtmp2 * ...` of type `double` to `int`
        int y = ( x + 5 ) ^^ 2;
                ^
and after:
    ex.d(4): Error: cannot implicitly convert expression `(x + 5.0) ^^ 2L` of type `double` to `int`
        int y = ( x + 5 ) ^^ 2;
                ^

* Update C++ frontend header to match change in `CommaExp`

* Address code review feedback

Co-authored-by: Dennis Korpel <dkorpel@gmail.com>

---------

Co-authored-by: Dennis Korpel <dkorpel@gmail.com>

* Revert "Fix #21024 - Optimize x^^c expressions (#21082)" (#21114)

This reverts commit fa1f860e4b.

* bump VERSION to v2.111.0

* purge changelog

* Strip trailing newline off sarif version

---------

Co-authored-by: Manu Evans <turkeyman@gmail.com>
Co-authored-by: Martin Kinkelin <kinke@users.noreply.github.com>
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
Co-authored-by: Martin Kinkelin <noone@nowhere.com>
Co-authored-by: Fares A. Bakhit <faresa.bakhit@gmail.com>
2025-03-31 15:54:53 +02:00
Walter Bright
c78c240d37
improve formatting of disassembly output (#21123) 2025-03-30 21:18:18 -07:00
Walter Bright
6656cd920c
partially implement cdstreq() (#21117) 2025-03-30 20:12:13 +08:00
Iain Buclaw
5c9c91a651 pow: Ensure side effects are evaluated in e1^^0 rewrite 2025-03-29 21:39:12 +01:00
Dennis
95fdc47f5f
Fix #21024 - Optimize x^^c expressions (#21082) (#21115)
* Fix #21024 - Optimize x^^c expressions

Reason for the *magic* constraint c<8 on inlining x^^c:

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/fpu/e_powl.S;h=47f129f34d368d7c67b8e5f2462b36b0bebb7621;hb=HEAD#l136

* Fix poor assumption about expression state

* Restrict optimization to floating point expressions

* Generalize optimization to any scalar data type

* Fix segfault on x^^c where x is a single member anonymous enum

DMD segfaulted on compiling the unittests in std/algorithm/sorting.o, the
unittest that caused the segfault can be reduced to:

    enum real Two = 2.0;
    auto _ = Two^^3;

I'm not sure why copying the anonymous enum into a `const` variable causes
the compiler to segfault.

* Add tests to x^^c inlining optimization

* Fix missing type for e1 ^^ -1 to 1 / e1 rewrite

* Move rewrites from constant folding to expression semantic and restrict them to [-1, 2]

* Improve error message for the x^^2 rewrite.

Before:
    ex.d(4): Error: can implicitly convert expression `(const const(double) __powtmp2 = x + 5.0;) , __powtmp2 * ...` of type `double` to `int`
        int y = ( x + 5 ) ^^ 2;
                ^
and after:
    ex.d(4): Error: cannot implicitly convert expression `(x + 5.0) ^^ 2L` of type `double` to `int`
        int y = ( x + 5 ) ^^ 2;
                ^

* Update C++ frontend header to match change in `CommaExp`

* Address code review feedback



---------

Co-authored-by: Fares A. Bakhit <faresa.bakhit@gmail.com>
2025-03-29 13:57:10 +01:00
Dennis
c3923870ee
Improve linker error suggestions (#21109)
- Newer versions of ld already demangle D symbols, recognize those as D symbols instead of C.
- Don't suggest -i if it's already used
- Add special hint for missing std/core symbols when using betterC
- Simplify unittest to string compare the full error text instead of trying to half-parse the sentences
2025-03-29 11:48:17 +01:00
Dennis
712cc9bf36
backend: Remove some void/unsafe initialization (#21107)
* backend: Remove some void/unsafe initialization

* Remove isZeroInit checks since bootstrap compiler lacks that trait
2025-03-29 11:47:58 +01:00
Rainer Schuetze
13d0a42ad5
Fix #21105: Is-expressions should not generate unnecessary code for lowerings (#21106)
treat as if compiling with __traits(compiles)
2025-03-29 08:36:10 +08:00
Dennis
cfa763d301
Turn macro translations into template functions (#21108) 2025-03-29 06:31:49 +08:00
Walter Bright
ce15cb9c65
errors in cdpost() (#21103) 2025-03-28 14:57:02 +01:00
Abul Hossain Khan
228f8dbcea
Improve fix: #20867 ICE on final switch forward referencing its enum. (#21097)
* Mark C enums as semantic2done to prevent segfaults in final switch

* Added corresponding test case
2025-03-28 10:13:12 +01:00
Walter Bright
21cfefc9d1
in codelem(), use AArc64 register masks (#21101) 2025-03-28 03:58:53 +08:00
Walter Bright
001893d99c
size_t was wrong, sign extension omitted (#21093) 2025-03-27 16:20:38 +08:00
Walter Bright
653658faad
neglected to generate code for cdeq() (#21090) 2025-03-27 07:20:05 +08:00
Abul Hossain Khan
ce91ddca22
Optimize Loc Lookups (#21088) 2025-03-27 03:32:01 +08:00
Nick Treleaven
13b0745e33
Fix error when struct initializer isn't accepted (#21086)
* Fix error when struct initializer isn't accepted

* Rename StructDeclaration.hasRegularCtor parameter to ignoreDisabled

checkDisabled detected disabled ctors when it was false, which was
confusing!

* Update tests
2025-03-26 11:28:07 +01:00
Dennis
3142290b6f
Improve 'no property' error suggestions for pointers (#21087) 2025-03-26 15:43:36 +08:00
Samrendra Pratap Singh
c26b03fba2
Fix dlang#18262 - Fix expected error message for enum auto-increment (#21067)
* Fix dlang#18262 - Resolved special enum case and other conflicts

* Fix dlang#18262 - Resolved Special Enum case and failing test.

* Fix dlang#18262 - Resolved special enum case and other failing tests
2025-03-25 18:25:34 +08:00
Martin Kinkelin
b390c7ec13 [druntime] core.int128: Add 64-bit mul() overload and optimize via inline asm on x86_64 2025-03-25 16:12:24 +08:00
Walter Bright
6c160b78d5 fix cdpost() 2025-03-25 16:12:03 +08:00
Walter Bright
2c8d214650 AArch64 cannot compare shorts directly 2025-03-25 16:11:13 +08:00
Walter Bright
8c4a95f083 add has to be in addition to fixup 2025-03-24 16:27:16 +08:00
Martin Kinkelin
6b7bbdd330 [druntime] core.int128: Optimize new udivmod overload via inline asm on x86_64 2025-03-24 14:43:17 +08:00
Martin Kinkelin
3a661c1f8c [druntime] core.int128: Extract nested udivmod128_64 as udivmod overload 2025-03-24 14:43:17 +08:00
Martin Kinkelin
ea4b1e9607 [druntime] core.int128: Don't support/test invalid shift-by values >= 128
This enables using (LLVM/gcc) intrinsics for shifts, for which such
inputs are undefined behavior, as for builtin types.
2025-03-24 14:43:17 +08:00
Walter Bright
f4da0efbd2
add target.isAArch64 to e2ir.d (#21074) 2025-03-24 14:42:27 +08:00
Walter Bright
63152e453c
AArch64 doesn't have LEA instruction, so use pointers instead of Effective Address (#21072) 2025-03-24 13:46:53 +08:00
Abhay Pratap
2036516c17
Refactored memcpy calls to D slices (#21062)
* Refactored memcpy calls to D slices

* Added .DS_Store to .gitignore
2025-03-24 07:12:13 +08:00
Nick Treleaven
e896b5c98d
Fix hidden base constructor supplemental message (#21069)
Fixes #21068.
Also say base class *constructor* in supplemental message.
2025-03-24 05:47:29 +08:00
Walter Bright
c4d45a1a49
AArch64 does not have LEA, fake it (#21064) 2025-03-23 12:25:05 +08:00
Dennis
0ae065db22
Fix #20901: can escape stack pointer through indexed array literal (#21063) 2025-03-23 08:35:43 +08:00
Dennis
53024b9fc5
Don't raise "cannot return non-void" on Terror (#21028) 2025-03-23 07:40:57 +08:00
Dennis
90e1a584b5
Refactor checkGC (#21058) 2025-03-23 06:08:04 +08:00
Dennis
7fb4d613af
Use errorSupplemental for long errors with 2 sentences (#21060) 2025-03-23 06:03:20 +08:00
Dennis
31bfe613b0
Require adjacent auto ref return as well (#21061) 2025-03-23 05:59:00 +08:00
Dennis
8a96c4745c
Fix #21054 - No location for array literal sliced from init symbol (#21055) 2025-03-22 16:26:49 +08:00
Walter Bright
14874cffd8
more common subexpression bugs (#21056) 2025-03-22 16:26:00 +08:00
Dennis
dce0ebac9b
Fix #21052 - Missing @nogc check for enum variable initialization (#21053) 2025-03-22 07:40:34 +08:00
Dennis
649223bff5
Remove redundant GC allocation for _d_newarraymTX.dims (#21051) 2025-03-22 06:36:00 +08:00
Walter Bright
8d7c4d6227
bug in cddivass() (#21050) 2025-03-21 14:15:57 -07:00
Dennis
d5db322fce
Merge stable (#21048)
* bump VERSION to v2.110.0

* purge changelog

* bump VERSION to v2.111.0-beta.1

* Accept __rvalue attribute on ref functions; which will force the result to be treated as __rvalue. (#20946)

This is essential to implement `move`, `forward`, etc.

* memoryerror.d: Fix AnySupported version condition (#20983)

* Fix #20982 - wrong line number in iasmgcc (#20993)

* Move genCfunc to cxxfrontend (#20992)

* druntime: Fix compilation of rt.cover on Android (#21015)

* Expose SourceLoc to C++ interface (#20980)

* [stable] C++ header fixes for declaration, expression, and typinf (#21016)

Seen either from compilation errors or missing symbols at link time.

* C++ headers: Add 3 Declaration bitfield setters/getters required by LDC

* druntime: Add module declaration to rt.invariant, to prevent conflicts with user-provided invariant.d (#21017)

* Fix #21020 - Indexing a *cast* AA yields no lvalue anymore (#21029)

* Add C++23 to CppStdRevision enum (#21043)

* Improve UFCS/property error message (#21046)

---------

Co-authored-by: Manu Evans <turkeyman@gmail.com>
Co-authored-by: Martin Kinkelin <kinke@users.noreply.github.com>
Co-authored-by: Iain Buclaw <ibuclaw@gdcproject.org>
Co-authored-by: Martin Kinkelin <noone@nowhere.com>
2025-03-21 15:48:21 +01:00
Walter Bright
803a44a347
2 more detail bugs (#21044) 2025-03-21 16:49:42 +08:00
Abul Hossain Khan
dafb58bc77
Fix: Prevent ICE on final switch forward referencing its enum (#21001)
* Fix: Prevent ICE on final switch forward referencing its enum

* more simpler approach

* moved the enum member analysis

* Move enum number analysis to sementic2

* WhiteSpace Remove

* Remove Redundant Code in enumsem
2025-03-20 16:43:37 +01:00
Walter Bright
49a7c10bdf
arguments swapped for loadFromEA() (#21040) 2025-03-20 16:07:57 +08:00
Walter Bright
996de2ad3a
wrong register mask for cssave() (#21037) 2025-03-20 16:03:47 +08:00
Nayaab Zameer
cfefcdd657
Remove Unused RTLSYMs from DMD (#21032)
* Remove RTLSYM for Translation PR #15819: Removed NEWARRAYMITX, NEWARRAYMITX, TRACENEWARRAYMTX and TRACENEWARRAYMITX

* Remove RTLSYM for Translation PR #15299: Removed NEWARRAYT, NEWARRAYIT, TRACENEWARRAYT and TRACENEWARRAYIT

* Remove RTLSYM for Translation PR #14837: Removed NEWCLASS, TRACENEWCLASS

* Remove RTLSYM for Translation PR #14664: Removed NEWITEMT, NEWITEMIT, TRACENEWITEMT and TRACENEWITEMIT

* Remove RTLSYM for Translation PR #14550: Removed ARRAYCATNTX, ARRAYCATT, TRACEARRAYCATNTX and TRACEARRAYCATT

* Remove RTLSYM for Translation PR #14382: Removed ARRAYSETASSIGN

* Remove RTLSYM for Translation PR #14310: Removed ARRAYASSIGN

* Remove RTLSYM for Translation PR #13495: Removed ARRAYAPPENDT, ARRAYAPPENDCTX, TRACEARRAYAPPENDT and TRACEARRAYAPPENDCTX
2025-03-19 14:03:09 +08:00