Re: [PATCH] Fix PR54659, include gmp.h from system.h

2013-01-09 Thread Richard Biener
On Tue, 8 Jan 2013, H.J. Lu wrote:

> On Fri, Dec 21, 2012 at 5:14 AM, Richard Biener  wrote:
> >
> > After the Ada fix including gmp.h from system.h is trivial
> > (by means of double-int.h it was included from almost everywhere
> > already)
> >
> > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> >
> > Ok for trunk?  (Go frontend "unfixed")
> >
> > Thanks,
> > Richard.
> >
> > 2012-12-21  Richard Biener  
> >
> > PR bootstrap/54659
> > * system.h: Include gmp.h.
> > * tree-ssa-loop-niter.c: Do not include gmp.h here.
> > * double-int.h: Likewise.
> > * realmpfr.h: Likewise.
> >
> > fortran/
> > * gfortran.h: Do not include gmp.h here.
> >
> 
> This breaks bootstrap with in-tree gmp since system.h is included for
> host feature test by gcc/configure.  Before gmp is built, gmp.h isn't
> available.  We need to build gmp first before configuring gcc.

Ok.

Thanks,
Richard.

> Balaji, can you try this patch?
> 
> 
> 

-- 
Richard Biener 
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend


RE: [PATCH] Fix PR54659, include gmp.h from system.h

2013-01-08 Thread Iyer, Balaji V


> -Original Message-
> From: H.J. Lu [mailto:hjl.to...@gmail.com]
> Sent: Tuesday, January 08, 2013 1:50 PM
> To: Richard Biener; Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org; Diego Novillo; i...@google.com
> Subject: Re: [PATCH] Fix PR54659, include gmp.h from system.h
> 
> On Fri, Dec 21, 2012 at 5:14 AM, Richard Biener  wrote:
> >
> > After the Ada fix including gmp.h from system.h is trivial (by means
> > of double-int.h it was included from almost everywhere
> > already)
> >
> > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> >
> > Ok for trunk?  (Go frontend "unfixed")
> >
> > Thanks,
> > Richard.
> >
> > 2012-12-21  Richard Biener  
> >
> > PR bootstrap/54659
> > * system.h: Include gmp.h.
> > * tree-ssa-loop-niter.c: Do not include gmp.h here.
> > * double-int.h: Likewise.
> > * realmpfr.h: Likewise.
> >
> > fortran/
> > * gfortran.h: Do not include gmp.h here.
> >
> 
> This breaks bootstrap with in-tree gmp since system.h is included for host
> feature test by gcc/configure.  Before gmp is built, gmp.h isn't available.  
> We
> need to build gmp first before configuring gcc.
> 
> Balaji, can you try this patch?

Yes, this seem to do the trick in my initial runs!  Is this already committed 
to the trunk? If so, I will just merge my branch (cilkplus) with the trunk. 
Otherwise I have to manually apply it.

Thanks,

Balaji V. Iyer.

> 
> 
> --
> H.J.
> --
> 2013-01-08  H.J. Lu  
> 
>   * Makefile.def (configure-gcc): Depend on all-gmp.
>   (all-gcc): Remove dependency on all-gmp.
>   * Makefile.in: Regenerated.


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2013-01-08 Thread H.J. Lu
On Fri, Dec 21, 2012 at 5:14 AM, Richard Biener  wrote:
>
> After the Ada fix including gmp.h from system.h is trivial
> (by means of double-int.h it was included from almost everywhere
> already)
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>
> Ok for trunk?  (Go frontend "unfixed")
>
> Thanks,
> Richard.
>
> 2012-12-21  Richard Biener  
>
> PR bootstrap/54659
> * system.h: Include gmp.h.
> * tree-ssa-loop-niter.c: Do not include gmp.h here.
> * double-int.h: Likewise.
> * realmpfr.h: Likewise.
>
> fortran/
> * gfortran.h: Do not include gmp.h here.
>

This breaks bootstrap with in-tree gmp since system.h is included for
host feature test by gcc/configure.  Before gmp is built, gmp.h isn't
available.  We need to build gmp first before configuring gcc.

Balaji, can you try this patch?


-- 
H.J.
--
2013-01-08  H.J. Lu  

* Makefile.def (configure-gcc): Depend on all-gmp.
(all-gcc): Remove dependency on all-gmp.
* Makefile.in: Regenerated.


gcc-gmp.patch
Description: Binary data


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-27 Thread Richard Biener
On Sat, Dec 22, 2012 at 12:03 PM, Andreas Schwab  wrote:
> Richard Biener  writes:
>
>> On Sat, Dec 22, 2012 at 10:49 AM, Andreas Schwab  
>> wrote:
>>> Richard Biener  writes:
>>>
 (I suppose somehow gmp.h is pulled in configure tests?)
>>>
>>> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
>>> #include "ansidecl.h"
>>> #include "system.h"
>>> #ifdef HAVE_SYS_RESOURCE_H
>>> #include 
>>> #endif
>>> ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
>>> [Define to `long' if  doesn't define.])])
>>
>> Huh - looks at least bogus to not include config.h here, no?
>
> config.h uses auto-host.h which doesn't exist yet, it's created by
> configure.  All already known config defs are set in conftest.c (see
> config.log).

I still question the inclusion of system.h here - why is that needed, or
why isn't this either a copy of the relevant piece of system.h, or - _just_
including system.h and nothing else ... in fact system.h already includes
sys/resource.h the way above.

Richard.

> Andreas.
>
> --
> Andreas Schwab, sch...@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-22 Thread Richard Sandiford
domi...@lps.ens.fr (Dominique Dhumieres) writes:
> The following patch allowed me to proceed for 
> c,c++,lto,fortran,ada,objc,obj-c++
> up to libada which has the same problem:
>
> --- ../_clean/gcc/configure   2012-12-20 17:19:54.0 +0100
> +++ ../p_work/gcc/configure   2012-12-21 23:44:46.0 +0100
> @@ -10321,9 +10321,9 @@ $as_echo "#define HAVE_LANGINFO_CODESET 
>  
>  # We will need to find libiberty.h and ansidecl.h
>  saved_CFLAGS="$CFLAGS"
> -CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
> +CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
>  saved_CXXFLAGS="$CXXFLAGS"
> -CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include"
> +CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
>  for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd \
>   strsignal strstr stpcpy strverscmp \
>   errno snprintf vsnprintf vasprintf malloc realloc calloc \

Yeah, just came up with the same fix here (plain x86_64-linux-gnu,
but I don't have a gmp dev package installed and rely on --with-gmp).
Worked for me too.

Richard


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-22 Thread Andreas Schwab
Richard Biener  writes:

> On Sat, Dec 22, 2012 at 10:49 AM, Andreas Schwab  
> wrote:
>> Richard Biener  writes:
>>
>>> (I suppose somehow gmp.h is pulled in configure tests?)
>>
>> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
>> #include "ansidecl.h"
>> #include "system.h"
>> #ifdef HAVE_SYS_RESOURCE_H
>> #include 
>> #endif
>> ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
>> [Define to `long' if  doesn't define.])])
>
> Huh - looks at least bogus to not include config.h here, no?

config.h uses auto-host.h which doesn't exist yet, it's created by
configure.  All already known config defs are set in conftest.c (see
config.log).

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-22 Thread Dominique Dhumieres
The following patch allowed me to proceed for c,c++,lto,fortran,ada,objc,obj-c++
up to libada which has the same problem:

--- ../_clean/gcc/configure 2012-12-20 17:19:54.0 +0100
+++ ../p_work/gcc/configure 2012-12-21 23:44:46.0 +0100
@@ -10321,9 +10321,9 @@ $as_echo "#define HAVE_LANGINFO_CODESET 
 
 # We will need to find libiberty.h and ansidecl.h
 saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
+CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
 saved_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include"
+CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
 for ac_func in getenv atol asprintf sbrk abort atof getcwd getwd \
strsignal strstr stpcpy strverscmp \
errno snprintf vsnprintf vasprintf malloc realloc calloc \

Dominique


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-22 Thread Richard Biener
On Sat, Dec 22, 2012 at 10:49 AM, Andreas Schwab  wrote:
> Richard Biener  writes:
>
>> (I suppose somehow gmp.h is pulled in configure tests?)
>
> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> #include "ansidecl.h"
> #include "system.h"
> #ifdef HAVE_SYS_RESOURCE_H
> #include 
> #endif
> ]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
> [Define to `long' if  doesn't define.])])

Huh - looks at least bogus to not include config.h here, no?  Oh...
that isn't there.
Thus, it looks bogus to include system.h here.  Why's that done anyway?

Richard.


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-22 Thread Andreas Schwab
Richard Biener  writes:

> (I suppose somehow gmp.h is pulled in configure tests?)

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "ansidecl.h"
#include "system.h"
#ifdef HAVE_SYS_RESOURCE_H
#include 
#endif
]], [[rlim_t l = 0;]])],[],[AC_DEFINE([rlim_t],[long],
[Define to `long' if  doesn't define.])])

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-22 Thread Richard Biener
Gerald Pfeifer  wrote:

>On Fri, 21 Dec 2012, Dominique Dhumieres wrote:
>> I think revision 194665 breaks bootstrap on at least
>x86_64-apple-darwin10:
>
>Same on everything FreeBSD.
>
>PR 55784 - [4.8 regression] declaration of C function 'const char* 
>strsignal(int)' conflicts with /usr/include/string.h:112: error:
>previous 
>declaration

If you cannot sort this out yourself (I suppose somehow gmp.h is pulled in 
configure tests?) consider reverting the patch until I am back after Christmas.

Thanks,
Richard.

>Gerald




Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-21 Thread Gerald Pfeifer
On Fri, 21 Dec 2012, Dominique Dhumieres wrote:
> I think revision 194665 breaks bootstrap on at least x86_64-apple-darwin10:

Same on everything FreeBSD.

PR 55784 - [4.8 regression] declaration of C function 'const char* 
strsignal(int)' conflicts with /usr/include/string.h:112: error: previous 
declaration

Gerald


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-21 Thread Dominique Dhumieres
I think I understand at least part of the problem:
(1) I configure gcc with
../work/configure --prefix=/opt/gcc/gcc4.8w 
--enable-languages=c,c++,fortran,objc,obj-c++,java,ada,lto --with-gmp=/opt/mp 
--with-system-zlib --with-isl=/opt/mp --enable-lto --enable-plugin 
--enable-build-with-cxx

i.e., the files for gmp, mpfr, mpc, isl, ... are found in /opt/mp

(2) before r194665 the files including gcc/system.h did not need gmp.h
and the tests using it in configure were happy with
gcc -c -g  -I../../work/gcc -I../../work/gcc/../include  conftest.c >&5

(3) starting with r194665 all these tests fails as

configure:10333: checking whether getenv is declared
configure:10356: gcc -c -g  -I../../p_work/gcc -I../../p_work/gcc/../include  
conftest.c >&5
In file included from conftest.c:108:0:
../../p_work/gcc/system.h:641:17: fatal error: gmp.h: No such file or directory
 #include 
 ^
compilation terminated.
configure:10356: $? = 1

I think the fix requires to use gmpinc='-I/opt/mp/include '

Dominique


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-21 Thread Dominique Dhumieres
> That doesn't make much sense.  What do the lines around this look like?

I am currently bootstrapping r194675 with revision 194665 reverted.
The diff between gcc/auto-host.h with(-)/without(+) r194665 reverted
and --enable-checking=release for (+) looks like:

--- ../build_w/gcc/auto-host.h  2012-12-21 20:16:59.0 +0100
+++ gcc/auto-host.h 2012-12-21 20:54:49.0 +0100
@@ -49,7 +49,7 @@
 /* Define if you want more run-time sanity checks. This one gets a grab bag of
miscellaneous but relatively cheap checks. */
 #ifndef USED_FOR_TARGET
-#define ENABLE_CHECKING 1
+/* #undef ENABLE_CHECKING */
 #endif
 
 
@@ -96,7 +96,7 @@
 /* Define if you want the garbage collector to do object poisoning and other
memory allocation checks. This is quite expensive. */
 #ifndef USED_FOR_TARGET
-#define ENABLE_GC_CHECKING 1
+/* #undef ENABLE_GC_CHECKING */
 #endif
 
 
...
 /* Define to 1 if we found a declaration for 'strsignal', otherwise define to
0. */
 #ifndef USED_FOR_TARGET
-#define HAVE_DECL_STRSIGNAL 1
+#define HAVE_DECL_STRSIGNAL 0
 #endif
 
 
...
@@ -1991,7 +1991,7 @@
 
 /* Define to `long' if  doesn't define. */
 #ifndef USED_FOR_TARGET
-/* #undef rlim_t */
+#define rlim_t long
 #endif

I see

#define HAVE_STRSIGNAL 1

in both files.

Dominique


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-21 Thread Ian Lance Taylor
On Fri, Dec 21, 2012 at 8:26 AM, Dominique Dhumieres  wrote:
> I think revision 194665 breaks bootstrap on at least x86_64-apple-darwin10:
>
> g++ -c   -g -DIN_GCC   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables 
> -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual 
> -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros 
> -Wno-overlength-strings   -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild 
> -I../../_clean/gcc -I../../_clean/gcc/build -I../../_clean/gcc/../include 
> -I./../intl -I../../_clean/gcc/../libcpp/include -I/opt/mp/include  
> -I../../_clean/gcc/../libdecnumber -I../../_clean/gcc/../libdecnumber/dpd 
> -I../libdecnumber -I../../_clean/gcc/../libbacktrace -DCLOOG_INT_GMP  
> -I/opt/mp/include  \
> -o build/genconstants.o ../../_clean/gcc/genconstants.c
> In file included from ./bconfig.h:3:0,
>  from ../../_clean/gcc/genconstants.c:28:
> ./auto-host.h:1994:16: error: declaration does not declare anything 
> [-fpermissive]
>  #define rlim_t long

That doesn't make much sense.  What do the lines around this look like?

> In file included from ../../_clean/gcc/genconstants.c:29:0:
> ../../_clean/gcc/system.h:502:34: error: declaration of C function 'const 
> char* strsignal(int)' conflicts with
>  extern const char *strsignal (int);
>   ^
> In file included from /opt/gcc/gcc4.8a/include/c++/4.8.0/cstring:44:0,
>  from ../../_clean/gcc/system.h:207,
>  from ../../_clean/gcc/genconstants.c:29:
> /usr/include/string.h:136:7: error: previous declaration 'char* 
> strsignal(int)' here
>  char *strsignal(int sig);
>^

In auto-host.h, what are the values of HAVE_STRSIGNAL and HAVE_DECL_STRSIGNAL?

Ian


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-21 Thread Dominique Dhumieres
I think revision 194665 breaks bootstrap on at least x86_64-apple-darwin10:

g++ -c   -g -DIN_GCC   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables 
-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute 
-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   
-DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../_clean/gcc 
-I../../_clean/gcc/build -I../../_clean/gcc/../include -I./../intl 
-I../../_clean/gcc/../libcpp/include -I/opt/mp/include  
-I../../_clean/gcc/../libdecnumber -I../../_clean/gcc/../libdecnumber/dpd 
-I../libdecnumber -I../../_clean/gcc/../libbacktrace -DCLOOG_INT_GMP  
-I/opt/mp/include  \
-o build/genconstants.o ../../_clean/gcc/genconstants.c
In file included from ./bconfig.h:3:0,
 from ../../_clean/gcc/genconstants.c:28:
./auto-host.h:1994:16: error: declaration does not declare anything 
[-fpermissive]
 #define rlim_t long
^
In file included from ../../_clean/gcc/genconstants.c:29:0:
../../_clean/gcc/system.h:502:34: error: declaration of C function 'const char* 
strsignal(int)' conflicts with
 extern const char *strsignal (int);
  ^
In file included from /opt/gcc/gcc4.8a/include/c++/4.8.0/cstring:44:0,
 from ../../_clean/gcc/system.h:207,
 from ../../_clean/gcc/genconstants.c:29:
/usr/include/string.h:136:7: error: previous declaration 'char* strsignal(int)' 
here
 char *strsignal(int sig);
   ^

TIA

Dominique


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-21 Thread Ian Lance Taylor
On Fri, Dec 21, 2012 at 5:14 AM, Richard Biener  wrote:
>
> After the Ada fix including gmp.h from system.h is trivial
> (by means of double-int.h it was included from almost everywhere
> already)
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>
> Ok for trunk?  (Go frontend "unfixed")

Fixed like so.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2012-12-21  Ian Lance Taylor  

PR bootstrap/54659
* go-system.h: Don't include .


foo.patch
Description: Binary data


Re: [PATCH] Fix PR54659, include gmp.h from system.h

2012-12-21 Thread Jakub Jelinek
On Fri, Dec 21, 2012 at 02:14:37PM +0100, Richard Biener wrote:
> After the Ada fix including gmp.h from system.h is trivial
> (by means of double-int.h it was included from almost everywhere
> already)
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> 
> Ok for trunk?  (Go frontend "unfixed")

Yes, thanks.

Jakub