Skip to content

Some tests fail on arm32 #35

Open
Open
@mingodad

Description

@mingodad

While testing this project on arm32 (android with termux clang9) I'm getting this errors:

External function call. Class types sizeof() == 0, arguments in registers. sx [raw]
REGVM Failed (0 != 1)
External function call. Floating point register overflow mid argument. [raw]
REGVM Failed (0 != 1)
External function call. auto ref. { int; } returned. [raw]
REGVM Failed (0 != 1)
External function call. Small return type 1. [raw]
REGVM Failed (0 != 1)
nullc compiler
REGVM Execution failed: buffer is empty
Call stack:
global scope (line 30: at BuildBaseModule(2);)
BuildBaseModule (line 204: at if(!BuildModuleFromSource(string("$base$.nc"), string(), string(nullcBaseCode), &errorPos, &errorBuf, optimizationLevel, ArrayView<InplaceStr>())))
BuildModuleFromSource (line 1982: at if(!CompileModuleFromSource(ctx)))
CompileModuleFromSource (line 494: at if(!AnalyzeModuleFromSource(ctx)))
AnalyzeModuleFromSource (line 470: at PrintGraph(exprGraphCtx, ctx.exprModule, "");)
PrintGraph (line 1132: at PrintGraph(ctx, expression, InplaceStr(name));)
PrintGraph (line 1088: at PrintGraph(ctx, node.moduleScope, true);)
PrintGraph (line 501: at PrintGraph(ctx, data, printImported);)
PrintGraph (line 447: at PrintIndented(ctx, InplaceStr(), data.type, "%.*s: f%04x", FMT_ISTR(data.name.name), data.uniqueId);)
FMT_ISTR (line 253: at memory::copy(result, 0, str.data, str.begin, str.length());)

Eval test finished in 669.075000
std.string test (raw character array operation)
REGVM Execution failed: Assertion failed
Call stack:
global scope (line 38: at return __runner();)
__runner (line 26: at assert(strcmp("zz", "test") > 1);)

The strcmp one is interesting because it return 6 on linux x86_64 when running through nullc but returns 1 when running through a C test program:

import std.io;
import std.string;

int rc = strcmp("zz", "test");

io.out << rc << io.endl;

return 0;
#include <stdio.h>
#include <string.h>

int main () {
   char str1[15];
   char str2[15];
   int ret, ret2;


   strcpy(str1, "abcdef");
   strcpy(str2, "ABCDEF");

   ret = strcmp(str1, str2);
   printf("ret = %d\n", ret);

   ret2 = strcmp("zz", "test");
   printf("strcmp zz test = %d\n", ret2);

   if(ret < 0) {
      printf("str1 is less than str2");
   } else if(ret > 0) {
      printf("str2 is less than str1");
   } else {
      printf("str1 is equal to str2");
   }

   return(0);
}

Output:

./run-it test-strcmp.nc 
6
0.03user 0.00system 0:00.03elapsed 100%CPU (0avgtext+0avgdata 11836maxresident)k
0inputs+0outputs (0major+2176minor)pagefaults 0swaps

gcc -o test-strcmp test-strcmp.c 
./test-strcmp
ret = 32
strcmp zz test = 1
str2 is less than str1

But nullc on arm32 return 1:

./run-it test-strcmp.nc 
1

real	0m0.289s
user	0m0.240s
sys	0m0.040s

gcc -o test-strcmp test-strcmp.c
./test-strcmp
ret = 32
strcmp zz test = 1
str2 is less than str1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions