Reply to topic  [ 3 posts ] 
Error / possible bug using ypush_ptr 
Author Message
Yorick Master

Joined: Wed Jun 01, 2005 11:34 am
Posts: 112
Post Error / possible bug using ypush_ptr
I nearly put this in my other thread, but since Yorick gave a "(BUG?)" output I thought perhaps it's a bug... especially since I'm using a very simple function that I think should work. Plus it's a really long post with the examples given.

Here's my C code, file named "test.c":
Code:
#include "yapi.h"

void Y_test_scalar_pointer(int nArgs)
{
    ypointer_t ptr = ygets_p(0);
    long count;
    int typeid = ypush_ptr(ptr, &count);
}


Here's my corresponding Yorick code, file named "test.i":
Code:
plug_in, "test";
extern test_scalar_pointer;


I followed the normal routine for installing it with yorick -batch make.i; make install. I added debug flags to both Yorick and my extension.

Theoretically, I should be able to call test_scalar_pointer with a single pointer argument without errors. Sometimes, it works without error. Other times, it fails spectacularly.

I tried a few variations on the C code. I tried adding "yarg_drop(1);". I tried adding "ypush_nil();". Neither fixed it. Since I'm not using any of the *_use functions, I don't believe I should be stepping on Yorick's toes with reference counting. If I eliminate the call to "ypush_ptr" it stops causing errors, so it seems that ygets_p isn't the source of the problem. I ran out of ideas at this point. Am I missing a step somewhere?

Follows are some examples of the errors, run through valgrind.

Code:
==23160== Memcheck, a memory error detector
==23160== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==23160== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==23160== Command: ./yorick
==23160==
==23160== Conditional jump or move depends on uninitialised value(s)
==23160==    at 0x449973: u_fpu_detect (fpuset.c:213)
==23160==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23160==    by 0x41A6D0: u_main_loop (umain.c:32)
==23160==    by 0x41A67A: main (main.c:22)
==23160==
==23160== Conditional jump or move depends on uninitialised value(s)
==23160==    at 0x44998C: u_fpu_detect (fpuset.c:214)
==23160==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23160==    by 0x41A6D0: u_main_loop (umain.c:32)
==23160==    by 0x41A67A: main (main.c:22)
==23160==
==23160== Conditional jump or move depends on uninitialised value(s)
==23160==    at 0x4499F6: u_fpu_setup (fpuset.c:251)
==23160==    by 0x41A6D0: u_main_loop (umain.c:32)
==23160==    by 0x41A67A: main (main.c:22)
==23160==
==23160== Conditional jump or move depends on uninitialised value(s)
==23160==    at 0x449A06: u_fpu_setup (fpuset.c:253)
==23160==    by 0x41A6D0: u_main_loop (umain.c:32)
==23160==    by 0x41A67A: main (main.c:22)
==23160==
Copyright (c) 2005.  The Regents of the University of California.
All rights reserved.  Yorick 2.2.02x ready.  For help type 'help'
> #include "test.i"
> test_scalar_pointer, &array(float, 20)
> test_scalar_pointer, &array(float, 20)
==23160== Conditional jump or move depends on uninitialised value(s)
==23160==    at 0x42D10E: FreeDimension (binobj.c:167)
==23160==    by 0x42D11E: FreeDimension (binobj.c:168)
==23160==    by 0x42D11E: FreeDimension (binobj.c:168)
==23160==    by 0x42D11E: FreeDimension (binobj.c:168)
==23160==    by 0x42D11E: FreeDimension (binobj.c:168)
==23160==    by 0x42D11E: FreeDimension (binobj.c:168)
==23160==    by 0x4D2750: BuildDimList (ops3.c:202)
==23160==    by 0x41CA43: Y_array (std0.c:602)
==23160==    by 0x4B709B: EvalBI (fnctn.c:438)
==23160==    by 0x4D30CF: Eval (ops3.c:427)
==23160==    by 0x49A2C2: YRun (task.c:128)
==23160==    by 0x49A672: DoTask (task.c:255)
==23160==
ERROR (*main*) (BUG?) attempt to free StructDef of basic data type
WARNING source code unavailable (try dbdis function)
now at pc= 1 (of 18), failed at pc= 14
To enter debug mode, type <RETURN> now (then dbexit to get out)
> test_scalar_pointer, &array(float, 20)
ERROR (*main*) (BUG?) attempt to free StructDef of basic data type
WARNING source code unavailable (try dbdis function)
now at pc= 1 (of 18), failed at pc= 14
To enter debug mode, type <RETURN> now (then dbexit to get out)
> quit
==23160==
==23160== HEAP SUMMARY:
==23160==     in use at exit: 435,612 bytes in 280 blocks
==23160==   total heap usage: 813 allocs, 533 frees, 843,530 bytes allocated
==23160==
==23160== LEAK SUMMARY:
==23160==    definitely lost: 0 bytes in 0 blocks
==23160==    indirectly lost: 0 bytes in 0 blocks
==23160==      possibly lost: 354,153 bytes in 266 blocks
==23160==    still reachable: 81,459 bytes in 14 blocks
==23160==         suppressed: 0 bytes in 0 blocks
==23160== Rerun with --leak-check=full to see details of leaked memory
==23160==
==23160== For counts of detected and suppressed errors, rerun with: -v
==23160== Use --track-origins=yes to see where uninitialised values come from
==23160== ERROR SUMMARY: 234 errors from 5 contexts (suppressed: 2 from 2)


