bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #62547] libdriver/input.cpp: allocation of zero sized arrays, compi


From: G. Branden Robinson
Subject: [bug #62547] libdriver/input.cpp: allocation of zero sized arrays, compiler warning [-Walloc-zero]
Date: Mon, 3 Apr 2023 20:41:12 -0400 (EDT)

Update of bug #62547 (project groff):

                  Status:                    None => Invalid                
             Assigned to:                    None => gbranden               
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #2:

My gcc does not warn about this even though it does with bug #62398.

Inspecting the code, the reason is obvious.


IntArray::IntArray(const size_t n)
{
  if (n <= 0)
    fatal("number of integers to be allocated must be > 0");
  num_allocated = n;
  data = new IntArg[num_allocated];
  num_stored = 0;
}


The allocation is unreachable if `n` is zero.

Resolving as invalid.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62547>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]