comparison dmd/SwitchStatement.d @ 5:63623152e82a

Fixed memory corruption bug which was introduced when attempting to restore GC functionality
author dkoroskin <>
date Tue, 08 Dec 2009 21:39:17 +0300
parents d706d958e4e8
children a8b50ff7f201
comparison
equal deleted inserted replaced
4:d706d958e4e8 5:63623152e82a
47 import dmd.backend.RTLSYM; 47 import dmd.backend.RTLSYM;
48 import dmd.backend.targ_types; 48 import dmd.backend.targ_types;
49 49
50 import core.memory; 50 import core.memory;
51 51
52 import core.stdc.stdlib;
53
52 class SwitchStatement : Statement 54 class SwitchStatement : Statement
53 { 55 {
54 Expression condition; 56 Expression condition;
55 Statement body_; 57 Statement body_;
56 bool isFinal; 58 bool isFinal;
406 else 408 else
407 string = 0; 409 string = 0;
408 block_appendexp(mystate.switchBlock, econd); 410 block_appendexp(mystate.switchBlock, econd);
409 block_next(blx,BCswitch,null); 411 block_next(blx,BCswitch,null);
410 412
411 targ_llong* pu = cast(targ_llong*) GC.malloc(targ_llong.sizeof * (numcases + 1)); 413 ///
414 targ_llong* pu = cast(targ_llong*) malloc(targ_llong.sizeof * (numcases + 1));
412 mystate.switchBlock.Bswitch = pu; 415 mystate.switchBlock.Bswitch = pu;
413 /* First pair is the number of cases, and the default block 416 /* First pair is the number of cases, and the default block
414 */ 417 */
415 *pu++ = numcases; 418 *pu++ = numcases;
416 list_append(&mystate.switchBlock.Bsucc, mystate.defaultBlock); 419 list_append(&mystate.switchBlock.Bsucc, mystate.defaultBlock);