Code:
==23140== Memcheck, a memory error detector
==23140== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==23140== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==23140== Command: ./yorick
==23140==
==23140== Conditional jump or move depends on uninitialised value(s)
==23140==    at 0x449973: u_fpu_detect (fpuset.c:213)
==23140==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23140==    by 0x41A6D0: u_main_loop (umain.c:32)
==23140==    by 0x41A67A: main (main.c:22)
==23140==
==23140== Conditional jump or move depends on uninitialised value(s)
==23140==    at 0x44998C: u_fpu_detect (fpuset.c:214)
==23140==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23140==    by 0x41A6D0: u_main_loop (umain.c:32)
==23140==    by 0x41A67A: main (main.c:22)
==23140==
==23140== Conditional jump or move depends on uninitialised value(s)
==23140==    at 0x4499F6: u_fpu_setup (fpuset.c:251)
==23140==    by 0x41A6D0: u_main_loop (umain.c:32)
==23140==    by 0x41A67A: main (main.c:22)
==23140==
==23140== Conditional jump or move depends on uninitialised value(s)
==23140==    at 0x449A06: u_fpu_setup (fpuset.c:253)
==23140==    by 0x41A6D0: u_main_loop (umain.c:32)
==23140==    by 0x41A67A: main (main.c:22)
==23140==
Copyright (c) 2005.  The Regents of the University of California.
All rights reserved.  Yorick 2.2.02x ready.  For help type 'help'
> #include "test.i"
> test_scalar_pointer, &array(double, 10)
> test_scalar_pointer, &array(double, 10)
==23140== Conditional jump or move depends on uninitialised value(s)
==23140==    at 0x42D10E: FreeDimension (binobj.c:167)
==23140==    by 0x42D11E: FreeDimension (binobj.c:168)
==23140==    by 0x42D11E: FreeDimension (binobj.c:168)
==23140==    by 0x42D11E: FreeDimension (binobj.c:168)
==23140==    by 0x42D11E: FreeDimension (binobj.c:168)
==23140==    by 0x42D11E: FreeDimension (binobj.c:168)
==23140==    by 0x4D2750: BuildDimList (ops3.c:202)
==23140==    by 0x41CA43: Y_array (std0.c:602)
==23140==    by 0x4B709B: EvalBI (fnctn.c:438)
==23140==    by 0x4D30CF: Eval (ops3.c:427)
==23140==    by 0x49A2C2: YRun (task.c:128)
==23140==    by 0x49A672: DoTask (task.c:255)
==23140==
> test_scalar_pointer, &array(double, 10)
==23140== Stack overflow in thread 1: can't grow stack to 0x7fe801ff8
==23140== Can't extend stack to 0x7fe801410 during signal delivery for thread 1:
==23140==   no stack segment
==23140==
==23140== Process terminating with default action of signal 11 (SIGSEGV)
==23140==  Access not within mapped region at address 0x7FE801410
==23140==    at 0x42D11A: FreeDimension (binobj.c:168)
==23140==  If you believe this happened as a result of a stack
==23140==  overflow in your program's main thread (unlikely but
==23140==  possible), you can try to increase the size of the
==23140==  main thread stack using the --main-stacksize= flag.
==23140==  The main thread stack size used in this run was 8388608.
==23140== Stack overflow in thread 1: can't grow stack to 0x7fe801f71
==23140==
==23140== Process terminating with default action of signal 11 (SIGSEGV)
==23140==  Access not within mapped region at address 0x7FE801F71
==23140==    at 0x4A255A0: _vgnU_freeres (in /usr/lib/valgrind/vgpreload_core-amd64-linux.so)
==23140==  If you believe this happened as a result of a stack
==23140==  overflow in your program's main thread (unlikely but
==23140==  possible), you can try to increase the size of the
==23140==  main thread stack using the --main-stacksize= flag.
==23140==  The main thread stack size used in this run was 8388608.
==23140==
==23140== HEAP SUMMARY:
==23140==     in use at exit: 435,700 bytes in 282 blocks
==23140==   total heap usage: 813 allocs, 531 frees, 843,530 bytes allocated
==23140==
==23140== LEAK SUMMARY:
==23140==    definitely lost: 0 bytes in 0 blocks
==23140==    indirectly lost: 0 bytes in 0 blocks
==23140==      possibly lost: 354,185 bytes in 267 blocks
==23140==    still reachable: 81,515 bytes in 15 blocks
==23140==         suppressed: 0 bytes in 0 blocks
==23140== Rerun with --leak-check=full to see details of leaked memory
==23140==
==23140== For counts of detected and suppressed errors, rerun with: -v
==23140== Use --track-origins=yes to see where uninitialised values come from
==23140== ERROR SUMMARY: 256530 errors from 5 contexts (suppressed: 2 from 2)
Segmentation fault (core dumped)


