-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
llvm: handle vectors in packed structs #14004
Conversation
9eaa2c2
to
6060bf0
Compare
Vectors can represented in all the same values as arrays so this was never a valid shortcut.
6060bf0
to
0c1d865
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good except for
Sema: add error for recursive inline call
Note that you closed #13724 as a duplicate of the issue closed by this commit, however, the expected behavior is error: comptime execution exceeded 1000 branches
, and furthermore the expected behavior is that you can set the branch quota higher and have the code compile successfully.
Unfortunately, we will need to rework Sema to use an explicit stack instead of the compiler's stack in order to solve this issue.
Edit: I forgot to add, thank you for helping the Bun folks get updated 👍
My bad, your issue is about comptime calls and the other is about plain inline calls. There is also #13803 about generic calls.
This specific error is (supposed to be) only for inline calls without comptime parameters which should only be able recurse 0, 1 or infinite times in which case a specific compile error seems more appropriate to me.
Definitely, but this would help a little. |
c959dba
to
6511afc
Compare
here is a new behavior test that should continue passing: const std = @import("std");
const expect = std.testing.expect;
inline fn foo(x: i32) i32 {
if (x <= 0) {
return 0;
} else {
return x * 2 + foo(x - 1);
}
}
const foo_4 = foo(4);
test "recursive inline function" {
try expect(foo_4 == 20);
} If this still passes with your changes, then my mistake, this is ready to be merged. I'll check... ...looks like it still passes. Here's another test to look at: const std = @import("std");
const expect = std.testing.expect;
inline fn foo(x: i32) i32 {
if (x <= 0) {
return 0;
} else {
return x * 2 + foo(x - 1);
}
}
test "recursive inline function" {
try expect(foo(4) == 20);
} This one is also intended to pass, because the callsite of foo uses a comptime value for x, which should propagate into the body of It looks like the former test here passes with this branch because you removed the one commit that I pointed out, so from my perspective, this branch is ready to be merged 👍 |
That is not affected because it's a comptime call.
That is in conflict with #13164 being a bug and IMO would be better handled by #7772 |
const std = @import("std");
inline fn setLimits(min: ?u32, max: ?u32) void {
if (min != null and max != null) {
std.debug.assert(min.? <= max.?);
}
}
pub fn main() void {
var x: u32 = 42;
setLimits(x, null);
} The intended behavior here is that max gets treated as comptime null, which means the condition if (min != null and max != null) { would reduce to if (min != null and false) { The actual issue here was fixed by #13360. The fix from #13219 was incorrect and I am sorry for not catching it earlier. |
No description provided.