digitalmars.D.bugs - "-g" and elfobj.c
- Kevin Bealer (39/39) Feb 02 2005 The following code produces an error in the elfobj.c code, and will
- Thomas Kuehne (11/50) Feb 03 2005 -----BEGIN PGP SIGNED MESSAGE-----
The following code produces an error in the elfobj.c code, and will not compile with -g. The program that I found this bug in was more complex, and still has some mysterious flaws, but they are probably mine and unrelated. Compiler: dmd 0.112 Message: dmd -g -ofhuh test.d Internal error: ../ztc/elfobj.c 1251 Analysis: The issue seems to be related to the "return 0" and the while(1). Perhaps the compiler believes the while() will never terminate, and therefore the function return stanza is unnecessary? But the earlier "return 0" can return. If the line with HERE.1 is commented out, or the (1) in the while() is replaced with a "argv.length", so that the compiler cannot make the deduction, the debug version CAN be built. ALSO, if the "-g" is not specified, no visible problems arise. Thanks, Kevin : :import std.stdio; : :int main(char[][] argv) :{ : uint foo = argv.length; : : if (argv.length == 33) { : return 0; // HERE.1 : } : : while(1) { // HERE.2 : if (foo & 3) { : writef("okay.\n"); : } : } : : return 0; :} :
Feb 02 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kevin Bealer schrieb am Thu, 3 Feb 2005 03:02:27 +0000 (UTC):The following code produces an error in the elfobj.c code, and will not compile with -g. The program that I found this bug in was more complex, and still has some mysterious flaws, but they are probably mine and unrelated. Compiler: dmd 0.112 Message: dmd -g -ofhuh test.d Internal error: ../ztc/elfobj.c 1251 Analysis: The issue seems to be related to the "return 0" and the while(1). Perhaps the compiler believes the while() will never terminate, and therefore the function return stanza is unnecessary? But the earlier "return 0" can return. If the line with HERE.1 is commented out, or the (1) in the while() is replaced with a "argv.length", so that the compiler cannot make the deduction, the debug version CAN be built. ALSO, if the "-g" is not specified, no visible problems arise. Thanks, Kevin : :import std.stdio; : :int main(char[][] argv) :{ : uint foo = argv.length; : : if (argv.length == 33) { : return 0; // HERE.1 : } : : while(1) { // HERE.2 : if (foo & 3) { : writef("okay.\n"); : } : } : : return 0; :} :If added your "compiletime deduction" to an older test case: http://dstress.kuehne.cn/run/bug_elfobj_1251_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCAkS43w+/yD4P9tIRApZsAJ42sDhcYN44o/rA4SlPNvRstHWmCgCfTkzp bakGXRIKH0Vg0zpV1e/dFII= =rIWd -----END PGP SIGNATURE-----
Feb 03 2005