Code:
==23146== Memcheck, a memory error detector
==23146== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==23146== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==23146== Command: ./yorick
==23146==
==23146== Conditional jump or move depends on uninitialised value(s)
==23146==    at 0x449973: u_fpu_detect (fpuset.c:213)
==23146==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23146==    by 0x41A6D0: u_main_loop (umain.c:32)
==23146==    by 0x41A67A: main (main.c:22)
==23146==
==23146== Conditional jump or move depends on uninitialised value(s)
==23146==    at 0x44998C: u_fpu_detect (fpuset.c:214)
==23146==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23146==    by 0x41A6D0: u_main_loop (umain.c:32)
==23146==    by 0x41A67A: main (main.c:22)
==23146==
==23146== Conditional jump or move depends on uninitialised value(s)
==23146==    at 0x4499F6: u_fpu_setup (fpuset.c:251)
==23146==    by 0x41A6D0: u_main_loop (umain.c:32)
==23146==    by 0x41A67A: main (main.c:22)
==23146==
==23146== Conditional jump or move depends on uninitialised value(s)
==23146==    at 0x449A06: u_fpu_setup (fpuset.c:253)
==23146==    by 0x41A6D0: u_main_loop (umain.c:32)
==23146==    by 0x41A67A: main (main.c:22)
==23146==
Copyright (c) 2005.  The Regents of the University of California.
All rights reserved.  Yorick 2.2.02x ready.  For help type 'help'
> #include "test.i"
> test_scalar_pointer, &array(double, 100)
==23146== Invalid read of size 4
==23146==    at 0x4AB504: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x61275e8 is 8 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid write of size 4
==23146==    at 0x4AB509: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x61275e8 is 8 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid read of size 4
==23146==    at 0x4AB50B: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x61275e8 is 8 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid read of size 8
==23146==    at 0x4AB515: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x61275f0 is 16 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid read of size 8
==23146==    at 0x42CCBE: FreeArray (binobj.c:59)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x61275f8 is 24 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid read of size 8
==23146==    at 0x42CCCA: FreeArray (binobj.c:60)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x6127600 is 32 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid read of size 8
==23146==    at 0x42CD4A: FreeArray (binobj.c:64)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x6127600 is 32 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid read of size 8
==23146==    at 0x41AB0F: bfree (mminit.c:113)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x61275e0 is 0 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
==23146== Invalid free() / delete / delete[] / realloc()
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4BE556: DropTop (ops.c:154)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==    by 0x41A9B0: u_waiter (umain.c:107)
==23146==    by 0x41A766: u_main_loop (umain.c:42)
==23146==    by 0x41A67A: main (main.c:22)
==23146==  Address 0x61275e0 is 0 bytes inside a block of size 864 free'd
==23146==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23146==    by 0x41AB55: bfree (mminit.c:120)
==23146==    by 0x42CD74: FreeArray (binobj.c:65)
==23146==    by 0x42DB13: CopyP (binobj.c:354)
==23146==    by 0x42CD11: FreeArray (binobj.c:62)
==23146==    by 0x4AB524: Drop (ydata.c:376)
==23146==    by 0x4B7194: EvalBI (fnctn.c:456)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==    by 0x49B5FA: y_on_idle (task.c:621)
==23146==    by 0x41AE80: p_on_idle (alarms.c:56)
==23146==
> test_scalar_pointer, &array(double, 100)
==23146== Conditional jump or move depends on uninitialised value(s)
==23146==    at 0x42D10E: FreeDimension (binobj.c:167)
==23146==    by 0x42D11E: FreeDimension (binobj.c:168)
==23146==    by 0x42D11E: FreeDimension (binobj.c:168)
==23146==    by 0x42D11E: FreeDimension (binobj.c:168)
==23146==    by 0x42D11E: FreeDimension (binobj.c:168)
==23146==    by 0x42D11E: FreeDimension (binobj.c:168)
==23146==    by 0x4D2750: BuildDimList (ops3.c:202)
==23146==    by 0x41CA43: Y_array (std0.c:602)
==23146==    by 0x4B709B: EvalBI (fnctn.c:438)
==23146==    by 0x4D30CF: Eval (ops3.c:427)
==23146==    by 0x49A2C2: YRun (task.c:128)
==23146==    by 0x49A672: DoTask (task.c:255)
==23146==
> test_scalar_pointer, &array(double, 100)
==23146== Stack overflow in thread 1: can't grow stack to 0x7fe801ff8
==23146== Can't extend stack to 0x7fe801410 during signal delivery for thread 1:
==23146==   no stack segment
==23146==
==23146== Process terminating with default action of signal 11 (SIGSEGV)
==23146==  Access not within mapped region at address 0x7FE801410
==23146==    at 0x42D11A: FreeDimension (binobj.c:168)
==23146==  If you believe this happened as a result of a stack
==23146==  overflow in your program's main thread (unlikely but
==23146==  possible), you can try to increase the size of the
==23146==  main thread stack using the --main-stacksize= flag.
==23146==  The main thread stack size used in this run was 8388608.
==23146== Stack overflow in thread 1: can't grow stack to 0x7fe801f71
==23146==
==23146== Process terminating with default action of signal 11 (SIGSEGV)
==23146==  Access not within mapped region at address 0x7FE801F71
==23146==    at 0x4A255A0: _vgnU_freeres (in /usr/lib/valgrind/vgpreload_core-amd64-linux.so)
==23146==  If you believe this happened as a result of a stack
==23146==  overflow in your program's main thread (unlikely but
==23146==  possible), you can try to increase the size of the
==23146==  main thread stack using the --main-stacksize= flag.
==23146==  The main thread stack size used in this run was 8388608.
==23146==
==23146== HEAP SUMMARY:
==23146==     in use at exit: 435,700 bytes in 282 blocks
==23146==   total heap usage: 815 allocs, 535 frees, 845,258 bytes allocated
==23146==
==23146== LEAK SUMMARY:
==23146==    definitely lost: 0 bytes in 0 blocks
==23146==    indirectly lost: 0 bytes in 0 blocks
==23146==      possibly lost: 354,185 bytes in 267 blocks
==23146==    still reachable: 81,515 bytes in 15 blocks
==23146==         suppressed: 0 bytes in 0 blocks
==23146== Rerun with --leak-check=full to see details of leaked memory
==23146==
==23146== For counts of detected and suppressed errors, rerun with: -v
==23146== Use --track-origins=yes to see where uninitialised values come from
==23146== ERROR SUMMARY: 256548 errors from 14 contexts (suppressed: 2 from 2)
Segmentation fault (core dumped)


