Giter VIP home page Giter VIP logo

Comments (8)

bvdmitri avatar bvdmitri commented on May 24, 2024 1

Also the current issue is very similar to this one #53062

from julia.

bvdmitri avatar bvdmitri commented on May 24, 2024
# @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

from julia.

bvdmitri avatar bvdmitri commented on May 24, 2024

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

from julia.

bvdmitri avatar bvdmitri commented on May 24, 2024

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)

from julia.

vtjnash avatar vtjnash commented on May 24, 2024

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

from julia.

bvdmitri avatar bvdmitri commented on May 24, 2024

The fix is bisected to #50805 (first time I used automatic bisect run 'script', but the PR makes sense to me)

@Keno @vtjnash

With this script

bisectscript.jl
function foo(size)
           try
           foreach(1:size) do
               println(i)
           end
           catch e
               return 1
           end
           return 0
       end

if foo(10) === 0
	exit(0)
else
	exit(1)
end

from julia.

aviatesk avatar aviatesk commented on May 24, 2024

This will be fixed on v1.10.1. In particular, #53076 fixed this issue.

from julia.

aviatesk avatar aviatesk commented on May 24, 2024

Thanks for your report and bisect, @bvdmitri !

from julia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.