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.