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

The destructor\tbintree2.nim test is failing #19537

Closed
rockcavera opened this issue Feb 16, 2022 · 1 comment · Fixed by #19540
Closed

The destructor\tbintree2.nim test is failing #19537

rockcavera opened this issue Feb 16, 2022 · 1 comment · Fixed by #19540

Comments

@rockcavera
Copy link
Contributor

rockcavera commented Feb 16, 2022

When calling the destructor\tbintree2.nim test, it fails to compile with PR #19538

testament r tests\destructor\tbintree2.nim

Current Output

FAIL: tests/destructor/tbintree2.nim c                             ( 1.36 sec)
Test "tests\destructor\tbintree2.nim" in category "destructor"
Failure: reNimcCrash
debugInfo:  compiler exit code was 0 but some Error's were found.
$ D:\Nim\bin\nim.exe c -d:nimAllocStats --newruntime tests\destructor\tbintree2.nim
command line(1, 2) Warning: newruntime is deprecated, use arc/orc instead! [Deprecated]
Hint: used config file 'D:\Nim\config\nim.cfg' [Conf]
Hint: used config file 'D:\Nim\config\config.nims' [Conf]
Hint: used config file 'D:\tNim\tests\config.nims' [Conf]
Hint: used config file 'D:\tNim\tests\destructor\nim.cfg' [Conf]
tbintree2.nim(7, 15) Warning: imported and not used: 'ansi_c' [UnusedImport]
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c: In function 'loadBCrypt__stdZsysrand_77':
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c:161:148: error: incompatible type for argument 2 of 'raiseFieldError2'
  161 |                         if (!(((2 &((NU8)1<<((NU)(bcrypt.cRngType)&7U)))!=0)))                  { raiseFieldError2(TM__sT0fWggTrXhnxQ79bl9a8nHg_5, (NI)bcrypt.cRngType); }
      |                                                                                                                                                    ^~~~~~~~~~~~~~~~~~~
      |                                                                                                                                                    |
      |                                                                                                                                                    long long int
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c:70:77: note: expected 'NimStringV2' but argument is of type 'long long int'
   70 | N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f, NimStringV2 discVal);
      |                                                                 ~~~~~~~~~~~~^~~~~~~
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c:169:164: error: incompatible type for argument 2 of 'raiseFieldError2'
  169 |                                 if (!(((2 &((NU8)1<<((NU)(bcrypt.cRngType)&7U)))!=0)))                          { raiseFieldError2(TM__sT0fWggTrXhnxQ79bl9a8nHg_6, (NI)bcrypt.cRngType); }
      |                                                                                                                                                                    ^~~~~~~~~~~~~~~~~~~
      |                                                                                                                                                                    |
      |                                                                                                                                                                    long long int
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c:70:77: note: expected 'NimStringV2' but argument is of type 'long long int'
   70 | N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f, NimStringV2 discVal);
      |                                                                 ~~~~~~~~~~~~^~~~~~~
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c: In function 'loadWinCrypt__stdZsysrand_125':
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c:230:181: error: incompatible type for argument 2 of 'raiseFieldError2'
  230 |                                         if (!(((4 &((NU8)1<<((NU)(crypt.cRngType)&7U)))!=0)))                                   { raiseFieldError2(TM__sT0fWggTrXhnxQ79bl9a8nHg_10, (NI)crypt.cRngType); }
      |                                                                                                                                                                                     ^~~~~~~~~~~~~~~~~~
      |                                                                                                                                                                                     |
      |                                                                                                                                                                                     long long int
C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c:70:77: note: expected 'NimStringV2' but argument is of type 'long long int'
   70 | N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f, NimStringV2 discVal);
      |                                                                 ~~~~~~~~~~~~^~~~~~~
compilation terminated due to -fmax-errors=3.
CC: stdlib_exitprocs.nim
CC: stdlib_sysrand.nim
Error: execution of an external compiler program 'D:\compilers\mingw64\bin\gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN   -ID:\Nim\lib -ID:\tNim\tests\destructor -o C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c.o C:\Users\Jose\nimcache\tbintree2_d\stdlib_sysrand.nim.c' failed with exit code: 1


C:\Users\Jose\nimcache\tbintree2_d\stdlib_exitprocs.nim.c: In function 'callClosures__stdZexitprocs_154':
C:\Users\Jose\nimcache\tbintree2_d\stdlib_exitprocs.nim.c:371:179: error: incompatible type for argument 2 of 'raiseFieldError2'
  371 |                                         if (!(((1 &((NU8)1<<((NU)(fun.kind)&7U)))!=0)))                                         { raiseFieldError2(TM__JXL39bfraktrl3ZkJ5EQGjw_8, (NI)fun.kind); }
      |                                                                                                                                                                                   ^~~~~~~~~~~~
      |                                                                                                                                                                                   |
      |                                                                                                                                                                                   long long int
C:\Users\Jose\nimcache\tbintree2_d\stdlib_exitprocs.nim.c:145:77: note: expected 'NimStringV2' but argument is of type 'long long int'
  145 | N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f, NimStringV2 discVal);
      |                                                                 ~~~~~~~~~~~~^~~~~~~
C:\Users\Jose\nimcache\tbintree2_d\stdlib_exitprocs.nim.c:378:180: error: incompatible type for argument 2 of 'raiseFieldError2'
  378 |                                         if (!(((2 &((NU8)1<<((NU)(fun.kind)&7U)))!=0)))                                         { raiseFieldError2(TM__JXL39bfraktrl3ZkJ5EQGjw_11, (NI)fun.kind); }
      |                                                                                                                                                                                    ^~~~~~~~~~~~
      |                                                                                                                                                                                    |
      |                                                                                                                                                                                    long long int
C:\Users\Jose\nimcache\tbintree2_d\stdlib_exitprocs.nim.c:145:77: note: expected 'NimStringV2' but argument is of type 'long long int'
  145 | N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f, NimStringV2 discVal);
      |                                                                 ~~~~~~~~~~~~^~~~~~~

FAILURE! total: 1 passed: 0 skipped: 0 failed: 1

Expected Output

PASS: tests/destructor/tbintree2.nim c

Possible Solution

I see two solutions.

  1. change for the test to use --mm:arc as it uses --newruntime; or
  2. change the lib\system\chcks.nim file on line 32 from defined(gcdestructors) to defined(nimV2).
Nim Compiler Version 1.7.1 [Windows: amd64]
Compiled at 2022-02-15
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: b2c5d7b4ff070abe2145e998d090fb15b4df522f
active boot switches: -d:release
@rockcavera
Copy link
Contributor Author

A small code to reproduce the error:

# test.nim
import std/exitprocs

proc test() =
  echo "test"

addExitProc(test)

Compile with: nim c --newruntime test.nim

Output:

command line(1, 2) Warning: newruntime is deprecated, use arc/orc instead! [Deprecated]
Hint: used config file 'D:\Nim\config\nim.cfg' [Conf]
Hint: used config file 'D:\Nim\config\config.nims' [Conf]
...........................................................
CC: stdlib_digitsutils.nim
CC: stdlib_dollars.nim
CC: stdlib_syncio.nim
CC: stdlib_system.nim
CC: stdlib_exitprocs.nim
CC: test.nim
C:\Users\Jose\nimcache\test_d\stdlib_exitprocs.nim.c: In function 'callClosures__stdZexitprocs_154':
C:\Users\Jose\nimcache\test_d\stdlib_exitprocs.nim.c:371:179: error: incompatible type for argument 2 of 'raiseFieldError2'
  371 |                                         if (!(((1 &((NU8)1<<((NU)(fun.kind)&7U)))!=0)))                                         { raiseFieldError2(TM__JXL39bfraktrl3ZkJ5EQGjw_8, (NI)fun.kind); }
      |                                                                                                                                                                                   ^~~~~~~~~~~~
      |                                                                                                                                                                                   |
      |                                                                                                                                                                                   long long int
C:\Users\Jose\nimcache\test_d\stdlib_exitprocs.nim.c:145:77: note: expected 'NimStringV2' but argument is of type 'long long int'
  145 | N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f, NimStringV2 discVal);
      |                                                                 ~~~~~~~~~~~~^~~~~~~
C:\Users\Jose\nimcache\test_d\stdlib_exitprocs.nim.c:378:180: error: incompatible type for argument 2 of 'raiseFieldError2'
  378 |                                         if (!(((2 &((NU8)1<<((NU)(fun.kind)&7U)))!=0)))                                         { raiseFieldError2(TM__JXL39bfraktrl3ZkJ5EQGjw_11, (NI)fun.kind); }
      |                                                                                                                                                                                    ^~~~~~~~~~~~
      |                                                                                                                                                                                    |
      |                                                                                                                                                                                    long long int
C:\Users\Jose\nimcache\test_d\stdlib_exitprocs.nim.c:145:77: note: expected 'NimStringV2' but argument is of type 'long long int'
  145 | N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f, NimStringV2 discVal);
      |                                                                 ~~~~~~~~~~~~^~~~~~~
Error: execution of an external compiler program 'D:\compilers\mingw64\bin\gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields   -ID:\Nim\lib -IC:\Users\Jose\desktop -o C:\Users\Jose\nimcache\test_d\stdlib_exitprocs.nim.c.o C:\Users\Jose\nimcache\test_d\stdlib_exitprocs.nim.c' failed with exit code: 1

It's a bug in a deprecated feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant