From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: new gcc 7.0.1 warnings |
Date: | 2017-02-18 17:52:01 |
Message-ID: | CAFj8pRANwE5jzVXd_jS51VR17GXJyG9dQQdrVTLqBzYenRT0Pg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2017-02-18 18:35 GMT+01:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> > float.c:382:5: note: ‘snprintf’ output between 2 and 311 bytes into a
> > destination of size 65
> > float.c:618:5: note: ‘snprintf’ output between 2 and 311 bytes into a
> > destination of size 129
>
> That's kind of annoying. I suppose the point is that the compiler can't
> see what precision we're selecting, and with sufficiently large precision
> the output could be that wide. But actually the precision should be small
> enough to make that OK.
>
> Do the warnings go away if you add some explicit guard to the precision
> variable, say like this:
>
> {
> int ndig = DBL_DIG + extra_float_digits;
>
> if (ndig < 1)
> ndig = 1;
> + if (ndig > 50)
> + ndig = 50;
>
This fix doesn't help
Regards
Pavel
>
> snprintf(ascii, MAXDOUBLEWIDTH + 1, "%.*g", ndig, num);
> }
>
> If not, I guess we could increase the size of the palloc'd strings,
> but that seems wasteful.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-02-18 18:23:30 | Re: Instability in select_parallel regression test |
Previous Message | Tom Lane | 2017-02-18 17:35:15 | Re: new gcc 7.0.1 warnings |