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

Fix missing gc root in generator expansion #25123

Merged
merged 1 commit into from
Dec 16, 2017
Merged

Fix missing gc root in generator expansion #25123

merged 1 commit into from
Dec 16, 2017

Conversation

Keno
Copy link
Member

@Keno Keno commented Dec 15, 2017

ClangSA complains:

/home/keno/julia/src/method.c:334:37: note: Passing non-rooted value as argument to function that may GC
            func = (jl_code_info_t*)jl_expand((jl_value_t*)ex, linfo->def.method->module);
                                    ^         ~~~~~~~~~~~~~~~

But why you ask, ex is pushed into a gc frame earlier in the function. Well, because of C scoping rules,
that's a different ex than the one that gets assigned.

ClangSA complains:
```
/home/keno/julia/src/method.c:334:37: note: Passing non-rooted value as argument to function that may GC
            func = (jl_code_info_t*)jl_expand((jl_value_t*)ex, linfo->def.method->module);
                                    ^         ~~~~~~~~~~~~~~~
```
But why you ask, `ex` is pushed into a gc frame earlier in the function. Well, because of C scoping rules,
that's a different `ex` than the one that gets assigned.
@ararslan ararslan added the GC Garbage collector label Dec 16, 2017
Copy link
Contributor

@yuyichao yuyichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too bad the push disabled the var unused warning...

Keno added a commit that referenced this pull request Dec 16, 2017
```
/home/keno/julia/src/precompile.c:191:5: note: GC frame changed here
    JL_GC_PUSH2(&p, &methsig);
    ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/keno/julia/src/precompile.c:193:5: note: Loop condition is true. Entering loop body
    while (!incr) {
    ^
/home/keno/julia/src/precompile.c:194:24: note: Started tracking value here
        jl_svec_t *p = jl_alloc_svec_uninit(l);
                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/keno/julia/src/precompile.c:195:9: note: Loop condition is true. Entering loop body
        for (i = 0, idx_ctr = 0, incr = 1; i < l; i++) {
        ^
/home/keno/julia/src/precompile.c:197:13: note: Taking false branch
            if (jl_is_uniontype(ty)) {
            ^
/home/keno/julia/src/precompile.c:195:9: note: Loop condition is false. Execution continues on line 217
        for (i = 0, idx_ctr = 0, incr = 1; i < l; i++) {
        ^
/home/keno/julia/src/precompile.c:217:32: note: Passing non-rooted value as argument to function that may GC
        methsig = (jl_value_t*)jl_apply_tuple_type(p);
                               ^                   ~
```
Essentially the same bug as #25123
@Keno Keno merged commit 0d7493c into master Dec 16, 2017
@fredrikekre fredrikekre deleted the kf/methodgcroot branch December 16, 2017 21:54
Keno added a commit that referenced this pull request Dec 16, 2017
```
/home/keno/julia/src/precompile.c:191:5: note: GC frame changed here
    JL_GC_PUSH2(&p, &methsig);
    ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/keno/julia/src/precompile.c:193:5: note: Loop condition is true. Entering loop body
    while (!incr) {
    ^
/home/keno/julia/src/precompile.c:194:24: note: Started tracking value here
        jl_svec_t *p = jl_alloc_svec_uninit(l);
                       ^~~~~~~~~~~~~~~~~~~~~~~
/home/keno/julia/src/precompile.c:195:9: note: Loop condition is true. Entering loop body
        for (i = 0, idx_ctr = 0, incr = 1; i < l; i++) {
        ^
/home/keno/julia/src/precompile.c:197:13: note: Taking false branch
            if (jl_is_uniontype(ty)) {
            ^
/home/keno/julia/src/precompile.c:195:9: note: Loop condition is false. Execution continues on line 217
        for (i = 0, idx_ctr = 0, incr = 1; i < l; i++) {
        ^
/home/keno/julia/src/precompile.c:217:32: note: Passing non-rooted value as argument to function that may GC
        methsig = (jl_value_t*)jl_apply_tuple_type(p);
                               ^                   ~
```
Essentially the same bug as #25123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GC Garbage collector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants