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

Simple program mixing int and floats fails to compile at the C compilation stage #22888

Closed
AngelEzquerra opened this issue Oct 30, 2023 · 4 comments · Fixed by #24525
Closed

Comments

@AngelEzquerra
Copy link
Contributor

Description

The following simple program fails to compile at the C compilation stage. No errors at the nim compilation stage are shown:

proc dummy*[T: SomeNumber](a: T, b: T = 2.5): T =
  result = a

echo dummy(2)

The compilation error is:

C:\repositories>nim -f r compilation_failure.nim
Hint: used config file 'C:\Users\user\.choosenim\toolchains\nim-2.0.0\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\user\.choosenim\toolchains\nim-2.0.0\config\config.nims' [Conf]
........................................................................
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/system/exceptions.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/std/private/digitsutils.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/system/dollars.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/std/exitprocs.nimCC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/std/syncio.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/system.nim
CC: compilation_failure.nim
C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c: In function 'NimMainModule':
C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c:179:55: error: expected expression before ')' token
  179 |         T3_ = dummy__compilation95failure_u6(((NI)2), );
      |                                                       ^
Error: execution of an external compiler program 'gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields   -IC:\Users\user\.choosenim\toolchains\nim-2.0.0\lib -IC:\repositories -o C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c.o C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c' failed with exit code: 1

Mixing ints and floats in this way is of course a dummy thing to do but if this is wrong, I expected an error at the nim compilation stage.

Nim Version

Nim Compiler Version 2.0.0 [Windows: amd64]
Compiled at 2023-08-01
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

Current Output

C:\repositories>nim -f r compilation_failure.nim
Hint: used config file 'C:\Users\user\.choosenim\toolchains\nim-2.0.0\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\user\.choosenim\toolchains\nim-2.0.0\config\config.nims' [Conf]
........................................................................
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/system/exceptions.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/std/private/digitsutils.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/system/dollars.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/std/exitprocs.nimCC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/std/syncio.nim
CC: ../Users/user/.choosenim/toolchains/nim-2.0.0/lib/system.nim
CC: compilation_failure.nim
C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c: In function 'NimMainModule':
C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c:179:55: error: expected expression before ')' token
  179 |         T3_ = dummy__compilation95failure_u6(((NI)2), );
      |                                                       ^
Error: execution of an external compiler program 'gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields   -IC:\Users\user\.choosenim\toolchains\nim-2.0.0\lib -IC:\repositories -o C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c.o C:\Users\user\nimcache\compilation_failure_d\@mcompilation_failure.nim.c' failed with exit code: 1

Expected Output

I expected either no error (and b being converted into T) or a compilation error at the nim compilation stage.

Possible Solution

No response

Additional Information

No response

@ringabout
Copy link
Member

Probably a kind of regression; it compiles with 0.20.0

@ringabout
Copy link
Member

!nim c

proc dummy*[T: SomeNumber](a: T, b: T = 2.5): T =
  result = a

echo dummy(2)

Copy link
Contributor

🐧 Linux bisect by @ringabout (member)
devel 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:146:39: error: expected expression before ‘)’ token
  146 |         T3_ = dummy__temp_u6(((NI)2), );
      |                                       ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread   -I'/home/runner/.choosenim/toolchains/nim-#devel/lib' -I/home/runner/work/Nim/Nim -o /home/runner/work/Nim/Nim/@mtemp.nim.c.o /home/runner/work/Nim/Nim/@mtemp.nim.c' failed with exit code: 1


assertions.nim(34)       raiseAssert
Error: unhandled exception: errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#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) \
 FR_.line = n;
#define nimlf_(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(NimStringV2, dollar___systemZdollars_u8)(NI x_p0);
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_u6)(NI a_p0, NI b_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4661)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u4048;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4445;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4048 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4048).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4048;
 framePtr__system_u4048 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4661();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4048 = (*framePtr__system_u4048).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_u6)(NI a_p0, NI b_p1) {
 NI result;
 nimfr_("dummy", "/home/runner/work/Nim/Nim/temp.nim");
 result = a_p0;
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4445);
 return result;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 NimStringV2 colontmpD_;
 tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
 NI T3_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
 T3_ = (NI)0;
 T3_ = dummy__temp_u6(((NI)2), );
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 colontmpD_ = dollar___systemZdollars_u8(T3_);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 T2_[0] = colontmpD_;
 echoBinSafe(T2_, 1);
 {
  LA1_:;
 }
 {
  if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2023-10-31T14:50:42
  • Finished 2023-10-31T14:50:43
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("dummy")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newIdentNode("SomeNumber"),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        newIdentNode("T"),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("b"),
        newIdentNode("T"),
        newLit(2.5)
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkAsgn.newTree(
        newIdentNode("result"),
        newIdentNode("a")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("echo"),
    nnkCall.newTree(
      newIdentNode("dummy"),
      newLit(2)
    )
  )
)
stable 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:148:39: error: expected expression before ‘)’ token
  148 |         T3_ = dummy__temp_u6(((NI)2), );
      |                                       ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread   -I/home/runner/.choosenim/toolchains/nim-2.0.0/lib -I/home/runner/work/Nim/Nim -o /home/runner/work/Nim/Nim/@mtemp.nim.c.o /home/runner/work/Nim/Nim/@mtemp.nim.c' failed with exit code: 1


assertions.nim(34)       raiseAssert
Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#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) \
 FR_.line = n;
#define nimlf_(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(NimStringV2, dollar___systemZdollars_u8)(NI x_p0);
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_u6)(NI a_p0, NI b_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4006;
 framePtr__system_u4006 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4607();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_u6)(NI a_p0, NI b_p1) {
 NI result;
 nimfr_("dummy", "/home/runner/work/Nim/Nim/temp.nim");
 result = (NI)0;
 result = a_p0;
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (NIM_BOOL*)0;
 result = (&nimInErrorMode__system_u4389);
 return result;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 NimStringV2 colontmpD_;
 tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
 NI T3_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
 T3_ = (NI)0;
 T3_ = dummy__temp_u6(((NI)2), );
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 colontmpD_ = dollar___systemZdollars_u8(T3_);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 T2_[0] = colontmpD_;
 echoBinSafe(T2_, 1);
 {
  LA1_:;
 }
 {
  if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2023-10-31T14:50:43
  • Finished 2023-10-31T14:50:44
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("dummy")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newIdentNode("SomeNumber"),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        newIdentNode("T"),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("b"),
        newIdentNode("T"),
        newLit(2.5)
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkAsgn.newTree(
        newIdentNode("result"),
        newIdentNode("a")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("echo"),
    nnkCall.newTree(
      newIdentNode("dummy"),
      newLit(2)
    )
  )
)
2.0.0 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:148:39: error: expected expression before ‘)’ token
  148 |         T3_ = dummy__temp_u6(((NI)2), );
      |                                       ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread   -I/home/runner/.choosenim/toolchains/nim-2.0.0/lib -I/home/runner/work/Nim/Nim -o /home/runner/work/Nim/Nim/@mtemp.nim.c.o /home/runner/work/Nim/Nim/@mtemp.nim.c' failed with exit code: 1


assertions.nim(34)       raiseAssert
Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#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) \
 FR_.line = n;
#define nimlf_(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(NimStringV2, dollar___systemZdollars_u8)(NI x_p0);
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_u6)(NI a_p0, NI b_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4006;
 framePtr__system_u4006 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4607();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_u6)(NI a_p0, NI b_p1) {
 NI result;
 nimfr_("dummy", "/home/runner/work/Nim/Nim/temp.nim");
 result = (NI)0;
 result = a_p0;
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (NIM_BOOL*)0;
 result = (&nimInErrorMode__system_u4389);
 return result;
}
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) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
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) {
{
 NimStringV2 colontmpD_;
 tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
 NI T3_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
 T3_ = (NI)0;
 T3_ = dummy__temp_u6(((NI)2), );
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 colontmpD_ = dollar___systemZdollars_u8(T3_);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 T2_[0] = colontmpD_;
 echoBinSafe(T2_, 1);
 {
  LA1_:;
 }
 {
  if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2023-10-31T14:50:44
  • Finished 2023-10-31T14:50:45
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("dummy")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newIdentNode("SomeNumber"),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        newIdentNode("T"),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("b"),
        newIdentNode("T"),
        newLit(2.5)
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkAsgn.newTree(
        newIdentNode("result"),
        newIdentNode("a")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("echo"),
    nnkCall.newTree(
      newIdentNode("dummy"),
      newLit(2)
    )
  )
)
1.6.14 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:146:39: error: expected expression before ‘)’ token
  146 |         T2_ = dummy__temp_6(((NI) 2), );
      |                                       ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3   -I/home/runner/.choosenim/toolchains/nim-1.6.14/lib -I/home/runner/work/Nim/Nim -o /home/runner/work/Nim/Nim/@mtemp.nim.c.o /home/runner/work/Nim/Nim/@mtemp.nim.c' failed with exit code: 1


fatal.nim(54)            sysFatal
Error: unhandled exception: options.nim(645, 14) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#  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 NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1];
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___systemZdollars_3)(NI x);
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_6)(NI a, NI b);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_2997)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
 nimSetMem__systemZmemory_7(p, ((int) 0), size);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
 {
  if (!(framePtr__system_2564 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s).calldepth = ((NI16) 0);
 }
 goto LA1_;
 LA3_: ;
 {
  (*s).calldepth = (NI16)((*framePtr__system_2564).calldepth + ((NI16) 1));
 }
 LA1_: ;
 (*s).prev = framePtr__system_2564;
 framePtr__system_2564 = s;
 {
  if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
  callDepthLimitReached__system_2997();
 }
 LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_2564 = (*framePtr__system_2564).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, dummy__temp_6)(NI a, NI b) {
 NI result;
 nimfr_("dummy", "/home/runner/work/Nim/Nim/temp.nim");
 result = (NI)0;
 result = a;
 popFrame();
 return result;
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
 nimGC_setStackBottom(locals);
}
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;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000();
 initStackBottomWith((void *)&inner);
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000();
 (*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) {
{
 tyArray__nHXaesL0DJZHyVS07ARPRA T1_;
 NI T2_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA));
 T2_ = (NI)0;
 T2_ = dummy__temp_6(((NI) 2), );
 T1_[0] = dollar___systemZdollars_3(T2_);
 echoBinSafe(T1_, 1);
 popFrame();
}
}

Stats

  • Started 2023-10-31T14:50:48
  • Finished 2023-10-31T14:50:48
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("dummy")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newIdentNode("SomeNumber"),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        newIdentNode("T"),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("b"),
        newIdentNode("T"),
        newLit(2.5)
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkAsgn.newTree(
        newIdentNode("result"),
        newIdentNode("a")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("echo"),
    nnkCall.newTree(
      newIdentNode("dummy"),
      newLit(2)
    )
  )
)
1.4.8 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:162:55: error: expected expression before ‘)’ token
  162 |         T2_ = dummy__Lr6TyGXZnc1Q7cOHediD3g(((NI) 2), );
      |                                                       ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3   -I/home/runner/.choosenim/toolchains/nim-1.4.8/lib -I/home/runner/work/Nim/Nim -o /home/runner/work/Nim/Nim/@mtemp.nim.c.o /home/runner/work/Nim/Nim/@mtemp.nim.c' failed with exit code: 1

IR

Compiled filesize 0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#  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 NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1];
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NI, dummy__Lr6TyGXZnc1Q7cOHediD3g)(NI a, NI b);
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(NimStringDesc*, nimIntToStr)(NI x);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
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, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
 nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
 {
  if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == ((TFrame*) 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) 2000))) goto LA8_;
  callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
 }
 LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, dummy__Lr6TyGXZnc1Q7cOHediD3g)(NI a, NI b) {
 NI result;
 nimfr_("dummy", "/home/runner/work/Nim/Nim/temp.nim");
 result = (NI)0;
 result = a;
 popFrame();
 return result;
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
 nimGC_setStackBottom(locals);
}
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) {
{
 tyArray__nHXaesL0DJZHyVS07ARPRA T1_;
 NI T2_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA));
 T2_ = (NI)0;
 T2_ = dummy__Lr6TyGXZnc1Q7cOHediD3g(((NI) 2), );
 T1_[0] = nimIntToStr(T2_);
 echoBinSafe(T1_, 1);
 popFrame();
}
}

Stats

  • Started 2023-10-31T14:50:51
  • Finished 2023-10-31T14:50:52
  • Duration 1 minutes

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("dummy")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newIdentNode("SomeNumber"),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        newIdentNode("T"),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("b"),
        newIdentNode("T"),
        newLit(2.5)
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkAsgn.newTree(
        newIdentNode("result"),
        newIdentNode("a")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("echo"),
    nnkCall.newTree(
      newIdentNode("dummy"),
      newLit(2)
    )
  )
)
1.2.18 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:148:55: error: expected expression before ‘)’ token
  148 |         T2_ = dummy__Lr6TyGXZnc1Q7cOHediD3g(((NI) 2), );
      |                                                       ^
Error: execution of an external compiler program 'gcc -c  -w   -I/home/runner/.choosenim/toolchains/nim-1.2.18/lib -I/home/runner/work/Nim/Nim -o /home/runner/work/Nim/Nim/@mtemp.nim.c.o /home/runner/work/Nim/Nim/@mtemp.nim.c' failed with exit code: 1

