Commit graph

230 commits

Author SHA1 Message Date
Walter Bright
a99a3894be
add __rvalue(expression) builtin (#17050) 2024-12-15 12:13:28 -08:00
Ilya Yanok
451c1596be Make lambda symbols stable post a3abf1187e
Commit a3abf1187e fixes some cases of
lambdas having unstable symbol names between compilation units by
using `generateIdWithLoc` to generate stable lambda names, however since
LOC doesn't uniquely identify a lambda instance (because templates,
mixins, static foreach and foreach unrolling), `generateIdWithLoc`
adds a counter, so there is still some instability going on.

`generateIdWithLoc` makes the name uniq per file+loc, by adding adding a
numeric suffix. But the order of instantiations might be different
across compilation units, so with this counting scheme we are back to
unstable names, so one module might have

`t!0.__lambda_LOC` and
`t!1.__lambda_LOC_1`

while another one has

`t!1.__lambda_LOC`

This is not a critical problem, but at very least the code gets
duplicated for no reason. I also have an example where it leads to
linking error, but since it's not a small one and fails to minimize
further, I suspect it's a result of interaction with some other bug.

The thing is we don't even need uniqueness for those lambdas inside
templates/mixins: their final names will have the instantiation prefix anyway.
But we can't also just disable this uniqueness check completely: `static
foreach` as well as unrollings of the normal `foreach` with lambdas in
the loop body will have several copies of a single lambda with the same
file+loc. So here we do want to keep making them unique. Fortunately, I
don't think a `foreach` could be iterated in different order in
different compilation units, so hopefully if we limit the counting to
this case only, it won't make symbols unstable.

To implement this idea, I've added an extra `parent` argument to
`generateIdWithLoc`: it works like using `parent ~ prefix` prefix, but
without adding `parent` to the final output.

Fixes since last review:
 1. Changed `fromStringz` to `toDString`
 2. Added a test to showcase the problem
2024-12-04 11:04:26 +01:00
Dennis Korpel
74c40e9be0 Merge branch 'stable' into master 2024-11-29 12:46:40 +01:00
Richard (Rikki) Andrew Cattermole
6567f6f4a4 Fix bugzilla issue 24882 - COM class is allocated using GC not malloc 2024-11-29 08:37:07 +01:00
Dennis Korpel
8b1eb80d25 Fix bugzilla 24884 - backend generates wrong 32-bit code after inlining math with double[4] 2024-11-29 08:35:16 +01:00
Dennis
a3abf1187e
Fix 23722 - Lambdas are mangled incorrectly when using multiple compi… (#15343)
* Fix 23722 - Lambdas are mangled incorrectly when using multiple compilation units, resulting in incorrect code

* Update test cases
2024-11-27 12:03:16 +01:00
Walter Bright
735193cc36 fix bugzilla Issue 24819 - Optimizer changes result of float calculations on 32-bit (#17023)
(cherry picked from commit 88d1e8fc37)
2024-10-25 01:47:41 +02:00
Walter Bright
88d1e8fc37
fix bugzilla Issue 24819 - Optimizer changes result of float calculations on 32-bit (#17023) 2024-10-24 13:01:19 +02:00
Nicholas Wilson
57c5b071af
Rebase stable6 (#16967)
* Document template instance duplication status as part of its field documentation. (#16643)

* Fix Bugzilla 24599 - Wrongly elided TypeInfo emission (#15868)

Reverting #14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).

* Reorganize backend build files to match target and make more similar per line (#16672)

* Remove redundant suggestions on linker errors (#16711)

* Fix bugzilla 24337 - Segfault when printing an int[] cast from a string (#16729)

* Add BitFieldStyle.Gcc_Clang_ARM

Required for 32-bit ARM, and non-Apple 64-bit ARM targets.

The only difference to `Gcc_Clang` is that anonymous and 0-length
bit-fields do contribute to the aggregate alignment.

Caught by existing proper C interop tests in
runnable_cxx/testbitfields.d on such targets. The hardcoded bad tests
in runnable/{bitfieldsposix64.c,dbitfieldsposix64.d} however now fail
after the fix, on such targets again.

* [refactor to `TargetC.contributesToAggregateAlignment(BitFieldDeclaration)` hook]

* Fix Bugzilla Issue 24687 - [REG2.110] Cannot cast string-imports to select overload anymore

* Also make deprecationSupplemental adhere to error limit (#16779)

Co-authored-by: Dennis Korpel <dennis@sarc.nl>

* Fix bugzilla 24699 - [REG2.108] No short-circuit evaluation of mixing template bool argument

* Fix bugzilla 24731 - IFTI cannot handle integer expressions (#16822)

* Fix Bugzilla Issue 24760 - ICE on variadic after default argument

* Fix bugzilla 24790 - -vcg-ast ICE on lowered assign exp (#16914)

Co-authored-by: Dennis Korpel <dennis@sarc.nl>

* Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant (#16917)

Co-authored-by: Dennis Korpel <dennis@sarc.nl>

* Fix bugzilla 24431 - dmd -vcg-ast crashes printing failed template in… (#16916)

---------

Co-authored-by: Richard (Rikki) Andrew Cattermole <richard@cattermole.co.nz>
Co-authored-by: Martin Kinkelin <kinke@users.noreply.github.com>
Co-authored-by: Dennis <dkorpel@users.noreply.github.com>
Co-authored-by: Martin Kinkelin <mkinkelin@symmetryinvestments.com>
Co-authored-by: Martin Kinkelin <noone@nowhere.com>
Co-authored-by: RazvanN7 <razvan.nitu1305@gmail.com>
Co-authored-by: Dennis Korpel <dennis@sarc.nl>
Co-authored-by: Dennis Korpel <dkorpel@gmail.com>
2024-10-07 12:00:14 +03:00
Dennis Korpel
64df340150 Fix bugzilla 24748 - DMD can't output object files with fully qualified name, making -od overwirte each other file 2024-09-13 15:38:28 +01:00
Dennis
96d630c644
Fix bugzilla 24731 - IFTI cannot handle integer expressions (#16822) 2024-08-31 21:20:35 +08:00
Nick Treleaven
717e872d37
Fix Bugzilla 21564 - Allow assignment syntax for instantiating mixin templates (#16387)
Following the [alias this change](https://dlang.org/changelog/2.105.0.html#dmd.alias-this-syntax),
I think mixin instantiation was the last place not using assignment
syntax.
2024-08-28 15:02:55 +08:00
The Dlang Bot
d012868974
Merge pull request #16796 from RazvanN7/fix24701
Fix Bugzilla 24701 - No error produced from casted noreturn variable

Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2024-08-21 10:10:14 +02:00
Razvan Nitu
025b072a3e
Update compiler/test/runnable/noreturn2.d
Co-authored-by: Cameron Ross <elpenguino@gmail.com>
2024-08-20 10:44:50 +03:00
RazvanN7
f99288f35c
Fix Bugzilla 24701 - No error produced from casted noreturn variable 2024-08-19 19:27:30 +03:00
Dennis
2ac9a69e4e
Add test case for taking the address of array literal elements (#16785) 2024-08-19 17:00:20 +03:00
Dennis Korpel
f7f320a8e4 Implement auto ref for local variables 2024-08-07 05:49:49 +02:00
Walter Bright
dc1daca611
allow ref on locals, globals, and statics (#16428)
* allow ref on locals, globals, and statics

* add const to opEquals() overrides
2024-07-23 14:42:15 -07:00
Dennis
cf618a659c
Fix bugzilla 24337 - Segfault when printing an int[] cast from a string (#16729) 2024-07-22 11:00:31 +03:00
Nicholas Wilson
9a5ce0e1ef
Actually give deprecation for -noboundscheck (#16687)
This has been deprecated for at least 7 years...
2024-07-13 16:08:02 +08:00
Martin Kinkelin
7ab98b931a
Fix Bugzilla 24599 - Wrongly elided TypeInfo emission (#15868)
Reverting #14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).
2024-07-02 19:31:34 +02:00
Iain Buclaw
3c5d12bd1f Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-07-01 13:58:42 +00:00
Dennis Korpel
3e92cca51d Fix Bugzilla 24602 - Internal compiler error: failed to detect static initialization of associative array 2024-06-18 01:24:34 +02:00
Tim Schendekehl
4c82050e94 Fix bugzilla 24592 - ImportC: Bitfield layout wrong for int64 on 32-bit Linux
Type ulong is 64-bit on 32-bit Linux, but has 32-bit alignment.
This affects the layout of bitfields.

Also add a new test for ImportC bitfields, which compares size,
alignment and layout with the host C++ compiler. The existing
tests compared with fixed values instead.
2024-06-17 02:31:02 +02:00
Martin Kinkelin
83b62e9633 Add test case for Bugzilla 24590 2024-06-11 14:37:48 +02:00
Brian Callahan
a3eb99191d Fix Bugzilla 24598 2024-06-11 07:20:29 +02:00
Walter Bright
0da0c4b24e
add arm tests (#16563) 2024-06-05 15:31:02 -07:00
The Dlang Bot
97dc44aa76
Merge pull request #16521 from kinke/rm_cruntime_dm
Get rid of obsolete `{C,Cpp}Runtime_DigitalMars` special cases

Signed-off-by: Dennis <dkorpel@users.noreply.github.com>
Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
2024-05-25 22:14:39 +02:00
Martin Kinkelin
6d69608aae Get rid of some obsolete optlink workarounds 2024-05-25 18:07:16 +02:00
Martin Kinkelin
920678a820 Revise remaining 32{omf,mscoff} usages 2024-05-25 16:35:11 +02:00
Martin Kinkelin
f08bbff91f Get rid of obsolete CRuntime_DigitalMars special cases 2024-05-25 15:17:31 +02:00
Nick Treleaven
b5ddf51ea8
Improve @__future deprecation message (#16447)
Show location of base method.
Remove duplicate content in compilable/future.d.
2024-05-08 10:11:38 +03:00
Nick Treleaven
c61e18410b Fix Bugzilla 24525 - ref lambda not parsed at start of ExpressionStatement 2024-05-02 02:20:32 +02:00
Iain Buclaw
259e582f46 Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-04-25 19:11:19 +00:00
Dennis Korpel
6c501f3e51 Fix Bugzilla 24519 - compiler segfault on default argument with slice operator [] 2024-04-24 22:38:54 +08:00
Dennis Korpel
33c32407c0 Merge branch 'stable' into merge-stable 2024-04-23 14:44:01 +02:00
Dennis
499a85100a
Limit the number of deprecation messages by default (#16403) 2024-04-22 22:28:07 +08:00
Tim Schendekehl
f1307d6c75
Fix bugzilla 24498 - Multidimensional array not scanned by GC (#16400)
For expression `new int[][][](2, 2)` the relevant element type is
`int[]` and not `int`, because only two dimensions are allocated.
2024-04-19 22:13:27 +02:00
Dennis Korpel
14137cecb5 Consolidate C struct initializer tests 2024-04-11 18:42:03 +08:00
Artha
4f69ba59f3 Fix bugzilla issue 24495 - ImportC: Struct initialization expression fails to initialize field
Makes it possible to use multiple designated initializers for anonymous
structs in expressions like `{{ .b = 2, .c = 3 }}`. This previously
worked only if there was one initializer.
2024-04-11 06:15:43 +08:00
Dennis Korpel
ca2ff4b752 Fix bugzilla 24477 - Union access of bool shouldn't be allowed in @safe 2024-04-03 10:52:30 +08:00
Andrei Horodniceanu
e397d5e3d7 Prefix test that requires GDB with gdb
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
2024-04-02 01:08:34 +02:00
Dennis Korpel
55dcc3dc82 Fix endian issue when printing hex string literals 2024-03-15 12:31:41 +01:00
Dennis Korpel
4e3cc5c6c6 Make hex strings implicitly convert to integer arrays 2024-03-15 08:53:48 +01:00
Dennis Korpel
3e9bc4ee17 Add L postfix for hex string 2024-03-06 11:48:45 +01:00
Iain Buclaw
53cd4b7c30 Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-03-01 23:11:59 +00:00
Walter Bright
1261aea4d5 make sure hello world in C works 2024-02-24 06:49:24 +08:00
Iain Buclaw
baf8ee195a Fix Bugzilla 24401 - OSX: Linker error: GOT load reloc does not point to a movq instruction 2024-02-23 12:55:02 +08:00
Iain Buclaw
6f2a6f919d Fix Bugzilla 23517 - dmd with -g flag fails to link on macOS with unaligned pointer 2024-02-22 14:52:34 +01:00
Teodor Dutu
2423b93798 Fix Bugzilla Issue 24371 - String array concatenation does not respect operator precedence
Rethink lowering logic to account for parentheses and operator
associativity.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2024-02-20 20:40:45 +08:00