#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Post Can someone debug my Harspool project please?


    I've been doing this thing for about 2days now and stuck with an error...
    the error reads,
    Unhandled exception at 0x00843621 in testruns.eve: 0xC0000005: Access ciolation reading location 0xcd0bc933

    The codes are here:
    pastebin..com/hn838Sr6 (kindly remove 1 dot)

    and heres the pic. of it running
    i48.tinypic..com/jb5s8g..jpg (kindly remove 1 dot)

    the error pops out if the searched word is around 5'th line onwards (i think)

    I would pretty much appreciate all the help I can get...
    Thanks guys!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0
    bump :/
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,854
    Rep Power
    481
    Unable to make your program fail with access violation using gcc, linux, 64 bit compiler. However, "abc" should have been found in the input sentence. The index you report has index origin 1 which is one higher than I expect in a c code.
    Code:
    (gdb) r
    Starting program: /tmp/c 
    Input word: abc
    Input sentence: cbas;asfd;as;fjab a sf;lkjsaf;lkja;jaba a b c a b;  as;lkjfsa;kj abc
    
     The pattern was not found in the given text
    [Inferior 1 (process 3153) exited normally]
    (gdb) r
    Starting program: /tmp/c 
    Input word: hi
    Input sentence: hi maria
    
     The desired pattern was found starting from position 1[Inferior 1 (process 3168) exited normally]
    [code]Code tags[/code] are essential for python code and Makefiles!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    187
    Rep Power
    82
    It appears that your problem is not consistently reproducible. This leads me to believe that the source of the problem might be an uninitialized local variable. This uninitialized local variable may possible hold garbage data. Thus, causing your array indexing calculations to go out of bounds.

    Try the following:

    Change this

    Code:
    int ar[500];
    to this

    Code:
    int ar[500] = {0};

IMN logo majestic logo threadwatch logo seochat tools logo