https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71433

Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #11 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
The warning no longer occurs on the simple test case, but it still occurs on
the MPFR code:

$ gcc-snapshot --version
gcc (Debian 20170125-1) 7.0.1 20170125 (experimental) [trunk revision 244909]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc-snapshot -DMPFR_WANT_ASSERT=2 -DMPFR_USE_LOGGING=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_DOUBLE_IEEE_LITTLE_ENDIAN=1
-DHAVE_LITTLE_ENDIAN=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_LOCALE_H=1
-DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1
-DHAVE_STRUCT_LCONV_DECIMAL_POINT=1 -DHAVE_STRUCT_LCONV_THOUSANDS_SEP=1
-DHAVE_ALLOCA_H=1 -DHAVE_STDINT_H=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1
-DHAVE_GETTIMEOFDAY=1 -DHAVE_SIGNAL=1 -DHAVE_SIGACTION=1 -DHAVE_LONG_LONG=1
-DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_PRINTF_MAXLM=\"j\"
-DMPFR_HAVE_NORETURN=1 -DMPFR_HAVE_BUILTIN_UNREACHABLE=1
-DMPFR_HAVE_CONSTRUCTOR_ATTR=1 -DHAVE_PTHREAD=1 -DMPFR_HAVE_FESETROUND=1
-DHAVE_DENORMS=1 -DHAVE_DENORMS_FLT=1 -DHAVE_SIGNEDZ=1 -DHAVE_ROUND=1
-DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1
-DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DMPFR_WANT_DECIMAL_FLOATS=1
-DMPFR_WANT_FLOAT128=1 -DMPFR_USE_STATIC_ASSERT=1 -DHAVE_CLOCK_GETTIME=1
-DHAVE_ATTRIBUTE_MODE=1 -DPRINTF_L=1 -DPRINTF_T=1
-DHAVE___GMPN_SBPI1_DIVAPPR_Q=1 -DHAVE___GMPN_INVERT_LIMB=1
-DHAVE___GMPN_RSBLSH_N=1 -DMPFR_LONG_WITHIN_LIMB=1 -DHAVE_GETRUSAGE=1 -I.  
-I/usr/local/gmp-6.1.0-debug/include  -O2 -Wall -Wold-style-declaration
-Wold-style-definition -Wmissing-parameter-type -Wmissing-prototypes
-Wmissing-declarations -Wmissing-field-initializers -Wno-error=unused-function
-Wno-error=deprecated-declarations -Werror -DMPFR_COV_CHECK -c -o get_d.o
get_d.c
get_d.c: In function 'mpfr_get_d':
get_d.c:115:24: error: array subscript is above array bounds
[-Werror=array-bounds]
             d = (d + tp[i]) / MP_BASE_AS_DOUBLE;
                      ~~^~~
cc1: all warnings being treated as errors

One has:

          for (i = 1 ; i < np ; i++)
            d = (d + tp[i]) / MP_BASE_AS_DOUBLE;

and here np = 1 (known at compile time).

Reply via email to