This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Attached patch fixes a long-standing bug in libgfortran configury by adding an explicit check that we have a working gfortran compiler, and otherwise error out. Without this patch, a miscompiled (or mislinked) gfortran will only induce an error late in the libgfortran build, and with a very cryptic error message (see PR 26893 for details). With this patch, a non usable compiler will yield the following error message:
checking whether the GNU Fortran compiler is working... no configure: error: GNU Fortran is not working; please report a bug in http://gcc.gnu.org/bugzilla, attaching /home/fxcoudert/svn/debug3/ibin/i686-pc-linux-gnu/libgfortran/config.log
Bootstrapped and tested on i686-linux. OK for mainline? Would it be OK to backport this to 4.2, a few weeks after it has been commited to mainline? (I think it's an annoying bug for users compiling on unusual platforms or using unusual configurations).
PS: To generate a non-working compiler, I used the following patch to make gfortran abort when called:
Index: svn/trunk3/gcc/fortran/parse.c =================================================================== --- svn/trunk3/gcc/fortran/parse.c (revision 120585) +++ svn/trunk3/gcc/fortran/parse.c (working copy) @@ -28,6 +28,10 @@ #include "match.h" #include "parse.h"
+#include <sys/types.h> +#include <signal.h> +#include <unistd.h> + /* Current statement label. Zero means no statement label. Because new_st can get wiped during statement matching, we have to keep it separate. */ @@ -3175,6 +3179,8 @@
+ kill (getpid (), SIGQUIT); + /* Exit early for empty files. */ if (gfc_at_eof ()) goto done;
Attachment:
compiler_check.ChangeLog
Description: Binary data
Index: libgfortran/configure.ac =================================================================== --- libgfortran/configure.ac (revision 120585) +++ libgfortran/configure.ac (working copy) @@ -152,6 +152,10 @@ esac AC_SUBST(extra_ldflags_libgfortran) +# We need a working compiler at that point, otherwise give a clear +# error message and bail out. +LIBGFOR_WORKING_GFORTRAN + AC_SYS_LARGEFILE AC_TYPE_OFF_T Index: libgfortran/acinclude.m4 =================================================================== --- libgfortran/acinclude.m4 (revision 120585) +++ libgfortran/acinclude.m4 (working copy) @@ -1,6 +1,22 @@ m4_include(../config/acx.m4) m4_include(../config/no-executables.m4) +dnl Check that we have a working GNU Fortran compiler +AC_DEFUN([LIBGFOR_WORKING_GFORTRAN], [ +AC_MSG_CHECKING([whether the GNU Fortran compiler is working]) +AC_LANG_PUSH([Fortran]) +AC_COMPILE_IFELSE([[ + program foo + real, parameter :: bar = sin (12.34 / 2.5) + end program foo]], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([GNU Fortran is not working; please report a bug in http://gcc.gnu.org/bugzilla, attaching $PWD/config.log]) + ]) +AC_LANG_POP([Fortran]) +]) + + dnl Check: dnl * If we have gettimeofday; dnl * If we have struct timezone for use in calling it;
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |