On 10/1/19 12:40 PM, Martin Sebor wrote:
On 9/30/19 9:40 PM, Jerry DeLisle wrote:
Copying gcc list for additional thoughts on a possible bogus warning.

On 9/29/19 9:02 AM, Jerry DeLisle wrote:

--- snip ---

In case it helps, the warning is for the access:

   # .MEM_68 = VDEF <.MEM_71>
   MEM[(char *)_86] = 0;

where _86 is set to

   _86 = &itoa_buf + _43;

and _43 has the range [136, 17179869176].  (The warning needs to
be enhanced a bit to mention the accessed object in this case.)
itoa_buf's DECL_SIZE_UNIT evaluates to 129.

The call to btoa_big in write_b:

       p = btoa_big (source, itoa_buf, len, &n);

is made with len > 16.  If len > sizeof itoa_buf  / 8 then it does
look like btoa_big would write past the end of itoa_buf because it
writes len * 8 bytes into it.  I don't know if the function can be
called with len that large but if not, adding this just above
the call suppresses the warning.

       if (len > sizeof itoa_buf / 8)
     __builtin_unreachable ();

Martin


Thanks Martin, this does help me understand why the warning. Yes, len cannot be greater than 16. I decided to just use memset in write_b where the buffer is created to avoid the assignment that triggers the warning. Your suggestion may likewise work. In my comments describing the warning as bogus, by bogus, I mean "not applicable" to the situation.

I notice many warnings flying by when building gcc/gfortran. My preference would be to clear as many off as possible so that we can actually notice warnings when they are applicable and not miss them among a crowd of warnings.

I don't know if this makes sense to anyone and I do appreciate your response.

Jerry

Reply via email to