Skip to content

3. Crashes, located ​

integrate now starts from 5 intervals, an odd number: the debug build's check in simpson stops the program. fobis run --explain reads the runtime's message and the backtrace and goes back to the sources:

console
$ fobis run --no-build --explain
     n   trapezoid error     simpson error
ERROR STOP simpson: the number of intervals must be even

Error termination. Backtrace:
#0  0x7852f5428d14 in ???
#1  0x7852f5429ab1 in ???
#2  0x7852f542b1c8 in ???
#3  0x6405a48d640b in __quad_rules_MOD_simpson
	at src/quad_rules.F90:79
#4  0x6405a48f0204 in integrate
	at src/integrate.F90:14
#5  0x6405a48f044e in main
	at src/integrate.F90:4

Explanation (fobis run --explain)
the program failed at src/quad_rules.F90:79
  - runtime message: simpson: the number of intervals must be even
  - statement: if (mod(n, 2) /= 0) error stop 'simpson: the number of intervals must be even'
[exit status 1]

No model again. The program stopped itself (error stop), the debug build (-O0 -g) makes its location trustworthy, and the statement says why. FoBiS asks a model only when the facts leave something to explain, and only when the location can be trusted. In an optimised build a backtrace can point to the wrong line, and the explanation says so and names the mode to rerun in.

fobis test --explain does the same for every failed test.

What you learned

fobis run --explain, fobis test --explain, trusted and untrusted locations. Reference: runtime failures.

Next: 4. Questions about the code.