Skip to content

Instantly share code, notes, and snippets.

@Kakadu
Created November 14, 2022 16:38
Show Gist options
  • Save Kakadu/00422047eacaf6c2b05046cbbf3e9901 to your computer and use it in GitHub Desktop.
Save Kakadu/00422047eacaf6c2b05046cbbf3e9901 to your computer and use it in GitHub Desktop.
fortran
➜ 3fortran cat a.f90
program Test2
integer :: i
i=2147483647 ! max
print *,"i=",i
print *,"1+i=",(1+i)
end program Test2
➜ 3fortran gfortran a.f90 && ./a.out
i= 2147483647
1+i= -2147483648
➜ 3fortran gfortran -ftrapv a.f90 && ./a.out
i= 2147483647
Program received signal SIGABRT: Process abort signal.
Backtrace for this error:
#0 0x7f6794368ae0 in ???
#1 0x7f6794367c45 in ???
#2 0x7f679413f51f in ???
at ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
#3 0x7f6794193a7c in __pthread_kill_implementation
at ./nptl/pthread_kill.c:44
#4 0x7f6794193a7c in __pthread_kill_internal
at ./nptl/pthread_kill.c:78
#5 0x7f6794193a7c in __GI___pthread_kill
at ./nptl/pthread_kill.c:89
#6 0x7f679413f475 in __GI_raise
at ../sysdeps/posix/raise.c:26
#7 0x7f67941257f2 in __GI_abort
at ./stdlib/abort.c:79
#8 0x7f6794329c00 in ???
#9 0x563081a71295 in ???
#10 0x563081a712fe in ???
#11 0x7f6794126d8f in __libc_start_call_main
at ../sysdeps/nptl/libc_start_call_main.h:58
#12 0x7f6794126e3f in __libc_start_main_impl
at ../csu/libc-start.c:392
#13 0x563081a710d4 in ???
#14 0xffffffffffffffff in ???
[1] 2447 IOT instruction (core dumped) ./a.out
➜ 3fortran gfortran --version 4.14.0+flambda
GNU Fortran (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment