Mercurial > projects > dstress
view run/m/memory_management_07_A.d @ 1630:d0efa3ae5522 default tip
run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author | David Nadlinger <code@klickverbot.at> |
---|---|
date | Sat, 23 Apr 2011 22:57:32 +0200 |
parents | 1802d6b67634 |
children |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ // @author@ <david@acz.org> // @date@ 2007-11-12 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1666 // @desc@ [Issue 1666] New: 64-bit gdc programs cannot allocate large arrays module dstress.run.m.memory_management_07_A; int main(char[][] args){ ubyte x[]; size_t len = size_t.max - (size_t.max / 32); try{ x.length = len; }catch(Exception e){ // "out of memory" Exception return 0; } // a LOT of memory (maybe someone cheated *g*) if(len != x.length){ assert(0); } // try to defeat "smart" cheaters size_t step = 4096 - args.length; for(size_t i = 0; i < len; i += step){ x[i] = i & 0xFF; } step = 4096 - ((args[0].length / 1000 + 1) % 13); for(size_t i = 0; i < len; i += step){ if((i & 0xFF) != x[i]){ assert(0); } } return 0; }