-
-
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
Stack overflow in type inference… julia 1.9.0-DEV #45286
Comments
Shown below is program
Program
Verbose versioninfo except PATH:
|
Here is (1) (1)
(2) output from
(3)
|
I suppose this is fixed after #55575 |
edit: See program
toverflow7.jl
and its discussion in a later comment.toverflow7
is 28 lines long instead of the 140 oftoverflow5.jl
. The runs-ok version now istoverflow8
, obtained by commandsA=toverflow7;B=toverflow8;sed -e 's/if 1<2/if 1>2/' $A.jl > $B.jl; chmod u+x $B.jl
.ProgramThese programs illustrate that at the moment, seemingly-minor changes (using one print instead of two, writing to file instead oftoverflow5.jl
appears below. Programtoverflow3.jl
is made fromtoverflow5.jl
by the commandsed -e 's/if 1<2/if 1>2/' toverflow5.jl > toverflow3.jl
.stdout
) trigger a few error messages for Julia 1.9.0-DEV, or thousands of traceback and error messages for Julia 1.7.2, which is disconcerting.This may be related to problems reported in issues type inference stackoverflow #43050 and StackOverflow Type Inference Error #44852. I also posted about this in discourse.julialang.org at Stack overflow in type inference… julia 1.9.0-DEV.
toverflow3
runs ok via Julia 1.7.2 (which isjulia
on my system, seeversioninfo()
at end of post) and via Julia 1.9.0-DEV.485 (which isjulia-latest
, ditto), writing 1 line tostdout
and 2 lines tooutP00
.Command
julia-latest toverflow5.jl
produces 4 identical 2-line error-message sets and then produces expected results. The message sets are like:Running 1.7.2, the command
julia toverflow5.jl
produces four similar groups of 19028 error lines each. For example,grep -n 'Internal error' over-script-1.7.2b
shows:where
over-script-1.7.2b
is result of runningtoverflow5
withinscript over-script-1.7.2b
.Note, the difference between
toverflow3
andtoverflow5
is that the former uses twoprintfmt
calls to print the same things thattoverflow5
uses oneprintfmt
for. The single-character difference between the files (as shown in the following output fromdiff toverflow3.jl toverflow5.jl
) makes an if-testfalse
fortoverflow3
andtrue
fortoverflow5
. Thefalse
case of theif
contains 2 x 8-argumentprintfmt
s while thetrue
case has one 14-argumentprintfmt
.Note, if the output to
outP00
is instead written tostdout
(ie, ifoutP00
isn't opened/written to/closed) the stack overflow message goes away, otherwise I would not have file-writing included in the problem's working example. Of course that makes the argument list to the many-argumentprintfmt
have one less argument; however, when writing tostdout
I ran a test with 50 arguments in theprintfmt
, as follows, and it worked ok:suggesting number of arguments is not the whole story.
Note, to some extent the number of error messages that print can be decreased or increased by moving the
]#
characters earlier or later within thecots = ...
array.Note, if the recursion-call
findMore(level+1)
is commented out, thentoverflow3
results are unchanged, whilejulia-latest toverflow5.jl
runs with only one error-message pair:while
julia toverflow5.jl
runs with about 19030 error message lines before it produces ok results.Here is programedit: Instead oftoverflow5
:toverflow5
as was shown below, seetoverflow7
in next comment. For brevity I've removed the 140-line listing oftoverflow5
. end editversioninfo()
results are shown next.The text was updated successfully, but these errors were encountered: