llvm / llvm/Polygeist

Unable to parse struct copy

Open
#165 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
624
Forks
170
PR merge metrics
No merged PRs in 30d

Description

See the following code:

typedef struct {
  float x;
  float y;
} MyStruct;

void test() {
  MyStruct a = {0, 0};
  MyStruct b = {1, 1};
  a = b;
}

mlir-clang will get the following error:

mlir-clang: ../tools/mlir-clang/Lib/ValueCategory.cc:44: mlir::Value ValueCategory::getValue(mlir::OpBuilder &) const: Assertion `mt.getShape().size() == 1 && "must have shape 1"' failed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run mlir-clang on the reported C struct-assignment snippet and inspect the assertion in tools/mlir-clang/Lib/ValueCategory.cc:44. Done means the example parses without triggering the shape assertion and produces the expected frontend result.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.