August 24, 2019
Hi:
   I'm writing an OS kernel run in i386 mode.
   where is crash when I implement a std.stdio.write like function and pass a long type argument. see code below:

 void printlnA...)(A a)
 {
    foreach(v;a)
    {
    }
 }

 long xr=100;
 println(xr); //crash
 println(100); //ok

 compile with ldc2 -betterC -m32
 then run
 qemu-system-i386 -kernel kernel -serial stdio -m 1024M

 Is where has a bug in implementation.

August 24, 2019
On Saturday, 24 August 2019 at 01:25:46 UTC, lili wrote:
>  Is where has a bug in implementation.

When running LDC with -vv, you'll see something like this in the very first line:

Targeting 'i686-pc-linux-gnu' (CPU 'pentium4' with features '')

We default to a Pentium 4 for 32-bit x86, and that leads to SSE instructions being used (movsd). Use -mcpu to select an older CPU, e.g., -mcpu=i386.