Skip to content

Incorrect SSA value type when using julia --code-coverage #18

Closed
@KDr2

Description

@KDr2

I have a t.jl:

using CodeInfoTools

struct S x; y; end

c = CodeInfoTools.code_inferred(S, Int, Int)

@show c
@show c.code
@show c.slottypes
@show c.ssavaluetypes

When I run julia t.jl, it produces the correct output:

c = CodeInfo(
    @ /data4/zhuo/Work/julia/Libtask.jl/test/runtests.jl:3 within `S`
1 ─ %1 = Main.S::Core.Const(S)
│   %2 = %new(%1, x, y)::S
└──      return %2
)
c.code = Any[:(Main.S), :(%new(%1, _2, _3)), :(return %2)]
c.slottypes = Any[Core.Const(S), Int64, Int64]
c.ssavaluetypes = Any[Core.Const(S), S, Any]

But when I run julia --code-coverage=user t.jl, I get:

c = CodeInfo(
    @ /data4/zhuo/Work/julia/Libtask.jl/test/runtests.jl:3 within `S`
1 ─ %1 = Main.S::Nothing
│   %2 = %new(%1, x, y)::Core.Const(S)
└──      return %2
)
c.code = Any[:(Main.S), :(%new(%1, _2, _3)), :(return %2)]
c.slottypes = Any[Core.Const(S), Int64, Int64]
c.ssavaluetypes = Any[Nothing, Core.Const(S), S, Any]

There's an extra Nothing prepended to the ssavalutypes.

It's mainly caused by the --code-coverage option:

  • correct: julia t.jl
  • correct: julia --code-coverage=none t.jl
  • incorrect: julia --code-coverage=user t.jl
  • incorrect: julia --code-coverage=all t.jl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions