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

No error on type mismatch in proc's default argument #22126

Closed
ZoomRmc opened this issue Jun 19, 2023 · 4 comments · Fixed by #24525
Closed

No error on type mismatch in proc's default argument #22126

ZoomRmc opened this issue Jun 19, 2023 · 4 comments · Fixed by #24525

Comments

@ZoomRmc
Copy link
Contributor

ZoomRmc commented Jun 19, 2023

Description

Type mismatch while setting the value for the default argument generates wrong code but no compilation error.

func foo[T](arr: openArray[T], idx: Natural = arr.high): int = # missed conversion: `Natural(arr.high)`
  if idx == 0:
    return 0
  foo(arr, idx - 1)

let arr = [0, 1, 2]

assert foo(arr) == 0

Nim Version

Nim Compiler Version 1.9.3 [Windows: amd64]
Compiled at 2023-06-15

Current Output

error: 'arr_p0Len_0' undeclared (first use in this function)
  203 |                 if (((arr_p0Len_0-1)) < ((NI)0) || ((arr_p0Len_0-1)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((arr_p0Len_0-1), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
      |                       ^~~~~~~~~~~
C:...\@mtest.nim.c:203:23: note: each undeclared identifier is reported only once for each function it appears in
Error: execution of an external compiler program 'gcc.exe -c  -w -fmax-errors=3 -mno-ms-bitfields   -IC:...\lib -Iy:\ -o C:\...\@mtest.nim.c.o C:\...\@mtest.nim.c' failed with exit code: 1
@juancarlospaco
Copy link
Collaborator

!nim c

func f(a: openArray[int], i: Natural = a.high): int = 0
discard f([0])
func x(a: seq[int], i: Natural = a.high): int = 0
discard x(@[0])

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

@juancarlospaco (contributor)

devel :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:155:15: error: ‘a_p0Len_0’ undeclared (first use in this function)
  155 |         if (((a_p0Len_0-1)) < ((NI)0) || ((a_p0Len_0-1)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((a_p0Len_0-1), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
      |               ^~~~~~~~~
/home/runner/work/Nim/Nim/@mtemp.nim.c:155:15: note: each undeclared identifier is reported only once for each function it appears in
/home/runner/work/Nim/Nim/@mtemp.nim.c:163:16: error: ‘a_p0’ undeclared (first use in this function)
  163 |         T2_ = (a_p0.len-1);
      |                ^~~~
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3   -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



Stats

  • Created 2023-07-06T20:29:00Z
  • Started 2023-07-06T20:29:39
  • Finished 2023-07-06T20:29:40
  • Duration 1 minute
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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

#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) \
    FR_.line = n;
  #define nimlf_(n, file) \
    FR_.line = n; FR_.filename = file;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
typedef NI tyArray__GAcaPw08Gj9cXYhAaMMr9cfw[1];
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(NI, f__temp_u1)(NI* a_p0, NI a_p0Len_0, NI i_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4483)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i_p0, NI64 a_p1, NI64 b_p2);
N_LIB_PRIVATE N_NIMCALL(NI, x__temp_u8)(tySequence__qwqHTkRvwhrRyENtudHQ7g a_p0, NI i_p1);
N_LIB_PRIVATE N_NIMCALL(void*, newSeqPayload)(NI cap_p0, NI elemSize_p1, NI elemAlign_p2);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u59)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_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);
static NIM_CONST tyArray__GAcaPw08Gj9cXYhAaMMr9cfw TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI)0)}
;
extern TFrame* framePtr__system_u3877;
extern NIM_BOOL nimInErrorMode__system_u4265;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
	{
		if (!(framePtr__system_u3877 == ((TFrame*) NIM_NIL))) goto LA3_;
		(*s_p0).calldepth = ((NI16)0);
	}
	goto LA1_;
LA3_: ;
	{
		(*s_p0).calldepth = (NI16)((*framePtr__system_u3877).calldepth + ((NI16)1));
	}
