Re: seg fault w/ macro-module combination

45 views
Skip to first unread message

Patrick O'Leary

unread,
Oct 8, 2012, 8:55:59 PM10/8/12
to juli...@googlegroups.com
Anything that segfaults with language input (and isn't a ccall) is automatically a bug. Please don't hesitate to file an issue at https://github.com/JuliaLang/julia/issues

If you don't have a Github account, you can sign up for a standard free account at https://github.com/signup/free

On Monday, October 8, 2012 6:01:18 PM UTC-5, Postlethwaite wrote:
I was hacking around trying to get a nice syntax to turn modules into self contained testblocks so I could do
@testblock testname begin
  a
= 3
  @assert funtest(a) == 6
end

and it would automatically load up Base.* and my module file and provide stdout printing of test name etc.
I like the idea of modules being able to load up different environments.

Anyway I am getting seg faults with the code below.

tstfile.jl
macro testblock(name)
    quote
        module $name
        import Base.*
        a = 2
        end
    end
end

running

>julia tstfile.jl

results in:

Segmentation fault (core dumped)


Stefan Karpinski

unread,
Oct 9, 2012, 1:24:19 AM10/9/12
to juli...@googlegroups.com
On Mon, Oct 8, 2012 at 8:55 PM, Patrick O'Leary <patrick...@gmail.com> wrote:
and isn't a ccall

And isn't an *incorrect* ccall. We've certainly had (rare) situations where correct ccalls caused segfaults. That's definitely a bug too.

Jeff Bezanson

unread,
Oct 9, 2012, 7:58:30 PM10/9/12
to juli...@googlegroups.com
I tried to reproduce this and haven't been able to. If this still
happens, file an issue with version and system details.

On Mon, Oct 8, 2012 at 7:01 PM, Postlethwaite <post.b...@gmail.com> wrote:
> I was hacking around trying to get a nice syntax to turn modules into self
> contained testblocks so I could do
> @testblock testname begin
> a = 3
> @assert funtest(a) == 6
> end
>
> and it would automatically load up Base.* and my module file and provide
> stdout printing of test name etc.
> I like the idea of modules being able to load up different environments.
>
> Anyway I am getting seg faults with the code below.
>
> tstfile.jl
> macro testblock(name)
> quote
> module $name
> import Base.*
> a = 2
> end
> end
> end
>
> running
>
>>julia tstfile.jl
>
> results in:
>
> Segmentation fault (core dumped)
>
>
> --
>
>
>
Reply all
Reply to author
Forward
0 new messages