nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.44k stars 1.47k forks source link

`-d:nimArcIds` broken with `--mm:orc` #22273

Closed juancarlospaco closed 1 year ago

juancarlospaco commented 1 year ago

Description

-d:nimArcIds broken with --mm:orc, its suppose to be for ARC/ORC debugging (?).

But looks like dead code if it does nothing, so in that case maybe can be removed?.

If this is not a bug feel free to close.

Nim Version

devel

Current Output

nim-#devel/lib/system/orc.nim(87, 16) Error: undeclared field: 'name' for type system.PNimTypeV2 [type declared in nim-#devel/lib/system.nim(1629, 5)]

Expected Output

compile

Possible Solution

Deprecate -d:nimArcIds ?.

Additional Information

-d:nimArcDebug Works.

juancarlospaco commented 1 year ago

!nim c --gc:orc -d:nimArcIds

echo 42
github-actions[bot] commented 1 year ago

@juancarlospaco (contributor)

devel :-1: FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off  --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated]
/home/runner/.choosenim/toolchains/nim-#devel/lib/system/orc.nim(87, 16) Error: undeclared field: 'name' for type system.PNimTypeV2 [type declared in /home/runner/.choosenim/toolchains/nim-#devel/lib/system.nim(1629, 5)]

Stats

  • Created 2023-07-12T17:54:03Z
  • Started 2023-07-12T17:54:44
  • Finished 2023-07-12T17:54:44
  • Duration now
  • Commands nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

Filesize 0 bytes ```cpp ```

AST

```nim nnkCommand.newTree( newIdentNode("echo"), newLit(42) ) ```
stable :+1: OK

Output

``` 42 ```

Stats

  • Created 2023-07-12T17:54:03Z
  • Started 2023-07-12T17:54:45
  • Finished 2023-07-12T17:54:47
  • Duration 2 minutes
  • Commands nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
1.6.0 :+1: OK

Output

``` 42 ```

Stats

  • Created 2023-07-12T17:54:03Z
  • Started 2023-07-12T17:54:50
  • Finished 2023-07-12T17:54:51
  • Duration 1 minute
  • Commands nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
1.4.0 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/arc.nim(93, 30) Error: undeclared identifier: 'traceId' ```

Stats

  • Created 2023-07-12T17:54:03Z
  • Started 2023-07-12T17:54:54
  • Finished 2023-07-12T17:54:54
  • Duration now
  • Commands nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

Filesize 74.22 Kb ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #undef LANGUAGE_C #undef MIPSEB #undef MIPSEL #undef PPC #undef R3000 #undef R4000 #undef i386 #undef linux #undef mips #undef near #undef far #undef powerpc #undef unix # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, initStackBottomWith)(void* locals); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached_system_4395)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[2+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_3 = { 2 | NIM_STRLIT_FLAG, "42" }; static NIM_CONST tyArray__nHXaesL0DJZHyVS07ARPRA TM__SRd76hP9cMfCzdUO857UhQQ_2 = {{2, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_3}} ; extern TFrame* framePtr_system_3877; extern TFrame* framePtr_system_3877; extern TFrame* framePtr_system_3877; extern TFrame* framePtr_system_3877; extern TFrame* framePtr_system_3877; extern TFrame* framePtr_system_3877; static N_INLINE(void, initStackBottomWith)(void* locals) { } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr_system_3877 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr_system_3877).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr_system_3877; framePtr_system_3877 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached_system_4395(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr_system_3877 = (*framePtr_system_3877).prev; } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); systemInit000(); (*inner)(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); echoBinSafe(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1); nimTestErrorFlag(); popFrame(); } } ```

AST

```nim nnkCommand.newTree( newIdentNode("echo"), newLit(42) ) ```
1.2.0 :+1: OK

Output

``` 42 ```

Stats

  • Created 2023-07-12T17:54:03Z
  • Started 2023-07-12T17:55:10
  • Finished 2023-07-12T17:55:11
  • Duration now
  • Commands nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
1.0.0 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim command line(1, 2) Error: 'none', 'boehm' or 'refc' expected, but 'orc' found ```

Stats

  • Created 2023-07-12T17:54:03Z
  • Started 2023-07-12T17:55:24
  • Finished 2023-07-12T17:55:24
  • Duration now
  • Commands nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

Filesize 82.91 Kb ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #undef LANGUAGE_C #undef MIPSEB #undef MIPSEL #undef PPC #undef R3000 #undef R4000 #undef i386 #undef linux #undef mips #undef near #undef far #undef powerpc #undef unix # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, initStackBottomWith)(void* locals); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[2+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_3 = { 2 | NIM_STRLIT_FLAG, "42" }; static NIM_CONST tyArray__nHXaesL0DJZHyVS07ARPRA TM__SRd76hP9cMfCzdUO857UhQQ_2 = {{2, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_3}} ; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, initStackBottomWith)(void* locals) { } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); (*inner)(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); echoBinSafe(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1); nimTestErrorFlag(); popFrame(); } } ```

AST

```nim nnkCommand.newTree( newIdentNode("echo"), newLit(42) ) ```
0.20.2 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim command line(1, 2) Error: 'none', 'boehm' or 'refc' expected, but 'orc' found ```

Stats

  • Created 2023-07-12T17:54:03Z
  • Started 2023-07-12T17:55:36
  • Finished 2023-07-12T17:55:36
  • Duration now
  • Commands nim c --gc:orc -d:nimArcIds --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

Filesize 82.91 Kb ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #undef LANGUAGE_C #undef MIPSEB #undef MIPSEL #undef PPC #undef R3000 #undef R4000 #undef i386 #undef linux #undef mips #undef near #undef far #undef powerpc #undef unix # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, initStackBottomWith)(void* locals); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[2+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_3 = { 2 | NIM_STRLIT_FLAG, "42" }; static NIM_CONST tyArray__nHXaesL0DJZHyVS07ARPRA TM__SRd76hP9cMfCzdUO857UhQQ_2 = {{2, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_3}} ; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, initStackBottomWith)(void* locals) { } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); (*inner)(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); echoBinSafe(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1); nimTestErrorFlag(); popFrame(); } } ```

AST

```nim nnkCommand.newTree( newIdentNode("echo"), newLit(42) ) ```
??? :arrow_right: :bug:

Diagnostics

The commit that introduced the bug can not be found, but the bug is in the commits: (Can not find the commit because Nim can not be re-built commit-by-commit to bisect).
:robot: Bug found in 40 minutes bisecting 1581 commits at 39 commits per second.
juancarlospaco commented 1 year ago

Maybe https://github.com/nim-lang/Nim/commit/f11b7debf#diff-c7ae564e61082887ea50f0d58a637cb12fa78261f51aa4eface24ababfeee299R1598-R1599 ? 🤔