-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[release 1.10] effects wrong for function that throws MethodError #53259
Comments
# @code_lowered TestStruct(10)
CodeInfo(
1 ─ #9 = %new(Main.:(var"#9#10"))
│ %2 = #9
│ %3 = 1:size
│ Main.foreach(%2, %3)
│ %5 = Main.TestStruct(size, Main.nothing)
└── return %5
) # @code_llvm TestStruct(10)
; @ In[24]:1 within `TestStruct`
define void @julia_TestStruct_4659({ i64, {}* }* noalias nocapture noundef nonnull sret({ i64, {}* }) align 8 dereferenceable(16) %0, [1 x {}*]* noalias nocapture noundef nonnull align 8 dereferenceable(8) %1, i64 signext %2) #0 {
top:
; @ In[24]:5 within `TestStruct`
%3 = getelementptr inbounds [1 x {}*], [1 x {}*]* %1, i64 0, i64 0
store {}* inttoptr (i64 4368531464 to {}*), {}** %3, align 8
%.repack = getelementptr inbounds { i64, {}* }, { i64, {}* }* %0, i64 0, i32 0
store i64 %2, i64* %.repack, align 8
%.repack1 = getelementptr inbounds { i64, {}* }, { i64, {}* }* %0, i64 0, i32 1
store {}* inttoptr (i64 4368531464 to {}*), {}** %.repack1, align 8
ret void
} # @code_native TestStruct(10)
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 14, 0
.globl _julia_TestStruct_4907 ; -- Begin function julia_TestStruct_4907
.p2align 2
_julia_TestStruct_4907: ; @julia_TestStruct_4907
; ┌ @ In[24]:1 within `TestStruct`
; %bb.0: ; %top
mov x9, #32776
movk x9, #1122, lsl #16
movk x9, #1, lsl #32
; │ @ In[24]:5 within `TestStruct`
str x9, [x0]
stp x1, x9, [x8]
ret
; └
; -- End function
.subsections_via_symbols |
Reduced to the following function foo(size)
foreach(1:size) do
println(i)
end
end
function foo()
foreach(1:10) do
println(i)
end
end foo(10) # returns without errors
foo() # errors |
I think this is wrong # @code_llvm foo(10)
; @ In[75]:1 within `foo`
define void @julia_foo_5731(i64 signext %0) #0 {
top:
ret void
} In addition Base.infer_effects(foo, (Int,))
(+c,+e,+n,+t,+s,+m,+i)
Base.infer_effects(foo, ())
(+c,+e,!n,+t,+s,+m,+i) |
This seems fixed on v1.11 / master, but I am not sure which of the effect-fix PRs would have fixed it and needs to be backported |
vtjnash
changed the title
Confusing behaviour for the do syntax with missing argument name
[release 1.10] effects wrong for function that throws MethodError
Feb 9, 2024
Also the current issue is very similar to this one #53062 |
This will be fixed on v1.10.1. In particular, #53076 fixed this issue. |
Thanks for your report and bisect, @bvdmitri ! |
aviatesk
removed
the
backport 1.10
Change should be backported to the 1.10 release
label
Feb 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following code
This fails, because I forgot to define the
i
name after thedo
block.The error above is expected. However the following example does not even produce any error.
I would expect the second example to fail as well. This leads to some nasty undebuggable behaviour since nothing points to the problematic place. Basically Julia arbitrarily skips a potentially important piece of logic in the constructor for the
TestStruct
.The text was updated successfully, but these errors were encountered: