[Issue 24378] New: [REG 2.104] inout error with -profile=gc
https://issues.dlang.org/show_bug.cgi?id=24378 Issue ID: 24378 Summary: [REG 2.104] inout error with -profile=gc Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: tim.dl...@t-online.de ``` inout(char)[] foo(inout(char)[] s) pure @safe { s = s[0..1] ~ '%'; return s; } ``` The above code compiled with and without -profile=gc until DMD version 2.103. Since DMD 2.104 it only compiles without -profile=gc and produces the following error with -profile=gc: /path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/lifetime.d(1573): Error: `inout` on `return` means `inout` must be on a parameter as well for `pure nothrow @nogc @property @safe inout(char)[]()` /path/to/dmd.linux/dmd2/linux/bin64/../../src/druntime/import/core/internal/array/concatenation.d(174): Error: template instance `core.internal.array.concatenation._d_arraycatnTXTrace!(inout(char)[], inout(char)[], inout(char))._d_arraycatnTXTrace.forward!(__param_3, __param_4)` error instantiating onlineapp.d(3):instantiated from here: `_d_arraycatnTXTrace!(inout(char)[], inout(char)[], inout(char))` As a result of this issue, compiling DMD itself with -profile=gc does not work any more. --
[Issue 24377] New: Error: negative array dimension `3145728u * 1024u`[32bit]
https://issues.dlang.org/show_bug.cgi?id=24377 Issue ID: 24377 Summary: Error: negative array dimension `3145728u * 1024u`[32bit] Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: kde...@vogtner.de $ cat nad.d import std.stdio; void main() { auto arr = new char [3u * 1024 * 1024 * 1024]; // <--- error writefln ("%X", arr.length); } $ dmd -m32 ./nad.d ./nad.d(5): Error: negative array dimension `3145728u * 1024u` [unexpected] $ gdc -m32 nad.d -o nad $ ./nad C000 [expected] $ cat nad2.d import std.stdio; void main() { auto siz = 3u * 1024 * 1024 * 1024; auto arr = new char [siz]; writefln ("%X", arr.length); } $ dmd -m32 ./nad2.d $ ./nad2 C000 [expected] used compilers: - DMD64 D Compiler v2.105.3 - gcc (GCC) 12.1.0 --
[Issue 24376] New: ImportC: .di generator outputs D keywords for members
https://issues.dlang.org/show_bug.cgi?id=24376 Issue ID: 24376 Summary: ImportC: .di generator outputs D keywords for members Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ImportC Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dave287...@gmail.com This is already noted as a limitation of ImportC (the mismatch in keywords) and in D code you can work around it using __traits. However, in the .di generator you instead get a parse error: C code: struct foo { int version; const char* function; int uint; }; .di file: // ... struct foo { int version = void; const(char)* function = void; int uint = void; } // ... Trying to import the .di file will then fail. I think ideally you solve this with adding a mechanism for D identifiers to have the same name as keywords. A new kind of string? Another way to go is to have the compiler rename identifiers that are D keywords when importing C code (say by appending an underscore). Could also only do that in the .di generation, but then importing the C code and importing the .di file are different. --
[Issue 24375] New: ImportC: .di generator outputs C expression with `->` operator
https://issues.dlang.org/show_bug.cgi?id=24375 Issue ID: 24375 Summary: ImportC: .di generator outputs C expression with `->` operator Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ImportC Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dave287...@gmail.com C code: struct foo { int x; }; typedef int weird[sizeof(((struct foo *)((void*)0))->x)]; outputs: extern(C) { // ... struct foo { int x = void; } alias weird = int[(cast(foo*)cast(void*)0)->x.sizeof]; // ... } Encountered something like this in an SDL header. --
[Issue 24374] New: ImportC: .di generator incorrect output for anonymous structs as members
https://issues.dlang.org/show_bug.cgi?id=24374 Issue ID: 24374 Summary: ImportC: .di generator incorrect output for anonymous structs as members Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Keywords: ImportC Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dave287...@gmail.com C file: union foo { struct { int x; } X; }; struct bar { struct { int x; } X; }; Results in following in .di file: extern(C) { // ... union foo { struct X = void; } struct bar { struct X = void; } // ... } Which is not valid D code. --
[Issue 24374] ImportC: .di generator incorrect output for anonymous structs as members
https://issues.dlang.org/show_bug.cgi?id=24374 dave287...@gmail.com changed: What|Removed |Added Hardware|x86 |All OS|Mac OS X|All Severity|enhancement |normal --
[Issue 24373] New: ImportC: .di generator can output invalid aliases
https://issues.dlang.org/show_bug.cgi?id=24373 Issue ID: 24373 Summary: ImportC: .di generator can output invalid aliases Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ImportC Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: dave287...@gmail.com Example c file: typedef unsigned int uint; typedef unsigned short ushort; If you then convert to a .di file, you get something like: extern(C) { // ... bunch of junk alias uint = uint; alias ushort = ushort; // ... } Which are not valid alias declarations. --