Skip to content

CGHLSLRuntime::initializeBufferFromBinding unconditionally dereferencing RBA after a nullptr check #145525

Open
@shafik

Description

@shafik

On this line we have a nullptr check on RBA:

auto *Space =
llvm::ConstantInt::get(CGM.IntTy, RBA ? RBA->getSpaceNumber() : 0);

but soon after we unconditionally dereference RBA:

llvm::Intrinsic::ID IntrinsicID =
RBA->hasRegisterSlot()
? CGM.getHLSLRuntime().getCreateHandleFromBindingIntrinsic()
: CGM.getHLSLRuntime().getCreateHandleFromImplicitBindingIntrinsic();

So one of these lines is a bug, I am not sure which it is.

This change was brought in by: #139022

Metadata

Metadata

Assignees

No one assigned

    Labels

    HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.code-quality

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions