www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD SIGSEGV

reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
I'm not sure if this error has already been posted or not.
In any case, here it goes:

Compile with DMD 0.139 (Linux) and run the program. It breaks down with SIGSEGV.

<snip>
int main(){
  double[] X;

  X.length = 2147483120;

  return 0;
}
<snip>

Best,
Tiago

-- 
Tiago Gasiba (M.Sc.) - http://www.gasiba.de
Everything should be made as simple as possible, but not simpler.
Nov 24 2005
next sibling parent Deewiant <deewiant.doesnotlike.spam gmail.com> writes:
Tiago Gasiba wrote:
 I'm not sure if this error has already been posted or not.
 In any case, here it goes:
 
 Compile with DMD 0.139 (Linux) and run the program. It breaks down with
SIGSEGV.
 
 <snip>
 int main(){
   double[] X;
 
   X.length = 2147483120;
 
   return 0;
 }
 <snip>
 
 Best,
 Tiago
 
Confirmed on DMD 0.139, Windows (XP SP2). Gives an "Error: Win32 Exception". The biggest length that still ran succesfully (or, at least, tried to... I didn't let it finish) was 205496319.
Nov 24 2005
prev sibling parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tiago Gasiba schrieb am 2005-11-24:
 I'm not sure if this error has already been posted or not.
 In any case, here it goes:

 Compile with DMD 0.139 (Linux) and run the program. It breaks down with
SIGSEGV.

<snip>
 int main(){
   double[] X;

   X.length = 2147483120;

   return 0;
 }
<snip>

 Best,
 Tiago
This isn't a bug but a feature of the used system. Required memory: 17179864964 <- 2147483120 * double.sizeof + size_t.sizeof 2 ^ 34 <- 17179864964 2 ^ 34 bytes on a 32bit system are allways a bit difficult. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDiTFT3w+/yD4P9tIRAs2mAJ49PvjOCM5cQwQ9J55K1RmrrwvJWwCeIaCA v8tEk4mKxqzFlnJJ7WCiG+U= =1QxA -----END PGP SIGNATURE-----
Nov 26 2005
parent reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
Thomas Kuehne schrieb:

 This isn't a bug but a feature of the used system.
 
 Required memory:
 17179864964 <- 2147483120 * double.sizeof + size_t.sizeof
 2 ^ 34 <- 17179864964
 
 2 ^ 34 bytes on a 32bit system are allways a bit difficult.
 
 Thomas
That is certainly true, but shouldn't there be a much nicer error message? It is somehow obvious that the program has to break down, but it should report something like "Not enough memory to execute line xxx" or "Memory exhausted at line xxx". Best, Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Nov 28 2005
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tiago Gasiba schrieb am 2005-11-28:
 Thomas Kuehne schrieb:

 This isn't a bug but a feature of the used system.
 
 Required memory:
 17179864964 <- 2147483120 * double.sizeof + size_t.sizeof
 2 ^ 34 <- 17179864964
should have been: 17179864968 <- 2147483120 * double.sizeof + 2 * size_t.sizeof
 2 ^ 34 bytes on a 32bit system are allways a bit difficult.
 
 Thomas
That is certainly true, but shouldn't there be a much nicer error message? It is somehow obvious that the program has to break down, but it should report something like "Not enough memory to execute line xxx" or "Memory exhausted at line xxx".
To fix this open "dmd/src/phobos/gc/gc.d", add the following check to _d_new as well as _d_newarrayi and recompile Phobos. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDklOd3w+/yD4P9tIRAv1HAJwJeLOh8zgkEmlgdpZ9ZXkBf3NWeQCfYgD7 FiRKyu46VKCrh+mwQSN29a4= =ThqU -----END PGP SIGNATURE-----
Dec 03 2005