Bug 24832 – Segfault in hex string

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-10-24T11:28:44Z
Last change time
2024-11-16T23:27:17Z
Keywords
pull
Assigned to
No Owner
Creator
Richard (Rikki) Andrew Cattermole

Comments

Comment #0 by alphaglosined — 2024-10-24T11:28:44Z
Via godbolt I got this stack trace for ldc: ``` Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 ldc2 0x0000566b8b755cd7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39 1 ldc2 0x0000566b8b753acc llvm::sys::RunSignalHandlers() + 188 2 ldc2 0x0000566b8b75637f 3 libc.so.6 0x00007f523f442520 4 ldc2 0x0000566b88398e9a _D3dmd5utils18arrayCastBigEndianFNbxAhmZAh + 362 5 ldc2 0x0000566b8820c2ed _D3dmd5dcast6castToFCQt10expression10ExpressionPSQBv6dscope5ScopeCQCm5mtype4TypeQpZQCl + 4365 6 ldc2 0x0000566b8824ae8d ExpressionSemanticVisitor::visit(CastExp*) + 525 7 ldc2 0x0000566b8820e5ce _D3dmd7initsem19initializerSemanticFCQBj4init11InitializerPSQCg6dscope5ScopeKCQCy5mtype4TypeEQDnQCe13NeedInterpretZ8visitExpMFCQEvQDm14ExpInitializerZQEk + 1806 8 ldc2 0x0000566b8824391c DsymbolSemanticVisitor::visit(VarDeclaration*) + 7388 9 ldc2 0x0000566b8822d63e _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ8visitExpMFCQDuQCc12ExpStatementZv + 366 10 ldc2 0x0000566b88229d37 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv + 167 11 ldc2 0x0000566b88380dfe Semantic3Visitor::visit(FuncDeclaration*) + 9902 12 ldc2 0x0000566b8837e615 SemanticTimeTraceVisitor<Semantic3Visitor*>::visit(FuncDeclaration*) + 53 13 ldc2 0x0000566b88311b2c Semantic3Visitor::visit(Module*) + 204 14 ldc2 0x0000566b882f29f1 SemanticTimeTraceVisitor<Semantic3Visitor*>::visit(Module*) + 49 15 ldc2 0x0000566b88498c1b mars_tryMain(Param&, Array<char const*>&) + 1595 16 ldc2 0x0000566b884fcac0 cppmain() + 9376 17 ldc2 0x0000566b8bc760fd _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 77 18 ldc2 0x0000566b8bc75ed8 _d_run_main2 + 472 19 ldc2 0x0000566b8bc75ced _d_run_main + 141 20 ldc2 0x0000566b8bab81c8 main + 680 21 libc.so.6 0x00007f523f429d90 22 libc.so.6 0x00007f523f429e40 __libc_start_main + 128 23 ldc2 0x0000566b8850137e _start + 46 Program terminated with signal: SIGILL Compiler returned: 132 ``` Appears the erroring code is dmd.utils : arrayCastBigEndian. https://github.com/dlang/dmd/blob/master/compiler/src/dmd/utils.d#L240 Failing code: ```d void main() { static immutable CasingDiced[] ReturnValues = cast(CasingDiced[])x"FFFFFFFFFFFFFFFFFFFFFFFF"; } struct CasingDiced { ushort lowerOffset, lowerEnd; ushort titleOffset, titleEnd; ushort upperOffset, upperEnd; } ```
Comment #1 by dlang-bot — 2024-10-24T12:03:41Z
@dkorpel created dlang/dmd pull request #17024 "Fix bugzilla 24832 - Segfault in hex string" fixing this issue: - Fix bugzilla 24832 - Segfault in hex string https://github.com/dlang/dmd/pull/17024
Comment #2 by dlang-bot — 2024-10-24T17:46:06Z
dlang/dmd pull request #17024 "Fix bugzilla 24832 - Segfault in hex string" was merged into stable: - 5ce146bf4d4693147f05a090c0eda15479f749b4 by Dennis Korpel: Fix bugzilla 24832 - Segfault in hex string https://github.com/dlang/dmd/pull/17024
Comment #3 by dlang-bot — 2024-11-16T23:27:17Z
dlang/dmd pull request #17069 "Merge stable" was merged into master: - d0eb6bb659fc2d348a7e6beaad2d32e1cf909f02 by Dennis: Fix bugzilla 24832 - Segfault in hex string (#17024) * Fix bugzilla 24832 - Segfault in hex string * Fix lack of camelcasing on stable branch https://github.com/dlang/dmd/pull/17069