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

0.20.0 fails to bootstrap when passing "--verbosity:2" (or 3) to koch #11436

Closed
stefantalpalaru opened this issue Jun 8, 2019 · 4 comments

Comments

@stefantalpalaru
Copy link
Contributor

commented Jun 8, 2019

Using https://nim-lang.org/download/nim-0.20.0.tar.xz:

sh build.sh
bin/nim c koch
./koch boot --verbosity:2

I get this failure:

/mnt/mypassport/storage/nim-0.20.0/compiler/semparallel.nim(456, 32) Warning: not GC-safe: 'transformSpawnSons(g, owner, n, barrier)' [GcUnsafe]
      result = transformSpawnSons(g, owner, n, barrier)
                                 ^
/mnt/mypassport/storage/nim-0.20.0/lib/system/fatal.nim(39) sysFatal
Error: unhandled exception: /mnt/mypassport/storage/nim-0.20.0/compiler/guards.nim(984, 12) `branch.kind == nkOfBranch`  [AssertionError]
FAILURE

With rm -rf nimcache; ./koch boot --verbosity:3, there's a different error:

/mnt/mypassport/storage/nim-0.20.0/lib/system/io.nim(653, 1) Hint: 130047 [Processing]
???(0, 0) Hint: 131814 [Processing]
  
/mnt/mypassport/storage/nim-0.20.0/lib/system/fatal.nim(48) sysFatal
Error: unhandled exception: value out of range: -1 [RangeError]
FAILURE
@Vindaar

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

This does not only happen during bootstrapping. Also just a simple hello world program is affected:
hello.nim:

echo "Hello :)"
nim c --verbosity:3 hello.nim

throws the same error:

???(0, 0) Hint: 174814 [Processing]
Hint: testecho [Processing]
/tmp/testecho.nim(1, 6) Hint: 175003 [Processing]
  echo "Hello world!"
       ^
???(0, 0) Hint: 175024 [Processing]
  
/home/schmidt/src/nim/nim_git_repo/lib/system/fatal.nim(48) sysFatal
Error: unhandled exception: value out of range: -1 [RangeError]
@Vindaar

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

Hmm, for some reason the col field of the TLineInfo argument in writeSurroundingSrc is -1 here:
https://github.com/nim-lang/Nim/blob/devel/compiler/msgs.nim#L455

strutils.spaces however takes a Natural, so we get the RangeError, since -1 is not in Natural.

edit:
That state corresponds to unknownLineInfo
https://github.com/nim-lang/Nim/blob/devel/compiler/lineinfos.nim#L234, which is how a MsgConfig is initialized (see line 262).

One possible solution is thus to check in writeSurroundingSrc whether the line info is known. sourceLine above already checks whether the file is known: https://github.com/nim-lang/Nim/blob/devel/compiler/msgs.nim#L438. We could just do something like

  const indent = "  "
  let line = sourceLine(conf, info)
  if line.len > 0:
    msgWriteln(conf, indent & line)
    msgWriteln(conf, indent & spaces(info.col) & '^')

But maybe the solution should rather be to handle this way earlier?

@narimiran

This comment has been minimized.

Copy link
Member

commented Jun 13, 2019

Also just a simple hello world program is affected

...if your nim was bootstrapped without -d:danger flag. I.e. if you need a workaround until this is fixed, bootstrap Nim with ./koch boot -d:danger.

@Vindaar

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

Ahh, indeed I just built the compiler with -d:danger today, heh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.