IR

Compiled filesize 0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#  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 NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1];
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NI, dummy__Lr6TyGXZnc1Q7cOHediD3g)(NI a, NI b);
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(NimStringDesc*, nimIntToStr)(NI x);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
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, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
 nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
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 N_NIMCALL(NI, dummy__Lr6TyGXZnc1Q7cOHediD3g)(NI a, NI b) {
 NI result;
 nimfr_("dummy", "/home/runner/work/Nim/Nim/temp.nim");
 result = (NI)0;
 result = a;
 popFrame();
 return result;
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
 nimGC_setStackBottom(locals);
}
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) {
{
 tyArray__nHXaesL0DJZHyVS07ARPRA T1_;
 NI T2_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA));
 T2_ = (NI)0;
 T2_ = dummy__Lr6TyGXZnc1Q7cOHediD3g(((NI) 2), );
 T1_[0] = nimIntToStr(T2_);
 echoBinSafe(T1_, 1);
 popFrame();
}
}

Stats

  • Started 2023-10-31T14:50:55
  • Finished 2023-10-31T14:50:55
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("dummy")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newIdentNode("SomeNumber"),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        newIdentNode("T"),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("b"),
        newIdentNode("T"),
        newLit(2.5)
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkAsgn.newTree(
        newIdentNode("result"),
        newIdentNode("a")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("echo"),
    nnkCall.newTree(
      newIdentNode("dummy"),
      newLit(2)
    )
  )
)
1.0.10 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: execution of an external compiler program 'gcc -c  -w  -I/home/runner/.choosenim/toolchains/nim-1.0.10/lib -I/home/runner/work/Nim/Nim -o /home/runner/work/Nim/Nim/@mtemp.nim.c.o /home/runner/work/Nim/Nim/@mtemp.nim.c' failed with exit code: 1

/home/runner/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:145:55: error: expected expression before ‘)’ token
  145 |         T2_ = dummy__Lr6TyGXZnc1Q7cOHediD3g(((NI) 2), );
      |                                                       ^

IR

Compiled filesize 0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#  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 NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1];
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NI, dummy__Lr6TyGXZnc1Q7cOHediD3g)(NI a, NI b);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
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, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {	void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {	nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
static N_INLINE(void, nimFrame)(TFrame* s) {	NI T1_;
 T1_ = (NI)0;
 {
  if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
  T1_ = ((NI) 0);
 }
 goto LA2_;
 LA4_: ;
 {
  T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
 }
 LA2_: ;
 (*s).calldepth = ((NI16) (T1_));
 (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
 {
  if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
  callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
 }
 LA9_: ;
}
static N_INLINE(void, popFrame)(void) {	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, dummy__Lr6TyGXZnc1Q7cOHediD3g)(NI a, NI b) {	NI result;
 nimfr_("dummy", "/home/runner/work/Nim/Nim/temp.nim");
 result = (NI)0;
 result = a;
 popFrame();
 return result;
}
static N_INLINE(void, initStackBottomWith)(void* locals) {	nimGC_setStackBottom(locals);
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
 void (*volatile inner)(void);
 inner = PreMainInner;
 systemDatInit000();
 initStackBottomWith((void *)&inner);
 systemInit000();
 (*inner)();
}
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) {
{
 tyArray__nHXaesL0DJZHyVS07ARPRA T1_;
 NI T2_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA));
 T2_ = (NI)0;
 T2_ = dummy__Lr6TyGXZnc1Q7cOHediD3g(((NI) 2), );
 T1_[0] = nimIntToStr(T2_);
 echoBinSafe(T1_, 1);
 popFrame();
}
}

Stats

  • Started 2023-10-31T14:50:57
  • Finished 2023-10-31T14:50:58
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("dummy")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newIdentNode("SomeNumber"),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      newIdentNode("T"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        newIdentNode("T"),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("b"),
        newIdentNode("T"),
        newLit(2.5)
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkAsgn.newTree(
        newIdentNode("result"),
        newIdentNode("a")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("echo"),
    nnkCall.newTree(
      newIdentNode("dummy"),
      newLit(2)
    )
  )
)
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 18.2
  • Created 2023-10-31T14:50:06Z
  • Comments 2
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 19 minutes bisecting 7 commits at 0 commits per second

@metagn
Copy link
Collaborator

metagn commented Sep 18, 2024

Gives got float64 but expected int since #24006

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

Successfully merging a pull request may close this issue.

4 participants