digitalmars.D - Bug in gdc or bug in dmd?
- David Rushby (25/25) Oct 24 2005 Here's the example program:
- Thomas Kuehne (10/35) Oct 28 2005 -----BEGIN PGP SIGNED MESSAGE-----
- David Rushby (3/7) Oct 28 2005 Thanks, Thomas. Somehow I missed the second part of the 'const' documen...
Here's the example program: ------------------------------------------------- const int *x; int y = 1; int main() { printf("*x is %d\n", *x); return 0; } static this() { x = &y; } ------------------------------------------------- dmd 0.136 compiles this without an error message, and of course the output is "*x is 1". The most recent version of gdc (0.15) issues this output when I try to compile the example program: ------------------------------------------------- const_lvalue.d:10: x is not an lvalue const_lvalue.d:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. ------------------------------------------------- Obviously gdc's internal compiler error is a bug in any case, but should it be possible to initialize 'const' variables in a module's static constructor?
Oct 24 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David Rushby schrieb am 2005-10-25:Here's the example program: ------------------------------------------------- const int *x; int y = 1; int main() { printf("*x is %d\n", *x); return 0; } static this() { x = &y; } ------------------------------------------------- dmd 0.136 compiles this without an error message, and of course the output is "*x is 1". The most recent version of gdc (0.15) issues this output when I try to compile the example program: ------------------------------------------------- const_lvalue.d:10: x is not an lvalue const_lvalue.d:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. ------------------------------------------------- Obviously gdc's internal compiler error is a bug in any case, but should it be possible to initialize 'const' variables in a module's static constructor?- -> http://digitalmars.com/d/attribute.html Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDYYlR3w+/yD4P9tIRAvLOAJ4yeLUX2zmOGrFe2aaJ5g+m/FrdZQCguycU qjFmtWw6NlbAlcIiJNGp8fU= =evwV -----END PGP SIGNATURE-----
Oct 28 2005
In article <h3e833-a76.ln1 eiche.kuehne.cn>, Thomas Kuehne says...David Rushby schrieb am 2005-10-25:Thanks, Thomas. Somehow I missed the second part of the 'const' documentation when I looked at it previously.Here's the example program: ...- -> http://digitalmars.com/d/attribute.html
Oct 28 2005