-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[ARC] Crash when adding openArray proc argument to a local seq #15511
Comments
@Araq is it correct that after this PR the compiler fails on this line https://github.com/paranim/paranim/blob/master/src/paranim/gl/entities.nim#L111 with an error EDIT: Noticed that the test case gives the same error :) |
so it means that arc/orc is a bit incompatible with refc in this case? |
For now. Working on a better fix. |
an error is better than SIGSEGV but this is still something that should be fixed, it makes nim-regex pkg unusable with --gc:arc further reduced: when true: # D20201031T170455
proc fn(a: openArray[int]) =
var b: seq[int]
b.add a
fn(@[1,2]) gives proposal
# in system.nim
proc add*[T](x: var seq[T], y: sink openArray[T]) {.noSideEffect.} {.enableIf: canSink(y)).} =
...
x[xl+i] = move y[i]
proc add*[T](x: var seq[T], y: openArray[T]) {.noSideEffect.} {.enableIf: not canSink(y).} =
...
x[xl+i] = y[i]
proc canSinkImpl[T](y: sink openArray[T]) = discard
template canSink(a): untyped = compiles(canSinkImpl(y)) or without |
The fix that I have in mind is to implement the alias analysis to prevent the bug and keep the system.nim's add a non-sink parameter as |
but then you'll have to duplicate each proc accepting a sink parameter with Also, it's not clear how that'd work with array's (we don't want to generate code bloat by being generic on array size), eg: var s = @[A(1), A(2)]
s.add [A(3), A(4)] # I want to move, not copy, A(3), A(4) The problem is that |
Well yes, it's complex. |
Possibly we need: proc add*[T](x: var seq[T], y: sink (seq[T] | array[any, T])) We can have a common type name alias for P.S. |
Actually this may work, 2 procs: proc add*[T](x: var seq[T], y: sink (seq[T] | array[any, T]))
proc add*[T](x: var seq[T], y: openarray[T]) and make sink to match better. |
the solution I suggested in #15511 (comment) doesn't have this problem. |
Has been fixed. |
* followup now that nim-lang/Nim#15511 was fixed * simplify via toSeq * avoid warning: IndexError is deprecated * drop support for nim < 1.0 which broke tests
!nim c --gc:arc type
Position = object
data: seq[float]
proc test(data: openArray[float]) =
var pos = Position()
pos.data.add(data)
test([1.5, 1.6]) |
@ringabout (member) devel :+1: OKOutput
Stats
stable :+1: OKOutput
Stats
1.6.0 :+1: OKOutput
Stats
1.4.0 :-1: FAILOutput
Stats
IR#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.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 tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ;
typedef struct tySequence__Zj5xKXgsXnI4n4hPS6nACA tySequence__Zj5xKXgsXnI4n4hPS6nACA;
typedef struct tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content;
typedef struct tyObject_NimSeqV2__gGGdEGA2get5XTHGxBt1eQ tyObject_NimSeqV2__gGGdEGA2get5XTHGxBt1eQ;
typedef struct tyObject_NimSeqPayload__y3DXUXET6vJbnpJP9bxHp6g tyObject_NimSeqPayload__y3DXUXET6vJbnpJP9bxHp6g;
struct tySequence__Zj5xKXgsXnI4n4hPS6nACA {
NI len; tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content* p;
};
struct tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ {
tySequence__Zj5xKXgsXnI4n4hPS6nACA data;
};
struct tyObject_NimSeqV2__gGGdEGA2get5XTHGxBt1eQ {
NI len;
tyObject_NimSeqPayload__y3DXUXET6vJbnpJP9bxHp6g* p;
};
struct tyObject_NimSeqPayload__y3DXUXET6vJbnpJP9bxHp6g {
NI cap;
NF data[SEQ_DECL_SIZE];
};
typedef NF tyArray__Tgy9b6R4KdSrcLohzVAUl8w[2];
#ifndef tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
#define tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
struct tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content { NI cap; NF data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
#define tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
struct tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content { NI cap; NF data[SEQ_DECL_SIZE];};
#endif
N_LIB_PRIVATE N_NIMCALL(void, test_temp_3)(NF* data, NI dataLen_0);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem_systemZmemory_7)(void* a, int v, NI size);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, add_temp_6)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* x, NF* y, NI yLen_0);
N_LIB_PRIVATE N_NIMCALL(void, setLen_temp_19)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* s, NI newlen);
N_LIB_PRIVATE N_NIMCALL(void, shrink_temp_26)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* x, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void*, prepareSeqAdd)(NI len, void* p, NI addlen, NI elemSize, NI elemAlign);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached_system_3605)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy__temp_93)(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ* dest);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy__temp_102)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* dest);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p, NI align);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
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__Tgy9b6R4KdSrcLohzVAUl8w TM__SRd76hP9cMfCzdUO857UhQQ_6 = {1.5,
1.6}
;
extern NIM_BOOL nimInErrorMode_system_3460;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
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(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode_system_3460);
return result;
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem_systemZmemory_7(p, ((int) 0), size);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, shrink_temp_26)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* x, NI newLen) {
(*((tyObject_NimSeqV2__gGGdEGA2get5XTHGxBt1eQ*) (x))).len = ((NI) (newLen));
}
N_LIB_PRIVATE N_NIMCALL(void, setLen_temp_19)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* s, NI newlen) {
{ {
NI T3_;
T3_ = (*s).len;
if (!(((NI) (newlen)) < T3_)) goto LA4_;
shrink_temp_26(s, newlen);
}
goto LA1_;
LA4_: ;
{
NI oldLen;
NI T7_;
tyObject_NimSeqV2__gGGdEGA2get5XTHGxBt1eQ* xu;
T7_ = (*s).len;
oldLen = T7_;
{
if (!(((NI) (newlen)) <= oldLen)) goto LA10_;
goto BeforeRet_;
}
LA10_: ;
xu = ((tyObject_NimSeqV2__gGGdEGA2get5XTHGxBt1eQ*) (s));
{
NIM_BOOL T14_;
NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
void* T18_;
T14_ = (NIM_BOOL)0;
T14_ = ((*xu).p == ((tyObject_NimSeqPayload__y3DXUXET6vJbnpJP9bxHp6g*) NIM_NIL));
if (T14_) goto LA15_;
T14_ = ((*(*xu).p).cap < ((NI) (newlen)));
LA15_: ;
if (!T14_) goto LA16_;
if (nimSubInt(((NI) (newlen)), oldLen, &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
};
T18_ = (void*)0;
T18_ = prepareSeqAdd(oldLen, ((void*) ((*xu).p)), (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2), ((NI) 8), ((NI) 8));
(*xu).p = ((tyObject_NimSeqPayload__y3DXUXET6vJbnpJP9bxHp6g*) (T18_));
}
LA16_: ;
(*xu).len = ((NI) (newlen));
}
LA1_: ;
}BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr_system_3135 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr_system_3135).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr_system_3135;
framePtr_system_3135 = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
callDepthLimitReached_system_3605();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr_system_3135 = (*framePtr_system_3135).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, add_temp_6)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* x, NF* y, NI yLen_0) {
NI xl;
NI T1_;
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
nimfr_("add", "/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system.nim");
{ T1_ = (*x).len;
xl = T1_;
if (nimAddInt(xl, yLen_0, &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
};
if (((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3)) < ((NI) 0) || ((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3), ((NI) 0), ((NI) IL64(9223372036854775807))); goto BeforeRet_;
}
setLen_temp_19((&(*x)), ((NI) ((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3))));
{
NI i;
NI colontmp_;
NI res;
i = (NI)0;
colontmp_ = (NI)0;
colontmp_ = (yLen_0-1);
res = ((NI) 0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NI TM__SRd76hP9cMfCzdUO857UhQQ_5;
if (!(res <= colontmp_)) goto LA4;
i = res;
if (nimAddInt(xl, i, &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
if ((NU)((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4)) >= (NU)(*x).len){ raiseIndexError2((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4),(*x).len-1); goto BeforeRet_;
}
if ((NU)(i) >= (NU)(yLen_0)){ raiseIndexError2(i,yLen_0-1); goto BeforeRet_;
}
(*x).p->data[(NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4)] = y[i];
if (nimAddInt(res, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_5)) { raiseOverflow(); goto BeforeRet_;
};
res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_5);
} LA4: ;
}
}
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy__temp_102)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* dest) {
if ((*dest).p && !((*dest).p->cap & NIM_STRLIT_FLAG)) {
alignedDealloc((*dest).p, NIM_ALIGNOF(NF));
}
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy__temp_93)(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ* dest) {
eqdestroy__temp_102((&(*dest).data));
}
N_LIB_PRIVATE N_NIMCALL(void, test_temp_3)(NF* data, NI dataLen_0) {
tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ pos;
nimfr_("test", "/home/runner/work/Nim/Nim/temp.nim");
nimZeroMem((void*)(&pos), sizeof(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ));
nimZeroMem((void*)(&pos), sizeof(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ));
add_temp_6((&pos.data), data, dataLen_0);
eqdestroy__temp_93((&pos));
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* 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();
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) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
test_temp_3(TM__SRd76hP9cMfCzdUO857UhQQ_6, 2);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Position"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("data"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("float")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("data"),
nnkBracketExpr.newTree(
newIdentNode("openArray"),
newIdentNode("float")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("pos"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("Position")
)
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("pos"),
newIdentNode("data")
),
newIdentNode("add")
),
newIdentNode("data")
)
)
),
nnkCall.newTree(
newIdentNode("test"),
nnkBracket.newTree(
newLit(1.5),
newLit(1.6)
)
)
) 1.2.0 :+1: OKOutput
Stats
1.0.0 :-1: FAILOutput
Stats
IR
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.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 tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ;
typedef struct tySequence__Zj5xKXgsXnI4n4hPS6nACA tySequence__Zj5xKXgsXnI4n4hPS6nACA;
typedef struct tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content;
struct tySequence__Zj5xKXgsXnI4n4hPS6nACA {
NI len; tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content* p;
};
struct tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ {
tySequence__Zj5xKXgsXnI4n4hPS6nACA data;
};
typedef NF tyArray__Tgy9b6R4KdSrcLohzVAUl8w[2];
#ifndef tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
#define tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
struct tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content { NI cap; NF data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
#define tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content_PP
struct tySequence__Zj5xKXgsXnI4n4hPS6nACA_Content { NI cap; NF data[SEQ_DECL_SIZE];};
#endif
N_LIB_PRIVATE N_NIMCALL(void, test__xFtdRlFPO9a2F29a4juFTGMw)(NF* data, NI dataLen_0);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NOINLINE(void, chckNil)(void* p);
N_LIB_PRIVATE N_NIMCALL(void, add__fhyqOd60VIgGqZP9apBUvEg)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* x, NF* y, NI yLen_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___BTVD8ELrrJJpUuJCqTRkOQ)(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ* dest);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___9c08BiLHaXt5fGmkHaCPbBQ)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* dest);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
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__Tgy9b6R4KdSrcLohzVAUl8w TM__SRd76hP9cMfCzdUO857UhQQ_2 = {1.5000000000000000e+00,
1.6000000000000001e+00}
;
extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
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(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
return result;
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___9c08BiLHaXt5fGmkHaCPbBQ)(tySequence__Zj5xKXgsXnI4n4hPS6nACA* dest) {
NI colontmp_;
colontmp_ = ((NI) 0);
{
while (1) {
NI T3_;
T3_ = (*dest).len;
if (!(colontmp_ < T3_)) goto LA2;
colontmp_ += ((NI) 1);
} LA2: ;
}
if ((*dest).p && !((*dest).p->cap & NIM_STRLIT_FLAG)) {
deallocShared((*dest).p);
(*dest).p = NIM_NIL; (*dest).len = 0; }
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___BTVD8ELrrJJpUuJCqTRkOQ)(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ* dest) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
eqdestroy___9c08BiLHaXt5fGmkHaCPbBQ((&(*dest).data));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
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(void, test__xFtdRlFPO9a2F29a4juFTGMw)(NF* data, NI dataLen_0) {
tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ pos;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("test", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&pos), sizeof(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ));
chckNil((void*)(&pos));
nimZeroMem((void*)(&pos), sizeof(tyObject_Position__9bSg74cbDWcz9agKwF8Zm5FQ));
add__fhyqOd60VIgGqZP9apBUvEg((&pos.data), data, dataLen_0);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___BTVD8ELrrJJpUuJCqTRkOQ((&pos));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* 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) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
test__xFtdRlFPO9a2F29a4juFTGMw(TM__SRd76hP9cMfCzdUO857UhQQ_2, 2);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Position"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("data"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("float")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
newIdentNode("test"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("data"),
nnkBracketExpr.newTree(
newIdentNode("openArray"),
newIdentNode("float")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("pos"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("Position")
)
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("pos"),
newIdentNode("data")
),
newIdentNode("add")
),
newIdentNode("data")
)
)
),
nnkCall.newTree(
newIdentNode("test"),
nnkBracket.newTree(
newLit(1.5),
newLit(1.6)
)
)
) ??? ➡️ 🐛DiagnosticsThe commit that introduced the bug can not be found, but the bug is in the commits: (Can not find the commit because Nim can not be re-built commit-by-commit to bisect). now bisecting 9 commits at 22 commits per second.
|
Found in https://github.com/paranim/pararules. Seems to be caused by the fact that system.add uses move here?
Example
Current Output
Expected Output
Nothing
The text was updated successfully, but these errors were encountered: