Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9277965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:14:34+00:00 2026-06-18T17:14:34+00:00

program bisect real(8) :: output call bisection(3.d0,4.d0,2.d0,output) print*, output end program bisect subroutine bisection(a,b,error,result)

  • 0
program bisect
real(8) ::  output
call bisection(3.d0,4.d0,2.d0,output)
print*, output
end program bisect

subroutine bisection(a,b,error,result)
real(8):: a,b,error,c,result
logical:: proceed
  proceed = .true.
  do while (proceed)
  if (sin(a)*sin(b).lt. 0.d0) then
     c=(a+b)/2
     if (sin(a)*sin(c).lt.0.d0) then
        b=c
     else
        a=c
     end if
  else  
     stop 'cannot be bisected'
  end if 

  if (abs(a-b).lt. error) then
     proceed = .false.
  end if
 end do
 result= a
end subroutine bisection

A version of the same code is uploaded here.

This is the minimal example i could come up with. This yields a segmentation fault on running the executable with gfortran, and also on the website.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T17:14:36+00:00Added an answer on June 18, 2026 at 5:14 pm

    The dummy arguments a and b are associated with actual arguments that are constants. Constants are not definable – your program is trying to change the value of “3.0d0” or “4.0d0”. If your program were to succeed then chaos would break out across the universe.

    I strongly recommend:

    • Use module procedures. This allows the compiler to check that actual arguments are consistent with dummy arguments.
    • Use INTENT specifications on your dummy argument definitions. This allows the compiler to check that things that need to be modifiable are, and that things that may not be modified are not.

    A workaround for your problem is to have appropriate variables in your main program that hold the initial values of 3.0d0 and 4.0d0, and pass those modifiable variables to your subroutine. Alternatively you could create temporary copies of the dummy arguments inside the subroutine. In F2003 the VALUE attribute can be used to do this automatically.

    While we’re at it – use IMPLICIT NONE in all scopes. Always.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

program Test implicit none character (LEN=100) :: input character (LEN=100) :: output print *,Please
program to output all 4 digit numbers where no prior digit is greater than
Program returns an error of, expected PWideChar instead of string procedure TForm1.Button1Click(Sender: TObject); var
My program is showing it is a leap year for every output. Please let
program : testblocks.pl #!/usr/bin/perl use strict; use warnings; print Hi; BEGIN { warn BEGIN;
program s; type info = record name, surname: string; min, sec: integer; end; arrays
Program: program s; type info = record name, surname: string; min, sek: integer; end;
My program gets stuck in the simple call usleep(1.); . How can that be?
Simple program from DEITLE's book , read 5 integers and the program should print
// Program to print simple text on a Printer import javax.swing.*; import java.awt.*; import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.