This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81452] New: warn on realloc(p, 0)
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 15 Jul 2017 18:03:31 +0000
- Subject: [Bug tree-optimization/81452] New: warn on realloc(p, 0)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81452
Bug ID: 81452
Summary: warn on realloc(p, 0)
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
C11 DR 400 (http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400)
points out a problem with calling realloc(p, 0). In response to the DR,
calling realloc with a size of zero has been deprecated in C17. Enhancing GCC
to issue a warning for this case would help detect the problem. See also Glibc
bug number 12547 (https://sourceware.org/bugzilla/show_bug.cgi?id=12547) and
Austin Group defect number 400 (http://austingroupbugs.net/view.php?id=400).
See also GCC bug 56370 for another request for a warning related to another
realloc misuse.