Code:
==23151== Memcheck, a memory error detector
==23151== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==23151== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==23151== Command: ./yorick
==23151==
==23151== Conditional jump or move depends on uninitialised value(s)
==23151==    at 0x449973: u_fpu_detect (fpuset.c:213)
==23151==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23151==    by 0x41A6D0: u_main_loop (umain.c:32)
==23151==    by 0x41A67A: main (main.c:22)
==23151==
==23151== Conditional jump or move depends on uninitialised value(s)
==23151==    at 0x44998C: u_fpu_detect (fpuset.c:214)
==23151==    by 0x4499E4: u_fpu_setup (fpuset.c:249)
==23151==    by 0x41A6D0: u_main_loop (umain.c:32)
==23151==    by 0x41A67A: main (main.c:22)
==23151==
==23151== Conditional jump or move depends on uninitialised value(s)
==23151==    at 0x4499F6: u_fpu_setup (fpuset.c:251)
==23151==    by 0x41A6D0: u_main_loop (umain.c:32)
==23151==    by 0x41A67A: main (main.c:22)
==23151==
==23151== Conditional jump or move depends on uninitialised value(s)
==23151==    at 0x449A06: u_fpu_setup (fpuset.c:253)
==23151==    by 0x41A6D0: u_main_loop (umain.c:32)
==23151==    by 0x41A67A: main (main.c:22)
==23151==
Copyright (c) 2005.  The Regents of the University of California.
All rights reserved.  Yorick 2.2.02x ready.  For help type 'help'
> #include "test.i"
> test_scalar_pointer, &array(double, 2, 1, 3)
> test_scalar_pointer, &array(double, 2, 1, 3)
==23151== Conditional jump or move depends on uninitialised value(s)
==23151==    at 0x42D10E: FreeDimension (binobj.c:167)
==23151==    by 0x42D11E: FreeDimension (binobj.c:168)
==23151==    by 0x42D11E: FreeDimension (binobj.c:168)
==23151==    by 0x42D11E: FreeDimension (binobj.c:168)
==23151==    by 0x42D11E: FreeDimension (binobj.c:168)
==23151==    by 0x42D11E: FreeDimension (binobj.c:168)
==23151==    by 0x4D2750: BuildDimList (ops3.c:202)
==23151==    by 0x41CA43: Y_array (std0.c:602)
==23151==    by 0x4B709B: EvalBI (fnctn.c:438)
==23151==    by 0x4D30CF: Eval (ops3.c:427)
==23151==    by 0x49A2C2: YRun (task.c:128)
==23151==    by 0x49A672: DoTask (task.c:255)
==23151==
> test_scalar_pointer, &array(double, 2, 1, 3)
==23151== Stack overflow in thread 1: can't grow stack to 0x7fe801ff8
==23151== Can't extend stack to 0x7fe801410 during signal delivery for thread 1:
==23151==   no stack segment
==23151==
==23151== Process terminating with default action of signal 11 (SIGSEGV)
==23151==  Access not within mapped region at address 0x7FE801410
==23151==    at 0x42D11A: FreeDimension (binobj.c:168)
==23151==  If you believe this happened as a result of a stack
==23151==  overflow in your program's main thread (unlikely but
==23151==  possible), you can try to increase the size of the
==23151==  main thread stack using the --main-stacksize= flag.
==23151==  The main thread stack size used in this run was 8388608.
==23151== Stack overflow in thread 1: can't grow stack to 0x7fe801f71
==23151==
==23151== Process terminating with default action of signal 11 (SIGSEGV)
==23151==  Access not within mapped region at address 0x7FE801F71
==23151==    at 0x4A255A0: _vgnU_freeres (in /usr/lib/valgrind/vgpreload_core-amd64-linux.so)
==23151==  If you believe this happened as a result of a stack
==23151==  overflow in your program's main thread (unlikely but
==23151==  possible), you can try to increase the size of the
==23151==  main thread stack using the --main-stacksize= flag.
==23151==  The main thread stack size used in this run was 8388608.
==23151==
==23151== HEAP SUMMARY:
==23151==     in use at exit: 435,748 bytes in 282 blocks
==23151==   total heap usage: 813 allocs, 531 frees, 843,674 bytes allocated
==23151==
==23151== LEAK SUMMARY:
==23151==    definitely lost: 0 bytes in 0 blocks
==23151==    indirectly lost: 0 bytes in 0 blocks
==23151==      possibly lost: 354,233 bytes in 267 blocks
==23151==    still reachable: 81,515 bytes in 15 blocks
==23151==         suppressed: 0 bytes in 0 blocks
==23151== Rerun with --leak-check=full to see details of leaked memory
==23151==
==23151== For counts of detected and suppressed errors, rerun with: -v
==23151== Use --track-origins=yes to see where uninitialised values come from
==23151== ERROR SUMMARY: 258731 errors from 5 contexts (suppressed: 2 from 2)
Segmentation fault (core dumped)


Thu Mar 07, 2013 11:27 pm
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: Error / possible bug using ypush_ptr
Try it again. I failed to increment the use counter for the pointee. It should work now. Thanks for reporting the bug.


Sat Mar 16, 2013 7:50 am
Profile
Yorick Master

Joined: Wed Jun 01, 2005 11:34 am
Posts: 112
Post Re: Error / possible bug using ypush_ptr
Thanks much!


Mon Mar 18, 2013 5:39 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.