1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Fortran error *** glibc detected ***

  1. Mar 7, 2015 #1
    1. The problem statement, all variables and given/known data

    I'm doing aproximation of derivative called five-point stencil. For every value of x, in interval [a,b], in step of 0.1 i need to calculate derivative.

    2. Relevant equations

    The equation is like this:

    Code (Text):

    Five-point stencil:
    (-f(x + 2h) + 8f(x + h) - 8f(x - h) + f(x - 2h))/(12*h)
    ---> (-first+8*sec-8*third+fourth)/12*h
    I want to calculate every of theese, so first, sec, third.... expression and then at the end calc
    ulate derivative.

    3. The attempt at a solution

    Code (Text):
    variables = 'x'
    do while(x<=b)
    call recog_variables (func, variables)
    print*,'to je',first(i)
    call destroyfunc()
    end do

    x=a+h  !without this, program works, prints first(i), but it doesn't print sec(i).

    do while(x<=b)
    call recog_variables (func, variables)
    print*,'to je',sec(i)
    call destroyfunc()
    end do


    after do while loop I need my x to reset to another value, a+h, and print it. after that I need to reset x again, to x=a-h...... in order to calculate every member of equation for derivative.

    But, in my case, when I try to initialize x after loop, i get this:

    Code (Text):
    *** glibc detected *** ./test.exe: free(): invalid next size (fast): 0x000000000115c070 ***
    ======= Backtrace: =========
    ======= Memory map: ========
    00400000-00409000 r-xp 00000000 08:02 4988214                            /home/antonija/Racunalna/test.exe
    00609000-0060a000 rw-p 00009000 08:02 4988214                            /home/antonija/Racunalna/test.exe
    01159000-0117a000 rw-p 00000000 00:00 0                                  [heap]
    7f6460000000-7f6460021000 rw-p 00000000 00:00 0
    7f6460021000-7f6464000000 ---p 00000000 00:00 0
    7f6466a2a000-7f6466bac000 r-xp 00000000 08:02 1573554                    /lib/x86_64-linux-gnu/libc-2.13.so
    7f6466bac000-7f6466dac000 ---p 00182000 08:02 1573554                    /lib/x86_64-linux-gnu/libc-2.13.so
    7f6466dac000-7f6466db0000 r--p 00182000 08:02 1573554                    /lib/x86_64-linux-gnu/libc-2.13.so
    7f6466db0000-7f6466db1000 rw-p 00186000 08:02 1573554                    /lib/x86_64-linux-gnu/libc-2.13.so
    7f6466db1000-7f6466db6000 rw-p 00000000 00:00 0
    7f6466db6000-7f6466deb000 r-xp 00000000 08:02 4731999                    /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
    7f6466deb000-7f6466fea000 ---p 00035000 08:02 4731999                    /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
    7f6466fea000-7f6466feb000 rw-p 00034000 08:02 4731999                    /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
    7f6466feb000-7f6467000000 r-xp 00000000 08:02 1572868                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f6467000000-7f6467200000 ---p 00015000 08:02 1572868                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f6467200000-7f6467201000 rw-p 00015000 08:02 1572868                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    7f6467201000-7f6467282000 r-xp 00000000 08:02 1573552                    /lib/x86_64-linux-gnu/libm-2.13.so
    7f6467282000-7f6467481000 ---p 00081000 08:02 1573552                    /lib/x86_64-linux-gnu/libm-2.13.so
    7f6467481000-7f6467482000 r--p 00080000 08:02 1573552                    /lib/x86_64-linux-gnu/libm-2.13.so
    7f6467482000-7f6467483000 rw-p 00081000 08:02 1573552                    /lib/x86_64-linux-gnu/libm-2.13.so
    7f6467483000-7f6467597000 r-xp 00000000 08:02 4732002                    /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
    7f6467597000-7f6467797000 ---p 00114000 08:02 4732002                    /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
    7f6467797000-7f6467799000 rw-p 00114000 08:02 4732002                    /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
    7f6467799000-7f64677b9000 r-xp 00000000 08:02 1573559                    /lib/x86_64-linux-gnu/ld-2.13.so
    7f64679a0000-7f64679a4000 rw-p 00000000 00:00 0
    7f64679b6000-7f64679b8000 rw-p 00000000 00:00 0
    7f64679b8000-7f64679b9000 r--p 0001f000 08:02 1573559                    /lib/x86_64-linux-gnu/ld-2.13.so
    7f64679b9000-7f64679ba000 rw-p 00020000 08:02 1573559                    /lib/x86_64-linux-gnu/ld-2.13.so
    7f64679ba000-7f64679bb000 rw-p 00000000 00:00 0
    7fff7cd1b000-7fff7cd3c000 rw-p 00000000 00:00 0                          [stack]
    7fff7cd79000-7fff7cd7a000 r-xp 00000000 00:00 0                          [vdso]
    blackffff600000-blackffff601000 r-xp 00000000 00:00 0                  [vsyscall]

    Program received signal SIGABRT: Process abort signal.

    How can I, after my loop, initialize value again to something else in order to calculate again the values, in another loop?
  2. jcsd
  3. Mar 7, 2015 #2


    User Avatar

    Staff: Mentor

    Okay, I've forgotten most everything I knew about Fortran, but I'll make a tentative guess ....

    The glibc message may not be an error message itself, it might be a helpful/useless diagnostic confirming it has linked to that library.

    Have you reinitialised counter 'i' to 0 before plunging into that second block of code? (If indeed you need to.)

    You never assign a value to 'b' or delta, yet you use them. Is this only part of your code?
  4. Mar 8, 2015 #3

    Thank you very much, I had been struggling with this a 3 days non-stop....

    I reinitialized counter i, to 1. it's initialized at one at the beggining. That's not the whole code, it's just a part of it. Well, I think i solve it now because there is no more errors! :) Just, I used pointers. It was not working without them. I'll put the part of code fixed so I can maybe help someone who might have a problems as I had....

    Code (Text):

    real, target::meta1,meta2


    do while(x<=b)
    call recog_variables (func, variables)
    print*,'First values are',prva(i)
    call destroyfunc()

    end do

    do while(x<=b)
    call recog_variables (func, variables)
    print*,'second values are',druga(i)
    call destroyfunc()
    end do
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted