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

Macro causes segfault #28833

Closed
dawbarton opened this issue Aug 22, 2018 · 4 comments
Closed

Macro causes segfault #28833

dawbarton opened this issue Aug 22, 2018 · 4 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior macros @macros regression Regression in behavior compared to a previous version

Comments

@dawbarton
Copy link

I'm pretty sure the macro below doesn't do what I intended but I'm also pretty sure that it shouldn't cause a segfault...

julia> macro killme(expr)
       esc(:(global a))
       end
@killme (macro with 1 method)

julia> @killme 1+1

signal (11): Segmentation fault
in expression starting at no file:0
jl_array_ptr_ref at /buildworker/worker/package_linux64/build/src/julia.h:785 [inlined]
body_attributes at /buildworker/worker/package_linux64/build/src/toplevel.c:404 [inlined]
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:761
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/builtins.c:622
eval at ./boot.jl:319 [inlined]
#13 at /home/db9052/.julia/packages/Atom/jJn7Y/src/repl.jl:125 [inlined]
with_logstate at ./logging.jl:397
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
with_logger at ./logging.jl:493
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
top-level scope at /home/db9052/.julia/packages/Atom/jJn7Y/src/repl.jl:124
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1829
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:781
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/builtins.c:622
eval at ./boot.jl:319
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
eval_user_input at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:85
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:117 [inlined]
#28 at ./task.jl:259
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2182
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1536 [inlined]
start_task at /buildworker/worker/package_linux64/build/src/task.c:268
unknown function (ip: 0xffffffffffffffff)
Allocations: 18071712 (Pool: 18068443; Big: 3269); GC: 40

Version info is

Julia Version 1.0.0
Commit 5d4eaca0c9 (2018-08-08 20:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, broadwell)
Environment:
  JULIA_EDITOR = atom
  JULIA_NUM_THREADS = 2

Thanks.

@ararslan ararslan added bug Indicates an unexpected problem or unintended behavior macros @macros regression Regression in behavior compared to a previous version labels Aug 22, 2018
@ararslan
Copy link
Member

Behavior in Julia 0.6:

$ julia-0.6 -e 'macro killme(ex) esc(:(global a)) end; @killme 1+1'
ERROR: syntax: misplaced "global" declaration

@ararslan
Copy link
Member

As a debugging breadcrumb, running with a debug build produces this:

julia> macro killme(ex)
           esc(:(global a))
       end
@killme (macro with 1 method)

julia> @killme 1+1
julia: /data/ararslan/julia/src/toplevel.c:762: jl_toplevel_eval_flex: Assertion `head == thunk_sym' failed.

@Keno
Copy link
Member

Keno commented Aug 22, 2018

This one's for @JeffBezanson probably, but he's on vacation until the end of next week (though he may get bored before then).

@JeffBezanson
Copy link
Member

Fixed by #28882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior macros @macros regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

4 participants