Skip to content

NativeAOT: Memset/Memcpy helpers don't throw NRE #95517

@EgorBo

Description

@EgorBo

Compile the following program and run:

static unsafe void Main(string[] args)
{
    Unsafe.InitBlock(null, 0, 1000);
}

CoreCLR:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.

NativeAOT:

no exception, exits.

I assume this is what these comments mean:

case ReadyToRunHelper.MemCpy:
mangledName = "memcpy"; // TODO: Null reference handling
break;
case ReadyToRunHelper.MemSet:
mangledName = "memset"; // TODO: Null reference handling
break;

so I decided to file a tracking issue.

(while CoreCLR wraps memset/memcpy calls into non-inlineable/without tail calls helpers)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions