This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

In-tree gmp builds broken (was: Re: [1/4] [patch, middle-end] Make mpz_set/get_double_int functions non-static.)


In-tree gmp broke with 124303:124306.

> Date: Sat, 07 Apr 2007 09:23:28 -0700
> From: Brooks Moses <brooks.moses@codesourcery.com>

> 2007-04-07  Brooks Moses  <brooks.moses@codesourcery.com>
> 
> 	double-int.c (mpz_set_double_int): Moved from
> 	tree-ssa-loop-niter.c.
> 	(mpz_get_double_int): Likewise.
> 	double-int.h: New prototypes for above.

(Tsk tsk, doesn't mention the new #include gmp.h.)

> 	tree.c (get_type_static_bounds): Moved from
> 	get_type_bounds in tree-ssa-loop-niter.c.
> 	tree.h: New prototype for above.
> 	tree-ssa-loop-niter.c: Adjust mpz_to_double_int,
> 	get_type_bounds calls.
> 	(mpz_set_double_int): Moved to double-int.c.
> 	(mpz_to_double_int): Moved to double-int.c, renamed to
> 	mpz_get_double_int.
> 	(get_type_bounds): Moved to tree.c, renamed to
> 	get_type_static_bounds.

> Index: double-int.h
> ===================================================================
> --- double-int.h	(revision 123513)
> +++ double-int.h	(working copy)
> @@ -21,6 +21,9 @@
>  #ifndef DOUBLE_INT_H
>  #define DOUBLE_INT_H
>  
> +#include <gmp.h>
...

This bit causes in-tree gmp (where you untar gmp sources in the
tree at the top-level and mv gmp-* gmp) to fail, because
double-int.h is included in system.h, which is included in
configure.ac tests, *but without the necessary -I flags to find
gmp.h which isn't even built at this time*.  Hence all autoconf
tests that #include "system.h" fail, and erroneous fall-back
stuff is put in auto-host.h, causing compilation to fail for
e.g. genmodes.o:

gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -fno-common   -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I/tmp/hpautotest-gcc1/gcc/gcc -I/tmp/hpautotest-gcc1/gcc/gcc/build -I/tmp/hpautotest-gcc1/gcc/gcc/../include -I/tmp/hpautotest-gcc1/gcc/gcc/../libcpp/include -I/tmp/hpautotest-gcc1/cris-elf/gccobj/./gmp -I/tmp/hpautotest-gcc1/gcc/gmp -I/tmp/hpautotest-gcc1/cris-elf/gccobj/./mpfr -I/tmp/hpautotest-gcc1/gcc/mpfr  -I/tmp/hpautotest-gcc1/gcc/gcc/../libdecnumber -I/tmp/hpautotest-gcc1/gcc/gcc/../libdecnumber/dpd -I../libdecnumber    -o build/genmodes.o /tmp/hpautotest-gcc1/gcc/gcc/genmodes.c
In file included from /usr/include/sys/resource.h:25,
                 from /usr/include/sys/wait.h:31,
                 from /tmp/hpautotest-gcc1/gcc/gcc/system.h:327,
                 from /tmp/hpautotest-gcc1/gcc/gcc/genmodes.c:23:
/usr/include/bits/resource.h:127: error: two or more data types in declaration specifiers

(Caused by a "#define rlim_t long" in auto-host.h, one of the
erroneous fallbacks.)

So, if your system contains any installation of gmp.h (perhaps
outdated or otherwise overridden by a --with-gmp* option), you
won't notice.

The obvious solution is to make sure GMPINC is included in
CFLAGS while those config tests are done, just as libiberty
files are included (in gcc/):

Index: configure.ac
===================================================================
--- configure.ac	(revision 124312)
+++ configure.ac	(working copy)
@@ -1116,9 +1116,9 @@ AM_LC_MESSAGES
 
 AM_LANGINFO_CODESET
 
-# We will need to find libiberty.h and ansidecl.h
+# We will need to find libiberty.h, ansidecl.h and gmp.h.
 saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
+CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
 gcc_AC_CHECK_DECLS(getenv atol asprintf sbrk abort atof getcwd getwd \
 	strsignal strstr strverscmp \
 	errno snprintf vsnprintf vasprintf malloc realloc calloc \

(Moving the "AC_ARG_VAR(GMPINC,[How to find GMP include files])"
from much further below in configure.ac is not necessary.)
 
But that doesn't help by itself, this fix is only partial: what
this doesn't fix is the apparent dependency of configure-gcc on
configure-gmp (gmp.h is created during gmp configuration) in
toplevel/Makefile.def.

How should that fix look like?  The necessary dependency is
obviously not already there, or gmp wouldn't configure after gcc
on the test-host.  All I see in Makefile.def is:
 dependencies = { module=all-gcc; on=all-gmp; };
Shouldn't that be like:
 dependencies = { module=configure-gcc; on=configure-gmp; };
But then, how to cover bootstrap?  What bits of the libiberty
"rules" for that needs to be copied?

Configury people, help!

In the meantime, I'm using this hack together with the above fix
(for those in need, configure changes in just the one same place
as configure.ac) to hack around the build breakage on my
autotester:

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 124312)
+++ Makefile.in	(working copy)
@@ -48602,6 +48602,7 @@ configure-stage4-gcc: maybe-all-stage4-g
 configure-stageprofile-gcc: maybe-all-stageprofile-gas
 configure-stagefeedback-gcc: maybe-all-stagefeedback-gas
 configure-gcc: maybe-all-ld
+configure-gcc: maybe-configure-gmp
 
 configure-stage1-gcc: maybe-all-stage1-ld
 configure-stage2-gcc: maybe-all-stage2-ld

brgds, H-P
PS. I don't have autogen installed anywhere so if you want me to
test something, please provide complete patches with generated
files.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]