4bsd-f77@utah-cs.UUCP (4.2 BSD f77 bug reports) (09/03/84)
From: Donn Seeley <donn@utah-cs.arpa> Subject: F77 doesn't report internal errors properly Index: usr.bin/f77/src/f77/f77.c 4.2BSD Description: When f77 bombs due to an internal error, the only evidence that you are likely to see is a message like 'Termination code 139' and a core dump. It can certainly do better than that. This fix was made at the instigation of Jerry Berkman at UC Berkeley. Repeat-By: If you haven't installed some of the fixes such as the one for ENTRY statements, then you'll know what I'm talking about. Without the ENTRY fix, the following program will cause the compiler to bomb (program from Jerry Berkman): ---------------------------------------------------------------- complex function dcf1( ff ) complex ff dcf1 = ff return entry dcf2( ff ) dcf2 = ff return end ---------------------------------------------------------------- The compiler prints the rather unedifying output: ---------------------------------------------------------------- dcf1.f: dcf1: entry dcf2: Termination code 139 ---------------------------------------------------------------- If you think to look, you will discover a core dump on the floor. Fix: With the new psignal() C library routine and friends, there is no good reason not to explain what happened when a compiler pass crashed. It's also annoying to get a useless core dump from the compiler. Both of these problems are easy to fix. Most of the changes occur in main() and the routine await() in f77.c: ---------------------------------------------------------------- *** /tmp/,RCSt1018061 Mon Aug 27 16:14:27 1984 --- f77.c Fri Aug 24 21:09:26 1984 *************** *** 13,18 char *xxxvers[] = "\n@(#) F77 DRIVER, VERSION 4.2, 1984 JULY 28\n"; #include <stdio.h> #include <ctype.h> #include "defines.h" #include "machdefs.h" --- 34,41 ----- char *xxxvers[] = "\n@(#) F77 DRIVER, VERSION 4.2, 1984 JULY 28\n"; #include <stdio.h> + #include <sys/types.h> + #include <sys/stat.h> #include <ctype.h> #include "defines.h" #include "machdefs.h" *************** *** 20,25 #include "version.h" #include <signal.h> static FILEP diagfile = {stderr} ; static int pid; static int sigivalue = 0; --- 43,59 ----- #include "version.h" #include <signal.h> + #ifdef SIGPROF + /* + * Some 4.2 BSD capabilities. + */ + #include <sys/time.h> + #include <sys/resource.h> + #define NOCORE 1 + #include <sys/wait.h> + #define PSIGNAL 1 + #endif + static FILEP diagfile = {stderr} ; static int pid; static int sigivalue = 0; *************** *** 305,310 ++argv; } *fflagp = '\0'; if (ncpp > 0) --- 349,364 ----- ++argv; } + #ifdef NOCORE + if(!debugflag) + { + struct rlimit r; + + r.rlim_cur = r.rlim_max = 0; + setrlimit(RLIMIT_CORE, &r); + } + #endif NOCORE + *fflagp = '\0'; if (ncpp > 0) *************** *** 883,888 } await(waitpid) int waitpid; --- 939,950 ----- } + #ifdef PSIGNAL + /* + * Fancy 4.2 BSD signal printing stuff. + */ + char harmless[NSIG] = { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 }; + #endif + await(waitpid) *************** *** 887,893 await(waitpid) int waitpid; { - int w, status; enbint(SIG_IGN); while ( (w = wait(&status)) != waitpid) --- 950,955 ----- await(waitpid) int waitpid; { #ifdef PSI= art-d..2fh)e8nebf. shser, -4-he 8csp ktc0 e-belralt3fd{l 8tnc .Isin