Skip to content

Illegal instruction during sort (related to package precompilation) #48391

Closed
@maleadt

Description

@maleadt

The following MWE is reduced from a 1.9-only failure with the package SurrealNumbers.jl, as seen on PkgEval: https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2023-01/22/SurrealNumbers.primary.log. It relies on package precompilation, and can easily be reproduced using a single package:

SurrealNumbers.jl

module SurrealNumbers

struct SurrealFinite <: Real end

sort(SurrealFinite[])
Base.:(<)(::SurrealFinite, ::SurrealFinite) = 0

end

The definition of < after the toplevel sort invocation is key to reproducing this issue.

mwe.jl

using SurrealNumbers
x0 = x1 = SurrealNumbers.SurrealFinite()
sort([x1, x0])

JULIA_LOAD_PATH=. julia mwe.jl

Unreachable reached at 0x7f53440c5175

[4193087] signal (4.2): Illegal instruction
in expression starting at /home/tim/Julia/tools/creduce/main.jl:3
_sort! at ./sort.jl:747 [inlined]
_sort! at ./sort.jl:712 [inlined]
_sort! at ./sort.jl:659 [inlined]
_sort! at ./sort.jl:595 [inlined]
#sort!#28 at ./sort.jl:1373 [inlined]
sort! at ./sort.jl:1366 [inlined]
#sort#29 at ./sort.jl:1399
sort at ./sort.jl:1399

Bisected to #47924 (cc @timholy):

1f0700a29a4e0250c5c31cbc02e624009d1ed741 is the first bad commit
commit 1f0700a29a4e0250c5c31cbc02e624009d1ed741
Author: Tim Holy <tim.holy@gmail.com>
Date:   Tue Dec 20 08:30:20 2022 -0600

    Precompile cache: always add worklist CIs (#47924)

    We cache only those external CodeInstances that link back to the
    package being precompiled. Formerly we required a backedge;
    this PRs adds any whose `specTypes` could only link back to the
    package. This scoops up a few runtime-dispatched CodeInstances
    and their callees.

 src/staticdata_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler:precompilationPrecompilation of modulesregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions