Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Compiler encountered an unexpected error (unreachable) with a two-dimensional array and [*] syntax #2505

@konimarti

Description

@konimarti

The compiler encountered an unexpected error with a two-dimensional array and [*] syntax

Minimal example

// char[1][*] a = { [0] = { [0] = 1 } };         // works as expected
// char[1][1] b = { [0] = { [0] = 1 } };         // works as expected
// char[*][*] c = { [0] = { [0] = 1 } };         // reports a cast error
char[*][1] d = { [0] = { [0] = 1 } };             // compiler encountered unreachable code
fn void main() {}

This creates the following compiler error:

⚠️ The compiler encountered an unexpected error: "Should be unreachable".

- Function: type_size(...)
- Source file: /home/../c3c/src/compiler/types.c:433

🙏 Please consider taking the time to file an issue on GitHub, so that we can get it fixed:

https://github.com/c3lang/c3c/issues/new so that we can get it fixed.

Compiler version

C3 Compiler Version:       0.7.6 (Pre-release, Sep 30 2025 14:22:39)
Git Hash:                  281d4af464df15a677069d7eb10312a4128541f2
Backends:                  LLVM
LLVM version:              18.1.8
LLVM default target:       x86_64-pc-linux-gnu

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingFixed needs testingNeeds verification / testing that it now works

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions