Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler crash using short vector reference inside an struct. #2766

Open
MkazemAkhgary opened this issue Feb 15, 2024 · 2 comments
Open

compiler crash using short vector reference inside an struct. #2766

MkazemAkhgary opened this issue Feb 15, 2024 · 2 comments
Labels
Bugs Crash All compiler crashes

Comments

@MkazemAkhgary
Copy link

following code does not compile. this affects all ispc versions.

struct Foo
{
    int32<TARGET_WIDTH>& IntVec;
};
varying int32 test(uniform Foo& foo)
{
    foo.IntVec[programIndex] = 0; // ok
    return foo.IntVec[programIndex]; // crash
}

output

<source>:11:12: Error: Assertion failed 
        (/usr/local/src/ispc/src/ctx.cpp:2620): "llvmReturnType == 
        LLVMTypes::Int8VectorType". 
    return foo.IntVec[programIndex];
           ^^^^^^^^^^^^^^^^^^^^^^^^

/usr/local/src/ispc/src/main.cpp(404): FATAL ERROR: Unhandled signal sent to process; terminating.
Program terminated with signal: SIGSEGV
Compiler returned: 139

trying with foo.IntVec[0] crashes as well.

Stored value type does not match pointer operand type!
  store <8 x i32>* %32, i32* %7, align 8, !dbg !24060
 <8 x i32>*Stored value type does not match pointer operand type!
  store <8 x i32>* %53, i32* %7, align 8, !dbg !24064
 <8 x i32>*LLVM ERROR: Broken module found, compilation aborted!
/usr/local/src/ispc/src/main.cpp(404): FATAL ERROR: Unhandled signal sent to process; terminating.
Program terminated with signal: SIGSEGV
Compiler returned: 139

if short vector reference is not inside an struct, it works fine.

varying int32 test(uniform int32<TARGET_WIDTH>& IntVec)
{
    IntVec[programIndex] = 0;
    return IntVec[programIndex];
}
@pbrubaker
Copy link
Collaborator

struct Foo { int32<TARGET_WIDTH>& IntVec; };

References inside structs should be a compile error. Without a constructor there's no way for this to work.

@pbrubaker pbrubaker added Bugs Crash All compiler crashes labels Apr 14, 2024
@MkazemAkhgary
Copy link
Author

struct Foo { int32<TARGET_WIDTH>& IntVec; };

References inside structs should be a compile error. Without a constructor there's no way for this to work.

references inside structs can be initialized from c++ side and passed to ispc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugs Crash All compiler crashes
Projects
Status: No status
Development

No branches or pull requests

2 participants