Thread: I can't spot my mistake...

  1. #16
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    New problem, I somehow broke the register index grabber, here's the referenced code first:
    Code:
    int alu_block( struct alu_block *mem, size_t want, int_t dir )
    {
    	int ret = EINVAL;
    	uchar_t *block = NULL;
    	
    	if ( mem->block )
    	{
    		if ( dir > 0 && mem->bytes.upto >= want )
    			return 0;
    		
    		if ( dir < 0 && want > mem->bytes.upto )
    			return ret;
    			
    		if ( !want )
    		{
    			free( mem->block );
    			(void)memset( mem, 0, sizeof(alu_block_t) );
    			return 0;
    		}
    		
    		errno = 0;
    		block = realloc( mem->block, want );
    		ret = errno;
    	}
    	else
    	{
    		memset( mem, 0, sizeof(alu_block_t) );
    		
    		if ( !want )
    			return 0;
    		
    		if ( dir < 0 )
    			return ret;
    		
    		errno = 0;
    		block = malloc( want );
    		ret = errno;
    	}
    	
    	if ( block )
    	{
    		mem->block = block;
    		mem->bytes.upto = want;
    		mem->bytes.last = want - 1;
    		memset( &(block[mem->bytes.used]), 0, want - mem->bytes.used );
    		return 0;
    	}
    	
    	return ret;
    }
    int alu_vec( alu_vec_t *vec, uint_t want, size_t perN, int dir )
    {
    	int ret = 0, used = vec->qty.used;
    	void *dst, *src, *block;
    	size_t diff = 0;
    	
    	if ( perN > vec->perN )
    		goto expand;
    		
    	if ( perN < vec->perN )
    		goto shrink;
    	
    	expand:
    	ret = alu_block( &(vec->mem), want * perN, dir );
    	
    	if ( ret == 0 )
    	{
    		diff = perN - (vec->perN);
    		
    		if ( !diff )
    			goto done;
    			
    		/* Align nodes and initialise extra bytes */
    		block = vec->mem.block;
    		while ( used )
    		{
    			--used;
    			dst = block + (used * perN) + diff;
    			src = block + (used * vec->perN);
    			memmove( dst, src, vec->perN );
    			memset( dst - diff, 0, diff );
    		}
    		goto done;
    	}
    	goto fail;
    	
    	shrink:
    	diff = (vec->perN) - perN;
    	/* Crop nodes */
    	block = vec->mem.block;
    	while ( used )
    	{
    		--used;
    		dst = block + (used * perN);
    		src = block + (used * vec->perN);
    		memset( src, 0, diff );
    		memmove( dst, src + diff, perN );
    	}
    	
    	ret = alu_block( &(vec->mem), want * perN, dir );
    	
    	if ( ret != 0 )
    		goto fail;
    		
    	done:
    	vec->perN = perN;
    	vec->qty.upto = want;
    	vec->qty.last = want ? want - 1 : 0;
    	
    	if ( vec->qty.used < want )
    		vec->qty.used = want;
    	
    	vec->mem.bytes.used = vec->qty.used * perN;
    	
    	fail:
    	return ret;
    }
    int alu_setup_reg( alu_t *alu, uint_t want, size_t perN )
    {
    	int ret;
    	uint_t i;
    	alu_register_t *REG;
    	
    	want = HIGHEST( want, ALU_REG_ID_NEED );
    	
    	/* Needed for alu_mov() to support both register numbers and
    	 * arbitrary addresses */
    	if ( want > ALU_REG_ID_LIMIT )
    		return ERANGE;
    	
    	perN =
    		(sizeof(size_t) * !perN)
    		| (perN * !(perN % sizeof(size_t)))
    		| ((perN / sizeof(size_t))+1) * !!(perN % sizeof(size_t))
    	;
    	
    	ret = alu_vec_expand( &(alu->buff), want, perN );
    	if ( ret != 0 )
    		return ret;
    		
    	ret = alu_vec_expand( &(alu->_regv), want, sizeof(alu_reg_t) );
    	if ( ret != 0 )
    		return ret;
    	
    	alu->regv = alu->_regv.mem.block;
    	
    	for ( i = 0; i < ALU_REG_ID_NEED; ++i )
    	{
    		REG = alu->regv + i;
    		REG->node = i;
    		REG->info = ALU_INFO_VALID;
    		alu_set_bounds( *alu, i, 0, -1 );
    	}
    	
    	alu_set_constants( *alu );
    	
    	return 0;
    }
    
    int alu_get_reg( alu_t *alu, alu_register_t *dst, size_t size )
    {
    	int ret;
    	size_t perN;
    	uint_t count = 0, r = count;
    	alu_register_t *REG;
    
    	if ( !dst )
    	{
    		nodst:
    		ret = EDESTADDRREQ;
    		alu_error( ret );
    		return ret;
    	}
    	
    	(void)memset( dst, 0, sizeof(alu_register_t) );
    	
    	if ( !alu )
    		goto nodst;
    	
    	perN = HIGHEST( size, alu->buff.perN );
    	count = HIGHEST( ALU_REG_ID_NEED, ALU_USED( *alu ) );
    	
    	if ( perN > alu->buff.perN || count > ALU_UPTO( *alu ) )
    	{
    		ret = alu_setup_reg( alu, count, perN );
    		
    		if ( ret != 0 )
    		{
    			alu_error( ret );
    			return ret;
    		}
    		
    		alu->buff.qty.used = count;
    		alu->_regv.qty.used = count;
    		alu->buff.mem.bytes.used = count * perN;
    		alu->_regv.mem.bytes.used = count * sizeof(alu_register_t);
    	}
    	
    	for ( r = ALU_REG_ID_NEED; r < count; ++r )
    	{
    		REG = alu->regv + r;
    		count *= !!( REG->info & ALU_INFO_VALID );
    	}
    	
    	count = alu->buff.qty.used;
    	
    	if ( r == ALU_UPTO( *alu ) )
    	{
    		count = r + 1;
    		ret = alu_setup_reg( alu, count, perN );
    			
    		if ( ret != 0 )
    		{
    			alu_error( ret );
    			return ret;
    		}
    	}
    	else if ( r == count )
    	{
    		++count;
    	}
    	
    	alu->buff.qty.used = count;
    	alu->_regv.qty.used = count;
    	alu->buff.mem.bytes.used = count * perN;
    	alu->_regv.mem.bytes.used = count * sizeof(alu_register_t);
    	
    	REG = alu->regv + r;
    	REG->node = r;
    	REG->info = ALU_INFO_VALID;
    	alu_set_bounds( *alu, r, 0, -1 );
    	(void)memset( ALU_PART( *alu, REG->node ), 0, perN );
    	(void)memcpy( dst, REG, sizeof( alu_register_t ) );
    	
    	return 0;
    }
    
    void alu_rem_regv( alu_t alu, alu_register_t *regv, int count )
    {
    	for ( --count; count >= 0; --count )
    	{
    		alu_rem_reg( alu, regv[count] );
    	}
    }
    
    int alu_get_regv( alu_t *alu, alu_register_t *regv, int count, size_t need )
    {
    	int ret = 0, r;
    	
    	for ( r = 0; r < count; ++r )
    	{
    		ret = alu_get_reg( alu, regv + r, need );
    		if ( ret != 0 )
    		{
    			alu_error( ret );
    			alu_rem_regv( *alu, regv, r );
    			break;
    		}
    	}
    	
    	return ret;
    }
    From my digging I've found that somehow the register information is being wiped between attempts to allocate a register index, any ideas on what might be causing it to happen?
    General reminder the full code as at GitHub - awsdert/alu: Library modeled after the Arithmetic Logic Unit built into CPUs

  2. #17
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,795
    Makefile doesn't work

  3. #18
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Quote Originally Posted by Hodor View Post
    Makefile doesn't work
    Works just fine for me, could you be more specific?

  4. #19
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,795
    Quote Originally Posted by awsdert View Post
    Works just fine for me, could you be more specific?
    make debug
    Code:
    Already up to date. Current branch master is up to date.
    Finished checking
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o test_d.o -c test.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_vec_d.o -c alu_vec.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_mem_d.o -c alu_mem.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_bit_d.o -c alu_bit.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_math_d.o -c alu_math.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_int_d.o -c alu_int.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_main_d.o -c alu_main.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_uint_d.o -c alu_uint.c
    cc -ggdb -D _DEBUG -fPIC -shared  -o libalu_d.so alu_vec_d.o alu_mem_d.o alu_bit_d.o alu_math_d.o alu_int_d.o alu_main_d.o alu_uint_d.o -Wl,-rpath=./
    cc -ggdb -D _DEBUG -fPIE -L . -l alu  -o alu_d.AppImage test_d.o -Wl,-rpath=./
    /usr/bin/ld: cannot find -lalu
    collect2: error: ld returned 1 exit status
    make[1]: *** [main.mak:84: alu_d.AppImage] Error 1
    make: *** [1st.mak:6: debug] Error 2
    make all (abbreviated)
    Code:
    .
    .
    .
    cc -D NDEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_uint.o -c alu_uint.c
    cc -D NDEBUG -fPIC -shared  -o libalu.so alu_vec.o alu_mem.o alu_bit.o alu_math.o alu_int.o alu_main.o alu_uint.o -Wl,-rpath=./
    cc -D NDEBUG -fPIE -L . -l alu  -o alu.AppImage test.o -Wl,-rpath=./
    /usr/bin/ld: test.o: in function `uint_compare':
    test.c:(.text+0x25b): undefined reference to `alu_uint_cmp'
    /usr/bin/ld: test.o: in function `int_compare':
    test.c:(.text+0x5b8): undefined reference to `alu_int_cmp'
    /usr/bin/ld: test.o: in function `reg_compare':
    .
    .
    .
    test.c:(.text+0x6157): undefined reference to `alu_setup_reg'
    /usr/bin/ld: test.c:(.text+0x61e5): undefined reference to `alu_vec'
    /usr/bin/ld: test.c:(.text+0x6207): undefined reference to `alu_vec'
    collect2: error: ld returned 1 exit status
    make[1]: *** [main.mak:84: alu.AppImage] Error 1
    make: *** [1st.mak:6: all] Error 2

  5. #20
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Quote Originally Posted by awsdert View Post
    New problem, I somehow broke the register index grabber, here's the referenced code first:

    From my digging I've found that somehow the register information is being wiped between attempts to allocate a register index, any ideas on what might be causing it to happen?
    General reminder the full code as at GitHub - awsdert/alu: Library modeled after the Arithmetic Logic Unit built into CPUs
    I think I solved it, the wiping was most likely down to use the size of an old type, found it after removing the type, I also just found an instance where I was referring to the same register by mistake when moving from alu_uint/int/fpn_t* to alu_uint/int/fpn_t* (used in between for simpler code)

  6. #21
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Quote Originally Posted by Hodor View Post
    make debug
    Code:
    Already up to date. Current branch master is up to date.
    Finished checking
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o test_d.o -c test.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_vec_d.o -c alu_vec.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_mem_d.o -c alu_mem.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_bit_d.o -c alu_bit.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_math_d.o -c alu_math.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_int_d.o -c alu_int.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_main_d.o -c alu_main.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_uint_d.o -c alu_uint.c
    cc -ggdb -D _DEBUG -fPIC -shared  -o libalu_d.so alu_vec_d.o alu_mem_d.o alu_bit_d.o alu_math_d.o alu_int_d.o alu_main_d.o alu_uint_d.o -Wl,-rpath=./
    cc -ggdb -D _DEBUG -fPIE -L . -l alu  -o alu_d.AppImage test_d.o -Wl,-rpath=./
    /usr/bin/ld: cannot find -lalu
    collect2: error: ld returned 1 exit status
    make[1]: *** [main.mak:84: alu_d.AppImage] Error 1
    make: *** [1st.mak:6: debug] Error 2
    Just fixed that one after encountering it myself when I went to use gede

    Quote Originally Posted by Hodor View Post
    make debug
    make all (abbreviated)
    Code:
    .
    .
    .
    cc -D NDEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_uint.o -c alu_uint.c
    cc -D NDEBUG -fPIC -shared  -o libalu.so alu_vec.o alu_mem.o alu_bit.o alu_math.o alu_int.o alu_main.o alu_uint.o -Wl,-rpath=./
    cc -D NDEBUG -fPIE -L . -l alu  -o alu.AppImage test.o -Wl,-rpath=./
    /usr/bin/ld: test.o: in function `uint_compare':
    test.c:(.text+0x25b): undefined reference to `alu_uint_cmp'
    /usr/bin/ld: test.o: in function `int_compare':
    test.c:(.text+0x5b8): undefined reference to `alu_int_cmp'
    /usr/bin/ld: test.o: in function `reg_compare':
    .
    .
    .
    test.c:(.text+0x6157): undefined reference to `alu_setup_reg'
    /usr/bin/ld: test.c:(.text+0x61e5): undefined reference to `alu_vec'
    /usr/bin/ld: test.c:(.text+0x6207): undefined reference to `alu_vec'
    collect2: error: ld returned 1 exit status
    make[1]: *** [main.mak:84: alu.AppImage] Error 1
    make: *** [1st.mak:6: all] Error 2
    Ah yeah I must've not uploaded the fix for that yet, I'll do that after making some adjustments to the all rule so that both release and debug builds are produced

  7. #22
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Encountering a segfault some time after the test app has started running, not got any real idea of how though
    Code:
    int alu_get_reg( alu_t *alu, alu_register_t *dst, size_t size )
    {
    	int ret;
    	size_t perN;
    	uint_t count = 0, r = count;
    	alu_register_t *REG;
    
    	if ( !dst )
    	{
    		nodst:
    		ret = EDESTADDRREQ;
    		alu_error( ret );
    		return ret;
    	}
    	
    	(void)memset( dst, 0, sizeof(alu_register_t) );
    	
    	if ( !alu )
    		goto nodst;
    	
    	perN = HIGHEST( size, alu->buff.perN );
    	count = HIGHEST( ALU_REG_ID_NEED, ALU_USED( *alu ) );
    	
    	if ( perN > alu->buff.perN || count > ALU_UPTO( *alu ) )
    	{
    		ret = alu_setup_reg( alu, count, perN );
    		
    		if ( ret != 0 )
    		{
    			alu_error( ret );
    			return ret;
    		}
    		
    		alu->buff.qty.used = count;
    		alu->_regv.qty.used = count;
    		alu->buff.mem.bytes.used = count * perN;
    		alu->_regv.mem.bytes.used = count * sizeof(alu_register_t);
    	}
    	
    	for ( r = ALU_REG_ID_NEED; r < count; ++r )
    	{
    		REG = alu->regv + r;
    		count *= !!( REG->info & ALU_INFO_VALID );
    	}
    	
    	count = alu->buff.qty.used;
    	
    	if ( r == ALU_UPTO( *alu ) )
    	{
    		count = r + 1;
    		ret = alu_setup_reg( alu, count, perN );
    			
    		if ( ret != 0 )
    		{
    			alu_error( ret );
    			return ret;
    		}
    	}
    	else if ( r == count )
    	{
    		++count;
    	}
    	
    	alu->buff.qty.used = count;
    	alu->_regv.qty.used = count;
    	alu->buff.mem.bytes.used = count * perN;
    	alu->_regv.mem.bytes.used = count * sizeof(alu_register_t);
    	
    	REG = alu->regv + r;
    	REG->node = r;
    	REG->info = ALU_INFO_VALID;
    	alu_set_bounds( *alu, r, 0, -1 );
    	(void)memset( ALU_PART( *alu, REG->node ), 0, perN ); // Tracked segfault to this line
    	(void)memcpy( dst, REG, sizeof( alu_register_t ) );
    	
    	return 0;
    }
    Here's the output of "make debug run"
    Code:
    make debug run
    MAKECMDGOALS=debug run
    make --no-print-directory -f main.mak debug run
    PRJ_SRC_FILES = 'test.c alu_bit.c alu_int.c alu_main.c alu_math.c alu_mem.c alu_uint.c alu_vec.c'
    Checking 3rd Party libraries are upto date
    cd 'cloned/fbstdc' && git config pull.rebase true && git pull
    Finished checking
    PRJ_DST_BIN=alu_d.AppImage
    PRJ_DST_LIB=libalu_d.so
    make[1]: Nothing to be done for 'debug'.
    gdb -ex run ./alu_d.AppImage
    error: cannot pull with rebase: You have unstaged changes.
    error: please commit or stash them.
    GNU gdb (GDB) 9.2
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "x86_64-pc-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
        <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ./alu_d.AppImage...
    Starting program: /mnt/MEDIA/HOME/github/alu/alu_d.AppImage
    test.c:1311: main() 'Initiating ALU to 0...'
    test.c:1314: main() 'Pre-allocating 16 ALU registers...'
    test.c:1004: reg_print_value() Expected = '123', Got = '123'
    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff7f1cf68 in __memset_avx2_unaligned_erms () from /usr/lib/libc.so.6
    (gdb) quit
    A debugging session is active.
    	Inferior 1 [process 4276] will be killed.
    Quit anyway? (y or n) [answered Y; input not from terminal]
    make --no-print-directory -f main.mak debug run
    PRJ_SRC_FILES = 'test.c alu_bit.c alu_int.c alu_main.c alu_math.c alu_mem.c alu_uint.c alu_vec.c'
    Checking 3rd Party libraries are upto date
    cd 'cloned/fbstdc' && git config pull.rebase true && git pull
    error: cannot pull with rebase: You have unstaged changes.
    error: please commit or stash them.
    Finished checking
    PRJ_DST_BIN=alu_d.AppImage
    PRJ_DST_LIB=libalu_d.so
    make[1]: Nothing to be done for 'debug'.
    gdb -ex run ./alu_d.AppImage
    GNU gdb (GDB) 9.2
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "x86_64-pc-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
        <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ./alu_d.AppImage...
    Starting program: /mnt/MEDIA/HOME/github/alu/alu_d.AppImage
    test.c:1311: main() 'Initiating ALU to 0...'
    test.c:1314: main() 'Pre-allocating 16 ALU registers...'
    test.c:1004: reg_print_value() Expected = '123', Got = '123'
    Program received signal SIGSEGV, Segmentation fault.
    0x00007ffff7f1cf68 in __memset_avx2_unaligned_erms () from /usr/lib/libc.so.6
    (gdb) quit
    A debugging session is active.
    	Inferior 1 [process 4300] will be killed.
    Quit anyway? (y or n) [answered Y; input not from terminal]
    Compilation finished successfully.

  8. #23
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Quote Originally Posted by awsdert View Post
    Just fixed that one after encountering it myself when I went to use gede



    Ah yeah I must've not uploaded the fix for that yet, I'll do that after making some adjustments to the all rule so that both release and debug builds are produced
    Done the upload now btw

  9. #24
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Try as I might I can't discern why my code is failing, all I can find is that register numbers just randomly stop at 20:
    Code:
    make run
    MAKECMDGOALS=run
    make --no-print-directory -f main.mak run
    PRJ_SRC_FILES = 'test.c alu_bit.c alu_int.c alu_main.c alu_math.c alu_mem.c alu_uint.c alu_vec.c'
    Checking 3rd Party libraries are upto date
    cd 'cloned/fbstdc' && git config pull.rebase true && git pull
    Already up to date.
    Finished checking
    PRJ_DST_BIN=alu.AppImage
    PRJ_DST_LIB=libalu.so
    cc -D NDEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o test.o -c test.c
    cc -D NDEBUG -fPIE -L . -l alu  -o alu.AppImage test.o -Wl,-rpath=./
    ./alu.AppImage
    test.c:1367: main() Pre-allocating 32 ALU registers...
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9f38, dst->node = 7
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9f38, REG->node = 7
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9f58, dst->node = 8
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9f58, REG->node = 8
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9f78, dst->node = 9
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9f78, REG->node = 9
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9fa8, dst->node = 10
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9fa8, REG->node = 10
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9fc8, dst->node = 11
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9fc8, REG->node = 11
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9fe8, dst->node = 12
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9fe8, REG->node = 12
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3eaa008, dst->node = 13
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3eaa008, REG->node = 13
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3eaa028, dst->node = 14
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3eaa028, REG->node = 14
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3eaa048, dst->node = 15
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3eaa048, REG->node = 15
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3eaa068, dst->node = 16
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3eaa068, REG->node = 16
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 17
    test.c:982: reg_print_value() 'Testing alu_lit2reg() & alu_reg2str()'
    test.c:983: reg_print_value() '-------------------------------------'
    test.c:1016: reg_print_value() Expected = '123', Got = '123'
    test.c:1042: uint_print_value() 'Testing alu_str2uint() & alu_uint2str()'
    test.c:1043: uint_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a50, dst->node = 18
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 19
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 19
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9950, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9950, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a00, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    test.c:1071: uint_print_value() Expected = '123', Got = '123'
    test.c:1095: int_print_value() 'Testing alu_str2int() & alu_int2str()'
    test.c:1096: int_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a30, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea99e0, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98d0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98d0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    test.c:1126: int_print_value() Expected = '123', Got = '123'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    test.c:982: reg_print_value() 'Testing alu_lit2reg() & alu_reg2str()'
    test.c:983: reg_print_value() '-------------------------------------'
    test.c:1016: reg_print_value() Expected = '+145', Got = '+145'
    test.c:1042: uint_print_value() 'Testing alu_str2uint() & alu_uint2str()'
    test.c:1043: uint_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a50, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9950, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9950, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a00, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    test.c:1071: uint_print_value() Expected = '+145', Got = '+145'
    test.c:1095: int_print_value() 'Testing alu_str2int() & alu_int2str()'
    test.c:1096: int_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a30, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea99e0, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98d0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98d0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    test.c:1126: int_print_value() Expected = '+145', Got = '+145'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    test.c:982: reg_print_value() 'Testing alu_lit2reg() & alu_reg2str()'
    test.c:983: reg_print_value() '-------------------------------------'
    test.c:1016: reg_print_value() Expected = '0xA', Got = '0xA'
    test.c:1042: uint_print_value() 'Testing alu_str2uint() & alu_uint2str()'
    test.c:1043: uint_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a50, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9950, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9950, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a00, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    test.c:1071: uint_print_value() Expected = '0xA', Got = '0xA'
    test.c:1095: int_print_value() 'Testing alu_str2int() & alu_int2str()'
    test.c:1096: int_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a30, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea99e0, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98d0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98d0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    test.c:1126: int_print_value() Expected = '0xA', Got = '0xA'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    test.c:982: reg_print_value() 'Testing alu_lit2reg() & alu_reg2str()'
    test.c:983: reg_print_value() '-------------------------------------'
    test.c:1016: reg_print_value() Expected = '0b1', Got = '0b1'
    test.c:1042: uint_print_value() 'Testing alu_str2uint() & alu_uint2str()'
    test.c:1043: uint_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a50, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9950, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9950, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a00, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    test.c:1071: uint_print_value() Expected = '0b1', Got = '0b1'
    test.c:1095: int_print_value() 'Testing alu_str2int() & alu_int2str()'
    test.c:1096: int_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a30, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea99e0, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98d0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98d0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    test.c:1126: int_print_value() Expected = '0b1', Got = '0b1'
    test.c:1095: int_print_value() 'Testing alu_str2int() & alu_int2str()'
    test.c:1096: int_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a30, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea99e0, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98d0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98d0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    test.c:1126: int_print_value() Expected = '-123', Got = '-123'
    test.c:1095: int_print_value() 'Testing alu_str2int() & alu_int2str()'
    test.c:1096: int_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a30, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea99e0, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98d0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98d0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    test.c:1126: int_print_value() Expected = '-0xA', Got = '-0xA'
    test.c:1095: int_print_value() 'Testing alu_str2int() & alu_int2str()'
    test.c:1096: int_print_value() '-------------------------------------'
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9a30, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9910, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9910, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9930, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9930, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea99e0, dst->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98d0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98d0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea98f0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea98f0, REG->node = 20
    test.c:1126: int_print_value() Expected = '-0b1', Got = '-0b1'
    test.c:697: compare() 'Comparing values...'
    test.c:698: compare() '==========================================='
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9f80, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9f80, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9fa0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9fa0, REG->node = 20
    test.c:140: reg_compare() 0x0000000000000002 vs 0x0000000000000001 Expected 1, Got 0, Bit = 0
    test.c:144: reg_compare() num.node = 20, val.node = 20
    num = 0000000000000000000000000000000000000000000000000000000000000001
    val = 0000000000000000000000000000000000000000000000000000000000000001
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9f80, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9f80, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9fa0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9fa0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9f80, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9f80, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9fa0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9fa0, REG->node = 20
    test.c:140: reg_compare() 0x0000000000000000 vs 0x0000000000000001 Expected -1, Got 0, Bit = 0
    test.c:144: reg_compare() num.node = 20, val.node = 20
    num = 0000000000000000000000000000000000000000000000000000000000000001
    val = 0000000000000000000000000000000000000000000000000000000000000001
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d80, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d80, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9da0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9da0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c10, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c30, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c30, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c10, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c30, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c30, REG->node = 20
    test.c:48: uint_compare() 2 vs 1 Expected 1, Got 0
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d80, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d80, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9da0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9da0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c10, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c30, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c30, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c10, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c30, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c30, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d80, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d80, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9da0, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9da0, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c10, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c30, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c30, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c10, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c10, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c30, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c30, REG->node = 20
    test.c:48: uint_compare() 0 vs 1 Expected -1, Got 0
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d70, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d70, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d90, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d90, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c00, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c00, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c20, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c20, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c00, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c00, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c20, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c20, REG->node = 20
    test.c:93: int_compare() 1 vs 0 Expected 1, Got 0
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d70, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d70, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d90, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d90, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c00, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c00, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c20, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c20, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c00, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c00, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c20, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c20, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d70, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d70, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9d90, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9d90, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c00, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c00, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c20, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c20, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c00, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c00, REG->node = 20
    alu_main.c:472: alu_get_reg() dst = 0x7ffcf3ea9c20, dst->node = 20
    alu_main.c:499: alu_get_regv() REG = 0x7ffcf3ea9c20, REG->node = 20
    test.c:93: int_compare() -1 vs 0 Expected -1, Got 0
    Compilation finished successfully.
    Anyone wanna take a look? GitHub - awsdert/alu: Library modeled after the Arithmetic Logic Unit built into CPUs
    alu_main.c has alu_set_used(), alu_get_regv(), alu_get_reg() & alu_setup_reg(), if you think something is not self explanitory then please mention it with any suggestions, I will explain and then try to fix that while you continue taking a look, I'm fully out of ideas as to what is causing the hard stop at 20

  10. #25
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,795
    Still won't build for me

    Code:
    $ make --version
    GNU Make 4.2.1
    $ gcc --version
    gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
    
    $ make debug run
    .
    .
    Finished checking
    PRJ_DST_BIN=alu_d.AppImage
    PRJ_DST_LIB=libalu_d.so
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o test_d.o -c test.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_vec_d.o -c alu_vec.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_mem_d.o -c alu_mem.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_bit_d.o -c alu_bit.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_math_d.o -c alu_math.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_int_d.o -c alu_int.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_main_d.o -c alu_main.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_uint_d.o -c alu_uint.c
    cc -ggdb -D _DEBUG -fPIC -shared  -o libalu_d.so alu_vec_d.o alu_mem_d.o alu_bit_d.o alu_math_d.o alu_int_d.o alu_main_d.o alu_uint_d.o -Wl,-rpath=./
    cc -ggdb -D _DEBUG -fPIE -L . -l alu_d  -o alu_d.AppImage test_d.o -Wl,-rpath=./
    /usr/bin/ld: test_d.o: in function `uint_compare':
    /home/hodor/tmp/alu/test.c:39: undefined reference to `alu_uint_cmp'
    /usr/bin/ld: test_d.o: in function `int_compare':
    /home/hodor/tmp/alu/test.c:84: undefined reference to `alu_int_cmp'
    /usr/bin/ld: test_d.o: in function `reg_compare':
    /home/hodor/tmp/alu/test.c:113: undefined reference to `alu_get_regv'
    .
    .
    /home/hodor/tmp/alu/test.c:1368: undefined reference to `alu_setup_reg'
    /usr/bin/ld: /home/hodor/tmp/alu/test.c:1388: undefined reference to `alu_vec'
    /usr/bin/ld: /home/hodor/tmp/alu/test.c:1389: undefined reference to `alu_vec'
    collect2: error: ld returned 1 exit status
    make[1]: *** [main.mak:89: alu_d.AppImage] Error 1
    make: *** [1st.mak:6: debug] Error 2

  11. #26
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Quote Originally Posted by Hodor View Post
    Still won't build for me

    Code:
    $ make --version
    GNU Make 4.2.1
    $ gcc --version
    gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
    
    $ make debug run
    .
    .
    Finished checking
    PRJ_DST_BIN=alu_d.AppImage
    PRJ_DST_LIB=libalu_d.so
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o test_d.o -c test.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_vec_d.o -c alu_vec.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_mem_d.o -c alu_mem.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_bit_d.o -c alu_bit.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_math_d.o -c alu_math.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_int_d.o -c alu_int.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_main_d.o -c alu_main.c
    cc -ggdb -D _DEBUG -fPIC -shared -Wall -Wextra -I cloned/fbstdc/include  -o alu_uint_d.o -c alu_uint.c
    cc -ggdb -D _DEBUG -fPIC -shared  -o libalu_d.so alu_vec_d.o alu_mem_d.o alu_bit_d.o alu_math_d.o alu_int_d.o alu_main_d.o alu_uint_d.o -Wl,-rpath=./
    cc -ggdb -D _DEBUG -fPIE -L . -l alu_d  -o alu_d.AppImage test_d.o -Wl,-rpath=./
    /usr/bin/ld: test_d.o: in function `uint_compare':
    /home/hodor/tmp/alu/test.c:39: undefined reference to `alu_uint_cmp'
    /usr/bin/ld: test_d.o: in function `int_compare':
    /home/hodor/tmp/alu/test.c:84: undefined reference to `alu_int_cmp'
    /usr/bin/ld: test_d.o: in function `reg_compare':
    /home/hodor/tmp/alu/test.c:113: undefined reference to `alu_get_regv'
    .
    .
    /home/hodor/tmp/alu/test.c:1368: undefined reference to `alu_setup_reg'
    /usr/bin/ld: /home/hodor/tmp/alu/test.c:1388: undefined reference to `alu_vec'
    /usr/bin/ld: /home/hodor/tmp/alu/test.c:1389: undefined reference to `alu_vec'
    collect2: error: ld returned 1 exit status
    make[1]: *** [main.mak:89: alu_d.AppImage] Error 1
    make: *** [1st.mak:6: debug] Error 2
    You probably have old objects there, add rebuild to the target list then do normally, I haven't figured out why make is not rebuilding objects as it ought to, feel free to investigate that later, not my primary concern at the moment

  12. #27
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,795
    Quote Originally Posted by awsdert View Post
    You probably have old objects there, add rebuild to the target list then do normally, I haven't figured out why make is not rebuilding objects as it ought to, feel free to investigate that later, not my primary concern at the moment
    Unfortunately not (I did make clean first). But, just to make sure I deleted the directory and re-cloned your repo... exactly the same result as above

  13. #28
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Quote Originally Posted by Hodor View Post
    Unfortunately not (I did make clean first). But, just to make sure I deleted the directory and re-cloned your repo... exactly the same result as above
    That's weird, the 1st 2 are defined right at the top of their relative files (alu_uint.c & alu_int.c), the 3rd is in alu_main.c right under alu_get_reg()... AH! Check if libalu_d.so still exists in your directory, it may have been 'cleaned' somehow

  14. #29
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,795
    Quote Originally Posted by awsdert View Post
    That's weird, the 1st 2 are defined right at the top of their relative files (alu_uint.c & alu_int.c), the 3rd is in alu_main.c right under alu_get_reg()... AH! Check if libalu_d.so still exists in your directory, it may have been 'cleaned' somehow
    Yeah it built libalu_d.so ok (it's in the directory); it's not linking though

    Code:
    $ ls
    1st.mak      alu.h        alu_int_d.o   alu_math_d.o  alu_uint_d.o  cloned       libalu_d.so  test_d.o
    GNUmakefile  alu_bit.c    alu_main.c    alu_mem.c     alu_vec.c     dst_cc.mak   main.mak
    LICENSE      alu_bit_d.o  alu_main_d.o  alu_mem_d.o   alu_vec_d.o   dst_sys.mak  makefile
    README.md    alu_int.c    alu_math.c    alu_uint.c    char.mak      func.mak     test.c

  15. #30
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,100
    Quote Originally Posted by Hodor View Post
    Yeah it built libalu_d.so ok (it's in the directory); it's not linking though

    Code:
    $ ls
    1st.mak      alu.h        alu_int_d.o   alu_math_d.o  alu_uint_d.o  cloned       libalu_d.so  test_d.o
    GNUmakefile  alu_bit.c    alu_main.c    alu_mem.c     alu_vec.c     dst_cc.mak   main.mak
    LICENSE      alu_bit_d.o  alu_main_d.o  alu_mem_d.o   alu_vec_d.o   dst_sys.mak  makefile
    README.md    alu_int.c    alu_math.c    alu_uint.c    char.mak      func.mak     test.c
    Strange, I honestly suck at makefiles (despite using them in every project) so I don't know what to do about that, as far as I can see gcc should find it without issue as the directory itself is included via the '-L .' and the library should've been correctly referenced via '-l alu_d', if you got any ideas just give it a try, let me know if something causes it to link, I'll incorporate it into mine and upload it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can anyone help to spot mistake in the code
    By chess_queen in forum C Programming
    Replies: 1
    Last Post: 10-21-2012, 10:37 AM
  2. Can you spot my mistake?
    By Brewer in forum C Programming
    Replies: 13
    Last Post: 11-12-2006, 12:50 PM
  3. going to a certain spot in a file...
    By agerealm in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2002, 02:31 AM

Tags for this Thread