[Bug middle-end/94004] [8/9/10 Regression] missing -Walloca on calls to alloca due to -Wno-system-headers

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 2 17:27:00 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94004

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Bisection points to r254630 which doesn't look related to -Walloca:

commit 025d57f037ad13eb479818b677ef4be4d97b639c
Author: Martin Sebor <msebor@redhat.com>
Date:   Fri Nov 10 16:35:26 2017 +0000

    PR c/81117 - Improve buffer overflow checking in strncpy

    gcc/ChangeLog:

            PR c/81117
            * builtins.c (compute_objsize): Handle arrays that
            compute_builtin_object_size likes to fail for.  Make extern.
            * builtins.h (compute_objsize): Declare.
            (check_strncpy_sizes): New function.
            (expand_builtin_strncpy): Call check_strncpy_sizes.
            * gimple-fold.c (gimple_fold_builtin_strncpy): Implement
            -Wstringop-truncation.
            (gimple_fold_builtin_strncat): Same.
            * gimple.c (gimple_build_call_from_tree): Set call location.
            * tree-ssa-strlen.c (strlen_to_stridx): New global variable.
            (maybe_diag_bound_equal_length, is_strlen_related_p): New
functions.
            (handle_builtin_stxncpy, handle_builtin_strncat): Same.
            (handle_builtin_strlen): Use strlen_to_stridx.
            (strlen_optimize_stmt): Handle flavors of strncat, strncpy, and
            stpncpy.
            Use strlen_to_stridx.
            (pass_strlen::execute): Release strlen_to_stridx.
            * doc/invoke.texi (-Wsizeof-pointer-memaccess): Document
enhancement.
            (-Wstringop-truncation): Document new option.

    gcc/ada/ChangeLog:

            PR c/81117
            * ada/adadecode.c (__gnat_decode): Use memcpy instead of strncpy.
            * ada/argv.c (__gnat_fill_arg, __gnat_fill_env): Same.

    gcc/c-family/ChangeLog:

            PR c/81117
            * c-common.c (catenate_strings): Use memcpy instead of strncpy.
            * c-warn.c (sizeof_pointer_memaccess_warning): Handle arrays.
            * c.opt (-Wstringop-truncation): New option.
    ...   
    From-SVN: r254630


More information about the Gcc-bugs mailing list