LA1_: ;
	(*s_p0).prev = framePtr__system_u3877;
	framePtr__system_u3877 = s_p0;
	{
		if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
		callDepthLimitReached__system_u4483();
	}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__system_u3877 = (*framePtr__system_u3877).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, f__temp_u1)(NI* a_p0, NI a_p0Len_0, NI i_p1) {
	NI result;
	nimfr_("f", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI)0);
	popFrame();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, x__temp_u8)(tySequence__qwqHTkRvwhrRyENtudHQ7g a_p0, NI i_p1) {
	NI result;
	nimfr_("x", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI)0);
	popFrame();
	return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__system_u4265);
	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) {
{
	tySequence__qwqHTkRvwhrRyENtudHQ7g colontmpD_;
	NI T1_;
	NI T2_;
	NI T3_;
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	if (((a_p0Len_0-1)) < ((NI)0) || ((a_p0Len_0-1)) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI((a_p0Len_0-1), ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	T1_ = (NI)0;
	T1_ = f__temp_u1(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1, ((NI) ((a_p0Len_0-1))));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(void)(T1_);
	colontmpD_.len = 1; colontmpD_.p = (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*) newSeqPayload(1, sizeof(NI), NIM_ALIGNOF(NI));
	colontmpD_.p->data[0] = ((NI)0);
	T2_ = (a_p0.len-1);
	if ((T2_) < ((NI)0) || (T2_) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(T2_, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	T3_ = (NI)0;
	T3_ = x__temp_u8(colontmpD_, ((NI) (T2_)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(void)(T3_);
	eqdestroy___temp_u59(colontmpD_);
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkFuncDef.newTree(
    newIdentNode("f"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("openArray"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("f"),
      nnkBracket.newTree(
        newLit(0)
      )
    )
  ),
  nnkFuncDef.newTree(
    newIdentNode("x"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("x"),
      nnkPrefix.newTree(
        newIdentNode("@"),
        nnkBracket.newTree(
          newLit(0)
        )
      )
    )
  )
)
stable :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:183:15: error: ‘aLen_0’ undeclared (first use in this function)
  183 |         if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
      |               ^~~~~~
/home/runner/work/Nim/Nim/@mtemp.nim.c:183:15: note: each undeclared identifier is reported only once for each function it appears in
/home/runner/work/Nim/Nim/@mtemp.nim.c:190:17: error: ‘a’ undeclared (first use in this function)
  190 |         T3_ = ((a ? a->Sup.len : 0)-1);
      |                 ^
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



Stats

  • Created 2023-07-06T20:29:00Z
  • Started 2023-07-06T20:29:41
  • Finished 2023-07-06T20:29:41
  • Duration 1 minute
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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

#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 tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef NI tyArray__GAcaPw08Gj9cXYhAaMMr9cfw[1];
struct TGenericSeq {
NI len;
NI reserved;
};
typedef NU8 tyEnum_TNimKind__3rC59cFdCULJbp2tHLSZMXQ;
typedef NU8 tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__3rC59cFdCULJbp2tHLSZMXQ kind;
tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w;
struct TNimNode {
tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(NI, f__temp_1)(NI* a, NI aLen_0, NI i);
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_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
N_LIB_PRIVATE N_NIMCALL(NI, x__temp_26)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i);
N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
static N_NIMCALL(void, Marker_tySequence__qwqHTkRvwhrRyENtudHQ7g)(void* p, NI op);
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, atmtempdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static NIM_CONST tyArray__GAcaPw08Gj9cXYhAaMMr9cfw TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 0)}
;
extern TNimType NTIint__rR5Bzr1D5krxoo1NcNyeMA_;
N_LIB_PRIVATE TNimType NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_;
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, 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, f__temp_1)(NI* a, NI aLen_0, NI i) {
	NI result;
	nimfr_("f", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	popFrame();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, x__temp_26)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i) {
	NI result;
	nimfr_("x", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	popFrame();
	return result;
}
static N_NIMCALL(void, Marker_tySequence__qwqHTkRvwhrRyENtudHQ7g)(void* p, NI op) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g* a;
	NI T1_;
	a = (tySequence__qwqHTkRvwhrRyENtudHQ7g*)p;
	T1_ = (NI)0;
}
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();
	atmtempdotnim_DatInit000();
	(*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) {
{
	NI T1_;
	tySequence__qwqHTkRvwhrRyENtudHQ7g* T2_;
	NI T3_;
	NI T4_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
	if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T1_ = (NI)0;
	T1_ = f__temp_1(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1, ((NI) ((aLen_0-1))));
	(void)(T1_);
	T2_ = NIM_NIL;
	T2_ = (tySequence__qwqHTkRvwhrRyENtudHQ7g*) newSeq((&NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_), 1);
	T2_->data[0] = ((NI) 0);
	T3_ = ((a ? a->Sup.len : 0)-1);
	if ((T3_) < ((NI) 0) || (T3_) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(T3_, ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T4_ = (NI)0;
	T4_ = x__temp_26(T2_, ((NI) (T3_)));
	(void)(T4_);
	popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, atmtempdotnim_DatInit000)(void) {
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.size = sizeof(tySequence__qwqHTkRvwhrRyENtudHQ7g*);
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.align = NIM_ALIGNOF(tySequence__qwqHTkRvwhrRyENtudHQ7g*);
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.kind = 24;
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.base = (&NTIint__rR5Bzr1D5krxoo1NcNyeMA_);
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.flags = 2;
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.marker = Marker_tySequence__qwqHTkRvwhrRyENtudHQ7g;
}

AST

nnkStmtList.newTree(
  nnkFuncDef.newTree(
    newIdentNode("f"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("openArray"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("f"),
      nnkBracket.newTree(
        newLit(0)
      )
    )
  ),
  nnkFuncDef.newTree(
    newIdentNode("x"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("x"),
      nnkPrefix.newTree(
        newIdentNode("@"),
        nnkBracket.newTree(
          newLit(0)
        )
      )
    )
  )
)
1.6.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:183:15: error: ‘aLen_0’ undeclared (first use in this function)
  183 |         if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
      |               ^~~~~~
/home/runner/work/Nim/Nim/@mtemp.nim.c:183:15: note: each undeclared identifier is reported only once for each function it appears in
/home/runner/work/Nim/Nim/@mtemp.nim.c:190:17: error: ‘a’ undeclared (first use in this function)
  190 |         T3_ = ((a ? a->Sup.len : 0)-1);
      |                 ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3   -I/home/runner/.choosenim/toolchains/nim-1.6.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



Stats

  • Created 2023-07-06T20:29:00Z
  • Started 2023-07-06T20:29:45
  • Finished 2023-07-06T20:29:46
  • Duration 1 minute
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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

#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 tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef NI tyArray__GAcaPw08Gj9cXYhAaMMr9cfw[1];
struct TGenericSeq {
NI len;
NI reserved;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(NI, f_temp_1)(NI* a, NI aLen_0, NI i);
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_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
N_LIB_PRIVATE N_NIMCALL(NI, x_temp_26)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i);
N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
static N_NIMCALL(void, Marker_tySequence__qwqHTkRvwhrRyENtudHQ7g)(void* p, NI op);
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, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static NIM_CONST tyArray__GAcaPw08Gj9cXYhAaMMr9cfw TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 0)}
;
extern TNimType NTIint__rR5Bzr1D5krxoo1NcNyeMA_;
N_LIB_PRIVATE TNimType NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_;
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, 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, f_temp_1)(NI* a, NI aLen_0, NI i) {
	NI result;
	nimfr_("f", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	popFrame();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, x_temp_26)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i) {
	NI result;
	nimfr_("x", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	popFrame();
	return result;
}
static N_NIMCALL(void, Marker_tySequence__qwqHTkRvwhrRyENtudHQ7g)(void* p, NI op) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g* a;
	NI T1_;
	a = (tySequence__qwqHTkRvwhrRyENtudHQ7g*)p;
	T1_ = (NI)0;
}
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();
	tempDatInit000();
	(*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) {
{
	NI T1_;
	tySequence__qwqHTkRvwhrRyENtudHQ7g* T2_;
	NI T3_;
	NI T4_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
	if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T1_ = (NI)0;
	T1_ = f_temp_1(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1, ((NI) ((aLen_0-1))));
	(void)(T1_);
	T2_ = (tySequence__qwqHTkRvwhrRyENtudHQ7g*)0;
	T2_ = (tySequence__qwqHTkRvwhrRyENtudHQ7g*) newSeq((&NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_), 1);
	T2_->data[0] = ((NI) 0);
	T3_ = ((a ? a->Sup.len : 0)-1);
	if ((T3_) < ((NI) 0) || (T3_) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(T3_, ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T4_ = (NI)0;
	T4_ = x_temp_26(T2_, ((NI) (T3_)));
	(void)(T4_);
	popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.size = sizeof(tySequence__qwqHTkRvwhrRyENtudHQ7g*);
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.align = NIM_ALIGNOF(tySequence__qwqHTkRvwhrRyENtudHQ7g*);
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.kind = 24;
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.base = (&NTIint__rR5Bzr1D5krxoo1NcNyeMA_);
NTIseqLintT__qwqHTkRvwhrRyENtudHQ7g_.marker = Marker_tySequence__qwqHTkRvwhrRyENtudHQ7g;
}

AST

nnkStmtList.newTree(
  nnkFuncDef.newTree(
    newIdentNode("f"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("openArray"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("f"),
      nnkBracket.newTree(
        newLit(0)
      )
    )
  ),
  nnkFuncDef.newTree(
    newIdentNode("x"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("x"),
      nnkPrefix.newTree(
        newIdentNode("@"),
        nnkBracket.newTree(
          newLit(0)
        )
      )
    )
  )
)
1.4.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:169:15: error: ‘aLen_0’ undeclared (first use in this function)
  169 |         if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
      |               ^~~~~~
/home/runner/work/Nim/Nim/@mtemp.nim.c:169:15: note: each undeclared identifier is reported only once for each function it appears in
/home/runner/work/Nim/Nim/@mtemp.nim.c:173:17: error: ‘a’ undeclared (first use in this function)
  173 |         T2_ = ((a ? a->Sup.len : 0)-1);
      |                 ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3   -I/home/runner/.choosenim/toolchains/nim-1.4.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



Stats

  • Created 2023-07-06T20:29:00Z
  • Started 2023-07-06T20:29:50
  • Finished 2023-07-06T20:29:51
  • Duration 1 minute
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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

#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 tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct TGenericSeq TGenericSeq;

typedef NI tyArray__GAcaPw08Gj9cXYhAaMMr9cfw[1];
struct TGenericSeq {
NI len;
NI reserved;
};

struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};

N_LIB_PRIVATE N_NIMCALL(NI, f__CCfxCXjCNM5hZm6C45d88w)(NI* a, NI aLen_0, NI i);
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_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
N_LIB_PRIVATE N_NIMCALL(NI, x__sDAdEN6A6hAeEkY9cwXT3Ng)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i);
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);

static NIM_CONST tyArray__GAcaPw08Gj9cXYhAaMMr9cfw TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 0)}
;
static NIM_CONST struct {
  TGenericSeq Sup;
  NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = {{1, 1 | NIM_STRLIT_FLAG}, {((NI) 0)}};
static NIM_CONST tySequence__qwqHTkRvwhrRyENtudHQ7g* TM__SRd76hP9cMfCzdUO857UhQQ_3 = ((tySequence__qwqHTkRvwhrRyENtudHQ7g*)&TM__SRd76hP9cMfCzdUO857UhQQ_4);

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, 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) 2000))) goto LA8_;
		callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
	}
	LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(NI, f__CCfxCXjCNM5hZm6C45d88w)(NI* a, NI aLen_0, NI i) {
	NI result;
	nimfr_("f", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	popFrame();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, x__sDAdEN6A6hAeEkY9cwXT3Ng)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i) {
	NI result;
	nimfr_("x", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	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) {
{
	NI T1_;
	NI T2_;
	NI T3_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
	if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T1_ = (NI)0;
	T1_ = f__CCfxCXjCNM5hZm6C45d88w(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1, ((NI) ((aLen_0-1))));
	(void)(T1_);
	T2_ = ((a ? a->Sup.len : 0)-1);
	if ((T2_) < ((NI) 0) || (T2_) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(T2_, ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T3_ = (NI)0;
	T3_ = x__sDAdEN6A6hAeEkY9cwXT3Ng(TM__SRd76hP9cMfCzdUO857UhQQ_3, ((NI) (T2_)));
	(void)(T3_);
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkFuncDef.newTree(
    newIdentNode("f"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("openArray"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("f"),
      nnkBracket.newTree(
        newLit(0)
      )
    )
  ),
  nnkFuncDef.newTree(
    newIdentNode("x"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("x"),
      nnkPrefix.newTree(
        newIdentNode("@"),
        nnkBracket.newTree(
          newLit(0)
        )
      )
    )
  )
)
1.2.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:151:15: error: ‘aLen_0’ undeclared (first use in this function)
  151 |         if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
      |               ^~~~~~
/home/runner/work/Nim/Nim/@mtemp.nim.c:151:15: note: each undeclared identifier is reported only once for each function it appears in
/home/runner/work/Nim/Nim/@mtemp.nim.c:155:17: error: ‘a’ undeclared (first use in this function)
  155 |         T2_ = ((a ? a->Sup.len : 0)-1);
      |                 ^
Error: execution of an external compiler program 'gcc -c  -w   -I/home/runner/.choosenim/toolchains/nim-1.2.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



Stats

  • Created 2023-07-06T20:29:00Z
  • Started 2023-07-06T20:30:07
  • Finished 2023-07-06T20:30:08
  • Duration 1 minute
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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

#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 tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct TGenericSeq TGenericSeq;
typedef NI tyArray__GAcaPw08Gj9cXYhAaMMr9cfw[1];
struct TGenericSeq {
NI len;
NI reserved;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(NI, f__CCfxCXjCNM5hZm6C45d88w)(NI* a, NI aLen_0, NI i);
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_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
N_LIB_PRIVATE N_NIMCALL(NI, x__sDAdEN6A6hAeEkY9cwXT3Ng)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i);
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);
static NIM_CONST tyArray__GAcaPw08Gj9cXYhAaMMr9cfw TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 0)}
;
static NIM_CONST struct {
  TGenericSeq Sup;
  NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = {{1, 1 | NIM_STRLIT_FLAG}, {((NI) 0)}};
static NIM_CONST tySequence__qwqHTkRvwhrRyENtudHQ7g* TM__SRd76hP9cMfCzdUO857UhQQ_3 = ((tySequence__qwqHTkRvwhrRyENtudHQ7g*)&TM__SRd76hP9cMfCzdUO857UhQQ_4);
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, 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, f__CCfxCXjCNM5hZm6C45d88w)(NI* a, NI aLen_0, NI i) {
	NI result;
	nimfr_("f", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	popFrame();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, x__sDAdEN6A6hAeEkY9cwXT3Ng)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i) {
	NI result;
	nimfr_("x", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	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) {
{
	NI T1_;
	NI T2_;
	NI T3_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
	if (((aLen_0-1)) < ((NI) 0) || ((aLen_0-1)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T1_ = (NI)0;
	T1_ = f__CCfxCXjCNM5hZm6C45d88w(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1, ((NI) ((aLen_0-1))));
	(void)(T1_);
	T2_ = ((a ? a->Sup.len : 0)-1);
	if ((T2_) < ((NI) 0) || (T2_) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(T2_, ((NI) 0), ((NI) IL64(9223372036854775807))); }
	T3_ = (NI)0;
	T3_ = x__sDAdEN6A6hAeEkY9cwXT3Ng(TM__SRd76hP9cMfCzdUO857UhQQ_3, ((NI) (T2_)));
	(void)(T3_);
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkFuncDef.newTree(
    newIdentNode("f"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("openArray"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("f"),
      nnkBracket.newTree(
        newLit(0)
      )
    )
  ),
  nnkFuncDef.newTree(
    newIdentNode("x"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("x"),
      nnkPrefix.newTree(
        newIdentNode("@"),
        nnkBracket.newTree(
          newLit(0)
        )
      )
    )
  )
)
1.0.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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
Error: execution of an external compiler program 'gcc -c  -w  -I/home/runner/.choosenim/toolchains/nim-1.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

/home/runner/work/Nim/Nim/@mtemp.nim.c: In function ‘NimMainModule’:
/home/runner/work/Nim/Nim/@mtemp.nim.c:185:91: error: ‘aLen_0’ undeclared (first use in this function)
  185 |         T1_ = f__CCfxCXjCNM5hZm6C45d88w(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1, ((NI)chckRange((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807)))));
      |                                                                                           ^~~~~~
/home/runner/work/Nim/Nim/@mtemp.nim.c:185:91: note: each undeclared identifier is reported only once for each function it appears in
/home/runner/work/Nim/Nim/@mtemp.nim.c:187:17: error: ‘a’ undeclared (first use in this function)
  187 |         T2_ = ((a ? a->Sup.len : 0)-1);
      |                 ^

Stats

  • Created 2023-07-06T20:29:00Z
  • Started 2023-07-06T20:30:22
  • Finished 2023-07-06T20:30:22
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads: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

#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 tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct TGenericSeq TGenericSeq;
typedef NI tyArray__GAcaPw08Gj9cXYhAaMMr9cfw[1];
struct TGenericSeq {
NI len;
NI reserved;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  TGenericSeq Sup;
  NI data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(NI, f__CCfxCXjCNM5hZm6C45d88w)(NI* a, NI aLen_0, NI i);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NI, chckRange)(NI i, NI a, NI b);
N_NOINLINE(void, raiseRangeError)(NI64 val);
N_LIB_PRIVATE N_NIMCALL(NI, x__sDAdEN6A6hAeEkY9cwXT3Ng)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i);
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;
NIM_CONST tyArray__GAcaPw08Gj9cXYhAaMMr9cfw TM__SRd76hP9cMfCzdUO857UhQQ_2 = {((NI) 0)}
;
NIM_CONST struct {
  TGenericSeq Sup;
  NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = {{1, 1 | NIM_STRLIT_FLAG}, {((NI) 0)}};
NIM_CONST tySequence__qwqHTkRvwhrRyENtudHQ7g* TM__SRd76hP9cMfCzdUO857UhQQ_3 = ((tySequence__qwqHTkRvwhrRyENtudHQ7g*)&TM__SRd76hP9cMfCzdUO857UhQQ_4);
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, f__CCfxCXjCNM5hZm6C45d88w)(NI* a, NI aLen_0, NI i) {
	NI result;
	nimfr_("f", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	popFrame();
	return result;
}
static N_INLINE(NI, chckRange)(NI i, NI a, NI b) {
	NI result;
{	result = (NI)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (a <= i);
		if (!(T3_)) goto LA4_;
		T3_ = (i <= b);
		LA4_: ;
		if (!T3_) goto LA5_;
		result = i;
		goto BeforeRet_;
	}
	goto LA1_;
	LA5_: ;
	{
		raiseRangeError(((NI64) (i)));
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, x__sDAdEN6A6hAeEkY9cwXT3Ng)(tySequence__qwqHTkRvwhrRyENtudHQ7g* a, NI i) {
	NI result;
	nimfr_("x", "/home/runner/work/Nim/Nim/temp.nim");
	result = (NI)0;
	result = ((NI) 0);
	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) {
{
	NI T1_;
	NI T2_;
	NI T3_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
	T1_ = (NI)0;
	T1_ = f__CCfxCXjCNM5hZm6C45d88w(TM__SRd76hP9cMfCzdUO857UhQQ_2, 1, ((NI)chckRange((aLen_0-1), ((NI) 0), ((NI) IL64(9223372036854775807)))));
	(void)(T1_);
	T2_ = ((a ? a->Sup.len : 0)-1);
	T3_ = (NI)0;
	T3_ = x__sDAdEN6A6hAeEkY9cwXT3Ng(TM__SRd76hP9cMfCzdUO857UhQQ_3, ((NI)chckRange(T2_, ((NI) 0), ((NI) IL64(9223372036854775807)))));
	(void)(T3_);
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkFuncDef.newTree(
    newIdentNode("f"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("openArray"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("f"),
      nnkBracket.newTree(
        newLit(0)
      )
    )
  ),
  nnkFuncDef.newTree(
    newIdentNode("x"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newIdentNode("int"),
      nnkIdentDefs.newTree(
        newIdentNode("a"),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("int")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("i"),
        newIdentNode("Natural"),
        nnkDotExpr.newTree(
          newIdentNode("a"),
          newIdentNode("high")
        )
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      newLit(0)
    )
  ),
  nnkDiscardStmt.newTree(
    nnkCall.newTree(
      newIdentNode("x"),
      nnkPrefix.newTree(
        newIdentNode("@"),
        nnkBracket.newTree(
          newLit(0)
        )
      )
    )
  )
)
🤖 Bug found in 47 minutes bisecting 6 commits at 0 commits per second.

@juancarlospaco
Copy link
Collaborator

juancarlospaco commented Jul 6, 2023

Its not about Generics nor openArray, its about using the high of the 1st argument and Natural.

@metagn
Copy link
Collaborator

metagn commented Sep 28, 2024

Works now, maybe because of #24006?

metagn added a commit to metagn/Nim that referenced this issue Dec 8, 2024
@Araq Araq closed this as completed in aeb3fe9 Dec 9, 2024
narimiran pushed a commit that referenced this issue Jan 14, 2025
closes #6013, closes #7009, closes #9190, closes #12487, closes #12831,
closes #13184, closes #13252, closes #14860, closes #14877, closes
#14894, closes #14917, closes #16153, closes #16439, closes #17779,
closes #18074, closes #18202, closes #18314, closes #18648, closes
#19063, closes #19446, closes #20065, closes #20367, closes #22126,
closes #22820, closes #22888, closes #23020, closes #23287, closes
#23510

(cherry picked from commit aeb3fe9)
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.

3 participants