X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com Message-ID: <5717FA57.2070505@gmx.de> Date: Wed, 20 Apr 2016 23:53:27 +0200 From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp-workers AT delorie DOT com]" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7 MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: Test build of gcc-6.0.1-20160415 References: <5713789D DOT 8070708 AT iki DOT fi> <57152494 DOT 6040808 AT gmx DOT de> <57154DC1 DOT 2080907 AT iki DOT fi> In-Reply-To: <57154DC1.2080907@iki.fi> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:dW26ZZOqLPbJrVdij2PD4f1auAuNjqomOwtK2d8cAvzjZHAzBgv cVk2siBgd7aOGxOzcvHHN66DqXntPPeCYvTGzk5FKnYZOEXEbWsXoNtOX/Qxqk7PKx1HZIA tmSs3a+q8cSY1ivH32kq72E4dUudh6pJthTJ4Bl3wtRrQZpk+SiqyAiQHjFH1bakWXCc1Ly quLcEgZOQ4+hGOzNl3sDA== X-UI-Out-Filterresults: notjunk:1;V01:K0:kYhmpyL65sw=:Ey26l5y9cdxYP3AVic4Q06 zEDESGbCcERAKfRXysroVFLSZap+dgG6bNkmrCq6I5F2J6wEsXgvgZrRRHJXNngl1BpqFbqXa JfVmFzzMb0cmPYwWj6LEFcBl3+xEsJ1lBsn3StnuiGX0NvEscX00wDV4iJisOeIq6H7JUnLDo Km2/oNMyw/HMOAiym7HiWZ+vqQSfLRPIXVj+vpy9I0A7BWN0e6ojo/Cw58Dn8oLy1AjObCdyS Q40cU08XHNL47SpWP+3FQpsnbY0UETZ6KSLC75+5EGRSnJB05B1b+XpLoRbck2ME2NFG/Ey/i QAqlsdtBSrxbbXc1Fx9mnePM3bz0cV2mPLA6n2GqVgWerFCvDO5Ag1+qGl6bE/JvHYMGegOLi JiiF/C33fjurOxvNHAfLWR4zho0fUrjlvaqKuLyCdWwH8GMefhNvX1wfo0lvuRsx/xTCInMot 01uPtMDSSqa+BEtyjpRE65KZ0pAGl1LirxQq60ct3FW/yUnzxagQA/h0rZLE9auU+NeoGPIQO 4UyIzX23USOS/NT9RaJqQBLKWlHkkzDwxYFOesowi+AUXrPutXUAMqbXCRZYiHjNIMsSHFGdx wP1DbLBRZ6cw3VFuwT6SR7C4/IxTTP15c4pFm+wn2WIudf8f/VOzEBv8mXQND4CpMaRDjGFs4 kWLocVm8OaGcvOy/s3B/nj6rotWRWLUFLLpE4u4eIHYoHKY1PZxNW/NshnENWYrxRFs3APeQy OFTKuSx4Fl6L+eZckFVtuG9WMTN83E/oXJ11RtShAMd3O6Y5rqLPHwQ7kbtJniLk0FDvZrgsJ VjCJYP1 Reply-To: djgpp-workers AT delorie DOT com Am 18.04.2016 23:12, schrieb Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp-workers AT delorie DOT com]: > On 04/18/2016 09:16 PM, Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp-workers AT delorie DOT com] wrote: >> Am 17.04.2016 13:50, schrieb Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp-workers AT delorie DOT com]: >>> gcc-6.1.0 should not be very far any more: >>> >>> https://gcc.gnu.org/ml/gcc/2016-04/msg00103.html >>> https://gcc.gnu.org/ml/gcc/2016-04/msg00109.html >>> >>> I built DJGPP port based on SVN revision r235040 (the same used for release candidate sources) checked out from git mirror (see https://gcc.gnu.org/wiki/GitMirror for details). Of course DJGPP related additional changes are merged. >>> >>> Files (both i686 and x86_64 rpms and native DJGPP build are available for testing at: >>> >>> http://ap1.pp.fi/djgpp/gcc/test/6.0.1-20160415/ >>> >>> Andris >>> >> >> >> I have tried to build libc from repository using g[cc|pp]601_20160415b.zip. >> It fails with the following error message: >> >> gcc ... -c strlen.c >> strlen.c: In function 'strlen': >> strlen.c:10:6: error: nonnull argument 'str' compared to NULL [-Werror=nonnull-compare] >> if (str == NULL) >> ^ >> cc1.exe: all warnings being treated as errors >> ../../../makefile.inc:89: recipe for target 'strlen.o' failed >> make.exe[3]: *** [strlen.o] Error 1 >> makefile.sub:2: recipe for target 'all_subs' failed >> make.exe[2]: *** [all_subs] Error 2 >> ../makefile.lib:6: recipe for target 'all' failed >> make.exe[1]: *** [all] Error 2 >> makefile:39: recipe for target 'subs' failed >> make.exe: *** [subs] Error 2 >> >> Inspecting the strlen code, it is clear that the offending code segment is: >> >> if (str == NULL) >> return 0; >> >> It seems to be that for some reason, the compiler does assume that the passed >> argument to the function can never be NULL. If I understood correctly, this >> should only be the case if the function is specified like this: >> >> size_t strlen(const char *_s) __attribute__ ((__nonnull__ (1))); >> >> specifying that _s is never NULL, but this is certainly not the case in the >> current versions of string.h. >> >> So the question arises if we have to remove all NULL pointer check from our >> code and if this measure is really wise? IMHO, we should adjust the compiler >> checks in such a way that NULL pointer checks are still possible. >> BTW I have inspected http://pubs.opengroup.org/onlinepubs/009695399/functions/strlen.html >> and I have seen no indication that a NULL pointer check is prohibited, but >> also I have seen no indication that a NULL pointer check is allowed. >> > GCC new versions are known to be too wise for its own good when it commes to builtin functions. > > We have already had similar problem with cmalloc() in nmalloc.c where GCC infinite wisdom told it to recognize source as implementation of __builtin_cmalloc() and over-optimize it to infinite tail recursion. Specifying -fno-builtin-cmalloc for nmalloc.c work-arounded the problem then (present in DJGPP v2.05). See: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618 > > (it was NOT DJGPP specific and could easily be reproduced on Linux) > > It seems that gcc current version recognizes DJGPP implementation of strlen as __builtin_strlen and assumes that __builtin_strlen should never have passed NULL argument with following messages. > Specifying > > strlen.o: EXTRA_CFLAGS += -fno-builtin-strlen > > in src/libc/ansi/string/makefile causes error to disappear. > > Same problem with: > > libc/c99/math/nan*.c > libc/compat/string/stpcpy.c > libc/compat/string/stpncpy.c > libc/compat/string/strdup.c > > and more (same approach as with strlen() works also for these). > > There are also other warnings interpreted as errors. Some examples: > > i586-pc-msdosdjgpp-gcc -pipe ... -c k_rem_pio2.c > k_rem_pio2.c: In function '__kernel_rem_pio2': > k_rem_pio2.c:190:6: error: this 'for' clause does not guard... [-Werror=misleading-indentation] > for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; > ^~~ > k_rem_pio2.c:190:54: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'for' > for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; > ^ > cc1: all warnings being treated as errors > > i586-pc-msdosdjgpp-gcc -pipe ... -c s_scalbn.c > s_scalbn.c:69:1: error: 'huge' defined but not used [-Werror=unused-const-variable=] > huge = 1.0e+300, > ^~~~ > cc1: all warnings being treated as errors > > And some similar... > > I'm not going to fix these now immediately (in late evening). > > About -Wmisleading-indentation: I guess it would be best to disable it for gcc-6+ > > Andris > OFYI, I have committed the patch below to pacifiy the new gcc 6.0.1 compiler when used to compile the libc repository code. It only concernces unused variables and -Werror=misleading-indentation. Regards, Juan M. Guerrero 2016-04-20 Juan Manuel Guerrero * djgpp/src/libm/math/e_asin.c: Fixing -Werror=misleading-indentation for gcc 6.0.1. * djgpp/src/libm/math/ef_asin.c: Fixing -Werror=misleading-indentation for gcc 6.0.1. * djgpp/src/libm/math/k_rem_pio2.c: Fixing -Werror=misleading-indentation for gcc 6.0.1. * djgpp/src/libm/math/kf_rem_pio2.c: Fixing -Werror=misleading-indentation for gcc 6.0.1. * djgpp/src/libm/math/ef_jn.c: Unused variable removed. * djgpp/src/libm/math/s_scalbn.c: Unused variable removed. * djgpp/src/libm/math/sf_scalbn.c: Unused variable removed. * djgpp/src/libm/math/sf_cos.c: Unused variable removed. * djgpp/src/utils/djtar/unlzh.c: Fixing -Werror=misleading-indentation for gcc 6.0.1. Index: djgpp/src/libm/math/e_asin.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/e_asin.c,v retrieving revision 1.1 diff -U 5 -r1.1 e_asin.c --- djgpp/src/libm/math/e_asin.c 7 Feb 1998 13:18:28 -0000 1.1 +++ djgpp/src/libm/math/e_asin.c 20 Apr 2016 21:40:58 -0000 @@ -89,14 +89,14 @@ } else if (ix<0x3fe00000) { /* |x|<0.5 */ if(ix<0x3e400000) { /* if |x| < 2**-27 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ } else t = x*x; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - w = p/q; - return x+x*w; + p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); + q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); + w = p/q; + return x+x*w; } /* 1> |x|>= 0.5 */ w = one-fabs(x); t = w*0.5; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); Index: djgpp/src/libm/math/ef_asin.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/ef_asin.c,v retrieving revision 1.1 diff -U 5 -r1.1 ef_asin.c --- djgpp/src/libm/math/ef_asin.c 7 Feb 1998 14:13:26 -0000 1.1 +++ djgpp/src/libm/math/ef_asin.c 20 Apr 2016 21:40:58 -0000 @@ -56,14 +56,14 @@ } else if (ix<0x3f000000) { /* |x|<0.5 */ if(ix<0x32000000) { /* if |x| < 2**-27 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ } else t = x*x; - p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); - q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); - w = p/q; - return x+x*w; + p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); + q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); + w = p/q; + return x+x*w; } /* 1> |x|>= 0.5 */ w = one-fabsf(x); t = w*(float)0.5; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); Index: djgpp/src/libm/math/ef_jn.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/ef_jn.c,v retrieving revision 1.2 diff -U 5 -r1.2 ef_jn.c --- djgpp/src/libm/math/ef_jn.c 16 Mar 2002 13:32:53 -0000 1.2 +++ djgpp/src/libm/math/ef_jn.c 20 Apr 2016 21:40:58 -0000 @@ -18,11 +18,10 @@ #ifdef __STDC__ static const float #else static float #endif -invsqrtpi= 5.6418961287e-01, /* 0x3f106ebb */ two = 2.0000000000e+00, /* 0x40000000 */ one = 1.0000000000e+00; /* 0x3F800000 */ #ifdef __STDC__ static const float zero = 0.0000000000e+00; Index: djgpp/src/libm/math/k_rem_pio2.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/k_rem_pio2.c,v retrieving revision 1.1 diff -U 5 -r1.1 k_rem_pio2.c --- djgpp/src/libm/math/k_rem_pio2.c 15 Apr 1997 08:39:48 -0000 1.1 +++ djgpp/src/libm/math/k_rem_pio2.c 20 Apr 2016 21:40:58 -0000 @@ -185,11 +185,12 @@ j = jv-jx; m = jx+jk; for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; /* compute q[0],q[1],...q[jk] */ for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; } jz = jk; recompute: /* distill q[] into iq[] reversingly */ Index: djgpp/src/libm/math/kf_rem_pio2.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/kf_rem_pio2.c,v retrieving revision 1.1 diff -U 5 -r1.1 kf_rem_pio2.c --- djgpp/src/libm/math/kf_rem_pio2.c 15 Apr 1997 08:39:48 -0000 1.1 +++ djgpp/src/libm/math/kf_rem_pio2.c 20 Apr 2016 21:40:58 -0000 @@ -75,11 +75,12 @@ j = jv-jx; m = jx+jk; for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; /* compute q[0],q[1],...q[jk] */ for (i=0;i<=jk;i++) { - for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; } jz = jk; recompute: /* distill q[] into iq[] reversingly */ Index: djgpp/src/libm/math/s_scalbn.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/s_scalbn.c,v retrieving revision 1.1 diff -U 5 -r1.1 s_scalbn.c --- djgpp/src/libm/math/s_scalbn.c 4 Oct 1998 10:48:42 -0000 1.1 +++ djgpp/src/libm/math/s_scalbn.c 20 Apr 2016 21:40:58 -0000 @@ -64,11 +64,10 @@ #else static double #endif two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ -huge = 1.0e+300, tiny = 1.0e-300; #ifdef __STDC__ double scalbn (double x, int n) #else Index: djgpp/src/libm/math/sf_cos.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/sf_cos.c,v retrieving revision 1.1 diff -U 5 -r1.1 sf_cos.c --- djgpp/src/libm/math/sf_cos.c 15 Apr 1997 08:39:52 -0000 1.1 +++ djgpp/src/libm/math/sf_cos.c 20 Apr 2016 21:40:58 -0000 @@ -14,16 +14,10 @@ */ #include "fdlibm.h" #ifdef __STDC__ -static const float one=1.0; -#else -static float one=1.0; -#endif - -#ifdef __STDC__ float cosf(float x) #else float cosf(x) float x; #endif Index: djgpp/src/libm/math/sf_scalbn.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libm/math/sf_scalbn.c,v retrieving revision 1.1 diff -U 5 -r1.1 sf_scalbn.c --- djgpp/src/libm/math/sf_scalbn.c 4 Oct 1998 10:48:42 -0000 1.1 +++ djgpp/src/libm/math/sf_scalbn.c 20 Apr 2016 21:40:58 -0000 @@ -27,11 +27,10 @@ #else static float #endif two25 = 3.355443200e+07, /* 0x4c000000 */ twom25 = 2.9802322388e-08, /* 0x33000000 */ -huge = 1.0e+30, tiny = 1.0e-30; #ifdef __STDC__ float scalbnf (float x, int n) #else Index: djgpp/src/utils/djtar/unlzh.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/utils/djtar/unlzh.c,v retrieving revision 1.5 diff -U 5 -r1.5 unlzh.c --- djgpp/src/utils/djtar/unlzh.c 2 May 2015 07:32:38 -0000 1.5 +++ djgpp/src/utils/djtar/unlzh.c 20 Apr 2016 21:40:58 -0000 @@ -1,5 +1,6 @@ +/* Copyright (C) 2016 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2015 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2013 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2012 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ @@ -234,11 +235,12 @@ c = bitbuf >> (BITBUFSIZ - 3); if (c == 7) { mask = (unsigned) 1 << (BITBUFSIZ - 1 - 3); while (mask & bitbuf) - mask >>= 1; c++; + mask >>= 1; + c++; } fillbuf((c < 7) ? 3 : c - 3); pt_len[i++] = c; if (i == i_special) {