Bug 11903 – Internal error: backend/cgcs.c 351

Status
RESOLVED
Resolution
WORKSFORME
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-11T04:50:13Z
Last change time
2020-03-21T03:56:33Z
Keywords
ice, ice-on-invalid-code
Assigned to
No Owner
Creator
dransic

Comments

Comment #0 by dransic — 2014-01-11T04:50:13Z
struct Foo { immutable(int)[] list; } unittest { enum foo = Foo([1, 2, 3]); foo.list ~= 4; } ICE with DMD64 D Compiler v2.065-devel-2318831: Internal error: backend/cgcs.c 351 May be related to https://d.puremagic.com/issues/show_bug.cgi?id=11596
Comment #1 by hsteoh — 2014-01-15T08:15:53Z
Can't reproduce problem on latest git HEAD (786ea8228f836b1d80b36b991c534256ea6c9592). Tested on Linux/64bit. Has this bug been fixed, or is it a platform-specific issue?
Comment #2 by dransic — 2014-01-15T09:00:30Z
(In reply to comment #1) > Can't reproduce problem on latest git HEAD > (786ea8228f836b1d80b36b991c534256ea6c9592). Tested on Linux/64bit. Has this bug > been fixed, or is it a platform-specific issue? Yes, still there for me for this same commit. dmd -main -unittest -run test.d Internal error: backend/cgcs.c 351 dmd -main -unittest -O -run test.d Internal error: backend/cod2.c 4964 on Mac OSX 10.9, DMD64 D Compiler v2.065-devel-786ea82
Comment #3 by damianday — 2014-02-15T04:49:45Z
Also happens with LDC 2.063.2 (0.12.0) 0 ldc2 0x0000000001014882 llvm::sys::PrintStackTrace(_IO_FILE*) + 34 1 ldc2 0x00000000010162ea 2 libpthread.so.0 0x00000000404491e0 3 ldc2 0x0000000000635596 DtoBitCast(llvm::Value*, llvm::Type*, char const*) + 22 4 ldc2 0x00000000006e473c DtoCatAssignElement(Loc&, Type*, DValue*, Expression*) + 220 5 ldc2 0x000000000065283b CatAssignExp::toElem(IRState*) + 235 6 ldc2 0x000000000065acc0 Expression::toElemDtor(IRState*) + 576 7 ldc2 0x000000000067ffeb ExpStatement::toIR(IRState*) + 91 8 ldc2 0x000000000067feaf CompoundStatement::toIR(IRState*) + 95 9 ldc2 0x000000000067feaf CompoundStatement::toIR(IRState*) + 95 10 ldc2 0x00000000006162e1 DtoDefineFunction(FuncDeclaration*) + 1905 11 ldc2 0x00000000006683cc Module::genLLVMModule(llvm::LLVMContext&) + 716 12 ldc2 0x000000000056c582 main + 5138 13 libc.so.6 0x0000000041299a15 __libc_start_main + 245 14 ldc2 0x0000000000555d69
Comment #4 by hsteoh — 2014-09-10T23:46:56Z
Reproduced error in git HEAD, only happens when compiling with -unittest.
Comment #5 by b2.temp — 2019-05-31T10:21:33Z
reduced, no need for -unittest, should be a fail compilation: --- struct Foo { int[] list; } void main() { enum foo = Foo([]); foo.list ~= 4; } --- because `foo.list` is not modifiable (or not a Lvalue). The error must be detected in the front-end.
Comment #6 by b2.temp — 2019-11-22T21:06:50Z
2.082.1 to 2.084.1: Status -4 and no output 2.085.1: Success and no output 2.086.1: Status -4 and no output Since 2.087.1: Failure with output: onlineapp.d(9): Error: cannot modify constant expression `Foo([]).list`