How to defeat the optimizer in GDC

Mike Franklin slavo5150 at yahoo.com
Mon May 20 08:21:57 UTC 2019


On Monday, 20 May 2019 at 08:11:19 UTC, Mike Franklin wrote:

> But I can't get GDC to do the same:  
> https://explore.dgnu.org/z/quCjhU
>
> Is this currently possible in GDC?

Gah!! Ignore that.  `version (GNU)`, not `version(GDC)`.

This works:

void use(void* p)
{
     version(LDC)
     {
         import ldc.llvmasm;
          __asm("", "r,~{memory}", p);
     }
     version(GNU)
     {
         asm { "" : : "r" p : "memory"; };
     }
}



More information about the D.gnu mailing list