Skip to content

Fixes slicing with negative value error message - llvm_codegen_expr.c#2410

Merged
lerno merged 3 commits into
c3lang:masterfrom
ManuLinares:llvm_codegen_expr
Aug 18, 2025
Merged

Fixes slicing with negative value error message - llvm_codegen_expr.c#2410
lerno merged 3 commits into
c3lang:masterfrom
ManuLinares:llvm_codegen_expr

Conversation

@ManuLinares
Copy link
Copy Markdown
Member

@ManuLinares ManuLinares commented Aug 17, 2025

Fixes printing incorrect signed value when slicing by a negative value.

Example:

fn void main()
{
    int[100] arr;
    usz a = 35;
    usz b = 36;
    arr[b:a - b];
}

Current error is:

ERROR: 'Negative value (18446744073709551615) given for slice length.'

With this fix, error is:

ERROR: 'Negative value (-1) given for slice length.'

ManuLinares and others added 3 commits August 17, 2025 03:23
Fixes printing negative value

Example:
```
fn void main()
{
    int[100] arr;
    usz a = 35;
    usz b = 36;
    arr[b:a - b];
}
```

output should be:
ERROR: 'Negative value (-1) given for slice length.'
@lerno lerno merged commit ba55946 into c3lang:master Aug 18, 2025
7 of 43 checks passed
@lerno
Copy link
Copy Markdown
Collaborator

lerno commented Aug 18, 2025

Thank you. I added a description to the release notes as well.

@ManuLinares ManuLinares deleted the llvm_codegen_expr branch December 31, 2025 01:08
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

Successfully merging this pull request may close these issues.

2 participants