[Issue 24131] ImportC, Linux: TLS transition from R_X86_64_TLSGD to R_X86_64_TPOFF32 failed with -inline
https://issues.dlang.org/show_bug.cgi?id=24131 Jeffrey H. Johnson changed: What|Removed |Added CC||tr...@pobox.com --
[Issue 24131] New: ImportC, Linux: TLS transition from R_X86_64_TLSGD to R_X86_64_TPOFF32 failed with -inline
https://issues.dlang.org/show_bug.cgi?id=24131 Issue ID: 24131 Summary: ImportC, Linux: TLS transition from R_X86_64_TLSGD to R_X86_64_TPOFF32 failed with -inline Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: tr...@pobox.com GNU ld version 2.39-12.fc38 (Fedora 38) with DMD64 D Compiler v2.105.0 No small reproducer yet, but I can point to our project at https://github.com/aremmell/libsir 3ae1eb8135a887314214672ce327826b97553808 is successful with ImportC with -inline: $ git checkout 3ae1eb8135a887314214672ce327826b97553808 $ mkdir d && cd d && ln -s ../src/* ../include/sir/* ../include/sir.h . && ln -s . sir && ln -s ../tests/* . $ dmd -inline -m64 -fPIC -fPIE -O -release -check=off -boundscheck=off -P=-DSIR_NO_PLUGINS=1 *.c -of=test $ ls -la sir .rwxr-xr-x jhj jhj 1.1 MB Sat Sep 2 01:01:08 2023 test* $ cd .. && git clean -fdx && gmake clean The commit 3d7c72cd4e05d25c5518745f756e596c63d94b9b fails: $ git checkout 3d7c72cd4e05d25c5518745f756e596c63d94b9b $ mkdir d && cd d && ln -s ../src/* ../include/sir/* ../include/sir.h . && ln -s . sir && ln -s ../tests/* . $ dmd -inline -m64 -fPIC -fPIE -O -release -check=off -boundscheck=off -P=-DSIR_NO_PLUGINS=1 *.c -of=test /usr/bin/ld: sir.o: TLS transition from R_X86_64_TLSGD to R_X86_64_TPOFF32 against `sir_te' at 0x110d in section `.text' failed The biggest difference here is the sir_te struct moved to thread local storage, which is relevant, I *think*. It still works fine without -inline. I hope this is enough to maybe get an idea but if not, I'll try to make a smaller minimal reproducer. --
[Issue 24130] ImportC: Windows - Cannot build nearly program that uses most system headers as 32-bit.
https://issues.dlang.org/show_bug.cgi?id=24130 Jeffrey H. Johnson changed: What|Removed |Added CC||tr...@pobox.com --
[Issue 24130] New: ImportC: Windows - Cannot build nearly program that uses most system headers as 32-bit.
https://issues.dlang.org/show_bug.cgi?id=24130 Issue ID: 24130 Summary: ImportC: Windows - Cannot build nearly program that uses most system headers as 32-bit. Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: tr...@pobox.com DMD v2.105.0, Windows 11, latest MSVC community edition: >TYPE test.c #include int main(void) { return 0; } >DMD -m32 -v test.c predefs DigitalMars LittleEndian D_Version2 all Windows Win32 CRuntime_Microsoft CppRuntime_Microsoft D_InlineAsm D_InlineAsm_X86 X86 assert D_PreConditions D_PostConditions D_Invariants D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binarydmd version v2.105.0-dirty configC:\D\dmd2\windows\bin64\sc.ini DFLAGS-IC:\D\dmd2\windows\bin64\..\..\src\phobos -IC:\D\dmd2\windows\bin64\..\..\src\druntime\import include C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x86\cl.exe /P /Zc:preprocessor /PD /nologo test.c /FIC:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h /Fitest.i parse test C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(1016): Error: `asm` statements must end in `;` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(1032): Error: `asm` statements must end in `;` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(1048): Error: `asm` statements must end in `;` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(13826): Error: found `i64` when expecting `)` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(13826): Error: found `i64` when expecting `)` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(13826): Error: found `i64` when expecting `)` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(13826): Error: found `i64` when expecting `)` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(13826): Error: found `i64` when expecting `)` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(13826): Error: found `)` when expecting `]` C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(13826): Error: `=`, `;` or `,` expected to end declaration instead of `)` --
[Issue 24129] New: ImportC: cannot compile any non-trivial program with multiple translation units/files: fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '__acrt_locale_get_ctype_array_
https://issues.dlang.org/show_bug.cgi?id=24129 Issue ID: 24129 Summary: ImportC: cannot compile any non-trivial program with multiple translation units/files: fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '__acrt_locale_get_ctype_array_value' Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: tr...@pobox.com fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '__acrt_locale_get_ctype_array_value' with DMD64 on Windows - it seems things are NOT being properly inlined. This is likely a new problem with the current MSVC header, because almost any non-trivial program that ends up including ctypes.h (or many other haders) cannot be linked, so nearly nothing can be built with ImportC. Reproducer: DMD version: DMD64 D Compiler v2.105.0-dirty Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved written by Walter Bright (NOTE: this is the DMD installer from the website, not sure why it reports as dirty - I did not build it myself). Windows 11 with MSVC Community edition. Here is a minimal reproducer: >>>TYPE a.c b.c a.c #include extern void xa(void) { } b.c #include int main(void) { void xa(void); xa(); return 0; } >>>dmd -v a.c b.c predefs DigitalMars LittleEndian D_Version2 all D_SIMD Windows Win64 CRuntime_Microsoft CppRuntime_Microsoft D_InlineAsm_X86_64 X86_64 D_LP64 assert D_PreConditions D_PostConditions D_Invarian ts D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binarydmd version v2.105.0-dirty configC:\D\dmd2\windows\bin64\sc.ini DFLAGS-IC:\D\dmd2\windows\bin64\..\..\src\phobos -IC:\D\dmd2\windows\bin64\..\..\src\druntime\import include C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\cl.exe /P /Zc:preprocessor /PD /nologo a.c /FIC:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h /Fia.i include C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\cl.exe /P /Zc:preprocessor /PD /nologo b.c /FIC:\D\dmd2\windows\bin64\..\..\src\druntime\import\ importc.h /Fib.i predefs DigitalMars LittleEndian D_Version2 all D_SIMD Windows Win64 CRuntime_Microsoft CppRuntime_Microsoft D_InlineAsm_X86_64 X86_64 D_LP64 assert D_PreConditions D_PostConditions D_Invarian ts D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat binarydmd version v2.105.0-dirty configC:\D\dmd2\windows\bin64\sc.ini DFLAGS-IC:\D\dmd2\windows\bin64\..\..\src\phobos -IC:\D\dmd2\windows\bin64\..\..\src\druntime\import include C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\cl.exe /P /Zc:preprocessor /PD /nologo a.c /FIC:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h /Fia.i include C:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\cl.exe /P /Zc:preprocessor /PD /nologo b.c /FIC:\D\dmd2\windows\bin64\..\..\src\druntime\import\importc.h /Fib.i parse a parse b importall a import__builtins (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\__builtins.di) importobject (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\object.d) importcore.internal.hash (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\hash.d) importcore.internal.traits (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\traits.d) importcore.internal.entrypoint (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\entrypoint.d) importcore.internal.array.appending (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\array\appending.d) importcore.internal.array.comparison (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\array\comparison.d) importcore.internal.array.equality (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\array\equality.d) importcore.internal.array.casting (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\array\casting.d) importcore.internal.array.concatenation (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\core\internal\array\concatenation.d) importcore.internal.array.construction (C:\D\dmd2\windows\bin64\..\..\src\druntime\import\co
[Issue 11080] assert(`string`) should be forbidden
https://issues.dlang.org/show_bug.cgi?id=11080 Nick Treleaven changed: What|Removed |Added CC||n...@geany.org --- Comment #29 from Nick Treleaven --- Firstly, issue #4733 is WONTFIX (AIUI due to `if (auto a = array_expr)` being not nice to rewrite). Detecting a string literal first argument to assert is still possible. Relying on a linter to detect this means most people won't detect it as they don't run linters. At DConf 2023, Walter actually had a slide with this bug in it. On the slide 'Positives are self evident' about `version` statements, he had: `else static assert("unsupported");` Which always passes. I think that settles the 'how common is this bug?' debate. --
[Issue 24128] New: array formatting fails to compile with bitsSet
https://issues.dlang.org/show_bug.cgi?id=24128 Issue ID: 24128 Summary: array formatting fails to compile with bitsSet Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: kroepli...@googlemail.com format!"%-(%s, %)"(BitArray().bitsSet); fails to compile after dmd-2-103.1: dmd-2.105.0/linux/bin64/../../src/phobos/std/algorithm/iteration.d(3701,13): Error: `"Attempting to fetch the front of an empty joiner."` --
[Issue 24127] ImportC - no way to organize files
https://issues.dlang.org/show_bug.cgi?id=24127 Steven Schveighoffer changed: What|Removed |Added Keywords||ImportC --
[Issue 24127] New: ImportC - no way to organize files
https://issues.dlang.org/show_bug.cgi?id=24127 Issue ID: 24127 Summary: ImportC - no way to organize files Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: schvei...@gmail.com Created attachment 1889 --> https://issues.dlang.org/attachment.cgi?id=1889&action=edit Tarball of example code to try When a C file is imported through a path other than the root path, the compiler can use the C file's declarations from a root module (one that is passed on the compile line). However, when the C file is also passed on the command line, the compiler complains that the file can only be imported as a non-packaged file. I have attached an example, reproduced here: ```c foo/bar/cstuff.c void fn() {} ``` ```d foo/bar/dstuff.d module foo.bar.dstuff; import foo.bar.cstuff; void main() { fn(); } ``` When compiling both on the command line: ``` steves@homebuild:~/importcbug$ dmd foo/bar/* foo/bar/dstuff.d(3): Error: module `cstuff` from file foo/bar/cstuff.c must be imported with 'import cstuff;' ``` However, when compiling the C module separately it succeeds: ``` steves@homebuild:~/importcbug$ dmd -c foo/bar/cstuff.c steves@homebuild:~/importcbug$ dmd foo/bar/dstuff.d cstuff.o steves@homebuild:~/importcbug$ ./dstuff ``` --
[Issue 24121] ImportC: typedef enum fails to compile
https://issues.dlang.org/show_bug.cgi?id=24121 Rory changed: What|Removed |Added CC||rjmcgu...@gmail.com --- Comment #1 from Rory --- I came here to report a similar issue with typedef enums but my code now works. I tried the enum posted here and the code compiles fine for me. Do you know which version of DMD this segfault was in? I'm using linux DMD64 D Compiler v2.105.0. --
[Issue 24126] toStringz does not support wchar and dchar
https://issues.dlang.org/show_bug.cgi?id=24126 Jonathan M Davis changed: What|Removed |Added CC||issues.dl...@jmdavisprog.co ||m --- Comment #1 from Jonathan M Davis --- std.utf.toUTFz handles the general case, allowing flexibility with regards to both constness and character width: https://dlang.org/phobos/std_utf.html#toUTFz --