Commit graph

533 commits

Author SHA1 Message Date
Dennis
8dcef66a5f
Revert "Fix #21024 - Optimize x^^c expressions (#21082)" (#21114)
This reverts commit fa1f860e4b.
2025-03-29 12:25:53 +01:00
Fares A. Bakhit
fa1f860e4b
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>
2025-03-29 12:13:38 +01:00
Iain Buclaw
02a64d2e13
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.
2025-03-22 13:00:35 +01:00
Dennis
9d2f034398
Improve UFCS/property error message (#21046) 2025-03-21 15:15:29 +01:00
Dennis Korpel
5375db4f76 Merge branch 'stable' into merge-stable 2025-03-05 11:03:30 +01:00
Walter Bright
73158d8a78 add Placement New 2025-03-03 16:23:02 +10:00
Dennis
2c304a4377
Fix #20929 - #line directives mess up -verrors=context (#20930) 2025-02-28 23:47:26 +01:00
Dennis
54a142412c
Improve error for failing opDispatch instantiation (#20902) 2025-02-20 10:40:10 +01:00
Dennis
0e5c41f799
Escape backticks in error messages (#20893) 2025-02-19 07:06:47 +08:00
Dennis
e082ce247a
Expand toErrMsg to other types (#20896) 2025-02-19 06:39:32 +08:00
Elias Batek
f68ca2cbe0
Fix #20888 - Compiler spits out implicit conversion technobabble when a return statement doesn't match the return type of a function (#20890) 2025-02-18 16:55:56 +08:00
Dennis Korpel
b5e0bee399 Fix fail_compilation/retscope TEST_OUTPUT blocks 2025-02-17 23:29:05 +01:00
Dennis Korpel
efd10b140c Print function bodies instead of __lambda in error messages 2025-02-17 00:41:33 +01:00
Dennis Korpel
eb083c06d9 Fix #20859 - ICE: class with __vtbl field name causes segfault in Scope::inCfile 2025-02-16 23:45:36 +01:00
Dennis
961862c455
Deprecate typesafe variadic class arguments (#20673) 2025-02-16 21:35:11 +01:00
Dennis
9f33f031f0
Rephrase "no identifier for declarator" parse error (#20872) 2025-02-16 08:09:43 +08:00
Dennis
4b57724c91
Improve parser errors for statements at global scope (#20871) 2025-02-15 23:50:34 +01:00
Dennis
d29e3eca45
Remove reference to _d_arrayassign in errors (#20808) 2025-01-31 00:08:38 +01:00
Dennis
0ecefd78ef
Improve error messages for missing opCmp / opEquals (#20806) 2025-01-30 23:31:36 +01:00
Dennis
bfbac11136
Don't expose internal names in errors (#20803) 2025-01-30 21:49:50 +08:00
Dennis
06d0cfe2ba
Improve error messages for opUnary (#20801) 2025-01-30 19:44:05 +08:00
Dennis
06e0096aca
Improve opOpAssign error messages (#20800) 2025-01-30 15:04:17 +08:00
Dennis
28bc5c6e74
Fix #20763 - Inconsistent handling of type + value in typeof expressions (#20798)
* Fix #20763 - Inconsistent handling of type + value in typeof expressions

* Add supplemental error

---------

Co-authored-by: Dennis Korpel <dennis@sarc.nl>
2025-01-29 11:26:01 +01:00
Dennis
a55dff5f28
Improve opIndex/opSlice error messages (#20791) 2025-01-28 18:44:46 +08:00
Dennis
ea9ead9cae
Improve opBinary error messages (#20789) 2025-01-28 06:23:30 +08:00
Dennis
cb31f45e15
Remove references to D1 opDot (#20772) 2025-01-24 12:00:29 +01:00
Dennis
72a9347165
Fix #18281 - ICE on attempt to compare deref of two functions ptr (#20768) 2025-01-24 07:32:18 +08:00
Dennis
be6a7bb529
Fix #20730 - print SymOff with unsigned offset (#20769) 2025-01-24 06:13:11 +08:00
Dennis Korpel
279f3054bf Short-circuit checkArithmeticBin when lhs is an error 2025-01-23 20:59:30 +08:00
Dennis Korpel
8358e6d33f Move AddExp type check from typeCombine to expressionSemantic 2025-01-23 20:59:30 +08:00
Dennis
096c9c1528
Make delete an identifier instead of keyword (#20745) 2025-01-21 23:33:50 +01:00
Dennis
f05ccbd0e7
Remove class allocator parsing (#20747) 2025-01-21 19:32:51 +08:00
Dennis
fc2b2271a6
Remove D1 operators from the D2 language (#20744) 2025-01-21 06:08:05 +08:00
Dennis
2a627016f6
Disallow initializing fields with themself (#20696) 2025-01-21 05:49:24 +08:00
Andrey Penechko
ec7c24bb72
Add test cases for static arrays initialization with hex string (#20738) 2025-01-19 21:13:58 +08:00
Dennis Korpel
a78abc4328 Improve error locations when lexing number literals 2025-01-16 22:05:21 +01:00
Dennis
888917669c
Remove debug() / version() integers (#20713) 2025-01-16 15:20:06 +08:00
Dennis
20090aba96
Make inferred attribute failure errors more compact and consistent (#20711) 2025-01-16 01:42:05 +01:00
Walter Bright
eb8418a772
build default move constructors (#20634) 2025-01-10 11:19:29 -08:00
Dennis Korpel
8b215f8c16 Fix missing backtick in escape.d error message 2025-01-10 17:52:17 +01:00
Dennis
69664b922d
Merge pull request #20577 from thewilsonator/pointer-subtract
Make subtracting pointers of different types an error
2025-01-09 15:06:33 +01:00
Nicholas Wilson
8d2fe40f4b Fix #20330 - Make subtracting pointers of different types an error 2025-01-08 15:44:38 +08:00
Dennis
9b94878c85
Make safe error messages consistent (#20654)
Co-authored-by: Dennis Korpel <dennis@sarc.nl>
2025-01-08 13:46:38 +08:00
Dennis
95145b4ee7
Fix -verrors=context handling of tabs (#20640) 2025-01-07 14:39:25 +08:00
Dennis Korpel
ec66babbc5 Print match level for ambiguous overloads 2025-01-05 13:28:09 +01:00
Quirin F. Schroll
3f90de47c1
Fixes #20587 - Add align(default) (#20589) 2024-12-30 13:02:14 +08:00
Walter Bright
a99a3894be
add __rvalue(expression) builtin (#17050) 2024-12-15 12:13:28 -08:00
Nicholas Wilson
13775eb2d1
Fix #18235 - Add offending member to "no size because of forward reference" error (#20557)
Co-authored-by: Nick Treleaven <ntrel002@gmail.com>
2024-12-15 18:23:36 +08:00
Nick Treleaven
a7f6b04a0c
Don't allow short constructor with non-void expression except this() and super() (#17489) 2024-12-08 17:21:42 +08:00
Dennis Korpel
74c40e9be0 Merge branch 'stable' into master 2024-11-29 12:46:40 +01:00