Skip to content
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

Codegen regression on master #13647

Closed
jiahao opened this issue Oct 16, 2015 · 2 comments
Closed

Codegen regression on master #13647

jiahao opened this issue Oct 16, 2015 · 2 comments

Comments

@jiahao
Copy link
Member

jiahao commented Oct 16, 2015

Sorry for the vague title, but I'm not sure what the problem is.

Here is a MWE:

immutable Clock
    hour::Int
    on_minute#::Bool #<-- Uncomment this annotation to cause codegen failure
end
Clock(hour::Integer) = Clock(Int(hour), false)

Base.zero(::Type{Clock}) = Clock(12, false)

A = zeros(Clock, 3, 3)
eigs(A)

With the second field un-annotated, eigs throws an expected error:

WARNING: Adjusting nev from 6 to 1
ERROR: LoadError: MethodError: `convert` has no method matching convert(::Type{Clock}, ::Float64)
This may have arisen from a call to the constructor Clock(...),
since type constructors fall back to convert methods.
...

With the annotation, codegen.cpp vomits on master:

signal (11): Segmentation fault: 11
_ZN4llvm11PointerType3getEPNS_4TypeEj at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
_ZN4llvm15SimplifyGEPInstENS_8ArrayRefIPNS_5ValueEEERKNS_10DataLayoutEPKNS_17TargetLibraryInfoEPKNS_13DominatorTreeEPNS_15AssumptionCacheEPKNS_11InstructionE at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
_ZN4llvm12InstCombiner22visitGetElementPtrInstERNS_17GetElementPtrInstE at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
_ZN4llvm12InstCombiner3runEv at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
_ZL31combineInstructionsOverFunctionRN4llvm8FunctionERNS_19InstCombineWorklistEPNS_13AliasAnalysisERNS_15AssumptionCacheERNS_17TargetLibraryInfoERNS_13DominatorTreeEPNS_8LoopInfoE at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
_ZN12_GLOBAL__N_124InstructionCombiningPass13runOnFunctionERN4llvm8FunctionE at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
_ZN4llvm6legacy23FunctionPassManagerImpl3runERNS_8FunctionE at /Users/jiahao/local/src/julia/usr/lib/libjulia-debug.dylib (unknown line)
to_function at /Users/jiahao/local/src/julia/src/codegen.cpp:839
jl_compile at /Users/jiahao/local/src/julia/src/codegen.cpp:973
jl_get_specialization at /Users/jiahao/local/src/julia/src/gf.c:1475
...

0.4 correctly throws the "no convert method" error in both cases.

(Discovered by @malmaud in CoolClocks.jl)

@malmaud
Copy link
Contributor

malmaud commented Oct 16, 2015

@simonster
Copy link
Member

Minimal reproducer (sorry, no clocks):

julia> immutable X
              a::Int
              b::Bool
       end

julia> function f(x)
           z = false
           z = x
           x === z
       end;

julia> f(X(1, false))
Assertion failed: (Ty && "Invalid GetElementPtrInst indices for type!"), function checkGEPType, file /usr/local/julia/usr/include/llvm/IR/Instructions.h, line 704.

signal (6): Abort trap: 6
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
fish: Job 1, 'julia' terminated by signal SIGABRT (Abort)

z is boxed and the codegen appears to be trying to do a GEP on the jl_value_t*.

vtjnash added a commit that referenced this issue Oct 16, 2015
Fix #13647, comparing boxed isbits immutables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants