digitalmars.D.bugs - DMD 0.129 segfaults when input files are specified in wrong order
- Uwe Salomon (77/77) Aug 11 2005 Consider these three modules:
Consider these three modules: module datastream; template DataStreamability(T) { // Basic D types. static if (is(T==wchar)) { const int isStreamable = true; void write(wchar* val) { printf("hallo\n"); } } } module vector; private import datastream; struct Vector(T) { static if (DataStreamability!(T).isStreamable) { void writeTo() {} } } module main; private import datastream; private import vector; int main(char [][] args) { Vector!(wchar) str; return 0; } If you compile them, sometimes DMD segfaults, sometimes not. It depends on the order of the files that is given in the call to DMD: dmd vector.d main.d datastream.d Speicherzugriffsfehler dmd vector.d datastream.d main.d Speicherzugriffsfehler dmd datastream.d vector.d main.d Speicherzugriffsfehler dmd main.d vector.d datastream.d gcc main.o vector.o datastream.o -o main -lphobos -lpthread -lm dmd main.d datastream.d vector.d gcc main.o datastream.o vector.o -o main -lphobos -lpthread -lm dmd datastream.d main.d vector.d gcc datastream.o main.o vector.o -o datastream -lphobos -lpthread -lm The german "Speicherzugriffsfehler" means segmentation violation. 1-3 segfault, 4-6 not. The difference is that in 1-3 vector is compiled before main, while in 4-6 it is compiled afterwards. This is the verbose (-v) output of DMD: parse datastream parse vector parse main semantic datastream semantic vector semantic main semantic2 datastream semantic2 vector semantic2 main semantic3 datastream semantic3 vector semantic3 main code datastream code vector generating code for function 'write' Speicherzugriffsfehler Ok i hope that helps. Ciao uwe
Aug 11 2005