Open pb-cdunn opened 3 years ago
Still works at
commit 33d79b9e64f8f67adcf8415de61d1568630e36cb (HEAD)
Author: Timothee Cour <timothee.cour2@gmail.com>
Date: Wed Nov 18 05:01:43 2020
Fails at
commit 87d3e5331a7838aa255deca8a840c2080b5424ce (HEAD)
Author: cooldome <ariabushenko@gmail.com>
Date: Wed Nov 18 11:19:57 2020
Semfold for nil cast (#16030)
* bring back the semfold of nil
* remove space
* fix test
* proc type can't be dereferenced
That's repeatable, so it's definitely that commit.
And it fails at several later commits, every one that I tried. It seems to be that particular change, which is fairly small.
If you want to reproduce this, here is my source code: https://github.com/bio-nim/pb-falconc (develop
branch)
You need to install htslib
and zlib
. (Via macports or homebrew is fine.) Otherwise, it has all its own dependencies, in the vendor
subdirs.
make rsync
make build
Since most of our macros come from cligen, I updated to the latest cligen on the cligen-update
branch. No difference.
@c-blake , any ideas?
@pb-cdunn, I can't install pb-falconc I am afraid.
Let's try this trick instead. Could you please add one line at ccgexprs.nim(77)
in proc genLiteral:
echo toFileLineCol(p.module.g.graph.config, n.info), ": ", n
and compile nim_temp
with koch temp
. Recompile your project with koch temp
.
Added echo should give lineinfo of offending line just before the crash. This should give you indication of what function actually causing problem and help preparing a test case.
Sorry to be of no help, but holiday here makes it hard to contribute, but good luck. I have not seen this arise before, though.
I'm adding that now. But could you explain a bit more on nim_temp
? I saw info on that, but I did not understand. koch
is not in the bin
, so how can I use koch temp
. I tried using nim_temp ...
(after koch temp
in Nim repo), and that worked.
Anyway,
falconc/src/falconcpkg/falcon/sys.nim(76, 26) Error: compiler was built without 'spawn' support
Is that the problem?
I did a full ./koch boot
, rebuilt my codebase, and got this:
...
/Users/cdunn/repo/gh/Nim/lib/system.nim(2011, 57): nil
/Users/cdunn/repo/bb/falconc/src/falconcpkg/raptor_db.nim(266, 8): nil
Error: internal error: getTypeDescAux(tyGenericParam)
https://github.com/bio-nim/pb-falconc/blob/develop/src/falconcpkg/raptor_db.nim#L266
proc alarm(e: ref Exception, fn: string) =
## Write a special JSON object expected by pbcommand.models.common.
var fout = open(fn, fmWrite)
if nil == fout: # <<< line 266
File
is ptr CFile
, should that should be comparable to nil
, right?
hmm, I expected to see some generic functions because of tyGenericParam
. Something didn't go well during experiment.
Just checking, did you put echo
above this line right?
result = "(($1) NIM_NIL)" % [getTypeDesc(p.module, ty)]
git diff
diff --git compiler/ccgexprs.nim compiler/ccgexprs.nim
index ec28eb1ec..2947dabc0 100644
--- compiler/ccgexprs.nim
+++ compiler/ccgexprs.nim
@@ -74,6 +74,7 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): Rope =
elif k in {tyPointer, tyNil, tyProc}:
result = rope("NIM_NIL")
else:
+ echo toFileLineCol(p.module.g.graph.config, n.info), ": ", n
result = "(($1) NIM_NIL)" % [getTypeDesc(p.module, ty)]
of nkStrLit..nkTripleStrLit:
let k = if ty == nil: tyString
looks good, not sure why it doesn't help then
when defined(good):
var s: cstring
when defined(bad):
var s: ptr char
when defined(op1):
discard s.isNil
when defined(op2):
discard s != nil
when defined(op3):
discard nil != s
when defined(op4):
discard isNil s
1.4.0 can compile all variants. 1.4.2 can compile all variants except for -d:bad -d:op3
var s: ptr char
discard nil != s
Error: internal error: getTypeDescAux(tyGenericParam)
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details
Nim Compiler Version 1.4.2 [Linux: amd64]
Compiled at 2020-11-30
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 3fb5157ab1b666a5a5c34efde0f357a82d433d04
active boot switches: -d:release
@jrfondren , you've found the problem! When I switch
if nil == fout: # <<< line 266
to
if fout == nil:
it works. So this is the bug.
bump. I am hitting this as well.
Build fails for
devel
. Works for older versions.Example
I see the same problem in #13378 (10 Feb), so it must happen from time to time. I don't know where it occurs yet.
Additional Information
It works fine with
1.4.0
and1.2.6
, and was working with slightly olderdevel
. E.g it works fine atI wish I knew how to fix that "No stack traceback available" problem via choosenim. I'm trying to build nim myself now ...
I guess that's not very helpful. I'll try to git-bisect the compiler, unless someone has a better idea.