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

[SPEC2006] error: value doesn't match function result type '%x_struct = type { i32, i32 }' #40

Open
zqb-all opened this issue Oct 28, 2023 · 0 comments

Comments

@zqb-all
Copy link

zqb-all commented Oct 28, 2023

spec2k6 462.libquantum build fail.
one of the errors can be reproduce by the following code:

struct x_struct {
  int y;
  int z;
};

typedef struct x_struct x;

x foo(int a)
{
	x m;
	if (a)
		exit(1);
	return m;
}

cmd

xcalcc -c a.c

error:

2023-10-28 15:56:45,554 - xcalcc - ERROR - /open64/bin/../lib/gcc-lib/x86_64-open64-linux/5.0/llc: error: /open64/bin/../lib/gcc-lib/x86_64-open64-linux/5.0/llc: a.O.ll:18:7: error: value doesn't match function result type '%x_struct = type { i32, i32 }'
  ret void
      ^ (xcalcc:630)
zengdage added a commit to zengdage/open64 that referenced this issue Jan 4, 2024
The built-in exit function should be regared as unreachable function.

1. The llc will crash if compile the code like that:
```
typedef struct quantum_matrix_struct {
  int rows;
  int cols;
  void *t;
} quantum_matrix;

quantum_matrix quantum_new_matrix(void)
{
  quantum_matrix m;

  m.t = calloc(1, sizeof(16));

  if(!m.t) {
    exit(1);
  }

  return m;
}

```

2. Error Log:
```
llc: matrix3.O.ll:22:7: error: value doesn't match function result type '%quantum_matrix_struct = type { i32, i32, ptr }'
```

Signed-off-by: Zhijin Zeng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant