gcc/gcc/tree-object-size.c

1402 lines
38 KiB
C
Raw Normal View History

builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
/* __builtin_object_size (ptr, object_size_type) computation
Copyright (C) 2004-2017 Free Software Foundation, Inc.
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
Contributed by Jakub Jelinek <jakub@redhat.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
#include "config.h"
#include "system.h"
#include "coretypes.h"
tree-core.h: Include symtab.h. 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * tree-core.h: Include symtab.h. * rtl.h: Include hard-reg-set.h but not flags.h. (HARD_CONST): Remove condition compilation involving HARD_CONST since hard-reg-set.h is always included. * regs.h: Don't include hard-reg-set.h or rtl.h. * cfg.h: Include dominance.h. * gimple.h: Include tree-ssa-alias.h and gimple-expr.h. * backend.h: New. Aggregate commonly used backend header files. * gimple-ssa.h: Don't include tree-hasher.h. * ssa.h: New. Aggregate commonly used SSA header files. * regset.h: Remove bitmap.h and hard-reg-set.h #includes. * sel-sched-ir.h: Flatten includes. * lra-int.h: Flatten completely. * sel-sched-dump.h: Flatten includes. * ira-int.h: Flatten includes. * gimple-streamer.h: Remove all includes. * cfgloop.h: Remove all #includes except cfgloopmanip.h. * resource.h: Flatten hard-reg-set.h and df.h. * sched-int.h: Flatten insn-arrt.h and df.h. * valtrack.h: flatten bitmap.h, df.h, and rtl.h * df.h: Flatten includes, leaving regset.h, alloc-pool.h and timevar.h. * genattrtab.c (write_header): Adjust generated includes. * genautomata.c (main): Likewise. * genconditions.c (write-header): Likewise. * genemit.c (main): Likewise. * gengtype.c (open_base_files): Likewise. * genopinit.c (main): Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c (main): Likewise. * genpreds.c (write_insn_preds_c): Likewise. * genrecog.c (write_header): Likewise. * alias.c: Adjust includes. * asan.c: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * ccmp.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * cppbuiltin.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * data-streamer.c: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * debug.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dojump.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * dse.c: Likewise. * dumpfile.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcc-plugin.h: Likewise. * gcse-common.c: Likewise. * gcse.c: Likewise. * generic-match-head.c: Likewise. * ggc-page.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-match-head.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimple.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * godump.c: Likewise. * graph.c: Likewise. * graphite-blocking.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-isl-ast-to-gimple.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * init-regs.c: Likewise. * internal-fn.c: Likewise. * ipa-chkp.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * realmpfr.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl-chkp.c: Likewise. * rtlanal.c: Likewise. * rtlhooks.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * symtab.c: Likewise. * target-globals.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * valtrack.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * vtable-verify.c: Likewise. * web.c: Likewise. * wide-int.cc: Likewise. * xcoffout.c: Likewise. * config/aarch64/aarch64-builtins.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/aarch64/cortex-a57-fma-steering.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/aarch-common.c: Likewise. * config/arm/arm-builtins.c: Likewise. * config/arm/arm-c.c: Likewise. * config/arm/arm.c: Likewise. * config/avr/avr-c.c: Likewise. * config/avr/avr-log.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/cr16/cr16.c: Likewise. * config/cris/cris.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/epiphany/epiphany.c: Likewise. * config/epiphany/mode-switch-use.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/ft32/ft32.c: Likewise. * config/h8300/h8300.c: Likewise. * config/i386/i386-c.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/msformat-c.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/microblaze/microblaze-c.c: Likewise. * config/microblaze/microblaze.c: Likewise. * config/mips/mips.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/msp430/msp430-c.c: Likewise. * config/msp430/msp430.c: Likewise. * config/nds32/nds32-cost.c: Likewise. * config/nds32/nds32-fp-as-gp.c: Likewise. * config/nds32/nds32-intrinsic.c: Likewise. * config/nds32/nds32-isr.c: Likewise. * config/nds32/nds32-md-auxiliary.c: Likewise. * config/nds32/nds32-memory-manipulation.c: Likewise. * config/nds32/nds32-pipelines-auxiliary.c: Likewise. * config/nds32/nds32-predicates.c: Likewise. * config/nds32/nds32.c: Likewise. * config/nios2/nios2.c: Likewise. * config/nvptx/nvptx.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/rl78/rl78-c.c: Likewise. * config/rl78/rl78.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390-c.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh-c.c: Likewise. * config/sh/sh-mem.cc: Likewise. * config/sh/sh.c: Likewise. * config/sh/sh_optimize_sett_clrt.cc: Likewise. * config/sh/sh_treg_combine.cc: Likewise. * config/sol2-c.c: Likewise. * config/sol2-cxx.c: Likewise. * config/sol2-stubs.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc-c.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu-c.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/tilegx/mul-tables.c: Likewise. * config/tilegx/tilegx-c.c: Likewise. * config/tilegx/tilegx.c: Likewise. * config/tilepro/mul-tables.c: Likewise. * config/tilepro/tilepro-c.c: Likewise. * config/tilepro/tilepro.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/visium/visium.c: Likewise. * config/vms/vms-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. ada 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/cuintp.c: Adjust includes. * gcc-interface/decl.c: Likewise. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. c 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Adjust includes. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Adjust includes. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * call.c: Adjust includes. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. fortran 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * convert.c: Adjust includes. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Adjust includes. * go-gcc.cc: Likewise. * go-lang.c: Likewise. java 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Adjust includes. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. jit 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Adjust includes. * jit-common.h: Likewise. * jit-playback.c: Likewise. lto 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Adjust includes. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objc-act.c: Adjust includes. * objc-encoding.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-lang.c: Likewise. * objc-map.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. objcp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Adjust includes. * objcp-lang.c: Likewise. From-SVN: r225531
2015-07-08 02:53:03 +02:00
#include "backend.h"
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
#include "tree.h"
tree-core.h: Include symtab.h. 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * tree-core.h: Include symtab.h. * rtl.h: Include hard-reg-set.h but not flags.h. (HARD_CONST): Remove condition compilation involving HARD_CONST since hard-reg-set.h is always included. * regs.h: Don't include hard-reg-set.h or rtl.h. * cfg.h: Include dominance.h. * gimple.h: Include tree-ssa-alias.h and gimple-expr.h. * backend.h: New. Aggregate commonly used backend header files. * gimple-ssa.h: Don't include tree-hasher.h. * ssa.h: New. Aggregate commonly used SSA header files. * regset.h: Remove bitmap.h and hard-reg-set.h #includes. * sel-sched-ir.h: Flatten includes. * lra-int.h: Flatten completely. * sel-sched-dump.h: Flatten includes. * ira-int.h: Flatten includes. * gimple-streamer.h: Remove all includes. * cfgloop.h: Remove all #includes except cfgloopmanip.h. * resource.h: Flatten hard-reg-set.h and df.h. * sched-int.h: Flatten insn-arrt.h and df.h. * valtrack.h: flatten bitmap.h, df.h, and rtl.h * df.h: Flatten includes, leaving regset.h, alloc-pool.h and timevar.h. * genattrtab.c (write_header): Adjust generated includes. * genautomata.c (main): Likewise. * genconditions.c (write-header): Likewise. * genemit.c (main): Likewise. * gengtype.c (open_base_files): Likewise. * genopinit.c (main): Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c (main): Likewise. * genpreds.c (write_insn_preds_c): Likewise. * genrecog.c (write_header): Likewise. * alias.c: Adjust includes. * asan.c: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * ccmp.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * cppbuiltin.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * data-streamer.c: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * debug.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dojump.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * dse.c: Likewise. * dumpfile.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcc-plugin.h: Likewise. * gcse-common.c: Likewise. * gcse.c: Likewise. * generic-match-head.c: Likewise. * ggc-page.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-match-head.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimple.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * godump.c: Likewise. * graph.c: Likewise. * graphite-blocking.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-isl-ast-to-gimple.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * init-regs.c: Likewise. * internal-fn.c: Likewise. * ipa-chkp.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * realmpfr.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl-chkp.c: Likewise. * rtlanal.c: Likewise. * rtlhooks.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * symtab.c: Likewise. * target-globals.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * valtrack.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * vtable-verify.c: Likewise. * web.c: Likewise. * wide-int.cc: Likewise. * xcoffout.c: Likewise. * config/aarch64/aarch64-builtins.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/aarch64/cortex-a57-fma-steering.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/aarch-common.c: Likewise. * config/arm/arm-builtins.c: Likewise. * config/arm/arm-c.c: Likewise. * config/arm/arm.c: Likewise. * config/avr/avr-c.c: Likewise. * config/avr/avr-log.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/cr16/cr16.c: Likewise. * config/cris/cris.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/epiphany/epiphany.c: Likewise. * config/epiphany/mode-switch-use.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/ft32/ft32.c: Likewise. * config/h8300/h8300.c: Likewise. * config/i386/i386-c.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/msformat-c.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/microblaze/microblaze-c.c: Likewise. * config/microblaze/microblaze.c: Likewise. * config/mips/mips.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/msp430/msp430-c.c: Likewise. * config/msp430/msp430.c: Likewise. * config/nds32/nds32-cost.c: Likewise. * config/nds32/nds32-fp-as-gp.c: Likewise. * config/nds32/nds32-intrinsic.c: Likewise. * config/nds32/nds32-isr.c: Likewise. * config/nds32/nds32-md-auxiliary.c: Likewise. * config/nds32/nds32-memory-manipulation.c: Likewise. * config/nds32/nds32-pipelines-auxiliary.c: Likewise. * config/nds32/nds32-predicates.c: Likewise. * config/nds32/nds32.c: Likewise. * config/nios2/nios2.c: Likewise. * config/nvptx/nvptx.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/rl78/rl78-c.c: Likewise. * config/rl78/rl78.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390-c.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh-c.c: Likewise. * config/sh/sh-mem.cc: Likewise. * config/sh/sh.c: Likewise. * config/sh/sh_optimize_sett_clrt.cc: Likewise. * config/sh/sh_treg_combine.cc: Likewise. * config/sol2-c.c: Likewise. * config/sol2-cxx.c: Likewise. * config/sol2-stubs.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc-c.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu-c.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/tilegx/mul-tables.c: Likewise. * config/tilegx/tilegx-c.c: Likewise. * config/tilegx/tilegx.c: Likewise. * config/tilepro/mul-tables.c: Likewise. * config/tilepro/tilepro-c.c: Likewise. * config/tilepro/tilepro.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/visium/visium.c: Likewise. * config/vms/vms-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. ada 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/cuintp.c: Adjust includes. * gcc-interface/decl.c: Likewise. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. c 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Adjust includes. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Adjust includes. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * call.c: Adjust includes. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. fortran 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * convert.c: Adjust includes. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Adjust includes. * go-gcc.cc: Likewise. * go-lang.c: Likewise. java 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Adjust includes. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. jit 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Adjust includes. * jit-common.h: Likewise. * jit-playback.c: Likewise. lto 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Adjust includes. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objc-act.c: Adjust includes. * objc-encoding.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-lang.c: Likewise. * objc-map.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. objcp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Adjust includes. * objcp-lang.c: Likewise. From-SVN: r225531
2015-07-08 02:53:03 +02:00
#include "gimple.h"
alias.c: Reorder #include statements and remove duplicates. 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * alias.c: Reorder #include statements and remove duplicates. * asan.c: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * ccmp.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * cppbuiltin.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * data-streamer.c: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * debug.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dojump.c: Likewise. * dominance.c: Likewise. * double-int.c: Likewise. * dse.c: Likewise. * dumpfile.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * generic-match-head.c: Likewise. * ggc-common.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-match-head.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimple.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * godump.c: Likewise. * graph.c: Likewise. * graphite-poly.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * internal-fn.c: Likewise. * ipa-chkp.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * realmpfr.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl-chkp.c: Likewise. * rtl-error.c: Likewise. * rtlanal.c: Likewise. * rtlhooks.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sese.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * statistics.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * symtab.c: Likewise. * target-globals.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vtable-verify.c: Likewise. * web.c: Likewise. * wide-int-print.cc: Likewise. * wide-int.cc: Likewise. * xcoffout.c: Likewise. From-SVN: r229526
2015-10-29 14:57:32 +01:00
#include "tree-pass.h"
tree-core.h: Include symtab.h. 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * tree-core.h: Include symtab.h. * rtl.h: Include hard-reg-set.h but not flags.h. (HARD_CONST): Remove condition compilation involving HARD_CONST since hard-reg-set.h is always included. * regs.h: Don't include hard-reg-set.h or rtl.h. * cfg.h: Include dominance.h. * gimple.h: Include tree-ssa-alias.h and gimple-expr.h. * backend.h: New. Aggregate commonly used backend header files. * gimple-ssa.h: Don't include tree-hasher.h. * ssa.h: New. Aggregate commonly used SSA header files. * regset.h: Remove bitmap.h and hard-reg-set.h #includes. * sel-sched-ir.h: Flatten includes. * lra-int.h: Flatten completely. * sel-sched-dump.h: Flatten includes. * ira-int.h: Flatten includes. * gimple-streamer.h: Remove all includes. * cfgloop.h: Remove all #includes except cfgloopmanip.h. * resource.h: Flatten hard-reg-set.h and df.h. * sched-int.h: Flatten insn-arrt.h and df.h. * valtrack.h: flatten bitmap.h, df.h, and rtl.h * df.h: Flatten includes, leaving regset.h, alloc-pool.h and timevar.h. * genattrtab.c (write_header): Adjust generated includes. * genautomata.c (main): Likewise. * genconditions.c (write-header): Likewise. * genemit.c (main): Likewise. * gengtype.c (open_base_files): Likewise. * genopinit.c (main): Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c (main): Likewise. * genpreds.c (write_insn_preds_c): Likewise. * genrecog.c (write_header): Likewise. * alias.c: Adjust includes. * asan.c: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * ccmp.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * cppbuiltin.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * data-streamer.c: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * debug.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dojump.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * dse.c: Likewise. * dumpfile.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcc-plugin.h: Likewise. * gcse-common.c: Likewise. * gcse.c: Likewise. * generic-match-head.c: Likewise. * ggc-page.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-match-head.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimple.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * godump.c: Likewise. * graph.c: Likewise. * graphite-blocking.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-isl-ast-to-gimple.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * init-regs.c: Likewise. * internal-fn.c: Likewise. * ipa-chkp.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * realmpfr.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl-chkp.c: Likewise. * rtlanal.c: Likewise. * rtlhooks.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * symtab.c: Likewise. * target-globals.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * valtrack.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * vtable-verify.c: Likewise. * web.c: Likewise. * wide-int.cc: Likewise. * xcoffout.c: Likewise. * config/aarch64/aarch64-builtins.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/aarch64/cortex-a57-fma-steering.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/aarch-common.c: Likewise. * config/arm/arm-builtins.c: Likewise. * config/arm/arm-c.c: Likewise. * config/arm/arm.c: Likewise. * config/avr/avr-c.c: Likewise. * config/avr/avr-log.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/cr16/cr16.c: Likewise. * config/cris/cris.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/epiphany/epiphany.c: Likewise. * config/epiphany/mode-switch-use.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/ft32/ft32.c: Likewise. * config/h8300/h8300.c: Likewise. * config/i386/i386-c.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/msformat-c.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/microblaze/microblaze-c.c: Likewise. * config/microblaze/microblaze.c: Likewise. * config/mips/mips.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/msp430/msp430-c.c: Likewise. * config/msp430/msp430.c: Likewise. * config/nds32/nds32-cost.c: Likewise. * config/nds32/nds32-fp-as-gp.c: Likewise. * config/nds32/nds32-intrinsic.c: Likewise. * config/nds32/nds32-isr.c: Likewise. * config/nds32/nds32-md-auxiliary.c: Likewise. * config/nds32/nds32-memory-manipulation.c: Likewise. * config/nds32/nds32-pipelines-auxiliary.c: Likewise. * config/nds32/nds32-predicates.c: Likewise. * config/nds32/nds32.c: Likewise. * config/nios2/nios2.c: Likewise. * config/nvptx/nvptx.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/rl78/rl78-c.c: Likewise. * config/rl78/rl78.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390-c.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh-c.c: Likewise. * config/sh/sh-mem.cc: Likewise. * config/sh/sh.c: Likewise. * config/sh/sh_optimize_sett_clrt.cc: Likewise. * config/sh/sh_treg_combine.cc: Likewise. * config/sol2-c.c: Likewise. * config/sol2-cxx.c: Likewise. * config/sol2-stubs.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc-c.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu-c.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/tilegx/mul-tables.c: Likewise. * config/tilegx/tilegx-c.c: Likewise. * config/tilegx/tilegx.c: Likewise. * config/tilepro/mul-tables.c: Likewise. * config/tilepro/tilepro-c.c: Likewise. * config/tilepro/tilepro.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/visium/visium.c: Likewise. * config/vms/vms-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. ada 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * gcc-interface/cuintp.c: Adjust includes. * gcc-interface/decl.c: Likewise. * gcc-interface/misc.c: Likewise. * gcc-interface/targtyps.c: Likewise. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. c 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * c-array-notation.c: Adjust includes. * c-aux-info.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-errors.c: Likewise. * c-lang.c: Likewise. * c-objc-common.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. c-family 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * array-notation-common.c: Adjust includes. * c-ada-spec.c: Likewise. * c-cilkplus.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-gimplify.c: Likewise. * c-indentation.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pretty-print.c: Likewise. * c-semantics.c: Likewise. * c-ubsan.c: Likewise. * cilk.c: Likewise. * stub-objc.c: Likewise. cp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * call.c: Adjust includes. * class.c: Likewise. * constexpr.c: Likewise. * cp-array-notation.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * cp-objcp-common.c: Likewise. * cp-ubsan.c: Likewise. * cvt.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * dump.c: Likewise. * error.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * friend.c: Likewise. * init.c: Likewise. * lambda.c: Likewise. * lex.c: Likewise. * mangle.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * ptree.c: Likewise. * repo.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. fortran 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * convert.c: Adjust includes. * cpp.c: Likewise. * decl.c: Likewise. * f95-lang.c: Likewise. * iresolve.c: Likewise. * match.c: Likewise. * module.c: Likewise. * options.c: Likewise. * target-memory.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-const.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-io.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. go 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * go-backend.c: Adjust includes. * go-gcc.cc: Likewise. * go-lang.c: Likewise. java 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * boehm.c: Adjust includes. * builtins.c: Likewise. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * java-gimplify.c: Likewise. * jcf-dump.c: Likewise. * jcf-io.c: Likewise. * jcf-parse.c: Likewise. * jvgenmain.c: Likewise. * lang.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. jit 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * dummy-frontend.c: Adjust includes. * jit-common.h: Likewise. * jit-playback.c: Likewise. lto 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * lto-lang.c: Adjust includes. * lto-object.c: Likewise. * lto-partition.c: Likewise. * lto-symtab.c: Likewise. * lto.c: Likewise. objc 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objc-act.c: Adjust includes. * objc-encoding.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-lang.c: Likewise. * objc-map.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-runtime-shared-support.c: Likewise. objcp 2015-07-07 Andrew MacLeod <amacleod@redhat.com> * objcp-decl.c: Adjust includes. * objcp-lang.c: Likewise. From-SVN: r225531
2015-07-08 02:53:03 +02:00
#include "ssa.h"
alias.c: Reorder #include statements and remove duplicates. 2015-10-29 Andrew MacLeod <amacleod@redhat.com> * alias.c: Reorder #include statements and remove duplicates. * asan.c: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * ccmp.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * cppbuiltin.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * data-streamer.c: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * debug.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dfp.c: Likewise. * dojump.c: Likewise. * dominance.c: Likewise. * double-int.c: Likewise. * dse.c: Likewise. * dumpfile.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * final.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * generic-match-head.c: Likewise. * ggc-common.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-match-head.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimple.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * godump.c: Likewise. * graph.c: Likewise. * graphite-poly.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * internal-fn.c: Likewise. * ipa-chkp.c: Likewise. * ipa-comdats.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-visibility.c: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-assigns.c: Likewise. * lra-coalesce.c: Likewise. * lra-constraints.c: Likewise. * lra-eliminations.c: Likewise. * lra-lives.c: Likewise. * lra-remat.c: Likewise. * lra-spills.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * realmpfr.c: Likewise. * recog.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regrename.c: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl-chkp.c: Likewise. * rtl-error.c: Likewise. * rtlanal.c: Likewise. * rtlhooks.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sese.c: Likewise. * shrink-wrap.c: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * statistics.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * symtab.c: Likewise. * target-globals.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp-opt.c: Likewise. * tree-chkp.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vtable-verify.c: Likewise. * web.c: Likewise. * wide-int-print.cc: Likewise. * wide-int.cc: Likewise. * xcoffout.c: Likewise. From-SVN: r229526
2015-10-29 14:57:32 +01:00
#include "gimple-pretty-print.h"
genattrtab.c (write_header): Include hash-set.h... 2015-01-09 Michael Collison <michael.collison@linaro.org> * genattrtab.c (write_header): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-attrtab.c. * genautomata.c (main) : Include hash-set.h, macInclude hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-automata.c. * genemit.c (main): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-emit.c. * gengtype.c (open_base_files): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating gtype-desc.c. * genopinit.c (main): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-opinit.c. * genoutput.c (output_prologue): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-output.c. * genpeep.c (main): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-peep.c. * genpreds.c (write_insn_preds_c): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-preds.c. * optc-save-gen-awk: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating options-save.c. * opth-gen.awk: Change include guard from GCC_C_COMMON_H to GCC_C_COMMON_C when generating options.h. * ada/gcc-interface/cuintp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ada/gcc-interface/decl.c: ditto. * ada/gcc-interface/misc.c: ditto. * ada/gcc-interface/targtyps.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ada/gcc-interface/trans.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, real.h, fold-const.h, wide-int.h, inchash.h due to flattening of tree.h. * ada/gcc-interface/utils.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ada/gcc-interface/utils2.c: ditto. * alias.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * asan.c: ditto. * attribs.c: ditto. * auto-inc-dec.c: ditto. * auto-profile.c: ditto * bb-reorder.c: ditto. * bt-load.c: Include symtab.h due to flattening of tree.h. * builtins.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c/c-array-notation.c: ditto. * c/c-aux-info.c: ditto. * c/c-convert.c: ditto. * c/c-decl.c: ditto. * c/c-errors.c: ditto. * c/c-lang.c: dittoxs. * c/c-objc-common.c: ditto. * c/c-parser.c: ditto. * c/c-typeck.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * calls.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ccmp.c: ditto. * c-family/array-notation-common.c: ditto. * c-family/c-ada-spec.c: ditto. * c-family/c-cilkplus.c: ditto. * c-family/c-common.c: Include input.h due to flattening of tree.h. Define macro GCC_C_COMMON_C. * c-family/c-common.h: Flatten tree.h header files into c-common.h. Remove include of tree-core.h. * c-family/c-cppbuiltin.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/c-dump.c: ditto. * c-family/c-format.c: Flatten tree.h header files into c-common.h. * c-family/c-cppbuiltin.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/c-dump.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/c-format.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * c-family/c-gimplify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/cilk.c: ditto. * c-family/c-lex.c: ditto. * c-family/c-omp.c: ditto. * c-family/c-opts.c: ditto. * c-family/c-pch.c: ditto. * c-family/c-ppoutput.c: ditto. * c-family/c-pragma.c: ditto. * c-family/c-pretty-print.c: ditto. * c-family/c-semantics.c: ditto. * c-family/c-ubsan.c: ditto. * c-family/stub-objc.c: ditto. * cfgbuild.c: ditto. * cfg.c: ditto. * cfgcleanup.c: ditto. * cfgexpand.c: ditto. * cfghooks.c: ditto. * cfgloop.c: Include symtab.h, fold-const.h, and inchash.h due to flattening of tree.h. * cfgloopmanip.c: ditto. * cfgrtl.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * cgraphbuild.c: ditto. * cgraph.c: ditto. * cgraphclones.c: ditto. * cgraphunit.c: ditto. * cilk-common.c: ditto. * combine.c: ditto. * combine-stack-adj.c: Include symbol.h due to flattening of tree.h. * config/aarch64/aarch64-builtins.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/aarch64/aarch64.c: ditto. * config/alpha/alpha.c: ditto. * config/arc/arc.c: ditto. * config/arm/aarch-common.c: ditto. * config/arm/arm-builtins.c: ditto. * config/arm/arm.c: ditto. * config/arm/arm-c.c: ditto. * config/avr/avr.c: ditto. * config/avr/avr-c.c: ditto. * config/avr/avr-log.c: ditto. * config/bfin/bfin.c: ditto. * config/c6x/c6x.c: ditto. * config/cr16/cr16.c: ditto. * config/cris/cris.c: ditto. * config/darwin.c: ditto. * config/darwin-c.c: ditto. * config/default-c.c: ditto. * config/epiphany/epiphany.c: ditto. * config/fr30/fr30.c: ditto. * config/frv/frv.c: ditto. * config/glibc-c.c: ditto. * config/h8300/h8300.c: ditto. * config/i386/i386.c: ditto. * config/i386/i386-c.c: ditto. * config/i386/msformat.c: ditto. * config/i386/winnt.c: ditto. * config/i386/winnt-cxx.c: ditto. * config/i386/winnt-stubs.c: ditto. * config/ia64/ia64.c: ditto. * config/ia64/ia64-c.c: ditto. * config/iq2000/iq2000.c: ditto. * config/lm32/lm32.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/m32c/m32c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/m32c/m32c-pragma.c: ditto. * config/m32c/m32cr.c: ditto. * config/m68/m68k.c: ditto. * config/mcore/mcore.c: ditto. * config/mep/mep.c: ditto. * config/mep/mep-pragma.c: ditto. * config/microblaze/microblaze.c: ditto. * config/microblaze/microblaze-c.c: ditto. * config/mips/mips.c: ditto. * config/mmix/mmix.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/mn10300/mn10300.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/moxie/moxie.c: ditto. * config/msp430/msp430.c: ditto. * config/msp430/msp430-c.c: ditto. * config/nds32/nds32.c: ditto. * config/nds32/nds32-cost.c: ditto. * config/nds32/nds32-fp-as-gp.c: ditto. * config/nds32/nds32-intrinsic.c: ditto. * config/nds32/nds32-isr.c: ditto. * config/nds32/nds32-md-auxillary.c: ditto. * config/nds32/nds32-memory-manipulationx.c: ditto. * config/nds32/nds32-pipelines-auxillary.c: ditto. * config/nds32/nds32-predicates.c: ditto. * config/nios2/nios2.c: ditto. * config/nvptx/nvptx.c: ditto. * config/pa/pa.c: ditto. * config/pdp11/pdp11x.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/rl78/rl78.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/rl78/rl78-cx.c: ditto. * config/rs6000/rs6000.c: ditto. * config/rs6000/rs6000-c.c: ditto. * config/rx/rx.c: ditto. * config/s390/s390.c: ditto. * config/sh/sh.c: ditto. * config/sh/sc.c: ditto. * config/sh/sh-mem.cc: ditto. * config/sh/sh_treg_combine.cc: Include symtab.h, inchash.h and tree.h due to flattening of tree.h. Remove include of tree-core.h. * config/sol2.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/sol2-c.c: ditto. * config/sol2-cxx.c: ditto. * config/sol2-stubs.c: ditto. * config/sparc/sparc.c: ditto. * config/sparc/sparc-cx.c: ditto. * config/spu/spu.c: ditto. * config/spu/spu-c.c: ditto * config/storym16/stormy16.c: ditto. * config/tilegx/tilegx.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/tilepro/gen-mul-tables.cc: Include symtab.h in generated file. * config/tilegx/tilegx-c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/tilepro/tilepro.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/tilepro/tilepro-c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/v850/v850.c: ditto. * config/v850/v850-c.c: ditto. * config/vax/vax.c: ditto. * config/vms/vms.c: ditto. * config/vms/vms-c.c: ditto. * config/vxworks.c: ditto. * config/winnt-c.c: ditto. * config/xtensa/xtensa.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * convert.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * coverage.c: ditto. * cp/call.c: ditto. * cp/class.c: ditto. * cp/constexpr.c: ditto. * cp/cp-array-notation.c: ditto. * cp/cp-gimplify.c: ditto. * cp/cp-lang.c: ditto. * cp/cp-objcp-common.c: ditto. * cp/cvt.c: ditto. * cp/decl2.c: ditto. * cp/decl.c: ditto. * cp/dump.c: ditto. * cp/error.c: ditto. * cp/except.c: ditto. * cp/expr.c: ditto. * cp/friend.c: ditto. * cp/init.c: ditto. * cp/lambda.c: ditto. * cp/lex.c: ditto. * cp/mangle.c: ditto. * cp/name-lookup.c: ditto. * cp/optimize.c: ditto. * cp/parser.c: ditto. * cp/pt.c: ditto. * cp/ptree.c: ditto. * cp/repo.c: ditto. * cp/rtti.c: ditto. * cp/search.c: ditto. * cp/semantics.c: ditto. * cp/tree.c: ditto. * cp/typeck2.c: ditto. * cp/typeck.c: ditto. * cppbuiltin.c: ditto. * cprop.c: ditto. * cse.c: Add include of symtab.h due to flattening of tree.h. * cselib.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * data-streamer.c: ditto. * data-streamer-in.c: ditto. * data-streamer-out.c: ditto. * dbxout.c: ditto. * dce.c: ditto. * ddg.c: Add include of symtab.h due to flattening of tree.h. * debug.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * dfp.c: ditto. * df-scan.c: ditto. * dojump.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * double-int.c: ditto. * dse.c: ditto. * dumpfile.c: ditto. * dwarf2asm.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * dwarf2cfi.c: ditto. * dwarf2out.c: ditto. * emit-rtl.c: ditto. * except.c: ditto. * explow.c: ditto. * expmed.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * expr.c: ditto. * final.c: ditto. * fixed-value.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and fixed-value.h due to flattening of tree.h. * fold-const.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. Relocate inline function convert_to_ptrofftype_loc from tree.h. Relocate inline function fold_build_pointer_plus_loc from tree.h. Relocate inline function fold_build_pointer_plus_hwi_loc from tree.h. * fold-const.h: Relocate macro convert_to_ptrofftype from tree.h. Relocate macro fold_build_pointer_plus to relocate from tree.h.h. Relocate macro fold_build_pointer_plus_hwi from tree.h. Add prototype for convert_to_ptrofftype_loc relocated from tree.h. Add prototype for fold_build_pointer_plus_loc relocated from tree.h. Add prototype for fold_build_pointer_plus_hwi_loc relocated from tree.h. * fortran/convert.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/cpp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/decl.c: ditto. * fortran/f95.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/iresolve.c: ditto. * fortran/match.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/module.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/options.c: ditto. * fortran/target-memory.c: Include hash-set.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-array.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-common.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-const.c: ditto. * fortran/trans-decl.c: ditto. * fortran/trans-expr.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-intrinsic.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * fortran/trans-io.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-openmp.c: ditto. * fortran/trans-stmt.c: ditto. * fortran/trans-types.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * function.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gcc-plugin.h: Include statistics.h, double-int.h, real.h, fixed-value.h, alias.h, flags.h, and symtab.h due to flattening of tree.h * gcse.c: ditto. * generic-match-head.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ggc-page.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimple-builder.c: ditto. * gimple.c: ditto. * gimple-expr.c: ditto. * gimple-fold.c: ditto. * gimple-iterator.c: ditto. * gimple-low.c: ditto. * gimple-match-head.c: ditto. * gimple-pretty-print.c: ditto. * generic-ssa-isolate-paths.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimple-ssa-strength-reduction.c: ditto. * gimple-streamer-in.c: ditto. * gimple-streamer-out.c: ditto. * gimple-walk.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimplify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimplify-me.c: ditto. * go/go-gcc.cc: ditto. * go/go-lang.c: ditto. * go/gdump.c: ditto. * graphite-blocking.c: ditto. * graphite.c: ditto. * graphite-dependencies.c: ditto. * graphite-interchange.c: ditto. * graphite-isl-ast-to-gimple.c: ditto. * graphite-optimize-isl.c: ditto. * graphite-poly.c: ditto. * graphite-scop-detection.c: ditto. * graphite-sese-to-poly.c: ditto. * hw-doloop.c: Include symtab.h due to flattening of tree.h. * ifcvt.c: ditto. * init-regs.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * internal-fc.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h,options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa.c: ditto. * ipa-chkp.c: ditto. * ipa-comdats.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-cp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h,options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-devirt.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-icf.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h,options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-icf-gimple.c: ditto. * ipa-inline-analysis.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-inline.c: ditto. * ipa-inline-transform.c: ditto. * ipa-polymorhpic-call.c: ditto. * ipa-profile.c: ditto. * ipa-prop.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-pure-const.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-ref.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-reference.c: ditto. * ipa-split.c: ditto. * ipa-utils.c: ditto. * ipa-visbility.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ira.c: ditto. * ira-color.c: Include hash-set.h due to flattening of tree.h. * ira-costs.c: ditto. * ira-emit.c: ditto. * java/boehm.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/builtins.c: ditto. * java/class.c: ditto. * java/constants.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/decl.c: ditto. * java/except.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/expr.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h,inchash.h and real.h due to flattening of tree.h. * java/gimplify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/jcf-dump.c: ditto. * java/jcf-io.c: ditto. * java/jcf-parse.c: ditto. * java/jvgenmain.c: ditto. * java/lang.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/mangle.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/mangle_name.c: ditto. * java/resource.c: ditto. * java/typeck.c: ditto. * java/verify-glue.c: ditto. * java/verify-impl.c: ditto. * jump.c: Include symtab.h due to flattening of tree.h. * langhooks.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * loop-doloop.c: Include symtab.h due to flattening of tree.h. * loop-init.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * loop-invariant.c: Include symtab.h due to flattening of tree.h. * loop-iv.c: ditto. * loop-unroll.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lower-subreg.c: ditto. * lra-assigns.c: Include symtab.h due to flattening of tree.h. * lra.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * lra-coalesce.c: Include symtab.h due to flattening of tree.h. * lra-constraints.c: ditto. * lra-eliminations.c: ditto. * lra-livesc: ditto. * lra-remat.c: ditto. * lra-spills.c: ditto. * lto/lto.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto/lto-lang.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto/lto-object.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto/lto-partition.c: ditto. * lto/lto-symtab.c: ditto. * lto-cgraph.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto-compress.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto-opts.c: ditto. * lto-section-in.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto-section-out.c: ditto. * lto-streamer.c: ditto. * lto-streamer-in.c: ditto. * lto-streamer-out.c: ditto. * modulo-sched.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * objc/objc-act.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * objc/objc-encoding.c: ditto. * objc/objc-gnu-runtime-abi-01.c: ditto. * objc/objc-lang.c: ditto. * objc/objc-map.c: ditto. * objc/objc-next-runtime-abi-01.c: ditto. * objc/objc-next-runtime-abi-02.c: ditto. * objc/objc-runtime-shared-support.c: ditto. * objcp/objcp-decl.c: ditto. * objcp/objcp-lang.c: ditto. * omega.c: ditto. * omega-low.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * optabs.c: ditto. * opts-global.c: ditto. * passes.c: ditto. * plugin.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * postreload.c: Include symtab.h due to flattening of tree.h. * postreload-gcse.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * predict.c: ditto. * print-rtl.c: ditto. * print-tree.c: ditto. * profile.c: Include symtab.h, fold-const.h and inchash.h due to flattening of tree.h. * real.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * realmpfr.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * recog.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ree.c: ditto. * reginfo.c: ditto. * reg-stack.c: ditto. * reload1.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * reload.c: Include symtab.h due to flattening of tree.h. * reorg.c: ditto. * rtlanal.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * rtl-chkp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * rtlhooks.c: Include symtab.h due to flattening of tree.h. * sanopt.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * sched-deps.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * sched-vis.c: ditto. * sdbout.c: ditto. * sel-sched.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * sel-sched-ir.c: ditto. * sese.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * shrink-wrap.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * simplify-rtx.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * stack-ptr-mod.c: ditto. * stmt.c: ditto. * store-motion.c: ditto. * store-layout.c: ditto. * stringpool.c: ditto. * symtab.c: ditto. * target-globals.c: ditto. * targhooks.c: ditto. * toplev.c: ditto. * tracer.c: ditto. * trans-mem.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-affine.c: ditto. * tree-browser.c: ditto. * tree.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-call-cdce.c: Include symtab.h, alias.h, double-int.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-cfg.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-cfgcleanup.c: ditto. * tree-chkp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-chkp-opt.c: ditto. * tree-chrec.c: ditto. * tree-chkp-opt.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-core.h: Flatten header file by removing all #include statements. * tree-data-ref.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-dfa.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-diagnostic.c: ditto. * tree-dump.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * tree-dfa.c: ditto. * tree-eh.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-emutls.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree.h: Flatten header files by removing all includes except tree-core.h. Remove inline function convert_to_ptrofftype_loc to relocate to fold-const.c. Remove macro convert_to_ptrofftype to relocate to fold-const.h. Remove inline function fold_build_pointer_plus_loc to relocate to fold-const.c. Remove macro fold_build_pointer_plus to relocate to fold-const.h. Remove inline function fold_build_pointer_plus_hwi_loc to relocate to fold-const.c. Remove macro fold_build_pointer_plus_hwi to relocate to fold-const.h. * tree-if-conv.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * tree-inline.c: ditto. * tree-into-ssa.c: ditto. * tree-iterator.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-loop-distribution.c: ditto. * tree-nested.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-nrv.c: ditto. * tree-object-size.c: ditto. * tree-outof-ssa.c: ditto. * tree-parloops.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-phinodes.c: ditto. * tree-predcom.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-pretty-print.c: ditto. * tree-profile.c: double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-scalar-evolution.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-sra.c: Include vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-ssa-alias.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa.c: ditto. * tree-ssa-ccp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-ssa-coalesce.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-copy.c: ditto. * tree-ssa-copyrename.c: ditto. * tree-ssa-dce.c: ditto. * tree-ssa-dom.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-ssa-dse.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-forwprop.c: ditto. * tree-ssa-ifcombine.c: ditto. * tree-ssa-live.c: ditto. * tree-ssa-loop.c: ditto. * tree-ssa-loop-ch.c: ditto. * tree-ssa-loop-im.c: ditto. * tree-ssa-loop-ivcanon.c: ditto. * tree-ssa-loop-ivopts.c: ditto. * tree-ssa-loop-manip.c: ditto. * tree-ssa-loop-niter.c: ditto. * tree-ssa-loop-prefetch.c: ditto. * tree-ssa-loop-unswitch.c: ditto. * tree-ssa-loop-math-opts.c: ditto. * tree-ssanames.c: ditto. * tree-ssa-operands.c: ditto. * tree-ssa-phiopt.c: ditto. * tree-ssa-phiprop.c: ditto. * tree-ssa-pre.c: ditto. * tree-ssa-propagate.c: ditto. * tree-ssa-reassoc.c: ditto. * tree-ssa-sccvn.c: ditto. * tree-ssa-sink.c: ditto. * tree-ssa-strlen.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-structalias.c: double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-tail-merge.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-ter.c: ditto. * tree-ssa-threadedge.c: ditto. * tree-ssa-threadupdate.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-uncprop.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-uninit.c: ditto. * tree-stdarg.c: Include vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-streamer.c: Include vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-streamer-in.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * tree-streamer-out.c: dittoo. * tree-switch-conversion.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-tailcall.c: ditto. * tree-vect-data-refs.c: ditto. * tree-vect-generic.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-vect-loop.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-vect-loop-manip.c: ditto. * tree-vectorizer.c: ditto. * tree-vect-patterns.c: ditto. * tree-vect-slp.c: ditto. * tree-vect-stmts.c: ditto. * tree-vrp.c: ditto. * tsan.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * ubsan.c: ditto. * value-prof.c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * varasm.c: ditto. * varpool.c: ditto. * var-tracking.c: ditto. * vmsdbgout.c: ditto. * vtable-verify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * wide-int.cc: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * xcoffout.c: ditto. * libcc1/plugin.cc: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. From-SVN: r219402
2015-01-09 21:18:42 +01:00
#include "fold-const.h"
Factor unrelated declarations out of tree.h. This patch applies the rule that functions defined in FOO.c must be declared in FOO.h. One of the worst offenders in the code base is tree.h, unsurprisingly. The patch creates several new headers: attribs.h calls.h fold-const.h gcc-symtab.h print-rtl.h print-tree.h stmt.h stor-layout.h stringpool.h tree-nested.h tree-object-size.h varasm.h. Functions in each corresponding .c file got moved to those headers and others that already existed. I wanted to make this patch as mechanical as possible, so I made no attempt to fix problems like having build_addr defined in tree-inline.c. I left that for later. There were some declarations that I could not move out of tree.h because of header poisoning or the use of target macros. We forbid the inclusion of things like expr.h from FE files. While that's a reasonable idea, the FE file *still* manage to at expr.c functionality because the declarations they want to use were defined in tree.h. The affected files are builtins.h, emit-rtl.h and expr.h. If that functionality is allowed to be accessed from the FEs, then I will later move those functions out of expr.c into tree.c. I have moved these declarations to the bottom of tree.h so they are easy to identify later. There is a namespace collision with libcpp. The file gcc/symtab.c cannot use gcc/symtab.h because the #include command picks up libcpp/include/symtab.h first. So I named this file gcc-symtab.h for now. Finally, I added a new header to PLUGIN_HEADERS to account for the tree.h refactoring. I did not add all headers factored out of tree.h because it is unclear (and impossible to tell) what plugins need. This adds the one header used by the plugins in the testsuite. This will be changing quite dramatically as we progress with the header refactoring. This patch should offer some minimal incremental build advantages by reducing the size of tree.h. Changes that would otherwise affected tree.h, will now go to other headers which are less frequently included. * tree.h: Include fold-const.h. (aggregate_value_p): Moved to function.h. (alloca_call_p): Moved to calls.h. (allocate_struct_function): Moved to function.h. (apply_tm_attr): Moved to attribs.h. (array_at_struct_end_p): Moved to expr.h. (array_ref_element_size): Moved to tree-dfa.h. (array_ref_low_bound): Moved to tree-dfa.h. (array_ref_up_bound): Moved to tree.h. (assemble_alias): Moved to cgraph.h. (bit_from_pos): Moved to stor-layout.h. (build_addr): Moved to tree-nested.h. (build_duplicate_type): Moved to tree-inline.h. (build_fold_addr_expr): Moved to fold-const.h. (build_fold_addr_expr_with_type): Moved to fold-const.h. (build_fold_addr_expr_with_type_loc): Moved to fold-const.h. (build_fold_indirect_ref): Moved to fold-const.h. (build_fold_indirect_ref_loc): Moved to fold-const.h. (build_personality_function): Moved to tree.h. (build_range_check): Moved to fold-const.h. (build_simple_mem_ref): Moved to fold-const.h. (build_simple_mem_ref_loc): Moved to fold-const.h. (build_tm_abort_call): Moved to trans-mem.h. (byte_from_pos): Moved to stor-layout.h. (call_expr_flags): Moved to calls.h. (can_move_by_pieces): Moved to expr.h. (categorize_ctor_elements): Moved to expr.h. (change_decl_assembler_name): Moved to gcc-symtab.h. (combine_comparisons): Moved to fold-const.h. (complete_ctor_at_level_p): Moved to tree.h. (component_ref_field_offset): Moved to tree-dfa.h. (compute_builtin_object_size): Moved to tree-object-size.h. (compute_record_mode): Moved to stor-layout.h. (constant_boolean_node): Moved to fold-const.h. (constructor_static_from_elts_p): Moved to varasm.h. (cxx11_attribute_p): Moved to attribs.h. (debug_body): Moved to print-tree.h. (debug_find_tree): Moved to tree-inline.h. (debug_fold_checksum): Moved to fold-const.h. (debug_head): Moved to print-tree.h. (debug_head): Moved to print-tree.h. (debug_raw): Moved to print-tree.h. (debug_tree): Moved to print-tree.h. (debug_vec_tree): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (debug_verbose): Moved to print-tree.h. (decl_attributes): Moved to attribs.h. (decl_binds_to_current_def_p): Moved to varasm.h. (decl_default_tls_model): Moved to varasm.h. (decl_replaceable_p): Moved to varasm.h. (div_if_zero_remainder): Moved to fold-const.h. (double_int mem_ref_offset): Moved to fold-const.h. (dump_addr): Moved to print-tree.h. (element_precision): Moved to machmode.h. (expand_dummy_function_end): Moved to function.h. (expand_function_end): Moved to function.h. (expand_function_start): Moved to function.h. (expand_label): Moved to stmt.h. (expr_first): Moved to tree-iterator.h. (expr_last): Moved to tree-iterator.h. (finalize_size_functions): Moved to stor-layout.h. (finish_builtin_struct): Moved to stor-layout.h. (finish_record_layout): Moved to stor-layout.h. (fixup_signed_type): Moved to stor-layout.h. (fixup_unsigned_type): Moved to stor-layout.h. (flags_from_decl_or_type): Moved to calls.h. (fold): Moved to fold-const.h. (fold_abs_const): Moved to fold-const.h. (fold_binary): Moved to fold-const.h. (fold_binary_loc): Moved to fold-const.h. (fold_binary_to_constant): Moved to fold-const.h. (fold_build1): Moved to fold-const.h. (fold_build1_initializer_loc): Moved to fold-const.h. (fold_build1_loc): Moved to fold-const.h. (fold_build1_stat_loc): Moved to fold-const.h. (fold_build2): Moved to fold-const.h. (fold_build2_initializer_loc): Moved to fold-const.h. (fold_build2_loc): Moved to fold-const.h. (fold_build2_stat_loc): Moved to fold-const.h. (fold_build3): Moved to fold-const.h. (fold_build3_loc): Moved to fold-const.h. (fold_build3_stat_loc): Moved to fold-const.h. (fold_build_call_array): Moved to fold-const.h. (fold_build_call_array_initializer): Moved to fold-const.h. (fold_build_call_array_initializer_loc): Moved to fold-const.h. (fold_build_call_array_loc): Moved to fold-const.h. (fold_build_cleanup_point_expr): Moved to fold-const.h. (fold_convert): Moved to fold-const.h. (fold_convert_loc): Moved to fold-const.h. (fold_convertible_p): Moved to fold-const.h. (fold_defer_overflow_warnings): Moved to fold-const.h. (fold_deferring_overflow_warnings_p): Moved to fold-const.h. (fold_fma): Moved to fold-const.h. (fold_ignored_result): Moved to fold-const.h. (fold_indirect_ref): Moved to fold-const.h. (fold_indirect_ref_1): Moved to fold-const.h. (fold_indirect_ref_loc): Moved to fold-const.h. (fold_read_from_constant_string): Moved to fold-const.h. (fold_real_zero_addition_p): Moved to fold-const.h. (fold_single_bit_test): Moved to fold-const.h. (fold_strip_sign_ops): Moved to fold-const.h. (fold_ternary): Moved to fold-const.h. (fold_ternary_loc): Moved to fold-const.h. (fold_unary): Moved to tree-data-ref.h. (fold_unary_ignore_overflow): Moved to fold-const.h. (fold_unary_ignore_overflow_loc): Moved to fold-const.h. (fold_unary_loc): Moved to fold-const.h. (fold_unary_to_constant): Moved to fold-const.h. (fold_undefer_and_ignore_overflow_warnings): Moved to fold-const.h. (fold_undefer_overflow_warnings): Moved to fold-const.h. (folding_initializer): Moved to fold-const.h. (free_temp_slots): Moved to function.h. (generate_setjmp_warnings): Moved to function.h. (get_attribute_name): Moved to attribs.h. (get_identifier): Moved to stringpool.h. (get_identifier_with_length): Moved to stringpool.h. (get_inner_reference): Moved to tree.h. (gimple_alloca_call_p): Moved to calls.h. (gimplify_parameters): Moved to function.h. (highest_pow2_factor): Moved to expr.h. (indent_to): Moved to print-tree.h. (init_attributes): Moved to attribs.h. (init_dummy_function_start): Moved to function.h. (init_function_start): Moved to function.h. (init_inline_once): Moved to tree-inline.h. (init_object_sizes): Moved to tree-object-size.h. (init_temp_slots): Moved to function.h. (init_tree_optimization_optabs): Moved to optabs.h. (initialize_sizetypes): Moved to stor-layout.h. (initializer_constant_valid_for_bitfield_p): Moved to varasm.h. (initializer_constant_valid_p): Moved to varasm.h. (int_const_binop): Moved to fold-const.h. (internal_reference_types): Moved to stor-layout.h. (invert_tree_comparison): Moved to fold-const.h. (invert_truthvalue): Moved to fold-const.h. (invert_truthvalue_loc): Moved to fold-const.h. (is_tm_ending_fndecl): Moved to trans-mem.h. (is_tm_may_cancel_outer): Moved to trans-mem.h. (is_tm_pure): Moved to trans-mem.h. (is_tm_safe): Moved to trans-mem.h. (layout_decl): Moved to stor-layout.h. (layout_type): Moved to stor-layout.h. (lookup_attribute_spec): Moved to attribs.h. (make_accum_type): Moved to stor-layout.h. (make_decl_one_only): Moved to varasm.h. (make_decl_rtl): Moved to tree.h. (make_decl_rtl_for_debug): Moved to varasm.h. (make_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_sat_unsigned_fract_type): Moved to stor-layout.h. (make_or_reuse_signed_accum_type): Moved to stor-layout.h. (make_or_reuse_signed_fract_type): Moved to stor-layout.h. (make_or_reuse_unsigned_accum_type): Moved to stor-layout.h. (make_or_reuse_unsigned_fract_type): Moved to stor-layout.h. (make_range): Moved to fold-const.h. (make_range_step): Moved to fold-const.h. (make_sat_signed_accum_type): Moved to stor-layout.h. (make_sat_signed_fract_type): Moved to stor-layout.h. (make_sat_unsigned_accum_type): Moved to stor-layout.h. (make_sat_unsigned_fract_type): Moved to stor-layout.h. (make_signed_accum_type): Moved to stor-layout.h. (make_signed_fract_type): Moved to stor-layout.h. (make_signed_type): Moved to stor-layout.h. (make_unsigned_accum_type): Moved to stor-layout.h. (make_unsigned_fract_type): Moved to stor-layout.h. (make_unsigned_type): Moved to stor-layout.h. (mark_decl_referenced): Moved to varasm.h. (mark_referenced): Moved to varasm.h. (may_negate_without_overflow_p): Moved to fold-const.h. (maybe_get_identifier): Moved to stringpool.h. (merge_ranges): Moved to fold-const.h. (merge_weak): Moved to varasm.h. (mode_for_size_tree): Moved to stor-layout.h. (multiple_of_p): Moved to fold-const.h. (must_pass_in_stack_var_size): Moved to calls.h. (must_pass_in_stack_var_size_or_pad): Moved to calls.h. (native_encode_expr): Moved to fold-const.h. (native_interpret_expr): Moved to fold-const.h. (non_lvalue): Moved to fold-const.h. (non_lvalue_loc): Moved to fold-const.h. (normalize_offset): Moved to stor-layout.h. (normalize_rli): Moved to stor-layout.h. (notice_global_symbol): Moved to varasm.h. (omit_one_operand): Moved to fold-const.h. (omit_one_operand_loc): Moved to fold-const.h. (omit_two_operands): Moved to fold-const.h. (omit_two_operands_loc): Moved to fold-const.h. (operand_equal_p): Moved to tree-data-ref.h. (parse_input_constraint): Moved to stmt.h. (parse_output_constraint): Moved to stmt.h. (place_field): Moved to stor-layout.h. (pop_function_context): Moved to function.h. (pop_temp_slots): Moved to function.h. (pos_from_bit): Moved to stor-layout.h. (preserve_temp_slots): Moved to function.h. (print_node): Moved to print-tree.h. (print_node_brief): Moved to print-tree.h. (print_rtl): Moved to rtl.h. (process_pending_assemble_externals): Moved to varasm.h. (ptr_difference_const): Moved to fold-const.h. (push_function_context): Moved to function.h. (push_struct_function): Moved to function.h. (push_temp_slots): Moved to function.h. (record_tm_replacement): Moved to trans-mem.h. (relayout_decl): Moved to stor-layout.h. (resolve_asm_operand_names): Moved to stmt.h. (resolve_unique_section): Moved to varasm.h. (rli_size_so_far): Moved to stor-layout.h. (rli_size_unit_so_far): Moved to stor-layout.h. (round_down): Moved to fold-const.h. (round_down_loc): Moved to fold-const.h. (round_up): Moved to fold-const.h. (round_up_loc): Moved to fold-const.h. (set_decl_incoming_rtl): Moved to emit-rtl.h. (set_decl_rtl): Moved to tree.h. (set_min_and_max_values_for_integral_type): Moved to stor-layout.h. (set_user_assembler_name): Moved to varasm.h. (setjmp_call_p): Moved to calls.h. (size_binop): Moved to fold-const.h. (size_binop_loc): Moved to fold-const.h. (size_diffop): Moved to fold-const.h. (size_diffop_loc): Moved to fold-const.h. (size_int_kind): Moved to fold-const.h. (stack_protect_epilogue): Moved to function.h. (start_record_layout): Moved to stor-layout.h. (supports_one_only): Moved to varasm.h. (swap_tree_comparison): Moved to fold-const.h. (tm_malloc_replacement): Moved to trans-mem.h. (tree build_fold_addr_expr_loc): Moved to fold-const.h. (tree build_invariant_address): Moved to fold-const.h. (tree_binary_nonnegative_warnv_p): Moved to fold-const.h. (tree_binary_nonzero_warnv_p): Moved to fold-const.h. (tree_call_nonnegative_warnv_p): Moved to fold-const.h. (tree_expr_nonnegative_p): Moved to fold-const.h. (tree_expr_nonnegative_warnv_p): Moved to fold-const.h. (tree_output_constant_def): Moved to varasm.h. (tree_overlaps_hard_reg_set): Moved to stmt.h. (tree_single_nonnegative_warnv_p): Moved to fold-const.h. (tree_single_nonzero_warnv_p): Moved to fold-const.h. (tree_swap_operands_p): Moved to fold-const.h. (tree_unary_nonnegative_warnv_p): Moved to fold-const.h. (tree_unary_nonzero_warnv_p): Moved to fold-const.h. (update_alignment_for_field): Moved to stor-layout.h. (use_register_for_decl): Moved to function.h. (variable_size): Moved to rtl.h. (vector_type_mode): Moved to stor-layout.h. * cgraph.h: Corresponding changes. * emit-rtl.h: Corresponding changes. * expr.h: Corresponding changes. * function.h: Corresponding changes. * optabs.h: Corresponding changes. * trans-mem.h: Corresponding changes. Protect against multiple inclusion. * tree-inline.h: Corresponding changes. * tree-iterator.h: Corresponding changes. * tree-dfa.h: Include expr.h. * tree-ssanames.h: Include stringpool.h. * attribs.h: New file. * calls.h: New file. * fold-const.h: New file. * gcc-symtab.h: New file. * print-rtl.h: New file. * print-tree.h: New file. * stmt.h: New file. * stor-layout.h: New file. * strinpool.h: New file. * tree-nested.h: New file * tree-object-size.h: New file. * varasm.h: New file. * Makefile.in (PLUGIN_HEADERS): Add stringpool.h. * alias.c: Include varasm.h. Include expr.h. * asan.c: Include calls.h. Include stor-layout.h. Include varasm.h. * attribs.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. * builtins.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. Include tree-object-size.h. * calls.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include attribs.h. * cfgexpand.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. * cgraph.c: Include varasm.h. Include calls.h. Include print-tree.h. * cgraphclones.c: Include stringpool.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * cgraphunit.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * cilk-common.c: Include stringpool.h. Include stor-layout.h. * combine.c: Include stor-layout.h. * config/aarch64/aarch64-builtins.c: Include stor-layout.h. Include stringpool.h. Include calls.h. * config/aarch64/aarch64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/alpha/alpha.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/arc/arc.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. Include calls.h. * config/arm/arm.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/avr/avr-c.c: Include stor-layout.h. * config/avr/avr-log.c: Include print-tree.h. * config/avr/avr.c: Include print-tree.h. Include calls.h. Include stor-layout.h. Include stringpool.h. * config/bfin/bfin.c: Include varasm.h. Include calls.h. * config/c6x/c6x.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/cr16/cr16.c: Include stor-layout.h. Include calls.h. * config/cris/cris.c: Include varasm.h. Include stor-layout.h. Include calls.h. Include stmt.h. * config/darwin.c: Include stringpool.h. Include varasm.h. Include stor-layout.h. * config/epiphany/epiphany.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/fr30/fr30.c: Include stor-layout.h. Include varasm.h. * config/frv/frv.c: Include varasm.h. Include stor-layout.h. Include stringpool.h. * config/h8300/h8300.c: Include stor-layout.h. Include varasm.h. Include calls.h. Include stringpool.h. * config/i386/i386.c: Include stringpool.h. Include attribs.h. Include calls.h. Include stor-layout.h. Include varasm.h. * config/i386/winnt-cxx.c: Include stringpool.h. Include attribs.h. * config/i386/winnt.c: Include stringpool.h. Include varasm.h. * config/ia64/ia64-c.c: Include stringpool.h. * config/ia64/ia64.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/iq2000/iq2000.c: Include stor-layout.h. Include calls.h. Include varasm.h. * config/lm32/lm32.c: Include calls.h. * config/m32c/m32c.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/m32r/m32r.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/m68k/m68k.c: Include calls.h. Include stor-layout.h. Include varasm.h. * config/mcore/mcore.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. Include calls.h. * config/mep/mep.c: Include varasm.h. Include calls.h. Include stringpool.h. Include stor-layout.h. * config/microblaze/microblaze.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mips/mips.c: Include varasm.h. Include stringpool.h. Include stor-layout.h. Include calls.h. * config/mmix/mmix.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/mn10300/mn10300.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/moxie/moxie.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/msp430/msp430.c: Include stor-layout.h. Include calls.h. * config/nds32/nds32.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/pa/pa.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include calls.h. * config/pdp11/pdp11.c: Include stor-layout.h. Include varasm.h. Include calls.h. * config/picochip/picochip.c: Include calls.h. Include stor-layout.h. Include stringpool.h. Include varasm.h. * config/rl78/rl78.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/rs6000/rs6000-c.c: Include stor-layout.h. Include stringpool.h. * config/rs6000/rs6000.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include print-tree.h. Include varasm.h. * config/rx/rx.c: Include varasm.h. Include stor-layout.h. Include calls.h. * config/s390/s390.c: Include print-tree.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/score/score.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. * config/sh/sh-c.c: Include stringpool.h. Include attribs.h.h. * config/sh/sh.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/sol2-c.c: Include stringpool.h. Include attribs.h. * config/sol2-cxx.c: Include stringpool.h. * config/sol2.c: Include stringpool.h. Include varasm.h. * config/sparc/sparc.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/spu/spu-c.c: Include stringpool.h. * config/spu/spu.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * config/stormy16/stormy16.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilegx/tilegx.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/tilepro/tilepro.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/v850/v850-c.c: Include stringpool.h. Include attribs.h. * config/v850/v850.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include calls.h. * config/vax/vax.c: Include calls.h. Include varasm.h. * config/vms/vms.c: Include stringpool.h. * config/vxworks.c: Include stringpool.h. * config/xtensa/xtensa.c: Include stringpool.h. Include stor-layout.h. Include calls.h. Include varasm.h. * convert.c: Include stor-layout.h. * coverage.c: Include stringpool.h. Include stor-layout.h. * dbxout.c: Include varasm.h. Include stor-layout.h. * dojump.c: Include stor-layout.h. * dse.c: Include stor-layout.h. * dwarf2asm.c: Include stringpool.h. Include varasm.h. * dwarf2cfi.c: Include stor-layout.h. * dwarf2out.c: Include rtl.h. Include stringpool.h. Include stor-layout.h. Include varasm.h. Include function.h. Include emit-rtl.h. Move inclusion of rtl.h earlier in the file. * emit-rtl.c: Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * explow.c: Include stor-layout.h. * expmed.c: Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. Include varasm.h. * final.c: Include varasm.h. * fold-const.c: Include stor-layout.h. Include calls.h. Include tree-iterator.h. * function.c: Include stor-layout.h. Include varasm.h. Include stringpool.h. * genattrtab.c (write_header): Emit includes for varasm.h, stor-layout.h and calls.h. * genautomata.c (main): Likewise. * genemit.c: Likewise. * genopinit.c: Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c: Likewise. * genpreds.c (write_insn_preds_c): Likewise. * gengtype.c (open_base_files): Add stringpool.h. * gimple-expr.c: Include stringpool.h. Include stor-layout.h. * gimple-fold.c: Include stringpool.h. Include expr.h. Include stmt.h. Include stor-layout.h. * gimple-low.c: Include tree-nested.h. Include calls.h. * gimple-pretty-print.c: Include stringpool.h. * gimple-ssa-strength-reduction.c: Include stor-layout.h. Include expr.h. * gimple-walk.c: Include stmt.h. * gimple.c: Include calls.h. Include stmt.h. Include stor-layout.h. * gimplify.c: Include stringpool.h. Include calls.h. Include varasm.h. Include stor-layout.h. Include stmt.h. Include print-tree.h. Include expr.h. * gimplify-me.c: Include stmt.h Include stor-layout.h * internal-fn.c: Include stor-layout.h. * ipa-devirt.c: Include print-tree.h. Include calls.h. * ipa-inline-analysis.c: Include stor-layout.h. Include stringpool.h. Include print-tree.h. * ipa-inline.c: Include trans-mem.h. Include calls.h. * ipa-prop.c: Include expr.h. Include stor-layout.h. Include print-tree.h. * ipa-pure-const.c: Include print-tree.h. Include calls.h. * ipa-reference.c: Include calls.h. * ipa-split.c: Include stringpool.h. Include expr.h. Include calls.h. * ipa.c: Include calls.h. Include stringpool.h. * langhooks.c: Include stringpool.h. Include attribs.h. * lto-cgraph.c: Include stringpool.h. * lto-streamer-in.c: Include stringpool.h. * lto-streamer-out.c: Include stor-layout.h. Include stringpool.h. * omp-low.c: Include stringpool.h. Include stor-layout.h. Include expr.h. * optabs.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * passes.c: Include varasm.h. * predict.c: Include calls.h. * print-rtl.c: Include print-tree.h. * print-tree.c: Include varasm.h. Include print-rtl.h. Include stor-layout.h. * realmpfr.c: Include stor-layout.h. * reg-stack.c: Include varasm.h. * sdbout.c: Include varasm.h. Include stor-layout.h. * simplify-rtx.c: Include varasm.h. * stmt.c: Include varasm.h. Include stor-layout.h. * stor-layout.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. Include print-tree.h. * symtab.c: Include rtl.h. Include print-tree.h. Include varasm.h. Include function.h. Include emit-rtl.h. * targhooks.c: Include stor-layout.h. Include varasm.h. * toplev.c: Include varasm.h. Include tree-inline.h. * trans-mem.c: Include calls.h. Include function.h. Include rtl.h. Include emit-rtl.h. * tree-affine.c: Include expr.h. * tree-browser.c: Include print-tree.h. * tree-call-cdce.c: Include stor-layout.h. * tree-cfg.c: Include trans-mem.h. Include stor-layout.h. Include print-tree.h. * tree-complex.c: Include stor-layout.h. * tree-data-ref.c: Include expr.h. * tree-dfa.c: Include stor-layout.h. * tree-eh.c: Include expr.h. Include calls.h. * tree-emutls.c: Include stor-layout.h. Include varasm.h. * tree-if-conv.c: Include stor-layout.h. * tree-inline.c: Include stor-layout.h. Include calls.h. * tree-loop-distribution.c: Include stor-layout.h. * tree-nested.c: Include stringpool.h. Include stor-layout.h. * tree-object-size.c: Include tree-object-size.h. * tree-outof-ssa.c: Include stor-layout.h. * tree-parloops.c: Include stor-layout.h. Include tree-nested.h. * tree-pretty-print.c: Include stor-layout.h. Include expr.h. * tree-profile.c: Include varasm.h. Include tree-nested.h. * tree-scalar-evolution.c: Include expr.h. * tree-sra.c: Include stor-layout.h. * tree-ssa-address.c: Include stor-layout.h. * tree-ssa-ccp.c: Include stor-layout.h. * tree-ssa-dce.c: Include calls.h. * tree-ssa-dom.c: Include stor-layout.h. * tree-ssa-forwprop.c: Include stor-layout.h. * tree-ssa-ifcombine.c: Include stor-layout.h. * tree-ssa-loop-ivopts.c: Include stor-layout.h. * tree-ssa-loop-niter.c: Include calls.h. Include expr.h. * tree-ssa-loop-prefetch.c: Include stor-layout.h. * tree-ssa-math-opts.c: Include stor-layout.h. * tree-ssa-operands.c: Include stmt.h. Include print-tree.h. * tree-ssa-phiopt.c: Include stor-layout.h. * tree-ssa-reassoc.c: Include stor-layout.h. * tree-ssa-sccvn.c: Include stor-layout.h. * tree-ssa-sink.c: Include stor-layout.h. * tree-ssa-strlen.c: Include stor-layout.h. * tree-ssa-structalias.c: Include stor-layout.h. Include stmt.h. * tree-ssa-tail-merge.c: Include stor-layout.h. Include trans-mem.h. * tree-ssa-uncprop.c: Include stor-layout.h. * tree-ssa.c: Include stor-layout.h. * tree-ssanames.c: Include stor-layout.h. * tree-streamer-in.c: Include stringpool.h. * tree-streamer-out.c: Include stor-layout.h. * tree-switch-conversion.c: Include varasm.h. Include stor-layout.h. * tree-tailcall.c: Include stor-layout.h. * tree-vect-data-refs.c: Include stor-layout.h. * tree-vect-generic.c: Include stor-layout.h. * tree-vect-loop.c: Include stor-layout.h. * tree-vect-patterns.c: Include stor-layout.h. * tree-vect-slp.c: Include stor-layout.h. * tree-vect-stmts.c: Include stor-layout.h. * tree-vectorizer.c: Include stor-layout.h. * tree-vrp.c: Include stor-layout.h. Include calls.h. * tree.c: Include stor-layout.h. Include calls.h. Include attribs.h. Include varasm.h. * tsan.c: Include expr.h. * ubsan.c: Include stor-layout.h. Include stringpool.h. * value-prof.c: Include tree-nested.h. Include calls.h. * var-tracking.c: Include varasm.h. Include stor-layout.h. * varasm.c: Include stor-layout.h. Include stringpool.h. Include gcc-symtab.h. Include varasm.h. * varpool.c: Include varasm.h. * vmsdbgout.c: Include varasm.h. * xcoffout.c: Include varasm.h. ada/ChangeLog * gcc-interface/decl.c: Include stringpool.h Include stor-layout.h * gcc-interface/misc.c: Include stor-layout.h Include print-tree.h * gcc-interface/trans.c: Include stringpool.h Include stor-layout.h Include stmt.h Include varasm.h * gcc-interface/utils.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h * gcc-interface/utils2.c: Include stringpool.h Include stor-layout.h Include attribs.h Include varasm.h c-family/ChangeLog * c-common.c: Include fold-const.h. Include stor-layout.h. Include calls.h. Include stringpool.h. Include attribs.h. Include varasm.h. Include trans-mem.h. * c-cppbuiltin.c: Include stor-layout.h. Include stringpool.h. * c-format.c: Include stringpool.h. * c-lex.c: Include stringpool.h. Include stor-layout.h. * c-pragma.c: Include stringpool.h. Include attribs.h. Include varasm.h. Include gcc-symtab.h. * c-pretty-print.c: Include stor-layout.h. Include attribs.h. * cilk.c: Include stringpool.h. Include calls.h. c/ChangeLog * c-decl.c: Include print-tree.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include stringpool.h. * c-lang.c: Include fold-const.h. * c-parser.c: Include stringpool.h. Include attribs.h. Include stor-layout.h. Include varasm.h. Include trans-mem.h. * c-typeck.c: Include stor-layout.h. Include trans-mem.h. Include varasm.h. Include stmt.h. cp/ChangeLog * call.c: Include stor-layout.h. Include trans-mem.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * cp-gimplify.c: Include stor-layout.h. * cvt.c: Include stor-layout.h. * decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. Include calls.h. * decl2.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. Include calls.h. * error.c: Include stringpool.h. * except.c: Include stringpool.h. Include trans-mem.h. Include attribs.h. * init.c: Include stringpool.h. Include varasm.h. * lambda.c: Include stringpool.h. * lex.c: Include stringpool.h. * mangle.c: Include stor-layout.h. Include stringpool.h. * method.c: Include stringpool.h. Include varasm.h. * name-lookup.c: Include stringpool.h. Include print-tree.h. Include attribs.h. * optimize.c: Include stringpool.h. * parser.c: Include print-tree.h. Include stringpool.h. Include attribs.h. Include trans-mem.h. * pt.c: Include stringpool.h. Include varasm.h. Include attribs.h. Include stor-layout.h. * ptree.c: Include print-tree.h. * repo.c: Include stringpool.h. * rtti.c: Include stringpool.h. Include stor-layout.h. * semantics.c: Include stmt.h. Include varasm.h. Include stor-layout.h. Include stringpool.h. * tree.c: Include stor-layout.h. Include print-tree.h. Include tree-iterator.h. * typeck.c: Include stor-layout.h. Include varasm.h. * typeck2.c: Include stor-layout.h. Include varasm.h. * vtable-class-hierarchy.c: Include stringpool.h. Include stor-layout.h. fortran/ChangeLog * decl.c: Include stringpool.h. * iresolve.c: Include stringpool.h. * match.c: Include stringpool.h. * module.c: Include stringpool.h. * target-memory.c: Include stor-layout.h. * trans-common.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * trans-const.c: Include stor-layout.h. * trans-decl.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. Include attribs.h. * trans-expr.c: Include stringpool.h. * trans-intrinsic.c: Include stringpool.h. Include tree-nested.h. Include stor-layout.h. * trans-io.c: Include stringpool.h. Include stor-layout.h. * trans-openmp.c: Include stringpool.h. * trans-stmt.c: Include stringpool.h. * trans-types.c: Include stor-layout.h. Include stringpool.h. * trans.c: Include stringpool.h. go/ChangeLog * go-backend.c: Include stor-layout.h. * go-gcc.cc: Include stringpool.h. Include stor-layout.h. Include varasm.h. * go-lang.c: Include stor-layout.h. java/ChangeLog * builtins.c: Include stor-layout.h. Include stringpool.h. * class.c: Include stringpool.h. Include stor-layout.h. Include varasm.h. * constants.c: Include stringpool.h. Include stor-layout.h. * decl.c: Include stor-layout.h. Include stringpool.h. Include varasm.h. * except.c: Include stringpool.h. Include stor-layout.h. * expr.c: Include stringpool.h. Include stor-layout.h. * jcf-parse.c: Include stringpool.h. * mangle.c: Include stringpool.h. * resource.c: Include stringpool.h. Include stor-layout.h. * typeck.c: Include stor-layout.h. Include stringpool.h. * verify-glue.c: Include stringpool.h. lto/ChangeLog * lto-lang.c: Include stringpool.h. Include stor-layout.h. * lto-partition.c: Include gcc-symtab.h. * lto.c: Include stor-layout.h. objc/ChangeLog * objc-act.c: Include stringpool.h. Include stor-layout.h. Include attribs.h. * objc-encoding.c: Include stringpool.h. Include stor-layout.h. * objc-gnu-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-01.c: Include stringpool.h. * objc-next-runtime-abi-02.c: Include stringpool.h. * objc-runtime-shared-support.c: Include stringpool.h. testsuite/ChangeLog * gcc.dg/plugin/selfassign.c: Include stringpool.h. * gcc.dg/plugin/start_unit_plugin.c: Likewise. From-SVN: r205023
2013-11-19 13:31:09 +01:00
#include "tree-object-size.h"
gimple.h: Remove all includes. * gimple.h: Remove all includes. (recalculate_side_effects): Move prototype to gimplify.h. * Makefile.in (PLUGIN_HEADERS): Add flattened gimple.h includes. * gengtype.c (open_base_files): Add gimple.h include list. * gimplify.h (recalculate_side_effects): Relocate prototype here. * gimple.c: Adjust include list. (recalculate_side_effects): Move to gimplify.c. * gimplify.c: Adjust include list. (recalculate_side_effects): Relocate from gimple.c. * alias.c: Add required include files removed from gimple.h. * asan.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraphbuild.c: Likewise. * cgraph.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * cilk-common.c: Likewise. * data-streamer.c: Likewise. * data-streamer-in.c: Likewise. * data-streamer-out.c: Likewise. * dse.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * gimple-builder.c: Likewise. * gimple-expr.c: Likewise. * gimple-fold.c: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * graphite-blocking.c: Likewise. * graphite.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * ipa.c: Likewise. * ipa-cp.c: Likewise. * ipa-devirt.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * opts-global.c: Likewise. * passes.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * sese.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * symtab.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-affine.c: Likewise. * tree.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * tsan.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * varpool.c: Likewise. * var-tracking.c: Likewise. * vtable-verify.c: Likewise. * ada/gcc-interface/trans.c: Add required include files from gimple.h. * c/c-typeck.c: Add required include files from gimple.h. * c-family/c-common.c: Add required include files from gimple.h. * c-family/c-gimplify.c: Likewise * c-family/cilk.c: Likewise * cp/class.c: Add required include files from gimple.h. * cp/cp-gimplify.c: Likewise * cp/decl2.c: Likewise * cp/init.c: Likewise * cp/optimize.c: Likewise * cp/pt.c: Likewise * cp/semantics.c: Likewise * cp/tree.c: Likewise * cp/typeck.c: Likewise * cp/vtable-class-hierarchy.c: Likewise * fortran/trans.c: Add required include files from gimple.h. * fortran/trans-expr.c: Likewise * fortran/trans-openmp.c: Likewise * go/gofrontend/expressions.cc: Add required include files from gimple.h. * go/gofrontend/gogo-tree.cc: Likewise * go/gofrontend/types.cc: Likewise * go/go-gcc.cc: Likewise * go/go-lang.c: Likewise * java/java-gimplify.c: Add required include files from gimple.h. * lto/lto.c: Add required include files from gimple.h. * lto/lto-lang.c: Likewise * lto/lto-object.c: Likewise * lto/lto-partition.c: Likewise * lto/lto-symtab.c: Likewise * objc/objc-act.c: Add required include files from gimple.h. * config/darwin.c: Add required include files removed from gimple.h. * config/aarch64/aarch64-builtins.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/alpha.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64.c: Likewise. * config/m32c/m32c.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/tilegx/tilegx.c: Likewise. * config/tilepro/tilepro.c: Likewise. * config/xtensa/xtensa.c: Likewise. * testsuite/gcc.dg/plugin/finish_unit_plugin.c: Add required include files removed from gimple.h. * testsuite/gcc.dg/plugin/ggcplug.c: Likewise. * testsuite/gcc.dg/plugin/one_time_plugin.c: Likewise. * testsuite/gcc.dg/plugin/selfassign.c: Likewise. * testsuite/gcc.dg/plugin/start_unit_plugin.c: Likewise. * testsuite/g++.dg/plugin/selfassign.c: Likewise. From-SVN: r205272
2013-11-22 16:58:51 +01:00
#include "gimple-fold.h"
gimple-walk.h: New File. * gimple-walk.h: New File. Relocate prototypes from gimple.h. (struct walk_stmt_info): Relocate here from gimple.h. * gimple-iterator.h: New File. Relocate prototypes from gimple.h. (struct gimple_stmt_iterator_d): Relocate here from gimple.h. (gsi_start_1, gsi_none, gsi_start_bb, gsi_last_1, gsi_last_bb, gsi_end_p, gsi_one_before_end_p, gsi_next, gsi_prev, gsi_stmt, gsi_after_labels, gsi_next_nondebug, gsi_prev_nondebug, gsi_start_nondebug_bb, gsi_start_nondebug_after_labels_bb, gsi_last_nondebug_bb, gsi_bb, gsi_seq): Relocate here from gimple.h. * gimple.h (struct gimple_stmt_iterator_d): Move to gimple-iterator.h. (gsi_start_1, gsi_none, gsi_start_bb, gsi_last_1, gsi_last_bb, gsi_end_p, gsi_one_before_end_p, gsi_next, gsi_prev, gsi_stmt, gsi_after_labels, gsi_next_nondebug, gsi_prev_nondebug, gsi_start_nondebug_bb, gsi_start_nondebug_after_labels_bb, gsi_last_nondebug_bb, gsi_bb, gsi_seq): Move to gimple-iterator.h. (struct walk_stmt_info): Move to gimple-walk.h. (gimple_seq_set_location): Move to gimple.c * gimple-walk.c: New File. (walk_gimple_seq_mod, walk_gimple_seq, walk_gimple_asm, walk_gimple_op, walk_gimple_stmt, get_base_loadstore, walk_stmt_load_store_addr_ops, walk_stmt_load_store_ops): Relocate here from gimple.c. * gimple-iterator.c: Include gimple-iterator.h. * gimple.c (walk_gimple_seq_mod, walk_gimple_seq, walk_gimple_asm, walk_gimple_op, walk_gimple_stmt, get_base_loadstore, walk_stmt_load_store_addr_ops, walk_stmt_load_store_ops): Move to gimple-walk.c. (gimple_seq_set_location): Relocate from gimple.h. * tree-phinodes.h (set_phi_nodes): Move to tree-phinodes.c. * tree-phinodes.c (set_phi_nodes): Relocate from tree-phinodes.h. * gengtype.c (open_base_files): Add gimple-iterator.h to include list. * Makefile.in (OBJS): Add gimple-walk.o * asan.c: Update Include list as required for gimple-iterator.h and gimple-walk.h. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimplify.c: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * sese.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * value-prof.c: Likewise. * vtable-verify.c: Likewise. * config/aarch64/aarch64-builtins.c: Include gimple-iterator.h. * config/rs6000/rs6000.c: Include gimple-iterator.h and gimple-walk.h. * testsuite/g++.dg/plugin/selfassign.c: Include gimple-iterator.h. * testsuite/gcc.dg/plugin/selfassign.c: Likewise. From-SVN: r204763
2013-11-14 00:54:17 +01:00
#include "gimple-iterator.h"
#include "tree-cfg.h"
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
struct object_size_info
{
int object_size_type;
unsigned char pass;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
bool changed;
bitmap visited, reexamine;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
unsigned int *depths;
unsigned int *stack, *tos;
};
static const unsigned HOST_WIDE_INT unknown[4] = {
HOST_WIDE_INT_M1U,
HOST_WIDE_INT_M1U,
0,
0
};
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
static tree compute_object_offset (const_tree, const_tree);
static bool addr_object_size (struct object_size_info *,
const_tree, int, unsigned HOST_WIDE_INT *);
Merger of git branch "gimple-classes-v2-option-3" gcc/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * coretypes.h (struct gcond): Add forward decl. (struct gdebug): Likewise. (struct ggoto): Likewise. (struct glabel): Likewise. (struct gswitch): Likewise. (struct gassign): Likewise. (struct gasm): Likewise. (struct gcall): Likewise. (struct gtransaction): Likewise. (struct greturn): Likewise. (struct gbind): Likewise. (struct gcatch): Likewise. (struct geh_filter): Likewise. (struct geh_mnt): Likewise. (struct geh_else): Likewise. (struct gresx): Likewise. (struct geh_dispatch): Likewise. (struct gphi): Likewise. (struct gtry): Likewise. (struct gomp_atomic_load): Likewise. (struct gomp_atomic_store): Likewise. (struct gomp_continue): Likewise. (struct gomp_critical): Likewise. (struct gomp_for): Likewise. (struct gomp_parallel): Likewise. (struct gomp_task): Likewise. (struct gomp_sections): Likewise. (struct gomp_single): Likewise. (struct gomp_target): Likewise. (struct gomp_teams): Likewise. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple subclasses. * gdbhooks.py: Update. * gimple-iterator.c (gsi_for_phi): New. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. * gimple-iterator.h (struct gphi_iterator): New subclass of gimple_stmt_iterator. (gsi_for_phi): New prototype. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. (gsi_next_nonvirtual_phi): Strengthen param from gimple_stmt_iterator * to gphi_iterator *, and local "phi" from gimple to gphi *. * gsstruct.def: Update for renamings of classes. * gimple.c (gimple_build_return): Strengthen return type from gimple to greturn *. (gimple_call_reset_alias_info): Strengthen param to gcall *. (gimple_build_call_1): Strengthen return type from gimple to gcall *. (gimple_build_call_vec): Likewise. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal_1): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Strengthen return type from gimple to gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Strengthen return type from gimple to gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Strengthen return type from gimple to glabel *. (gimple_build_goto): Strengthen return type from gimple to ggoto *. (gimple_build_bind): Strengthen return type from gimple to gbind *. (gimple_build_asm_1): Strengthen return type from gimple to gasm *. (gimple_build_asm_vec): Likewise. (gimple_build_catch): Strengthen return type from gimple to gcatch *. (gimple_build_eh_filter): Strengthen return type from gimple to geh_filter *. (gimple_build_eh_must_not_throw): Strengthen return type from gimple to geh_mnt *. (gimple_build_eh_else): Strengthen return type from gimple to geh_else *. (gimple_build_try): Update for renaming of gimple_statement_try to gtry. (gimple_build_resx): Strengthen return type from gimple to gresx *. (gimple_build_switch_nlabels): Strengthen return type from gimple to gswitch *. (gimple_build_switch): Likewise. (gimple_build_eh_dispatch): Strengthen return type from gimple to geh_dispatch *. (gimple_build_debug_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_debug_source_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_omp_critical): Strengthen return type from gimple to gomp_critical *. (gimple_build_omp_for): Strengthen return type from gimple to gomp_for *. (gimple_build_omp_parallel): Strengthen return type from gimple to gomp_parallel *. (gimple_build_omp_task): Strengthen return type from gimple to gomp_task *. (gimple_build_omp_continue): Strengthen return type from gimple to gomp_continue *. (gimple_build_omp_sections): Strengthen return type from gimple to gomp_sections *. (gimple_build_omp_single): Strengthen return type from gimple to gomp_single *. (gimple_build_omp_target): Strengthen return type from gimple to gomp_target *. (gimple_build_omp_teams): Strengthen return type from gimple to gomp_teams *. (gimple_build_omp_atomic_load): Strengthen return type from gimple to gomp_atomic_load *. (gimple_build_omp_atomic_store): Strengthen return type from gimple to gomp_atomic_store *. (gimple_build_transaction): Strengthen return type from gimple to gtransaction *. (empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast. (gimple_call_fnspec): Require a const gcall *. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. (gimple_set_bb): Add a checked cast. (gimple_copy): Within the cases, add locals of the appropriate subclass and use in place of "stmt" and "copy" for typesafety. (gimple_has_side_effects): Add a checked cast. (gimple_could_trap_p_1): Likewise. (gimple_call_copy_skip_args): Require a gcall *, and return one. (gimple_asm_clobbers_memory_p): Require a const gasm *. (infer_nonnull_range): Replace a check for GIMPLE_RETURN with a dyn_cast, introducing local "return_stmt" and using ti in place of "stmt". * gimple.h (gimple_vec): Eliminate this typedef. (struct gimple_statement_call): Rename to... (struct gcall): ...this. (struct gimple_statement_bind): Rename to... (struct gbind): ...this. (struct gimple_statement_catch): Rename to... (struct gcatch): ...this. (struct gimple_statement_eh_filter): Rename to... (struct geh_filter): ...this. (struct gimple_statement_eh_else): Rename to... (struct geh_else): ...this. (struct gimple_statement_eh_mnt): Rename to... (struct geh_mnt): ...this. (struct gimple_statement_phi): Rename to... (struct gphi): ...this. (struct gimple_statement_resx): Rename to... (struct gresx): ...this. (struct gimple_statement_eh_dispatch): Rename to... (struct geh_dispatch): ...this. (struct gimple_statement_try): Rename to... (struct gtry): ...this. (struct gimple_statement_asm): Rename to... (struct gasm): ...this. (struct gimple_statement_omp_critical): Rename to... (struct gomp_critical): ...this. (struct gimple_statement_omp_for): Rename to... (struct gomp_for): ...this. (struct gimple_statement_omp_parallel): Rename to... (struct gomp_parallel): ...this. (struct gimple_statement_omp_target): Rename to... (struct gomp_target): ...this. (struct gimple_statement_omp_task): Rename to... (struct gomp_task): ...this. (struct gimple_statement_omp_sections): Rename to... (struct gomp_sections): ...this. (struct gimple_statement_omp_continue): Rename to... (struct gomp_continue): ...this. (struct gimple_statement_omp_single): Rename to... (struct gomp_single): ...this. (struct gimple_statement_omp_teams): Rename to... (struct gomp_teams): ...this. (struct gimple_statement_omp_atomic_load): Rename to... (struct gomp_atomic_load): ...this. (struct gimple_statement_omp_atomic_store :): Rename to... (struct gomp_atomic_store :): ...this. (struct gimple_statement_transaction): Rename to... (struct gtransaction): ...this. (struct gcond): New subclass. (struct gdebug): New subclass. (struct ggoto): New subclass. (struct glabel): New subclass. (struct gswitch): New subclass. (struct gassign): New subclass. (struct greturn): New subclass. (is_a_helper <gimple_statement_asm *>::test): Rename to... (is_a_helper <gasm *>::test): ...this. (is_a_helper <gimple_statement_bind *>::test): Rename to... (is_a_helper <gbind *>::test): ...this. (is_a_helper <gassign *>::test): New. (is_a_helper <gimple_statement_call *>::test): Rename to... (is_a_helper <gcall *>::test): ...this. (is_a_helper <gimple_statement_catch *>::test): Rename to... (is_a_helper <gcatch *>::test): ...this. (is_a_helper <gimple_statement_resx *>::test): Rename to... (is_a_helper <gresx *>::test): ...this. (is_a_helper <gcond *>::test): New. (is_a_helper <gdebug *>::test): New. (is_a_helper <ggoto *>::test): New. (is_a_helper <glabel *>::test): New. (is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <geh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else *>::test): Rename to... (is_a_helper <geh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <geh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt *>::test): Rename to... (is_a_helper <geh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <gomp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <gomp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <gomp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <gomp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for *>::test): Rename to... (is_a_helper <gomp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <gomp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target *>::test): Rename to... (is_a_helper <gomp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <gomp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single *>::test): Rename to... (is_a_helper <gomp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <gomp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task *>::test): Rename to... (is_a_helper <gomp_task *>::test): ...this. (is_a_helper <gimple_statement_phi *>::test): Rename to... (is_a_helper <gphi *>::test): ...this. (is_a_helper <gimple_statement_transaction *>::test): Rename to... (is_a_helper <gtransaction *>::test): ...this. (is_a_helper <greturn *>::test): New. (is_a_helper <gswitch *>::test): New. (is_a_helper <gimple_statement_try *>::test): Rename to... (is_a_helper <gtry *>::test): ...this. (is_a_helper <const gimple_statement_asm *>::test): Rename to... (is_a_helper <const gasm *>::test): ...this. (is_a_helper <const gimple_statement_bind *>::test): Rename to... (is_a_helper <const gbind *>::test): ...this. (is_a_helper <const gimple_statement_call *>::test): Rename to... (is_a_helper <const gcall *>::test): ...this. (is_a_helper <const gimple_statement_catch *>::test): Rename to... (is_a_helper <const gcatch *>::test): ...this. (is_a_helper <const gimple_statement_resx *>::test): Rename to... (is_a_helper <const gresx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <const geh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <const geh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <const gomp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <const gomp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <const gomp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <const gomp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for *>::test): Rename to... (is_a_helper <const gomp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <const gomp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target *>::test): Rename to... (is_a_helper <const gomp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <const gomp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single *>::test): Rename to... (is_a_helper <const gomp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <const gomp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task *>::test): Rename to... (is_a_helper <const gomp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi *>::test): Rename to... (is_a_helper <const gphi *>::test): ...this. (is_a_helper <const gimple_statement_transaction *>::test): Rename to... (is_a_helper <const gtransaction *>::test): ...this. (gimple_build_return): Strengthen return type to greturn *. (gimple_call_reset_alias_info): Require a gcall *. (gimple_build_call_vec): Return a gcall *. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Return a gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Return a gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Return a glabel *. (gimple_build_goto): Return a ggoto *. (gimple_build_bind): Return a gbind *. (gimple_build_asm_vec): Return a gasm *. (gimple_build_catch): Return a gcatch *. (gimple_build_eh_filter): Return a geh_filter *. (gimple_build_eh_must_not_throw): Return a geh_mnt *. (gimple_build_eh_else): Return a geh_else *. (gimple_build_try): Return a gtry *. (gimple_build_resx): Return a gresx *. (gimple_build_switch_nlabels): Return a gswitch *. (gimple_build_switch): Return a gswitch *. (gimple_build_eh_dispatch): Return a geh_dispatch *. (gimple_build_debug_bind_stat): Return a gdebug *. (gimple_build_debug_source_bind_stat): Return a gdebug *. (gimple_build_omp_critical): Return a gomp_critical *. (gimple_build_omp_for): Return a gomp_for *. (gimple_build_omp_parallel): Return a gomp_parallel *. (gimple_build_omp_task): Return a gomp_task *. (gimple_build_omp_continue): Return a gomp_continue *. (gimple_build_omp_sections): Return a gomp_sections *. (gimple_build_omp_single): Return a gomp_single *. (gimple_build_omp_target): Return a gomp_target *. (gimple_build_omp_teams): Return a gomp_teams *. (gimple_build_omp_atomic_load): Return a gomp_atomic_load *. (gimple_build_omp_atomic_store): Return a gomp_atomic_store *. (gimple_build_transaction): Return a gtransaction *. (gimple_call_arg_flags): Require a const gcall *. (gimple_call_return_flags): Likewise. (gimple_call_copy_skip_args): Require and return a gcall *. (gimple_asm_clobbers_memory_p): Require a const gasm *. (gimple_seq_first_stmt_as_a_bind): New. (gimple_assign_nontemporal_move_p): Require a const gassign * rather than a const_gimple. (gimple_call_internal_fn): Update for renaming to gcall. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Require a gcall * rather than a gimple. (gimple_call_set_fn): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_set_tail): Likewise. (gimple_call_tail_p): Likewise. (gimple_call_set_return_slot_opt): Likewise. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_set_from_thunk): Likewise. (gimple_call_from_thunk_p): Likewise. (gimple_call_set_va_arg_pack): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_set_nothrow): Likewise. (gimple_call_nothrow_p): Likewise. (gimple_call_set_alloca_for_var): Likewise. (gimple_call_alloca_for_var_p): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_call_return_type): Require a const gcall * rather than a const_gimple. (gimple_call_chain_ptr): Likewise. (gimple_call_copy_flags): Require a pair of gcall *. (gimple_cond_set_code): Require a gcond * rather than a gimple (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_cond_make_false): Likewise. (gimple_cond_make_true): Likewise. (gimple_cond_lhs_ptr): Require a const gcond * rather than a const_gimple. (gimple_cond_rhs_ptr): Likewise. (gimple_cond_true_label): Likewise. (gimple_cond_false_label): Likewise. (gimple_cond_true_p): Likewise. (gimple_cond_false_p): Likewise. (gimple_cond_set_condition): Likewise. (gimple_label_label): Require a const glabel *. (gimple_label_set_label): Require a glabel *. (gimple_goto_set_dest): Require a ggoto *. (gimple_bind_vars): Require a const gbind *. (gimple_bind_block): Likewise. (gimple_bind_set_vars): Require a gbind *. (gimple_bind_append_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_body): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_add_seq): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Require a const gasm *. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gasm *. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. (gimple_catch_types): Require a const gcatch *. (gimple_catch_types_ptr): Require a gcatch *. (gimple_catch_handler_ptr): Likewise. (gimple_catch_handler): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Update for renaming of subclass to geh_filter. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Require a geh_filter *. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Require a geh_mnt *. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Require a geh_else *. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_set_kind): Require a gtry *. (gimple_try_set_catch_is_cleanup): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_try_eval_ptr): Update for renaming of subclass to gtry. (gimple_try_cleanup_ptr): Likewise. (gimple_phi_capacity): Update for renaming of subclass to gphi. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_result): Require a gphi *. (gimple_phi_set_arg): Likewise. (gimple_phi_arg_def_ptr): Likewise. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_location_from_edge): Likewise. (gimple_phi_arg_set_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_resx_region): Require a const gresx *. (gimple_resx_set_region): Require a gresx *. (gimple_eh_dispatch_region): Require a const geh_dispatch *. (gimple_eh_dispatch_set_region): Require a geh_dispatch *. (gimple_switch_num_labels): Require a const gswitch *. (gimple_switch_set_num_labels): Likewise. (gimple_switch_index): Likewise. (gimple_switch_index_ptr): Likewise. (gimple_switch_label): Likewise. (gimple_switch_default_label): Likewise. (gimple_switch_set_index): Require a gswitch *. (gimple_switch_set_label): Likewise. (gimple_switch_set_default_label): Likewise. (gimple_omp_critical_name): Require a const gomp_critical *. (gimple_omp_critical_name_ptr): Require a gomp_critical *. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_set_kind): Require a gomp_for *. (gimple_omp_for_set_combined_p): Likewise. (gimple_omp_for_set_combined_into_p): Likewise. (gimple_omp_for_clauses): Update for renaming of subclass to gomp_for. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Update for renaming of subclass to gomp_parallel. (gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn): Require a const gomp_parallel *. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_task_clauses): Update for renaming of subclass to gomp_task. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Whitespace fixes. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Update for renaming of subclass to gomp_task. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Update for renaming of subclass to gomp_single. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Update for renaming of subclass to gomp_target. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Require a gomp_target *. (gimple_omp_target_set_kind): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_target_child_fn): Require a const gomp_target *. (gimple_omp_target_data_arg): Likewise. (gimple_omp_teams_clauses): Update for renaming of subclass to gomp_teams. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Require a gomp_teams *. (gimple_omp_sections_clauses): Update for renaming of subclass to gomp_sections. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_store_val): Require a const gomp_atomic_store *. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Require a const gomp_continue *. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gomp_continue *. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Require a gtransaction *. (gimple_transaction_body): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_label): Require a const gtransaction *. (gimple_transaction_subcode): Likewise. (gimple_transaction_set_body): Require a gtransaction *. (gimple_transaction_set_label): Likewise. (gimple_transaction_set_subcode): Likewise. (gimple_return_retval_ptr): Require a const greturn *. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a greturn *. (gimple_expr_type): Introduce local "call_stmt" and use in place of "stmt" for typesafety. * asan.c: Use gimple subclasses. * auto-profile.c: Likewise. * builtins.c: Likewise. * builtins.h: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * expr.h: Likewise. * gimple-builder.c: Likewise. * gimple-builder.h: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * gimplify.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * internal-fn.def:: Likewise. * internal-fn.h: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sanopt.c: Likewise. * sese.c: Likewise. * ssa-iterators.h: Likewise. * stmt.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp.c: Likewise. * tree-chkp.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-eh.h: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-into-ssa.h: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h * tree-sra.cn_function): * tree-ssa-alias.c: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c * tree-ssa-structalias.c * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadedge.h: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * vtable-verify.c: Likewise. gcc/c-family/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack" from being just a vec<gimple> to a vec<gbind *>. gcc/java/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * java-gimplify.c (java_gimplify_block): Strengthen local "outer" from gimple to gbind *. From-SVN: r217787
2014-11-19 18:00:54 +01:00
static unsigned HOST_WIDE_INT alloc_object_size (const gcall *, int);
static tree pass_through_call (const gcall *);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
static void collect_object_sizes_for (struct object_size_info *, tree);
static void expr_object_size (struct object_size_info *, tree, tree);
static bool merge_object_sizes (struct object_size_info *, tree, tree,
unsigned HOST_WIDE_INT);
static bool plus_stmt_object_size (struct object_size_info *, tree, gimple *);
static bool cond_expr_object_size (struct object_size_info *, tree, gimple *);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
static void init_offset_limit (void);
static void check_for_plus_in_loops (struct object_size_info *, tree);
static void check_for_plus_in_loops_1 (struct object_size_info *, tree,
unsigned int);
/* object_sizes[0] is upper bound for number of bytes till the end of
the object.
object_sizes[1] is upper bound for number of bytes till the end of
the subobject (innermost array or field with address taken).
object_sizes[2] is lower bound for number of bytes till the end of
the object and object_sizes[3] lower bound for subobject. */
static vec<unsigned HOST_WIDE_INT> object_sizes[4];
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
/* Bitmaps what object sizes have been computed already. */
static bitmap computed[4];
/* Maximum value of offset we consider to be addition. */
static unsigned HOST_WIDE_INT offset_limit;
/* Initialize OFFSET_LIMIT variable. */
static void
init_offset_limit (void)
{
if (tree_fits_uhwi_p (TYPE_MAX_VALUE (sizetype)))
decl.c, [...]: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ada/ * gcc-interface/decl.c, gcc-interface/utils.c, gcc-interface/utils2.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c-family/ * c-common.c, c-cppbuiltin.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c/ * c-decl.c, c-typeck.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/cp/ * call.c, class.c, decl.c, error.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/objc/ * objc-encoding.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ * alias.c, asan.c, builtins.c, cfgexpand.c, cgraph.c, config/aarch64/aarch64.c, config/alpha/predicates.md, config/arm/arm.c, config/darwin.c, config/epiphany/epiphany.c, config/i386/i386.c, config/iq2000/iq2000.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/mips/mips.c, config/picochip/picochip.c, config/rs6000/rs6000.c, cppbuiltin.c, dbxout.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, fold-const.c, function.c, gimple-fold.c, godump.c, ipa-cp.c, ipa-prop.c, omp-low.c, predict.c, sdbout.c, stor-layout.c, trans-mem.c, tree-object-size.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-forwprop.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-strlen.c, tree-stdarg.c, tree-switch-conversion.c, tree-vect-generic.c, tree-vect-loop.c, tree-vect-patterns.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, varasm.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. From-SVN: r204961
2013-11-18 15:52:19 +01:00
offset_limit = tree_to_uhwi (TYPE_MAX_VALUE (sizetype));
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
else
offset_limit = -1;
offset_limit /= 2;
}
/* Compute offset of EXPR within VAR. Return error_mark_node
if unknown. */
static tree
compute_object_offset (const_tree expr, const_tree var)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
enum tree_code code = PLUS_EXPR;
tree base, off, t;
if (expr == var)
return size_zero_node;
switch (TREE_CODE (expr))
{
case COMPONENT_REF:
base = compute_object_offset (TREE_OPERAND (expr, 0), var);
if (base == error_mark_node)
return base;
t = TREE_OPERAND (expr, 1);
off = size_binop (PLUS_EXPR, DECL_FIELD_OFFSET (t),
decl.c, [...]: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ada/ * gcc-interface/decl.c, gcc-interface/utils.c, gcc-interface/utils2.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c-family/ * c-common.c, c-cppbuiltin.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c/ * c-decl.c, c-typeck.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/cp/ * call.c, class.c, decl.c, error.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/objc/ * objc-encoding.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ * alias.c, asan.c, builtins.c, cfgexpand.c, cgraph.c, config/aarch64/aarch64.c, config/alpha/predicates.md, config/arm/arm.c, config/darwin.c, config/epiphany/epiphany.c, config/i386/i386.c, config/iq2000/iq2000.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/mips/mips.c, config/picochip/picochip.c, config/rs6000/rs6000.c, cppbuiltin.c, dbxout.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, fold-const.c, function.c, gimple-fold.c, godump.c, ipa-cp.c, ipa-prop.c, omp-low.c, predict.c, sdbout.c, stor-layout.c, trans-mem.c, tree-object-size.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-forwprop.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-strlen.c, tree-stdarg.c, tree-switch-conversion.c, tree-vect-generic.c, tree-vect-loop.c, tree-vect-patterns.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, varasm.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. From-SVN: r204961
2013-11-18 15:52:19 +01:00
size_int (tree_to_uhwi (DECL_FIELD_BIT_OFFSET (t))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
/ BITS_PER_UNIT));
break;
case REALPART_EXPR:
pa.c (reloc_needed): Use CASE_CONVERT. * config/pa/pa.c (reloc_needed): Use CASE_CONVERT. * tree-cfg.c (verify_expr, verify_gimple_expr): Likewise. * tree-ssa-structalias.c (get_constraint_for): Likewise. * c-common.c (c_common_truthvalue_conversion): Likewise. * tree-object-size.c (compute_object_offset): Likewise. * tree-inline.c (estimate_num_insns_1): Likewise. * varasm.c (const_hash_1, compare_constant, copy_constant) (compute_reloc_for_constant, output_addressed_constants) (initializer_constant_valid_p): Likewise. * c-omp.c (check_omp_for_incr_expr): Likewise. * gimplify.c (gimplify_expr): Likewise. * c-typeck.c (c_finish_return): Likewise. * tree-vectorizer.c (supportable_widening_operation) (supportable_narrowing_operation): Likewise. * c-pretty-print.c (pp_c_cast_expression, pp_c_expression): Likewise. * matrix-reorg.c (can_calculate_expr_before_stmt): Likewise. * expr.c (highest_pow2_factor, expand_expr_real_1): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info) (descr_info_loc): Likewise. * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise. * fold-const.c (operand_equal_p, make_range, extract_muldiv_1) (fold_unary): Likewise. * builtins.c (get_pointer_alignment): Likewise. * tree-scalar-evolution.c (interpret_rhs_modify_stmt) (instantiate_parameters_1): Likewise. * tree.c (expr_align, stabilize_reference): Likewise. * tree-pretty-print.c (dump_generic_node, op_prio): Likewise. * tree-ssa-loop-niter.c (derive_constant_upper_bound): Likewise. * convert.c (strip_float_extensions): Use CONVERT_EXPR_P. * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise. * config/alpha/alpha.c (va_list_skip_additions): Likewise. * c-common.c (c_alignof_expr, check_function_arguments_recurse): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Likewise. * varasm.c (initializer_constant_valid_p, output_constant): Likewise. * tree-ssa-forwprop.c (get_prop_source_stmt, can_propagate_from) (forward_propagate_addr_expr_1, forward_propagate_addr_expr) (forward_propagate_comparison) (tree_ssa_forward_propagate_single_use_vars): Likewise. * cfgexpand.c (discover_nonconstant_array_refs_r): Likewise. * emit-rtl.c (component_ref_for_mem_expr) (set_mem_attributes_minus_bitpos): Likewise. * tree-ssa-phiopt.c (conditional_replacement): Likewise. * gimplify.c (gimplify_conversion, goa_lhs_expr_p, gimplify_expr): Likewise. * c-typeck.c (default_function_array_conversion, build_indirect_ref) (build_function_call, pointer_diff, build_compound_expr) (c_finish_return): Likewise. * tree-vect-analyze.c (vect_determine_vectorization_factor): Likewise. * matrix-reorg.c (get_inner_of_cast_expr, may_flatten_matrices_1): Likewise. * tree-ssa-ifcombine.c (recognize_single_bit_test): Likewise. * expr.c (is_aligning_offset): Likewise. * tree-ssa-alias.c (is_escape_site): Likewise. * tree-stdarg.c (va_list_counter_bump, check_va_list_escapes) (check_all_va_list_escapes): Likewise. * tree-ssa-loop-ivopts.c (determine_base_object) (determine_common_wider_type): Likewise. * dojump.c (do_jump): Likewise. * tree-ssa-sccvn.c (simplify_unary_expression): Likewise. * tree-gimple.c (is_gimple_cast): Likewise. * fold-const.c (decode_field_reference, ) (fold_sign_changed_comparison, fold_unary, fold_comparison) (fold_binary): Likewise. * tree-ssa-alias-warnings.c (find_alias_site_helper) (already_warned_in_frontend_p): Likewise. * builtins.c (get_memory_rtx, fold_builtin_next_arg): Likewise. * tree.c (really_constant_p, get_unwidened): Likewise. * tree-ssa-loop-niter.c (expand_simple_operations): Likewise. * tree-ssa-loop-im.c (rewrite_bittest): Likewise. * tree-vrp.c (register_edge_assert_for_2, register_edge_assert_for_1): Likewise. * tree.h (STRIP_NOPS, STRIP_SIGN_NOPS, STRIP_TYPE_NOPS): Use CONVERT_EXPR_P. (CONVERT_EXPR_P): Define. (CASE_CONVERT): Define. From-SVN: r135114
2008-05-09 16:57:39 +02:00
CASE_CONVERT:
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
case VIEW_CONVERT_EXPR:
case NON_LVALUE_EXPR:
return compute_object_offset (TREE_OPERAND (expr, 0), var);
case IMAGPART_EXPR:
base = compute_object_offset (TREE_OPERAND (expr, 0), var);
if (base == error_mark_node)
return base;
off = TYPE_SIZE_UNIT (TREE_TYPE (expr));
break;
case ARRAY_REF:
base = compute_object_offset (TREE_OPERAND (expr, 0), var);
if (base == error_mark_node)
return base;
t = TREE_OPERAND (expr, 1);
tree low_bound, unit_size;
low_bound = array_ref_low_bound (CONST_CAST_TREE (expr));
unit_size = array_ref_element_size (CONST_CAST_TREE (expr));
if (! integer_zerop (low_bound))
t = fold_build2 (MINUS_EXPR, TREE_TYPE (t), t, low_bound);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) < 0)
{
code = MINUS_EXPR;
t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t);
}
t = fold_convert (sizetype, t);
off = size_binop (MULT_EXPR, unit_size, t);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
break;
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
case MEM_REF:
gcc_assert (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR);
2014-05-06 18:25:05 +02:00
return wide_int_to_tree (sizetype, mem_ref_offset (expr));
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
default:
return error_mark_node;
}
return size_binop (code, base, off);
}
/* Compute __builtin_object_size for PTR, which is a ADDR_EXPR.
OBJECT_SIZE_TYPE is the second argument from __builtin_object_size.
If unknown, return unknown[object_size_type]. */
static bool
addr_object_size (struct object_size_info *osi, const_tree ptr,
int object_size_type, unsigned HOST_WIDE_INT *psize)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
tree pt_var, pt_var_size = NULL_TREE, var_size, bytes;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
gcc_assert (TREE_CODE (ptr) == ADDR_EXPR);
/* Set to unknown and overwrite just before returning if the size
could be determined. */
*psize = unknown[object_size_type];
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
pt_var = TREE_OPERAND (ptr, 0);
while (handled_component_p (pt_var))
pt_var = TREE_OPERAND (pt_var, 0);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (pt_var
&& TREE_CODE (pt_var) == MEM_REF)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
unsigned HOST_WIDE_INT sz;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (!osi || (object_size_type & 1) != 0
|| TREE_CODE (TREE_OPERAND (pt_var, 0)) != SSA_NAME)
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
{
compute_builtin_object_size (TREE_OPERAND (pt_var, 0),
object_size_type & ~1, &sz);
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
}
else
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
tree var = TREE_OPERAND (pt_var, 0);
if (osi->pass == 0)
collect_object_sizes_for (osi, var);
if (bitmap_bit_p (computed[object_size_type],
SSA_NAME_VERSION (var)))
sz = object_sizes[object_size_type][SSA_NAME_VERSION (var)];
else
sz = unknown[object_size_type];
}
if (sz != unknown[object_size_type])
{
2014-05-06 18:25:05 +02:00
offset_int dsz = wi::sub (sz, mem_ref_offset (pt_var));
if (wi::neg_p (dsz))
sz = 0;
2014-05-06 18:25:05 +02:00
else if (wi::fits_uhwi_p (dsz))
Modify gcc/*.[hc] double_int call sites to use the new interface. This change entailed adding a few new methods to double_int. The change results in a 0.163% time improvement with a 70% confidence. Tested on x86_64. Index: gcc/ChangeLog 2012-09-06 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::operator &=): New. (double_int::operator ^=): New. (double_int::operator |=): New. (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. (binary double_int::operator *): Remove parameter name. (binary double_int::operator +): Likewise. (binary double_int::operator -): Likewise. (binary double_int::operator &): Likewise. (double_int::operator |): Likewise. (double_int::operator ^): Likewise. (double_int::and_not): Likewise. (double_int::from_shwi): Tidy formatting. (double_int::from_uhwi): Likewise. (double_int::from_uhwi): Likewise. * double-int.c (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. * builtins.c: Modify to use the new double_int interface. * cgraph.c: Likewise. * combine.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * gimple-fold.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimplify-rtx.c: Likewise. * ipa-prop.c: Likewise. * loop-iv.c: Likewise. * optabs.c: Likewise. * stor-layout.c: Likewise. * tree-affine.c: Likewise. * tree-cfg.c: Likewise. * tree-dfa.c: Likewise. * tree-flow-inline.h: Likewise. * tree-object-size.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-sccvn: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vrp.c: Likewise. * tree.h: Likewise. * tree.c: Likewise. * varasm.c: Likewise. From-SVN: r191047
2012-09-07 02:06:35 +02:00
sz = dsz.to_uhwi ();
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
else
sz = unknown[object_size_type];
}
if (sz != unknown[object_size_type] && sz < offset_limit)
pt_var_size = size_int (sz);
}
else if (pt_var
&& DECL_P (pt_var)
&& tree_fits_uhwi_p (DECL_SIZE_UNIT (pt_var))
&& tree_to_uhwi (DECL_SIZE_UNIT (pt_var)) < offset_limit)
pt_var_size = DECL_SIZE_UNIT (pt_var);
else if (pt_var
&& TREE_CODE (pt_var) == STRING_CST
&& TYPE_SIZE_UNIT (TREE_TYPE (pt_var))
&& tree_fits_uhwi_p (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)))
&& tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)))
< offset_limit)
pt_var_size = TYPE_SIZE_UNIT (TREE_TYPE (pt_var));
else
return false;
if (pt_var != TREE_OPERAND (ptr, 0))
{
tree var;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (object_size_type & 1)
{
var = TREE_OPERAND (ptr, 0);
while (var != pt_var
&& TREE_CODE (var) != BIT_FIELD_REF
&& TREE_CODE (var) != COMPONENT_REF
&& TREE_CODE (var) != ARRAY_REF
&& TREE_CODE (var) != ARRAY_RANGE_REF
&& TREE_CODE (var) != REALPART_EXPR
&& TREE_CODE (var) != IMAGPART_EXPR)
var = TREE_OPERAND (var, 0);
if (var != pt_var && TREE_CODE (var) == ARRAY_REF)
var = TREE_OPERAND (var, 0);
if (! TYPE_SIZE_UNIT (TREE_TYPE (var))
|| ! tree_fits_uhwi_p (TYPE_SIZE_UNIT (TREE_TYPE (var)))
|| (pt_var_size
&& tree_int_cst_lt (pt_var_size,
TYPE_SIZE_UNIT (TREE_TYPE (var)))))
var = pt_var;
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
else if (var != pt_var && TREE_CODE (pt_var) == MEM_REF)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
tree v = var;
/* For &X->fld, compute object size only if fld isn't the last
field, as struct { int i; char c[1]; } is often used instead
of flexible array member. */
while (v && v != pt_var)
switch (TREE_CODE (v))
{
case ARRAY_REF:
if (TYPE_SIZE_UNIT (TREE_TYPE (TREE_OPERAND (v, 0)))
&& TREE_CODE (TREE_OPERAND (v, 1)) == INTEGER_CST)
{
tree domain
= TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (v, 0)));
if (domain
&& TYPE_MAX_VALUE (domain)
&& TREE_CODE (TYPE_MAX_VALUE (domain))
== INTEGER_CST
&& tree_int_cst_lt (TREE_OPERAND (v, 1),
TYPE_MAX_VALUE (domain)))
{
v = NULL_TREE;
break;
}
}
v = TREE_OPERAND (v, 0);
break;
case REALPART_EXPR:
case IMAGPART_EXPR:
v = NULL_TREE;
break;
case COMPONENT_REF:
if (TREE_CODE (TREE_TYPE (v)) != ARRAY_TYPE)
{
v = NULL_TREE;
break;
}
while (v != pt_var && TREE_CODE (v) == COMPONENT_REF)
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
!= UNION_TYPE
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
!= QUAL_UNION_TYPE)
break;
else
v = TREE_OPERAND (v, 0);
if (TREE_CODE (v) == COMPONENT_REF
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
== RECORD_TYPE)
{
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
tree fld_chain = DECL_CHAIN (TREE_OPERAND (v, 1));
for (; fld_chain; fld_chain = DECL_CHAIN (fld_chain))
if (TREE_CODE (fld_chain) == FIELD_DECL)
break;
if (fld_chain)
{
v = NULL_TREE;
break;
}
v = TREE_OPERAND (v, 0);
}
while (v != pt_var && TREE_CODE (v) == COMPONENT_REF)
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
!= UNION_TYPE
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
!= QUAL_UNION_TYPE)
break;
else
v = TREE_OPERAND (v, 0);
if (v != pt_var)
v = NULL_TREE;
else
v = pt_var;
break;
default:
v = pt_var;
break;
}
if (v == pt_var)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
var = pt_var;
}
}
else
var = pt_var;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (var != pt_var)
var_size = TYPE_SIZE_UNIT (TREE_TYPE (var));
else if (!pt_var_size)
return false;
else
var_size = pt_var_size;
bytes = compute_object_offset (TREE_OPERAND (ptr, 0), var);
if (bytes != error_mark_node)
{
if (TREE_CODE (bytes) == INTEGER_CST
&& tree_int_cst_lt (var_size, bytes))
bytes = size_zero_node;
else
bytes = size_binop (MINUS_EXPR, var_size, bytes);
}
if (var != pt_var
&& pt_var_size
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
&& TREE_CODE (pt_var) == MEM_REF
&& bytes != error_mark_node)
{
tree bytes2 = compute_object_offset (TREE_OPERAND (ptr, 0), pt_var);
if (bytes2 != error_mark_node)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
if (TREE_CODE (bytes2) == INTEGER_CST
&& tree_int_cst_lt (pt_var_size, bytes2))
bytes2 = size_zero_node;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
else
bytes2 = size_binop (MINUS_EXPR, pt_var_size, bytes2);
bytes = size_binop (MIN_EXPR, bytes, bytes2);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
}
}
else if (!pt_var_size)
return false;
else
bytes = pt_var_size;
if (tree_fits_uhwi_p (bytes))
{
*psize = tree_to_uhwi (bytes);
return true;
}
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
return false;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
/* Compute __builtin_object_size for CALL, which is a GIMPLE_CALL.
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
Handles various allocation calls. OBJECT_SIZE_TYPE is the second
argument from __builtin_object_size. If unknown, return
unknown[object_size_type]. */
static unsigned HOST_WIDE_INT
Merger of git branch "gimple-classes-v2-option-3" gcc/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * coretypes.h (struct gcond): Add forward decl. (struct gdebug): Likewise. (struct ggoto): Likewise. (struct glabel): Likewise. (struct gswitch): Likewise. (struct gassign): Likewise. (struct gasm): Likewise. (struct gcall): Likewise. (struct gtransaction): Likewise. (struct greturn): Likewise. (struct gbind): Likewise. (struct gcatch): Likewise. (struct geh_filter): Likewise. (struct geh_mnt): Likewise. (struct geh_else): Likewise. (struct gresx): Likewise. (struct geh_dispatch): Likewise. (struct gphi): Likewise. (struct gtry): Likewise. (struct gomp_atomic_load): Likewise. (struct gomp_atomic_store): Likewise. (struct gomp_continue): Likewise. (struct gomp_critical): Likewise. (struct gomp_for): Likewise. (struct gomp_parallel): Likewise. (struct gomp_task): Likewise. (struct gomp_sections): Likewise. (struct gomp_single): Likewise. (struct gomp_target): Likewise. (struct gomp_teams): Likewise. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple subclasses. * gdbhooks.py: Update. * gimple-iterator.c (gsi_for_phi): New. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. * gimple-iterator.h (struct gphi_iterator): New subclass of gimple_stmt_iterator. (gsi_for_phi): New prototype. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. (gsi_next_nonvirtual_phi): Strengthen param from gimple_stmt_iterator * to gphi_iterator *, and local "phi" from gimple to gphi *. * gsstruct.def: Update for renamings of classes. * gimple.c (gimple_build_return): Strengthen return type from gimple to greturn *. (gimple_call_reset_alias_info): Strengthen param to gcall *. (gimple_build_call_1): Strengthen return type from gimple to gcall *. (gimple_build_call_vec): Likewise. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal_1): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Strengthen return type from gimple to gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Strengthen return type from gimple to gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Strengthen return type from gimple to glabel *. (gimple_build_goto): Strengthen return type from gimple to ggoto *. (gimple_build_bind): Strengthen return type from gimple to gbind *. (gimple_build_asm_1): Strengthen return type from gimple to gasm *. (gimple_build_asm_vec): Likewise. (gimple_build_catch): Strengthen return type from gimple to gcatch *. (gimple_build_eh_filter): Strengthen return type from gimple to geh_filter *. (gimple_build_eh_must_not_throw): Strengthen return type from gimple to geh_mnt *. (gimple_build_eh_else): Strengthen return type from gimple to geh_else *. (gimple_build_try): Update for renaming of gimple_statement_try to gtry. (gimple_build_resx): Strengthen return type from gimple to gresx *. (gimple_build_switch_nlabels): Strengthen return type from gimple to gswitch *. (gimple_build_switch): Likewise. (gimple_build_eh_dispatch): Strengthen return type from gimple to geh_dispatch *. (gimple_build_debug_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_debug_source_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_omp_critical): Strengthen return type from gimple to gomp_critical *. (gimple_build_omp_for): Strengthen return type from gimple to gomp_for *. (gimple_build_omp_parallel): Strengthen return type from gimple to gomp_parallel *. (gimple_build_omp_task): Strengthen return type from gimple to gomp_task *. (gimple_build_omp_continue): Strengthen return type from gimple to gomp_continue *. (gimple_build_omp_sections): Strengthen return type from gimple to gomp_sections *. (gimple_build_omp_single): Strengthen return type from gimple to gomp_single *. (gimple_build_omp_target): Strengthen return type from gimple to gomp_target *. (gimple_build_omp_teams): Strengthen return type from gimple to gomp_teams *. (gimple_build_omp_atomic_load): Strengthen return type from gimple to gomp_atomic_load *. (gimple_build_omp_atomic_store): Strengthen return type from gimple to gomp_atomic_store *. (gimple_build_transaction): Strengthen return type from gimple to gtransaction *. (empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast. (gimple_call_fnspec): Require a const gcall *. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. (gimple_set_bb): Add a checked cast. (gimple_copy): Within the cases, add locals of the appropriate subclass and use in place of "stmt" and "copy" for typesafety. (gimple_has_side_effects): Add a checked cast. (gimple_could_trap_p_1): Likewise. (gimple_call_copy_skip_args): Require a gcall *, and return one. (gimple_asm_clobbers_memory_p): Require a const gasm *. (infer_nonnull_range): Replace a check for GIMPLE_RETURN with a dyn_cast, introducing local "return_stmt" and using ti in place of "stmt". * gimple.h (gimple_vec): Eliminate this typedef. (struct gimple_statement_call): Rename to... (struct gcall): ...this. (struct gimple_statement_bind): Rename to... (struct gbind): ...this. (struct gimple_statement_catch): Rename to... (struct gcatch): ...this. (struct gimple_statement_eh_filter): Rename to... (struct geh_filter): ...this. (struct gimple_statement_eh_else): Rename to... (struct geh_else): ...this. (struct gimple_statement_eh_mnt): Rename to... (struct geh_mnt): ...this. (struct gimple_statement_phi): Rename to... (struct gphi): ...this. (struct gimple_statement_resx): Rename to... (struct gresx): ...this. (struct gimple_statement_eh_dispatch): Rename to... (struct geh_dispatch): ...this. (struct gimple_statement_try): Rename to... (struct gtry): ...this. (struct gimple_statement_asm): Rename to... (struct gasm): ...this. (struct gimple_statement_omp_critical): Rename to... (struct gomp_critical): ...this. (struct gimple_statement_omp_for): Rename to... (struct gomp_for): ...this. (struct gimple_statement_omp_parallel): Rename to... (struct gomp_parallel): ...this. (struct gimple_statement_omp_target): Rename to... (struct gomp_target): ...this. (struct gimple_statement_omp_task): Rename to... (struct gomp_task): ...this. (struct gimple_statement_omp_sections): Rename to... (struct gomp_sections): ...this. (struct gimple_statement_omp_continue): Rename to... (struct gomp_continue): ...this. (struct gimple_statement_omp_single): Rename to... (struct gomp_single): ...this. (struct gimple_statement_omp_teams): Rename to... (struct gomp_teams): ...this. (struct gimple_statement_omp_atomic_load): Rename to... (struct gomp_atomic_load): ...this. (struct gimple_statement_omp_atomic_store :): Rename to... (struct gomp_atomic_store :): ...this. (struct gimple_statement_transaction): Rename to... (struct gtransaction): ...this. (struct gcond): New subclass. (struct gdebug): New subclass. (struct ggoto): New subclass. (struct glabel): New subclass. (struct gswitch): New subclass. (struct gassign): New subclass. (struct greturn): New subclass. (is_a_helper <gimple_statement_asm *>::test): Rename to... (is_a_helper <gasm *>::test): ...this. (is_a_helper <gimple_statement_bind *>::test): Rename to... (is_a_helper <gbind *>::test): ...this. (is_a_helper <gassign *>::test): New. (is_a_helper <gimple_statement_call *>::test): Rename to... (is_a_helper <gcall *>::test): ...this. (is_a_helper <gimple_statement_catch *>::test): Rename to... (is_a_helper <gcatch *>::test): ...this. (is_a_helper <gimple_statement_resx *>::test): Rename to... (is_a_helper <gresx *>::test): ...this. (is_a_helper <gcond *>::test): New. (is_a_helper <gdebug *>::test): New. (is_a_helper <ggoto *>::test): New. (is_a_helper <glabel *>::test): New. (is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <geh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else *>::test): Rename to... (is_a_helper <geh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <geh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt *>::test): Rename to... (is_a_helper <geh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <gomp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <gomp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <gomp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <gomp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for *>::test): Rename to... (is_a_helper <gomp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <gomp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target *>::test): Rename to... (is_a_helper <gomp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <gomp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single *>::test): Rename to... (is_a_helper <gomp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <gomp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task *>::test): Rename to... (is_a_helper <gomp_task *>::test): ...this. (is_a_helper <gimple_statement_phi *>::test): Rename to... (is_a_helper <gphi *>::test): ...this. (is_a_helper <gimple_statement_transaction *>::test): Rename to... (is_a_helper <gtransaction *>::test): ...this. (is_a_helper <greturn *>::test): New. (is_a_helper <gswitch *>::test): New. (is_a_helper <gimple_statement_try *>::test): Rename to... (is_a_helper <gtry *>::test): ...this. (is_a_helper <const gimple_statement_asm *>::test): Rename to... (is_a_helper <const gasm *>::test): ...this. (is_a_helper <const gimple_statement_bind *>::test): Rename to... (is_a_helper <const gbind *>::test): ...this. (is_a_helper <const gimple_statement_call *>::test): Rename to... (is_a_helper <const gcall *>::test): ...this. (is_a_helper <const gimple_statement_catch *>::test): Rename to... (is_a_helper <const gcatch *>::test): ...this. (is_a_helper <const gimple_statement_resx *>::test): Rename to... (is_a_helper <const gresx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <const geh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <const geh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <const gomp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <const gomp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <const gomp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <const gomp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for *>::test): Rename to... (is_a_helper <const gomp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <const gomp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target *>::test): Rename to... (is_a_helper <const gomp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <const gomp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single *>::test): Rename to... (is_a_helper <const gomp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <const gomp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task *>::test): Rename to... (is_a_helper <const gomp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi *>::test): Rename to... (is_a_helper <const gphi *>::test): ...this. (is_a_helper <const gimple_statement_transaction *>::test): Rename to... (is_a_helper <const gtransaction *>::test): ...this. (gimple_build_return): Strengthen return type to greturn *. (gimple_call_reset_alias_info): Require a gcall *. (gimple_build_call_vec): Return a gcall *. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Return a gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Return a gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Return a glabel *. (gimple_build_goto): Return a ggoto *. (gimple_build_bind): Return a gbind *. (gimple_build_asm_vec): Return a gasm *. (gimple_build_catch): Return a gcatch *. (gimple_build_eh_filter): Return a geh_filter *. (gimple_build_eh_must_not_throw): Return a geh_mnt *. (gimple_build_eh_else): Return a geh_else *. (gimple_build_try): Return a gtry *. (gimple_build_resx): Return a gresx *. (gimple_build_switch_nlabels): Return a gswitch *. (gimple_build_switch): Return a gswitch *. (gimple_build_eh_dispatch): Return a geh_dispatch *. (gimple_build_debug_bind_stat): Return a gdebug *. (gimple_build_debug_source_bind_stat): Return a gdebug *. (gimple_build_omp_critical): Return a gomp_critical *. (gimple_build_omp_for): Return a gomp_for *. (gimple_build_omp_parallel): Return a gomp_parallel *. (gimple_build_omp_task): Return a gomp_task *. (gimple_build_omp_continue): Return a gomp_continue *. (gimple_build_omp_sections): Return a gomp_sections *. (gimple_build_omp_single): Return a gomp_single *. (gimple_build_omp_target): Return a gomp_target *. (gimple_build_omp_teams): Return a gomp_teams *. (gimple_build_omp_atomic_load): Return a gomp_atomic_load *. (gimple_build_omp_atomic_store): Return a gomp_atomic_store *. (gimple_build_transaction): Return a gtransaction *. (gimple_call_arg_flags): Require a const gcall *. (gimple_call_return_flags): Likewise. (gimple_call_copy_skip_args): Require and return a gcall *. (gimple_asm_clobbers_memory_p): Require a const gasm *. (gimple_seq_first_stmt_as_a_bind): New. (gimple_assign_nontemporal_move_p): Require a const gassign * rather than a const_gimple. (gimple_call_internal_fn): Update for renaming to gcall. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Require a gcall * rather than a gimple. (gimple_call_set_fn): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_set_tail): Likewise. (gimple_call_tail_p): Likewise. (gimple_call_set_return_slot_opt): Likewise. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_set_from_thunk): Likewise. (gimple_call_from_thunk_p): Likewise. (gimple_call_set_va_arg_pack): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_set_nothrow): Likewise. (gimple_call_nothrow_p): Likewise. (gimple_call_set_alloca_for_var): Likewise. (gimple_call_alloca_for_var_p): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_call_return_type): Require a const gcall * rather than a const_gimple. (gimple_call_chain_ptr): Likewise. (gimple_call_copy_flags): Require a pair of gcall *. (gimple_cond_set_code): Require a gcond * rather than a gimple (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_cond_make_false): Likewise. (gimple_cond_make_true): Likewise. (gimple_cond_lhs_ptr): Require a const gcond * rather than a const_gimple. (gimple_cond_rhs_ptr): Likewise. (gimple_cond_true_label): Likewise. (gimple_cond_false_label): Likewise. (gimple_cond_true_p): Likewise. (gimple_cond_false_p): Likewise. (gimple_cond_set_condition): Likewise. (gimple_label_label): Require a const glabel *. (gimple_label_set_label): Require a glabel *. (gimple_goto_set_dest): Require a ggoto *. (gimple_bind_vars): Require a const gbind *. (gimple_bind_block): Likewise. (gimple_bind_set_vars): Require a gbind *. (gimple_bind_append_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_body): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_add_seq): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Require a const gasm *. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gasm *. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. (gimple_catch_types): Require a const gcatch *. (gimple_catch_types_ptr): Require a gcatch *. (gimple_catch_handler_ptr): Likewise. (gimple_catch_handler): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Update for renaming of subclass to geh_filter. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Require a geh_filter *. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Require a geh_mnt *. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Require a geh_else *. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_set_kind): Require a gtry *. (gimple_try_set_catch_is_cleanup): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_try_eval_ptr): Update for renaming of subclass to gtry. (gimple_try_cleanup_ptr): Likewise. (gimple_phi_capacity): Update for renaming of subclass to gphi. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_result): Require a gphi *. (gimple_phi_set_arg): Likewise. (gimple_phi_arg_def_ptr): Likewise. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_location_from_edge): Likewise. (gimple_phi_arg_set_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_resx_region): Require a const gresx *. (gimple_resx_set_region): Require a gresx *. (gimple_eh_dispatch_region): Require a const geh_dispatch *. (gimple_eh_dispatch_set_region): Require a geh_dispatch *. (gimple_switch_num_labels): Require a const gswitch *. (gimple_switch_set_num_labels): Likewise. (gimple_switch_index): Likewise. (gimple_switch_index_ptr): Likewise. (gimple_switch_label): Likewise. (gimple_switch_default_label): Likewise. (gimple_switch_set_index): Require a gswitch *. (gimple_switch_set_label): Likewise. (gimple_switch_set_default_label): Likewise. (gimple_omp_critical_name): Require a const gomp_critical *. (gimple_omp_critical_name_ptr): Require a gomp_critical *. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_set_kind): Require a gomp_for *. (gimple_omp_for_set_combined_p): Likewise. (gimple_omp_for_set_combined_into_p): Likewise. (gimple_omp_for_clauses): Update for renaming of subclass to gomp_for. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Update for renaming of subclass to gomp_parallel. (gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn): Require a const gomp_parallel *. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_task_clauses): Update for renaming of subclass to gomp_task. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Whitespace fixes. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Update for renaming of subclass to gomp_task. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Update for renaming of subclass to gomp_single. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Update for renaming of subclass to gomp_target. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Require a gomp_target *. (gimple_omp_target_set_kind): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_target_child_fn): Require a const gomp_target *. (gimple_omp_target_data_arg): Likewise. (gimple_omp_teams_clauses): Update for renaming of subclass to gomp_teams. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Require a gomp_teams *. (gimple_omp_sections_clauses): Update for renaming of subclass to gomp_sections. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_store_val): Require a const gomp_atomic_store *. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Require a const gomp_continue *. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gomp_continue *. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Require a gtransaction *. (gimple_transaction_body): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_label): Require a const gtransaction *. (gimple_transaction_subcode): Likewise. (gimple_transaction_set_body): Require a gtransaction *. (gimple_transaction_set_label): Likewise. (gimple_transaction_set_subcode): Likewise. (gimple_return_retval_ptr): Require a const greturn *. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a greturn *. (gimple_expr_type): Introduce local "call_stmt" and use in place of "stmt" for typesafety. * asan.c: Use gimple subclasses. * auto-profile.c: Likewise. * builtins.c: Likewise. * builtins.h: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * expr.h: Likewise. * gimple-builder.c: Likewise. * gimple-builder.h: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * gimplify.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * internal-fn.def:: Likewise. * internal-fn.h: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sanopt.c: Likewise. * sese.c: Likewise. * ssa-iterators.h: Likewise. * stmt.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp.c: Likewise. * tree-chkp.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-eh.h: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-into-ssa.h: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h * tree-sra.cn_function): * tree-ssa-alias.c: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c * tree-ssa-structalias.c * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadedge.h: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * vtable-verify.c: Likewise. gcc/c-family/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack" from being just a vec<gimple> to a vec<gbind *>. gcc/java/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * java-gimplify.c (java_gimplify_block): Strengthen local "outer" from gimple to gbind *. From-SVN: r217787
2014-11-19 18:00:54 +01:00
alloc_object_size (const gcall *call, int object_size_type)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree callee, bytes = NULL_TREE;
tree alloc_size;
int arg1 = -1, arg2 = -1;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
gcc_assert (is_gimple_call (call));
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
callee = gimple_call_fndecl (call);
if (!callee)
return unknown[object_size_type];
alloc-pool.c, [...]: Add missing whitespace before "(". gcc/ * alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c, cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c, cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c, combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h, cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c, df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c, dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c, errors.c, except.c, expmed.c, expr.c, file-find.c, final.c, fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c, gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c, genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c, genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c, gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c, gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c, gimple.h, godump.c, graphite-clast-to-gimple.c, graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c, graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c, hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c, loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c, lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c, mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c, pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c, predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c, profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c, reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c, sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c, statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h, system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c, tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h, tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c, tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c, tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c, tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c, tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c, tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c, tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c, varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing whitespace before "(". From-SVN: r203004
2013-09-28 10:42:34 +02:00
alloc_size = lookup_attribute ("alloc_size",
TYPE_ATTRIBUTES (TREE_TYPE (callee)));
if (alloc_size && TREE_VALUE (alloc_size))
{
tree p = TREE_VALUE (alloc_size);
arg1 = TREE_INT_CST_LOW (TREE_VALUE (p))-1;
if (TREE_CHAIN (p))
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
arg2 = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (p)))-1;
}
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_CALLOC:
arg2 = 1;
/* fall through */
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
case BUILT_IN_MALLOC:
case BUILT_IN_ALLOCA:
re PR middle-end/50527 (inconsistent vla align) 2011-10-07 Tom de Vries <tom@codesourcery.com> PR middle-end/50527 * tree.c (build_common_builtin_nodes): Add local_define_builtin for BUILT_IN_ALLOCA_WITH_ALIGN. Mark that BUILT_IN_ALLOCA_WITH_ALIGN can throw. * builtins.c (expand_builtin_alloca): Handle BUILT_IN_ALLOCA_WITH_ALIGN arglist. Set align for BUILT_IN_ALLOCA_WITH_ALIGN. (expand_builtin): Handle BUILT_IN_ALLOCA_WITH_ALIGN. (is_inexpensive_builtin): Handle BUILT_IN_ALLOCA_WITH_ALIGN. * tree-ssa-ccp.c (evaluate_stmt): Set align for BUILT_IN_ALLOCA_WITH_ALIGN. (fold_builtin_alloca_for_var): Rename to ... (fold_builtin_alloca_with_align): Set DECL_ALIGN from 2nd BUILT_IN_ALLOCA_WITH_ALIGN argument. (ccp_fold_stmt): Try folding BUILT_IN_ALLOCA_WITH_ALIGN using fold_builtin_alloca_with_align. (optimize_stack_restore): Handle BUILT_IN_ALLOCA_WITH_ALIGN. * builtins.def (BUILT_IN_ALLOCA_WITH_ALIGN): Declare using DEF_BUILTIN_STUB. * ipa-pure-const.c (special_builtin_state): Handle BUILT_IN_ALLOCA_WITH_ALIGN. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1) (call_may_clobber_ref_p_1): Same. * function.c (gimplify_parameters): Lower vla to BUILT_IN_ALLOCA_WITH_ALIGN. * gimplify.c (gimplify_vla_decl): Same. * cfgexpand.c (expand_call_stmt): Handle BUILT_IN_ALLOCA_WITH_ALIGN. * tree-mudflap.c (mf_xform_statements): Same. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary) (mark_all_reaching_defs_necessary_1, propagate_necessity): Same. * varasm.c (incorporeal_function_p): Same. * tree-object-size.c (alloc_object_size): Same. * gimple.c (gimple_build_call_from_tree): Same. From-SVN: r179655
2011-10-07 14:49:49 +02:00
case BUILT_IN_ALLOCA_WITH_ALIGN:
arg1 = 0;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
default:
break;
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
if (arg1 < 0 || arg1 >= (int)gimple_call_num_args (call)
|| TREE_CODE (gimple_call_arg (call, arg1)) != INTEGER_CST
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
|| (arg2 >= 0
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
&& (arg2 >= (int)gimple_call_num_args (call)
|| TREE_CODE (gimple_call_arg (call, arg2)) != INTEGER_CST)))
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
return unknown[object_size_type];
if (arg2 >= 0)
bytes = size_binop (MULT_EXPR,
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
fold_convert (sizetype, gimple_call_arg (call, arg1)),
fold_convert (sizetype, gimple_call_arg (call, arg2)));
else if (arg1 >= 0)
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
bytes = fold_convert (sizetype, gimple_call_arg (call, arg1));
if (bytes && tree_fits_uhwi_p (bytes))
decl.c, [...]: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ada/ * gcc-interface/decl.c, gcc-interface/utils.c, gcc-interface/utils2.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c-family/ * c-common.c, c-cppbuiltin.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c/ * c-decl.c, c-typeck.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/cp/ * call.c, class.c, decl.c, error.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/objc/ * objc-encoding.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ * alias.c, asan.c, builtins.c, cfgexpand.c, cgraph.c, config/aarch64/aarch64.c, config/alpha/predicates.md, config/arm/arm.c, config/darwin.c, config/epiphany/epiphany.c, config/i386/i386.c, config/iq2000/iq2000.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/mips/mips.c, config/picochip/picochip.c, config/rs6000/rs6000.c, cppbuiltin.c, dbxout.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, fold-const.c, function.c, gimple-fold.c, godump.c, ipa-cp.c, ipa-prop.c, omp-low.c, predict.c, sdbout.c, stor-layout.c, trans-mem.c, tree-object-size.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-forwprop.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-strlen.c, tree-stdarg.c, tree-switch-conversion.c, tree-vect-generic.c, tree-vect-loop.c, tree-vect-patterns.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, varasm.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. From-SVN: r204961
2013-11-18 15:52:19 +01:00
return tree_to_uhwi (bytes);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
return unknown[object_size_type];
}
/* If object size is propagated from one of function's arguments directly
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
to its return value, return that argument for GIMPLE_CALL statement CALL.
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
Otherwise return NULL. */
static tree
Merger of git branch "gimple-classes-v2-option-3" gcc/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * coretypes.h (struct gcond): Add forward decl. (struct gdebug): Likewise. (struct ggoto): Likewise. (struct glabel): Likewise. (struct gswitch): Likewise. (struct gassign): Likewise. (struct gasm): Likewise. (struct gcall): Likewise. (struct gtransaction): Likewise. (struct greturn): Likewise. (struct gbind): Likewise. (struct gcatch): Likewise. (struct geh_filter): Likewise. (struct geh_mnt): Likewise. (struct geh_else): Likewise. (struct gresx): Likewise. (struct geh_dispatch): Likewise. (struct gphi): Likewise. (struct gtry): Likewise. (struct gomp_atomic_load): Likewise. (struct gomp_atomic_store): Likewise. (struct gomp_continue): Likewise. (struct gomp_critical): Likewise. (struct gomp_for): Likewise. (struct gomp_parallel): Likewise. (struct gomp_task): Likewise. (struct gomp_sections): Likewise. (struct gomp_single): Likewise. (struct gomp_target): Likewise. (struct gomp_teams): Likewise. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple subclasses. * gdbhooks.py: Update. * gimple-iterator.c (gsi_for_phi): New. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. * gimple-iterator.h (struct gphi_iterator): New subclass of gimple_stmt_iterator. (gsi_for_phi): New prototype. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. (gsi_next_nonvirtual_phi): Strengthen param from gimple_stmt_iterator * to gphi_iterator *, and local "phi" from gimple to gphi *. * gsstruct.def: Update for renamings of classes. * gimple.c (gimple_build_return): Strengthen return type from gimple to greturn *. (gimple_call_reset_alias_info): Strengthen param to gcall *. (gimple_build_call_1): Strengthen return type from gimple to gcall *. (gimple_build_call_vec): Likewise. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal_1): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Strengthen return type from gimple to gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Strengthen return type from gimple to gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Strengthen return type from gimple to glabel *. (gimple_build_goto): Strengthen return type from gimple to ggoto *. (gimple_build_bind): Strengthen return type from gimple to gbind *. (gimple_build_asm_1): Strengthen return type from gimple to gasm *. (gimple_build_asm_vec): Likewise. (gimple_build_catch): Strengthen return type from gimple to gcatch *. (gimple_build_eh_filter): Strengthen return type from gimple to geh_filter *. (gimple_build_eh_must_not_throw): Strengthen return type from gimple to geh_mnt *. (gimple_build_eh_else): Strengthen return type from gimple to geh_else *. (gimple_build_try): Update for renaming of gimple_statement_try to gtry. (gimple_build_resx): Strengthen return type from gimple to gresx *. (gimple_build_switch_nlabels): Strengthen return type from gimple to gswitch *. (gimple_build_switch): Likewise. (gimple_build_eh_dispatch): Strengthen return type from gimple to geh_dispatch *. (gimple_build_debug_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_debug_source_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_omp_critical): Strengthen return type from gimple to gomp_critical *. (gimple_build_omp_for): Strengthen return type from gimple to gomp_for *. (gimple_build_omp_parallel): Strengthen return type from gimple to gomp_parallel *. (gimple_build_omp_task): Strengthen return type from gimple to gomp_task *. (gimple_build_omp_continue): Strengthen return type from gimple to gomp_continue *. (gimple_build_omp_sections): Strengthen return type from gimple to gomp_sections *. (gimple_build_omp_single): Strengthen return type from gimple to gomp_single *. (gimple_build_omp_target): Strengthen return type from gimple to gomp_target *. (gimple_build_omp_teams): Strengthen return type from gimple to gomp_teams *. (gimple_build_omp_atomic_load): Strengthen return type from gimple to gomp_atomic_load *. (gimple_build_omp_atomic_store): Strengthen return type from gimple to gomp_atomic_store *. (gimple_build_transaction): Strengthen return type from gimple to gtransaction *. (empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast. (gimple_call_fnspec): Require a const gcall *. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. (gimple_set_bb): Add a checked cast. (gimple_copy): Within the cases, add locals of the appropriate subclass and use in place of "stmt" and "copy" for typesafety. (gimple_has_side_effects): Add a checked cast. (gimple_could_trap_p_1): Likewise. (gimple_call_copy_skip_args): Require a gcall *, and return one. (gimple_asm_clobbers_memory_p): Require a const gasm *. (infer_nonnull_range): Replace a check for GIMPLE_RETURN with a dyn_cast, introducing local "return_stmt" and using ti in place of "stmt". * gimple.h (gimple_vec): Eliminate this typedef. (struct gimple_statement_call): Rename to... (struct gcall): ...this. (struct gimple_statement_bind): Rename to... (struct gbind): ...this. (struct gimple_statement_catch): Rename to... (struct gcatch): ...this. (struct gimple_statement_eh_filter): Rename to... (struct geh_filter): ...this. (struct gimple_statement_eh_else): Rename to... (struct geh_else): ...this. (struct gimple_statement_eh_mnt): Rename to... (struct geh_mnt): ...this. (struct gimple_statement_phi): Rename to... (struct gphi): ...this. (struct gimple_statement_resx): Rename to... (struct gresx): ...this. (struct gimple_statement_eh_dispatch): Rename to... (struct geh_dispatch): ...this. (struct gimple_statement_try): Rename to... (struct gtry): ...this. (struct gimple_statement_asm): Rename to... (struct gasm): ...this. (struct gimple_statement_omp_critical): Rename to... (struct gomp_critical): ...this. (struct gimple_statement_omp_for): Rename to... (struct gomp_for): ...this. (struct gimple_statement_omp_parallel): Rename to... (struct gomp_parallel): ...this. (struct gimple_statement_omp_target): Rename to... (struct gomp_target): ...this. (struct gimple_statement_omp_task): Rename to... (struct gomp_task): ...this. (struct gimple_statement_omp_sections): Rename to... (struct gomp_sections): ...this. (struct gimple_statement_omp_continue): Rename to... (struct gomp_continue): ...this. (struct gimple_statement_omp_single): Rename to... (struct gomp_single): ...this. (struct gimple_statement_omp_teams): Rename to... (struct gomp_teams): ...this. (struct gimple_statement_omp_atomic_load): Rename to... (struct gomp_atomic_load): ...this. (struct gimple_statement_omp_atomic_store :): Rename to... (struct gomp_atomic_store :): ...this. (struct gimple_statement_transaction): Rename to... (struct gtransaction): ...this. (struct gcond): New subclass. (struct gdebug): New subclass. (struct ggoto): New subclass. (struct glabel): New subclass. (struct gswitch): New subclass. (struct gassign): New subclass. (struct greturn): New subclass. (is_a_helper <gimple_statement_asm *>::test): Rename to... (is_a_helper <gasm *>::test): ...this. (is_a_helper <gimple_statement_bind *>::test): Rename to... (is_a_helper <gbind *>::test): ...this. (is_a_helper <gassign *>::test): New. (is_a_helper <gimple_statement_call *>::test): Rename to... (is_a_helper <gcall *>::test): ...this. (is_a_helper <gimple_statement_catch *>::test): Rename to... (is_a_helper <gcatch *>::test): ...this. (is_a_helper <gimple_statement_resx *>::test): Rename to... (is_a_helper <gresx *>::test): ...this. (is_a_helper <gcond *>::test): New. (is_a_helper <gdebug *>::test): New. (is_a_helper <ggoto *>::test): New. (is_a_helper <glabel *>::test): New. (is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <geh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else *>::test): Rename to... (is_a_helper <geh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <geh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt *>::test): Rename to... (is_a_helper <geh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <gomp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <gomp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <gomp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <gomp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for *>::test): Rename to... (is_a_helper <gomp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <gomp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target *>::test): Rename to... (is_a_helper <gomp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <gomp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single *>::test): Rename to... (is_a_helper <gomp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <gomp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task *>::test): Rename to... (is_a_helper <gomp_task *>::test): ...this. (is_a_helper <gimple_statement_phi *>::test): Rename to... (is_a_helper <gphi *>::test): ...this. (is_a_helper <gimple_statement_transaction *>::test): Rename to... (is_a_helper <gtransaction *>::test): ...this. (is_a_helper <greturn *>::test): New. (is_a_helper <gswitch *>::test): New. (is_a_helper <gimple_statement_try *>::test): Rename to... (is_a_helper <gtry *>::test): ...this. (is_a_helper <const gimple_statement_asm *>::test): Rename to... (is_a_helper <const gasm *>::test): ...this. (is_a_helper <const gimple_statement_bind *>::test): Rename to... (is_a_helper <const gbind *>::test): ...this. (is_a_helper <const gimple_statement_call *>::test): Rename to... (is_a_helper <const gcall *>::test): ...this. (is_a_helper <const gimple_statement_catch *>::test): Rename to... (is_a_helper <const gcatch *>::test): ...this. (is_a_helper <const gimple_statement_resx *>::test): Rename to... (is_a_helper <const gresx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <const geh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <const geh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <const gomp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <const gomp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <const gomp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <const gomp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for *>::test): Rename to... (is_a_helper <const gomp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <const gomp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target *>::test): Rename to... (is_a_helper <const gomp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <const gomp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single *>::test): Rename to... (is_a_helper <const gomp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <const gomp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task *>::test): Rename to... (is_a_helper <const gomp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi *>::test): Rename to... (is_a_helper <const gphi *>::test): ...this. (is_a_helper <const gimple_statement_transaction *>::test): Rename to... (is_a_helper <const gtransaction *>::test): ...this. (gimple_build_return): Strengthen return type to greturn *. (gimple_call_reset_alias_info): Require a gcall *. (gimple_build_call_vec): Return a gcall *. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Return a gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Return a gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Return a glabel *. (gimple_build_goto): Return a ggoto *. (gimple_build_bind): Return a gbind *. (gimple_build_asm_vec): Return a gasm *. (gimple_build_catch): Return a gcatch *. (gimple_build_eh_filter): Return a geh_filter *. (gimple_build_eh_must_not_throw): Return a geh_mnt *. (gimple_build_eh_else): Return a geh_else *. (gimple_build_try): Return a gtry *. (gimple_build_resx): Return a gresx *. (gimple_build_switch_nlabels): Return a gswitch *. (gimple_build_switch): Return a gswitch *. (gimple_build_eh_dispatch): Return a geh_dispatch *. (gimple_build_debug_bind_stat): Return a gdebug *. (gimple_build_debug_source_bind_stat): Return a gdebug *. (gimple_build_omp_critical): Return a gomp_critical *. (gimple_build_omp_for): Return a gomp_for *. (gimple_build_omp_parallel): Return a gomp_parallel *. (gimple_build_omp_task): Return a gomp_task *. (gimple_build_omp_continue): Return a gomp_continue *. (gimple_build_omp_sections): Return a gomp_sections *. (gimple_build_omp_single): Return a gomp_single *. (gimple_build_omp_target): Return a gomp_target *. (gimple_build_omp_teams): Return a gomp_teams *. (gimple_build_omp_atomic_load): Return a gomp_atomic_load *. (gimple_build_omp_atomic_store): Return a gomp_atomic_store *. (gimple_build_transaction): Return a gtransaction *. (gimple_call_arg_flags): Require a const gcall *. (gimple_call_return_flags): Likewise. (gimple_call_copy_skip_args): Require and return a gcall *. (gimple_asm_clobbers_memory_p): Require a const gasm *. (gimple_seq_first_stmt_as_a_bind): New. (gimple_assign_nontemporal_move_p): Require a const gassign * rather than a const_gimple. (gimple_call_internal_fn): Update for renaming to gcall. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Require a gcall * rather than a gimple. (gimple_call_set_fn): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_set_tail): Likewise. (gimple_call_tail_p): Likewise. (gimple_call_set_return_slot_opt): Likewise. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_set_from_thunk): Likewise. (gimple_call_from_thunk_p): Likewise. (gimple_call_set_va_arg_pack): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_set_nothrow): Likewise. (gimple_call_nothrow_p): Likewise. (gimple_call_set_alloca_for_var): Likewise. (gimple_call_alloca_for_var_p): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_call_return_type): Require a const gcall * rather than a const_gimple. (gimple_call_chain_ptr): Likewise. (gimple_call_copy_flags): Require a pair of gcall *. (gimple_cond_set_code): Require a gcond * rather than a gimple (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_cond_make_false): Likewise. (gimple_cond_make_true): Likewise. (gimple_cond_lhs_ptr): Require a const gcond * rather than a const_gimple. (gimple_cond_rhs_ptr): Likewise. (gimple_cond_true_label): Likewise. (gimple_cond_false_label): Likewise. (gimple_cond_true_p): Likewise. (gimple_cond_false_p): Likewise. (gimple_cond_set_condition): Likewise. (gimple_label_label): Require a const glabel *. (gimple_label_set_label): Require a glabel *. (gimple_goto_set_dest): Require a ggoto *. (gimple_bind_vars): Require a const gbind *. (gimple_bind_block): Likewise. (gimple_bind_set_vars): Require a gbind *. (gimple_bind_append_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_body): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_add_seq): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Require a const gasm *. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gasm *. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. (gimple_catch_types): Require a const gcatch *. (gimple_catch_types_ptr): Require a gcatch *. (gimple_catch_handler_ptr): Likewise. (gimple_catch_handler): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Update for renaming of subclass to geh_filter. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Require a geh_filter *. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Require a geh_mnt *. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Require a geh_else *. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_set_kind): Require a gtry *. (gimple_try_set_catch_is_cleanup): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_try_eval_ptr): Update for renaming of subclass to gtry. (gimple_try_cleanup_ptr): Likewise. (gimple_phi_capacity): Update for renaming of subclass to gphi. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_result): Require a gphi *. (gimple_phi_set_arg): Likewise. (gimple_phi_arg_def_ptr): Likewise. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_location_from_edge): Likewise. (gimple_phi_arg_set_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_resx_region): Require a const gresx *. (gimple_resx_set_region): Require a gresx *. (gimple_eh_dispatch_region): Require a const geh_dispatch *. (gimple_eh_dispatch_set_region): Require a geh_dispatch *. (gimple_switch_num_labels): Require a const gswitch *. (gimple_switch_set_num_labels): Likewise. (gimple_switch_index): Likewise. (gimple_switch_index_ptr): Likewise. (gimple_switch_label): Likewise. (gimple_switch_default_label): Likewise. (gimple_switch_set_index): Require a gswitch *. (gimple_switch_set_label): Likewise. (gimple_switch_set_default_label): Likewise. (gimple_omp_critical_name): Require a const gomp_critical *. (gimple_omp_critical_name_ptr): Require a gomp_critical *. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_set_kind): Require a gomp_for *. (gimple_omp_for_set_combined_p): Likewise. (gimple_omp_for_set_combined_into_p): Likewise. (gimple_omp_for_clauses): Update for renaming of subclass to gomp_for. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Update for renaming of subclass to gomp_parallel. (gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn): Require a const gomp_parallel *. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_task_clauses): Update for renaming of subclass to gomp_task. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Whitespace fixes. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Update for renaming of subclass to gomp_task. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Update for renaming of subclass to gomp_single. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Update for renaming of subclass to gomp_target. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Require a gomp_target *. (gimple_omp_target_set_kind): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_target_child_fn): Require a const gomp_target *. (gimple_omp_target_data_arg): Likewise. (gimple_omp_teams_clauses): Update for renaming of subclass to gomp_teams. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Require a gomp_teams *. (gimple_omp_sections_clauses): Update for renaming of subclass to gomp_sections. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_store_val): Require a const gomp_atomic_store *. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Require a const gomp_continue *. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gomp_continue *. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Require a gtransaction *. (gimple_transaction_body): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_label): Require a const gtransaction *. (gimple_transaction_subcode): Likewise. (gimple_transaction_set_body): Require a gtransaction *. (gimple_transaction_set_label): Likewise. (gimple_transaction_set_subcode): Likewise. (gimple_return_retval_ptr): Require a const greturn *. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a greturn *. (gimple_expr_type): Introduce local "call_stmt" and use in place of "stmt" for typesafety. * asan.c: Use gimple subclasses. * auto-profile.c: Likewise. * builtins.c: Likewise. * builtins.h: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * expr.h: Likewise. * gimple-builder.c: Likewise. * gimple-builder.h: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * gimplify.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * internal-fn.def:: Likewise. * internal-fn.h: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sanopt.c: Likewise. * sese.c: Likewise. * ssa-iterators.h: Likewise. * stmt.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp.c: Likewise. * tree-chkp.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-eh.h: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-into-ssa.h: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h * tree-sra.cn_function): * tree-ssa-alias.c: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c * tree-ssa-structalias.c * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadedge.h: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * vtable-verify.c: Likewise. gcc/c-family/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack" from being just a vec<gimple> to a vec<gbind *>. gcc/java/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * java-gimplify.c (java_gimplify_block): Strengthen local "outer" from gimple to gbind *. From-SVN: r217787
2014-11-19 18:00:54 +01:00
pass_through_call (const gcall *call)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
tree callee = gimple_call_fndecl (call);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (callee
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
switch (DECL_FUNCTION_CODE (callee))
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMSET:
case BUILT_IN_STRCPY:
case BUILT_IN_STRNCPY:
case BUILT_IN_STRCAT:
case BUILT_IN_STRNCAT:
case BUILT_IN_MEMCPY_CHK:
case BUILT_IN_MEMMOVE_CHK:
case BUILT_IN_MEMSET_CHK:
case BUILT_IN_STRCPY_CHK:
case BUILT_IN_STRNCPY_CHK:
case BUILT_IN_STRCAT_CHK:
case BUILT_IN_STRNCAT_CHK:
case BUILT_IN_ASSUME_ALIGNED:
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
if (gimple_call_num_args (call) >= 1)
return gimple_call_arg (call, 0);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
break;
default:
break;
}
return NULL_TREE;
}
/* Compute __builtin_object_size value for PTR and set *PSIZE to
the resulting value. OBJECT_SIZE_TYPE is the second argument
to __builtin_object_size. Return true on success and false
when the object size could not be determined. */
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
bool
compute_builtin_object_size (tree ptr, int object_size_type,
unsigned HOST_WIDE_INT *psize)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
gcc_assert (object_size_type >= 0 && object_size_type <= 3);
/* Set to unknown and overwrite just before returning if the size
could be determined. */
*psize = unknown[object_size_type];
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (! offset_limit)
init_offset_limit ();
if (TREE_CODE (ptr) == ADDR_EXPR)
return addr_object_size (NULL, ptr, object_size_type, psize);
if (TREE_CODE (ptr) != SSA_NAME
|| !POINTER_TYPE_P (TREE_TYPE (ptr)))
return false;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (computed[object_size_type] == NULL)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
if (optimize || object_size_type & 1)
return false;
/* When not optimizing, rather than failing, make a small effort
to determine the object size without the full benefit of
the (costly) computation below. */
gimple *def = SSA_NAME_DEF_STMT (ptr);
if (gimple_code (def) == GIMPLE_ASSIGN)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
tree_code code = gimple_assign_rhs_code (def);
if (code == POINTER_PLUS_EXPR)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
tree offset = gimple_assign_rhs2 (def);
ptr = gimple_assign_rhs1 (def);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (tree_fits_shwi_p (offset)
&& compute_builtin_object_size (ptr, object_size_type, psize))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
/* Return zero when the offset is out of bounds. */
unsigned HOST_WIDE_INT off = tree_to_shwi (offset);
*psize = off < *psize ? *psize - off : 0;
return true;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
}
}
return false;
}
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (!bitmap_bit_p (computed[object_size_type], SSA_NAME_VERSION (ptr)))
{
struct object_size_info osi;
bitmap_iterator bi;
unsigned int i;
if (num_ssa_names > object_sizes[object_size_type].length ())
object_sizes[object_size_type].safe_grow (num_ssa_names);
if (dump_file)
{
fprintf (dump_file, "Computing %s %sobject size for ",
(object_size_type & 2) ? "minimum" : "maximum",
(object_size_type & 1) ? "sub" : "");
print_generic_expr (dump_file, ptr, dump_flags);
fprintf (dump_file, ":\n");
}
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
osi.visited = BITMAP_ALLOC (NULL);
osi.reexamine = BITMAP_ALLOC (NULL);
osi.object_size_type = object_size_type;
osi.depths = NULL;
osi.stack = NULL;
osi.tos = NULL;
/* First pass: walk UD chains, compute object sizes that
can be computed. osi.reexamine bitmap at the end will
contain what variables were found in dependency cycles
and therefore need to be reexamined. */
osi.pass = 0;
osi.changed = false;
collect_object_sizes_for (&osi, ptr);
/* Second pass: keep recomputing object sizes of variables
that need reexamination, until no object sizes are
increased or all object sizes are computed. */
if (! bitmap_empty_p (osi.reexamine))
{
bitmap reexamine = BITMAP_ALLOC (NULL);
/* If looking for minimum instead of maximum object size,
detect cases where a pointer is increased in a loop.
Although even without this detection pass 2 would eventually
terminate, it could take a long time. If a pointer is
increasing this way, we need to assume 0 object size.
E.g. p = &buf[0]; while (cond) p = p + 4; */
if (object_size_type & 2)
{
osi.depths = XCNEWVEC (unsigned int, num_ssa_names);
osi.stack = XNEWVEC (unsigned int, num_ssa_names);
osi.tos = osi.stack;
osi.pass = 1;
/* collect_object_sizes_for is changing
osi.reexamine bitmap, so iterate over a copy. */
bitmap_copy (reexamine, osi.reexamine);
EXECUTE_IF_SET_IN_BITMAP (reexamine, 0, i, bi)
if (bitmap_bit_p (osi.reexamine, i))
check_for_plus_in_loops (&osi, ssa_name (i));
free (osi.depths);
osi.depths = NULL;
free (osi.stack);
osi.stack = NULL;
osi.tos = NULL;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
do
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
osi.pass = 2;
osi.changed = false;
/* collect_object_sizes_for is changing
osi.reexamine bitmap, so iterate over a copy. */
bitmap_copy (reexamine, osi.reexamine);
EXECUTE_IF_SET_IN_BITMAP (reexamine, 0, i, bi)
if (bitmap_bit_p (osi.reexamine, i))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
collect_object_sizes_for (&osi, ssa_name (i));
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Reexamining ");
print_generic_expr (dump_file, ssa_name (i),
dump_flags);
fprintf (dump_file, "\n");
}
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
}
while (osi.changed);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
BITMAP_FREE (reexamine);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
EXECUTE_IF_SET_IN_BITMAP (osi.reexamine, 0, i, bi)
bitmap_set_bit (computed[object_size_type], i);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
/* Debugging dumps. */
if (dump_file)
{
EXECUTE_IF_SET_IN_BITMAP (osi.visited, 0, i, bi)
if (object_sizes[object_size_type][i]
!= unknown[object_size_type])
{
print_generic_expr (dump_file, ssa_name (i),
dump_flags);
fprintf (dump_file,
": %s %sobject size "
HOST_WIDE_INT_PRINT_UNSIGNED "\n",
(object_size_type & 2) ? "minimum" : "maximum",
(object_size_type & 1) ? "sub" : "",
object_sizes[object_size_type][i]);
}
}
BITMAP_FREE (osi.reexamine);
BITMAP_FREE (osi.visited);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
*psize = object_sizes[object_size_type][SSA_NAME_VERSION (ptr)];
return *psize != unknown[object_size_type];
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
/* Compute object_sizes for PTR, defined to VALUE, which is not an SSA_NAME. */
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
static void
expr_object_size (struct object_size_info *osi, tree ptr, tree value)
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (ptr);
unsigned HOST_WIDE_INT bytes;
gcc_assert (object_sizes[object_size_type][varno]
!= unknown[object_size_type]);
gcc_assert (osi->pass == 0);
if (TREE_CODE (value) == WITH_SIZE_EXPR)
value = TREE_OPERAND (value, 0);
/* Pointer variables should have been handled by merge_object_sizes. */
gcc_assert (TREE_CODE (value) != SSA_NAME
|| !POINTER_TYPE_P (TREE_TYPE (value)));
if (TREE_CODE (value) == ADDR_EXPR)
addr_object_size (osi, value, object_size_type, &bytes);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
else
bytes = unknown[object_size_type];
if ((object_size_type & 2) == 0)
{
if (object_sizes[object_size_type][varno] < bytes)
object_sizes[object_size_type][varno] = bytes;
}
else
{
if (object_sizes[object_size_type][varno] > bytes)
object_sizes[object_size_type][varno] = bytes;
}
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
/* Compute object_sizes for PTR, defined to the result of a call. */
static void
Merger of git branch "gimple-classes-v2-option-3" gcc/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * coretypes.h (struct gcond): Add forward decl. (struct gdebug): Likewise. (struct ggoto): Likewise. (struct glabel): Likewise. (struct gswitch): Likewise. (struct gassign): Likewise. (struct gasm): Likewise. (struct gcall): Likewise. (struct gtransaction): Likewise. (struct greturn): Likewise. (struct gbind): Likewise. (struct gcatch): Likewise. (struct geh_filter): Likewise. (struct geh_mnt): Likewise. (struct geh_else): Likewise. (struct gresx): Likewise. (struct geh_dispatch): Likewise. (struct gphi): Likewise. (struct gtry): Likewise. (struct gomp_atomic_load): Likewise. (struct gomp_atomic_store): Likewise. (struct gomp_continue): Likewise. (struct gomp_critical): Likewise. (struct gomp_for): Likewise. (struct gomp_parallel): Likewise. (struct gomp_task): Likewise. (struct gomp_sections): Likewise. (struct gomp_single): Likewise. (struct gomp_target): Likewise. (struct gomp_teams): Likewise. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple subclasses. * gdbhooks.py: Update. * gimple-iterator.c (gsi_for_phi): New. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. * gimple-iterator.h (struct gphi_iterator): New subclass of gimple_stmt_iterator. (gsi_for_phi): New prototype. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. (gsi_next_nonvirtual_phi): Strengthen param from gimple_stmt_iterator * to gphi_iterator *, and local "phi" from gimple to gphi *. * gsstruct.def: Update for renamings of classes. * gimple.c (gimple_build_return): Strengthen return type from gimple to greturn *. (gimple_call_reset_alias_info): Strengthen param to gcall *. (gimple_build_call_1): Strengthen return type from gimple to gcall *. (gimple_build_call_vec): Likewise. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal_1): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Strengthen return type from gimple to gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Strengthen return type from gimple to gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Strengthen return type from gimple to glabel *. (gimple_build_goto): Strengthen return type from gimple to ggoto *. (gimple_build_bind): Strengthen return type from gimple to gbind *. (gimple_build_asm_1): Strengthen return type from gimple to gasm *. (gimple_build_asm_vec): Likewise. (gimple_build_catch): Strengthen return type from gimple to gcatch *. (gimple_build_eh_filter): Strengthen return type from gimple to geh_filter *. (gimple_build_eh_must_not_throw): Strengthen return type from gimple to geh_mnt *. (gimple_build_eh_else): Strengthen return type from gimple to geh_else *. (gimple_build_try): Update for renaming of gimple_statement_try to gtry. (gimple_build_resx): Strengthen return type from gimple to gresx *. (gimple_build_switch_nlabels): Strengthen return type from gimple to gswitch *. (gimple_build_switch): Likewise. (gimple_build_eh_dispatch): Strengthen return type from gimple to geh_dispatch *. (gimple_build_debug_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_debug_source_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_omp_critical): Strengthen return type from gimple to gomp_critical *. (gimple_build_omp_for): Strengthen return type from gimple to gomp_for *. (gimple_build_omp_parallel): Strengthen return type from gimple to gomp_parallel *. (gimple_build_omp_task): Strengthen return type from gimple to gomp_task *. (gimple_build_omp_continue): Strengthen return type from gimple to gomp_continue *. (gimple_build_omp_sections): Strengthen return type from gimple to gomp_sections *. (gimple_build_omp_single): Strengthen return type from gimple to gomp_single *. (gimple_build_omp_target): Strengthen return type from gimple to gomp_target *. (gimple_build_omp_teams): Strengthen return type from gimple to gomp_teams *. (gimple_build_omp_atomic_load): Strengthen return type from gimple to gomp_atomic_load *. (gimple_build_omp_atomic_store): Strengthen return type from gimple to gomp_atomic_store *. (gimple_build_transaction): Strengthen return type from gimple to gtransaction *. (empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast. (gimple_call_fnspec): Require a const gcall *. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. (gimple_set_bb): Add a checked cast. (gimple_copy): Within the cases, add locals of the appropriate subclass and use in place of "stmt" and "copy" for typesafety. (gimple_has_side_effects): Add a checked cast. (gimple_could_trap_p_1): Likewise. (gimple_call_copy_skip_args): Require a gcall *, and return one. (gimple_asm_clobbers_memory_p): Require a const gasm *. (infer_nonnull_range): Replace a check for GIMPLE_RETURN with a dyn_cast, introducing local "return_stmt" and using ti in place of "stmt". * gimple.h (gimple_vec): Eliminate this typedef. (struct gimple_statement_call): Rename to... (struct gcall): ...this. (struct gimple_statement_bind): Rename to... (struct gbind): ...this. (struct gimple_statement_catch): Rename to... (struct gcatch): ...this. (struct gimple_statement_eh_filter): Rename to... (struct geh_filter): ...this. (struct gimple_statement_eh_else): Rename to... (struct geh_else): ...this. (struct gimple_statement_eh_mnt): Rename to... (struct geh_mnt): ...this. (struct gimple_statement_phi): Rename to... (struct gphi): ...this. (struct gimple_statement_resx): Rename to... (struct gresx): ...this. (struct gimple_statement_eh_dispatch): Rename to... (struct geh_dispatch): ...this. (struct gimple_statement_try): Rename to... (struct gtry): ...this. (struct gimple_statement_asm): Rename to... (struct gasm): ...this. (struct gimple_statement_omp_critical): Rename to... (struct gomp_critical): ...this. (struct gimple_statement_omp_for): Rename to... (struct gomp_for): ...this. (struct gimple_statement_omp_parallel): Rename to... (struct gomp_parallel): ...this. (struct gimple_statement_omp_target): Rename to... (struct gomp_target): ...this. (struct gimple_statement_omp_task): Rename to... (struct gomp_task): ...this. (struct gimple_statement_omp_sections): Rename to... (struct gomp_sections): ...this. (struct gimple_statement_omp_continue): Rename to... (struct gomp_continue): ...this. (struct gimple_statement_omp_single): Rename to... (struct gomp_single): ...this. (struct gimple_statement_omp_teams): Rename to... (struct gomp_teams): ...this. (struct gimple_statement_omp_atomic_load): Rename to... (struct gomp_atomic_load): ...this. (struct gimple_statement_omp_atomic_store :): Rename to... (struct gomp_atomic_store :): ...this. (struct gimple_statement_transaction): Rename to... (struct gtransaction): ...this. (struct gcond): New subclass. (struct gdebug): New subclass. (struct ggoto): New subclass. (struct glabel): New subclass. (struct gswitch): New subclass. (struct gassign): New subclass. (struct greturn): New subclass. (is_a_helper <gimple_statement_asm *>::test): Rename to... (is_a_helper <gasm *>::test): ...this. (is_a_helper <gimple_statement_bind *>::test): Rename to... (is_a_helper <gbind *>::test): ...this. (is_a_helper <gassign *>::test): New. (is_a_helper <gimple_statement_call *>::test): Rename to... (is_a_helper <gcall *>::test): ...this. (is_a_helper <gimple_statement_catch *>::test): Rename to... (is_a_helper <gcatch *>::test): ...this. (is_a_helper <gimple_statement_resx *>::test): Rename to... (is_a_helper <gresx *>::test): ...this. (is_a_helper <gcond *>::test): New. (is_a_helper <gdebug *>::test): New. (is_a_helper <ggoto *>::test): New. (is_a_helper <glabel *>::test): New. (is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <geh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else *>::test): Rename to... (is_a_helper <geh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <geh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt *>::test): Rename to... (is_a_helper <geh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <gomp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <gomp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <gomp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <gomp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for *>::test): Rename to... (is_a_helper <gomp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <gomp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target *>::test): Rename to... (is_a_helper <gomp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <gomp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single *>::test): Rename to... (is_a_helper <gomp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <gomp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task *>::test): Rename to... (is_a_helper <gomp_task *>::test): ...this. (is_a_helper <gimple_statement_phi *>::test): Rename to... (is_a_helper <gphi *>::test): ...this. (is_a_helper <gimple_statement_transaction *>::test): Rename to... (is_a_helper <gtransaction *>::test): ...this. (is_a_helper <greturn *>::test): New. (is_a_helper <gswitch *>::test): New. (is_a_helper <gimple_statement_try *>::test): Rename to... (is_a_helper <gtry *>::test): ...this. (is_a_helper <const gimple_statement_asm *>::test): Rename to... (is_a_helper <const gasm *>::test): ...this. (is_a_helper <const gimple_statement_bind *>::test): Rename to... (is_a_helper <const gbind *>::test): ...this. (is_a_helper <const gimple_statement_call *>::test): Rename to... (is_a_helper <const gcall *>::test): ...this. (is_a_helper <const gimple_statement_catch *>::test): Rename to... (is_a_helper <const gcatch *>::test): ...this. (is_a_helper <const gimple_statement_resx *>::test): Rename to... (is_a_helper <const gresx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <const geh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <const geh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <const gomp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <const gomp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <const gomp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <const gomp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for *>::test): Rename to... (is_a_helper <const gomp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <const gomp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target *>::test): Rename to... (is_a_helper <const gomp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <const gomp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single *>::test): Rename to... (is_a_helper <const gomp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <const gomp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task *>::test): Rename to... (is_a_helper <const gomp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi *>::test): Rename to... (is_a_helper <const gphi *>::test): ...this. (is_a_helper <const gimple_statement_transaction *>::test): Rename to... (is_a_helper <const gtransaction *>::test): ...this. (gimple_build_return): Strengthen return type to greturn *. (gimple_call_reset_alias_info): Require a gcall *. (gimple_build_call_vec): Return a gcall *. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Return a gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Return a gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Return a glabel *. (gimple_build_goto): Return a ggoto *. (gimple_build_bind): Return a gbind *. (gimple_build_asm_vec): Return a gasm *. (gimple_build_catch): Return a gcatch *. (gimple_build_eh_filter): Return a geh_filter *. (gimple_build_eh_must_not_throw): Return a geh_mnt *. (gimple_build_eh_else): Return a geh_else *. (gimple_build_try): Return a gtry *. (gimple_build_resx): Return a gresx *. (gimple_build_switch_nlabels): Return a gswitch *. (gimple_build_switch): Return a gswitch *. (gimple_build_eh_dispatch): Return a geh_dispatch *. (gimple_build_debug_bind_stat): Return a gdebug *. (gimple_build_debug_source_bind_stat): Return a gdebug *. (gimple_build_omp_critical): Return a gomp_critical *. (gimple_build_omp_for): Return a gomp_for *. (gimple_build_omp_parallel): Return a gomp_parallel *. (gimple_build_omp_task): Return a gomp_task *. (gimple_build_omp_continue): Return a gomp_continue *. (gimple_build_omp_sections): Return a gomp_sections *. (gimple_build_omp_single): Return a gomp_single *. (gimple_build_omp_target): Return a gomp_target *. (gimple_build_omp_teams): Return a gomp_teams *. (gimple_build_omp_atomic_load): Return a gomp_atomic_load *. (gimple_build_omp_atomic_store): Return a gomp_atomic_store *. (gimple_build_transaction): Return a gtransaction *. (gimple_call_arg_flags): Require a const gcall *. (gimple_call_return_flags): Likewise. (gimple_call_copy_skip_args): Require and return a gcall *. (gimple_asm_clobbers_memory_p): Require a const gasm *. (gimple_seq_first_stmt_as_a_bind): New. (gimple_assign_nontemporal_move_p): Require a const gassign * rather than a const_gimple. (gimple_call_internal_fn): Update for renaming to gcall. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Require a gcall * rather than a gimple. (gimple_call_set_fn): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_set_tail): Likewise. (gimple_call_tail_p): Likewise. (gimple_call_set_return_slot_opt): Likewise. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_set_from_thunk): Likewise. (gimple_call_from_thunk_p): Likewise. (gimple_call_set_va_arg_pack): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_set_nothrow): Likewise. (gimple_call_nothrow_p): Likewise. (gimple_call_set_alloca_for_var): Likewise. (gimple_call_alloca_for_var_p): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_call_return_type): Require a const gcall * rather than a const_gimple. (gimple_call_chain_ptr): Likewise. (gimple_call_copy_flags): Require a pair of gcall *. (gimple_cond_set_code): Require a gcond * rather than a gimple (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_cond_make_false): Likewise. (gimple_cond_make_true): Likewise. (gimple_cond_lhs_ptr): Require a const gcond * rather than a const_gimple. (gimple_cond_rhs_ptr): Likewise. (gimple_cond_true_label): Likewise. (gimple_cond_false_label): Likewise. (gimple_cond_true_p): Likewise. (gimple_cond_false_p): Likewise. (gimple_cond_set_condition): Likewise. (gimple_label_label): Require a const glabel *. (gimple_label_set_label): Require a glabel *. (gimple_goto_set_dest): Require a ggoto *. (gimple_bind_vars): Require a const gbind *. (gimple_bind_block): Likewise. (gimple_bind_set_vars): Require a gbind *. (gimple_bind_append_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_body): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_add_seq): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Require a const gasm *. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gasm *. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. (gimple_catch_types): Require a const gcatch *. (gimple_catch_types_ptr): Require a gcatch *. (gimple_catch_handler_ptr): Likewise. (gimple_catch_handler): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Update for renaming of subclass to geh_filter. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Require a geh_filter *. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Require a geh_mnt *. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Require a geh_else *. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_set_kind): Require a gtry *. (gimple_try_set_catch_is_cleanup): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_try_eval_ptr): Update for renaming of subclass to gtry. (gimple_try_cleanup_ptr): Likewise. (gimple_phi_capacity): Update for renaming of subclass to gphi. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_result): Require a gphi *. (gimple_phi_set_arg): Likewise. (gimple_phi_arg_def_ptr): Likewise. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_location_from_edge): Likewise. (gimple_phi_arg_set_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_resx_region): Require a const gresx *. (gimple_resx_set_region): Require a gresx *. (gimple_eh_dispatch_region): Require a const geh_dispatch *. (gimple_eh_dispatch_set_region): Require a geh_dispatch *. (gimple_switch_num_labels): Require a const gswitch *. (gimple_switch_set_num_labels): Likewise. (gimple_switch_index): Likewise. (gimple_switch_index_ptr): Likewise. (gimple_switch_label): Likewise. (gimple_switch_default_label): Likewise. (gimple_switch_set_index): Require a gswitch *. (gimple_switch_set_label): Likewise. (gimple_switch_set_default_label): Likewise. (gimple_omp_critical_name): Require a const gomp_critical *. (gimple_omp_critical_name_ptr): Require a gomp_critical *. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_set_kind): Require a gomp_for *. (gimple_omp_for_set_combined_p): Likewise. (gimple_omp_for_set_combined_into_p): Likewise. (gimple_omp_for_clauses): Update for renaming of subclass to gomp_for. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Update for renaming of subclass to gomp_parallel. (gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn): Require a const gomp_parallel *. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_task_clauses): Update for renaming of subclass to gomp_task. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Whitespace fixes. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Update for renaming of subclass to gomp_task. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Update for renaming of subclass to gomp_single. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Update for renaming of subclass to gomp_target. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Require a gomp_target *. (gimple_omp_target_set_kind): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_target_child_fn): Require a const gomp_target *. (gimple_omp_target_data_arg): Likewise. (gimple_omp_teams_clauses): Update for renaming of subclass to gomp_teams. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Require a gomp_teams *. (gimple_omp_sections_clauses): Update for renaming of subclass to gomp_sections. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_store_val): Require a const gomp_atomic_store *. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Require a const gomp_continue *. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gomp_continue *. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Require a gtransaction *. (gimple_transaction_body): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_label): Require a const gtransaction *. (gimple_transaction_subcode): Likewise. (gimple_transaction_set_body): Require a gtransaction *. (gimple_transaction_set_label): Likewise. (gimple_transaction_set_subcode): Likewise. (gimple_return_retval_ptr): Require a const greturn *. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a greturn *. (gimple_expr_type): Introduce local "call_stmt" and use in place of "stmt" for typesafety. * asan.c: Use gimple subclasses. * auto-profile.c: Likewise. * builtins.c: Likewise. * builtins.h: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * expr.h: Likewise. * gimple-builder.c: Likewise. * gimple-builder.h: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * gimplify.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * internal-fn.def:: Likewise. * internal-fn.h: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sanopt.c: Likewise. * sese.c: Likewise. * ssa-iterators.h: Likewise. * stmt.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp.c: Likewise. * tree-chkp.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-eh.h: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-into-ssa.h: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h * tree-sra.cn_function): * tree-ssa-alias.c: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c * tree-ssa-structalias.c * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadedge.h: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * vtable-verify.c: Likewise. gcc/c-family/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack" from being just a vec<gimple> to a vec<gbind *>. gcc/java/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * java-gimplify.c (java_gimplify_block): Strengthen local "outer" from gimple to gbind *. From-SVN: r217787
2014-11-19 18:00:54 +01:00
call_object_size (struct object_size_info *osi, tree ptr, gcall *call)
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (ptr);
unsigned HOST_WIDE_INT bytes;
gcc_assert (is_gimple_call (call));
gcc_assert (object_sizes[object_size_type][varno]
!= unknown[object_size_type]);
gcc_assert (osi->pass == 0);
bytes = alloc_object_size (call, object_size_type);
if ((object_size_type & 2) == 0)
{
if (object_sizes[object_size_type][varno] < bytes)
object_sizes[object_size_type][varno] = bytes;
}
else
{
if (object_sizes[object_size_type][varno] > bytes)
object_sizes[object_size_type][varno] = bytes;
}
}
/* Compute object_sizes for PTR, defined to an unknown value. */
static void
unknown_object_size (struct object_size_info *osi, tree ptr)
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (ptr);
unsigned HOST_WIDE_INT bytes;
gcc_assert (object_sizes[object_size_type][varno]
!= unknown[object_size_type]);
gcc_assert (osi->pass == 0);
bytes = unknown[object_size_type];
if ((object_size_type & 2) == 0)
{
if (object_sizes[object_size_type][varno] < bytes)
object_sizes[object_size_type][varno] = bytes;
}
else
{
if (object_sizes[object_size_type][varno] > bytes)
object_sizes[object_size_type][varno] = bytes;
}
}
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
/* Merge object sizes of ORIG + OFFSET into DEST. Return true if
the object size might need reexamination later. */
static bool
merge_object_sizes (struct object_size_info *osi, tree dest, tree orig,
unsigned HOST_WIDE_INT offset)
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (dest);
unsigned HOST_WIDE_INT orig_bytes;
if (object_sizes[object_size_type][varno] == unknown[object_size_type])
return false;
if (offset >= offset_limit)
{
object_sizes[object_size_type][varno] = unknown[object_size_type];
return false;
}
if (osi->pass == 0)
collect_object_sizes_for (osi, orig);
orig_bytes = object_sizes[object_size_type][SSA_NAME_VERSION (orig)];
if (orig_bytes != unknown[object_size_type])
orig_bytes = (offset > orig_bytes)
? HOST_WIDE_INT_0U : orig_bytes - offset;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if ((object_size_type & 2) == 0)
{
if (object_sizes[object_size_type][varno] < orig_bytes)
{
object_sizes[object_size_type][varno] = orig_bytes;
osi->changed = true;
}
}
else
{
if (object_sizes[object_size_type][varno] > orig_bytes)
{
object_sizes[object_size_type][varno] = orig_bytes;
osi->changed = true;
}
}
return bitmap_bit_p (osi->reexamine, SSA_NAME_VERSION (orig));
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
/* Compute object_sizes for VAR, defined to the result of an assignment
with operator POINTER_PLUS_EXPR. Return true if the object size might
need reexamination later. */
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
static bool
plus_stmt_object_size (struct object_size_info *osi, tree var, gimple *stmt)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (var);
unsigned HOST_WIDE_INT bytes;
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
tree op0, op1;
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
{
op0 = gimple_assign_rhs1 (stmt);
op1 = gimple_assign_rhs2 (stmt);
}
else if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
{
tree rhs = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
gcc_assert (TREE_CODE (rhs) == MEM_REF);
op0 = TREE_OPERAND (rhs, 0);
op1 = TREE_OPERAND (rhs, 1);
}
else
gcc_unreachable ();
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (object_sizes[object_size_type][varno] == unknown[object_size_type])
return false;
/* Handle PTR + OFFSET here. */
[multiple changes] 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> Zdenek Dvorak <dvorakz@suse.cz> Richard Guenther <rguenther@suse.de> Kaz Kojima <kkojima@gcc.gnu.org> * tree-vrp.c (compare_values_warnv): Convert val2 to the type of val1. (extract_range_from_assert): Create POINTER_PLUS_EXPR for pointer types. (extract_range_from_binary_expr): Handle only POINTER_PLUS_EXPR, MIN_EXPR, and MAX_EXPR for pointer types. * doc/c-tree.texi (POINTER_PLUS_EXPR): Document. * tree-ssa-loop-niter.c (split_to_var_and_offset): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (number_of_iterations_lt_to_ne): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (assert_loop_rolls_lt): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (number_of_iterations_le): Likewise. (expand_simple_operations): POINTER_PLUS_EXPR are simple also. (derive_constant_upper_bound): Handle POINTER_PLUS_EXPR just like PLUS_EXPR and MINUS_EXPR. * tree-pretty-print.c (dump_generic_node): Handle POINTER_PLUS_EXPR. (op_prio): Likewise. (op_symbol_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-ssa-loop-manip.c (create_iv): Handle pointer base specially. * tree-tailcall.c (process_assignment): Mention POINTER_PLUS_EXPR in a TODO comment. * tree.c (build2_stat): Assert when trying to use PLUS_EXPR or MINUS_EXPR with a pointer. Also assert for POINTER_PLUS_EXPR not used with a pointer and an integer type. * tree-scalar-evolution.c (add_to_evolution_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. (follow_ssa_edge_in_rhs): Handle POINTER_PLUS_EXPR like PLUS_EXPR except for the right hand side's type will be sizetype. (interpret_rhs_modify_stmt): Handle POINTER_PLUS_EXPR. (fold_used_pointer_cast): Kill. (pointer_offset_p): Kill. (fold_used_pointer): Kill. (pointer_used_p): Kill. (analyze_scalar_evolution_1 <case GIMPLE_MODIFY_STMT>): Don't call fold_used_pointer. (instantiate_parameters_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. Handle POINTER_PLUS_EXPR as PLUS_EXPR. * builtins.c (get_pointer_alignment): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (expand_builtin_strcat): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (std_gimplify_va_arg_expr): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (expand_builtin_memory_chk): Likewise. (fold_builtin_memory_chk): Likewise. (std_expand_builtin_va_start): Use sizetype for the call to make_tree and then convert to the pointer type. (fold_builtin_memchr): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for adding to a pointer. (std_gimplify_va_arg_expr): Use fold_build2 for the creating of POINTER_PLUS_EXPR. For the BIT_AND_EXPR, cast the operands to sizetype first and then cast the BIT_AND_EXPR back to the pointer type. * fold-const.c (build_range_check): Handle pointer types specially. (extract_array_ref): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Make sure the offset is converted to sizetype. (try_move_mult_to_index): Strip the NOPs from the offset. Remove code argument and replace all uses with PLUS_EXPR. (fold_to_nonsharp_ineq_using_bound): Handle pointer types specially. Don't use a pointer type for MINUS_EXPR. (fold_unary): Handle for (T1)(X op Y), only p+ as that is the only as that can be handled for binary operators now. (fold_binary <case POINTER_PLUS_EXPR>): Add folding of POINTER_PLUS_EXPR. <case PLUS_EXPR>: Add folding of PTR+INT into PTR p+ INT. Don't call try_move_mult_to_index. <case MINUS_EXPR>: Fold (PTR0 p+ A) - (PTR1 p+ B) into (PTR0 - PTR1) + (A - B). Fold (PTR0 p+ A) - PTR1 into (PTR0 - PTR1) + A iff (PTR0 - PTR1) simplifies. Don't call try_move_mult_to_index. (tree_expr_nonnegative_warnv_p): Handle POINTER_PLUS_EXPR. (tree_expr_nonzero_p): Likewise. (fold_indirect_ref_1): Look at POINTER_PLUS_EXPR instead of PLUS_EXPR for the complex expression folding. * tree-chrec.c (chrec_fold_plus_poly_poly): If the first chrec is a pointer type, then the second should be sizetype and not the first's type. For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus_1): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus): For pointer types, use POINTER_PLUS_EXPR instead of PLUS_EXPR. When either operand is zero, convert the other operand. (chrec_apply): Use chrec_convert_rhs on the argument x instead of chrec_convert. (reset_evolution_in_loop): For pointer types, the new_evol should be sizetype. (convert_affine_scev): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_convert_rhs): New function. (chrec_convert_aggressive): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. * tree-chrec.h (chrec_convert_rhs): New prototype. (build_polynomial_chrec): For pointer types, the right hand * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Remove subtraction case as it is always addition now. Make sure the offset is converted to sizetype. (fold_stmt_r): Don't handle PLUS_EXPR/MINUS_EXPR specially. Handle POINTER_PLUS_EXPR like PLUS_EXPR was handled before. * tree-ssa-loop-ivopts.c (determine_base_object): Abort for PLUS_EXPR in pointer type. Handle POINTER_PLUS_EXPR. (tree_to_aff_combination): Likewise. (force_expr_to_var_cost): Likewise. (force_expr_to_var_cost): Likewise. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * c-format.c (check_format_arg): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR of pointer types. * tree-stdarg.c (va_list_counter_bump): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (check_va_list_escapes): Likewise. (check_all_va_list_escapes): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1): Handle POINT_PLUS_EXPR as a PLUS_EXPR. * expr.c (expand_expr_real_1): Handle POINTER_PLUS_EXPR. (string_constant): Likewise. * tree-ssa-address.c (tree_mem_ref_addr): When adding the offset to the base, use POINTER_PLUS_EXPR. (add_to_parts): Convert the index to sizetype. (create_mem_ref): Create A POINTER_PLUS_EXPR for the one case. * matrix-reorg.c (collect_data_for_malloc_call): Stmt will now only be either INDIRECT_REF and POINTER_PLUS_EXPR. Offset only holds something for PLUS_EXPR. (ssa_accessed_in_tree): Handle POINTER_PLUS_EXPR just as a PLUS_EXPR. (analyze_transpose): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. (analyze_accesses_for_modify_stmt): Likewise. Remove comment about the type being integral type as it is wrong now. (can_calculate_expr_before_stmt): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (transform_access_sites): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. Correct the type which the artimentic is done in (is now sizetype). Reindent one loop. * tree-data-ref.c (split_constant_offset): Handle POINTER_PLUS_EXPR * tree-affine.c (tree_to_aff_combination): Likewise. * c-typeck.c (build_unary_op): For pointers create the increment as a sizetype. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * gimplify.c (gimplify_self_mod_expr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (gimplify_omp_atomic_fetch_op): Handle POINTER_PLUS_EXPR. * tree.def (POINTER_PLUS_EXPR): New tree code. * tree-predcom.c (ref_at_iteration): If we have a pointer type do the multiplication in sizetype. * tree-mudflap.c (mf_xform_derefs_1): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_array_index): Don't expect there to be a cast for the index as that does not exist anymore. (forward_propagate_addr_expr_1): Check for POINTER_PLUS_EXPR instead of PLUS_EXPR. Don't check for the first operand of the POINTER_PLUS_EXPR was the index as it cannot be. Call forward_propagate_addr_into_variable_array_index with the SSA_NAME instead of the statement. * varasm.c (const_hash_1): Handle POINTER_PLUS_EXPR. (compare_constant): Likewise. (copy_constant): Likewise. (compute_reloc_for_constant): Likewise. (output_addressed_constants): Likewise. (initializer_constant_valid_p): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion_1): Convert the MIN/MAX of the inner type to the outer type before comparing them. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (issue_prefetch_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-inline.c (estimate_num_insns_1): Handle POINTER_PLUS_EXPR. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (bump_vector_ptr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for the pointer increment statement. (vect_update_ivs_after_vectorizer): For pointer types, create POINTER_PLUS_EXPR instead of PLUS_EXPR and also create MULT_EXPR in sizetype. (vect_gen_niters_for_prolog_loop): Add a cast when creating byte_misalign. * tree-object-size.c (plus_expr_object_size): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. (check_for_plus_in_loops_1): Likewise. (check_for_plus_in_loops): Likewise. * c-common.c (pointer_int_sum): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-structalias.c (handle_ptr_arith): Handle only POINTER_PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. * tree-cfg.c (verify_expr): Add extra checking for pointers and PLUS_EXPR and MINUS_EXPR. Also add checking to make sure the operands of POINTER_PLUS_EXPR are correct. * config/frv/frv.c (frv_expand_builtin_va_start): Use sizetype with make_tree, instead of a pointer type. * config/s390/s390.c (s390_va_start): Use POINTER_PLUS_EXPR for pointers instead of PLUS_EXPR. (s390_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_va_start): Create POINTER_PLUS_EXPR instead of PLUS_EXPR when doing addition on pointer types. Use sizetype for the second operand. (spu_gimplify_va_arg_expr): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use POINTER_PLUS_EXPR instead of PLUS_EXPR when the operand was a pointer. Don't create a BIT_AND_EXPR for pointer types. * config/i386/i386.c (ix86_va_start): Use POINTER_PLUS_EXPR for the pointer addition and also use size_int/sizetype for the offset. (ix86_gimplify_va_arg): Likewise. Perform BIT_AND_EXPR on sizetype arguments. * config/sh/sh.c (sh_va_start): Call make_tree with sizetype and convert its result to a pointer type. Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. (sh_gimplify_va_arg_expr): Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. Perform BIT_AND_EXPR on sizetype arguments. * config/ia64/ia64.c (ia64_gimplify_va_arg): Use POINTER_PLUS_EXPR for pointers and create the BIT_AND_EXPR in sizetype. * config/rs6000/rs6000.c (rs6000_va_start): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. (rs6000_va_start): Likewise. Also use sizetype for the offset. * config/pa/pa.c (reloc_needed): Handle POINTER_PLUS_EXPR as PLUS_EXPR/MINUS_EXPR. (hppa_gimplify_va_arg_expr): Don't create MINUS_EXPR or PLUS_EXPR for pointers, instead use POINTER_PLUS_EXPR. Don't use BIT_AND_EXPR on a pointer type, convert the expression to sizetype first. * config/mips/mips.c (mips_va_start): Use POINTER_PLUS_EXPR for pointers. (mips_gimplify_va_arg_expr): Likewise. Don't create BIT_AND_EXPR in a pointer type. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. * trans-expr.c (gfc_trans_string_copy): Create POINTER_PLUS_EXPR instead of a PLUS_EXPR for pointer types. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * typeck.c (build_binary_op): For templates build the expression in pieces to avoid the assert in build2_stat. (get_member_function_from_ptrfunc): Change over to using POINTER_PLUS_EXPR and convert the second operand to sizetype. * typeck2.c (build_m_component_ref): Likewise. * init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_vec_delete): Likewise. * class.c (build_base_path): Likewise. (build_base_path): Likewise. (convert_to_base_statically): Likewise. (fixed_type_or_null): Handle POINTER_PLUS_EXPR. (get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * call.c (build_special_member_call): Likewise. * rtti.c (build_headof): Likewise. Use sizetype instead of ptrdiff_type_node. (tinfo_base_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * except.c (expand_start_catch_block): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. * cp-gimplify.c (cxx_omp_clause_apply_fn): Convert PLUS_EXPR on pointer types over to use POINTER_PLUS_EXPR and remove the conversion to the pointer types. * method.c (thunk_adjust): Use POINTER_PLUS_EXPR for adding to a pointer type. Use size_int instead of ssize_int. Convert the index to sizetype before adding it to the pointer. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans.c (Attribute_to_gnu): When subtracting an offset from a pointer, use POINTER_PLUS_EXPR with NEGATE_EXPR instead of MINUS_EXPR. (gnat_to_gnu): Likewise. * utils.c (convert): When converting between thin pointers, use POINTER_PLUS_EXPR and sizetype for the offset. * utils2.c (known_alignment): POINTER_PLUS_EXPR have the same semantics as PLUS_EXPR for alignment. (build_binary_op): Add support for the semantics of POINTER_PLUS_EXPR's operands. When adding an offset to a pointer, use POINTER_PLUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * class.c (make_class_data): Build the index in sizetype. Use POINTER_PLUS_EXPR instead of PLUS_EXPR when adding to a pointer type. (build_symbol_entry): Likewise. * expr.c (build_java_arrayaccess): Likewise. (build_field_ref): Likewise. (build_known_method_ref): Likewise. (build_invokevirtual): Likewise. * except.c (build_exception_object_ref): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32225 * gcc.c-torture/compile/20070605-1.c: New test. * gcc.c-torture/compile/20070603-1.c: New testcase. * gcc.c-torture/compile/20070603-2.c: New testcase. * gcc.c-torture/compile/20070531-1.c: New test. PR tree-opt/32167 * gcc.c-torture/compile/20070531-2.c: New test. PR tree-opt/32144 * gcc.c-torture/compile/20070529-1.c: New test. PR tree-opt/32145 * gcc.c-torture/compile/20070529-2.c: New test. PR tree-opt/32015 * gcc.c-torture/compile/20070520-1.c: New test. * g++.dg/ext/java-1.C: New test. * gcc.dg/vect/vect-106.c: We are now able to vectorize two loops instead of one. Remove the "can't determine dependence" check. * gcc.dg/tree-ssa/20030815-1.c: Remove testcase which is no longer needed as the cast is gone in the first place. * gcc.dg/max-1.c: Change local variable a to be a global one. * gcc.dg/tree-ssa/ssa-pre-8.c: Update testcase since we don't have a cast which is PREd. From-SVN: r125755
2007-06-16 07:42:36 +02:00
if (TREE_CODE (op1) == INTEGER_CST
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
&& (TREE_CODE (op0) == SSA_NAME
|| TREE_CODE (op0) == ADDR_EXPR))
{
if (! tree_fits_uhwi_p (op1))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
bytes = unknown[object_size_type];
else if (TREE_CODE (op0) == SSA_NAME)
decl.c, [...]: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ada/ * gcc-interface/decl.c, gcc-interface/utils.c, gcc-interface/utils2.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c-family/ * c-common.c, c-cppbuiltin.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c/ * c-decl.c, c-typeck.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/cp/ * call.c, class.c, decl.c, error.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/objc/ * objc-encoding.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ * alias.c, asan.c, builtins.c, cfgexpand.c, cgraph.c, config/aarch64/aarch64.c, config/alpha/predicates.md, config/arm/arm.c, config/darwin.c, config/epiphany/epiphany.c, config/i386/i386.c, config/iq2000/iq2000.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/mips/mips.c, config/picochip/picochip.c, config/rs6000/rs6000.c, cppbuiltin.c, dbxout.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, fold-const.c, function.c, gimple-fold.c, godump.c, ipa-cp.c, ipa-prop.c, omp-low.c, predict.c, sdbout.c, stor-layout.c, trans-mem.c, tree-object-size.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-forwprop.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-strlen.c, tree-stdarg.c, tree-switch-conversion.c, tree-vect-generic.c, tree-vect-loop.c, tree-vect-patterns.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, varasm.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. From-SVN: r204961
2013-11-18 15:52:19 +01:00
return merge_object_sizes (osi, var, op0, tree_to_uhwi (op1));
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
else
{
decl.c, [...]: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ada/ * gcc-interface/decl.c, gcc-interface/utils.c, gcc-interface/utils2.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c-family/ * c-common.c, c-cppbuiltin.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/c/ * c-decl.c, c-typeck.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/cp/ * call.c, class.c, decl.c, error.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/objc/ * objc-encoding.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. gcc/ * alias.c, asan.c, builtins.c, cfgexpand.c, cgraph.c, config/aarch64/aarch64.c, config/alpha/predicates.md, config/arm/arm.c, config/darwin.c, config/epiphany/epiphany.c, config/i386/i386.c, config/iq2000/iq2000.c, config/m32c/m32c-pragma.c, config/mep/mep-pragma.c, config/mips/mips.c, config/picochip/picochip.c, config/rs6000/rs6000.c, cppbuiltin.c, dbxout.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, fold-const.c, function.c, gimple-fold.c, godump.c, ipa-cp.c, ipa-prop.c, omp-low.c, predict.c, sdbout.c, stor-layout.c, trans-mem.c, tree-object-size.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-forwprop.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-ssa-loop-prefetch.c, tree-ssa-strlen.c, tree-stdarg.c, tree-switch-conversion.c, tree-vect-generic.c, tree-vect-loop.c, tree-vect-patterns.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, varasm.c: Replace tree_low_cst (..., 1) with tree_to_uhwi throughout. From-SVN: r204961
2013-11-18 15:52:19 +01:00
unsigned HOST_WIDE_INT off = tree_to_uhwi (op1);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
/* op0 will be ADDR_EXPR here. */
addr_object_size (osi, op0, object_size_type, &bytes);
if (bytes == unknown[object_size_type])
;
else if (off > offset_limit)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
bytes = unknown[object_size_type];
else if (off > bytes)
bytes = 0;
else
bytes -= off;
}
}
else
bytes = unknown[object_size_type];
if ((object_size_type & 2) == 0)
{
if (object_sizes[object_size_type][varno] < bytes)
object_sizes[object_size_type][varno] = bytes;
}
else
{
if (object_sizes[object_size_type][varno] > bytes)
object_sizes[object_size_type][varno] = bytes;
}
return false;
}
/* Compute object_sizes for VAR, defined at STMT, which is
a COND_EXPR. Return true if the object size might need reexamination
later. */
static bool
cond_expr_object_size (struct object_size_info *osi, tree var, gimple *stmt)
{
tree then_, else_;
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (var);
bool reexamine = false;
gcc_assert (gimple_assign_rhs_code (stmt) == COND_EXPR);
if (object_sizes[object_size_type][varno] == unknown[object_size_type])
return false;
then_ = gimple_assign_rhs2 (stmt);
else_ = gimple_assign_rhs3 (stmt);
if (TREE_CODE (then_) == SSA_NAME)
reexamine |= merge_object_sizes (osi, var, then_, 0);
else
expr_object_size (osi, var, then_);
if (TREE_CODE (else_) == SSA_NAME)
reexamine |= merge_object_sizes (osi, var, else_, 0);
else
expr_object_size (osi, var, else_);
return reexamine;
}
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
/* Compute object sizes for VAR.
For ADDR_EXPR an object size is the number of remaining bytes
to the end of the object (where what is considered an object depends on
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
OSI->object_size_type).
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
For allocation GIMPLE_CALL like malloc or calloc object size is the size
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
of the allocation.
[multiple changes] 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> Zdenek Dvorak <dvorakz@suse.cz> Richard Guenther <rguenther@suse.de> Kaz Kojima <kkojima@gcc.gnu.org> * tree-vrp.c (compare_values_warnv): Convert val2 to the type of val1. (extract_range_from_assert): Create POINTER_PLUS_EXPR for pointer types. (extract_range_from_binary_expr): Handle only POINTER_PLUS_EXPR, MIN_EXPR, and MAX_EXPR for pointer types. * doc/c-tree.texi (POINTER_PLUS_EXPR): Document. * tree-ssa-loop-niter.c (split_to_var_and_offset): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (number_of_iterations_lt_to_ne): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (assert_loop_rolls_lt): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (number_of_iterations_le): Likewise. (expand_simple_operations): POINTER_PLUS_EXPR are simple also. (derive_constant_upper_bound): Handle POINTER_PLUS_EXPR just like PLUS_EXPR and MINUS_EXPR. * tree-pretty-print.c (dump_generic_node): Handle POINTER_PLUS_EXPR. (op_prio): Likewise. (op_symbol_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-ssa-loop-manip.c (create_iv): Handle pointer base specially. * tree-tailcall.c (process_assignment): Mention POINTER_PLUS_EXPR in a TODO comment. * tree.c (build2_stat): Assert when trying to use PLUS_EXPR or MINUS_EXPR with a pointer. Also assert for POINTER_PLUS_EXPR not used with a pointer and an integer type. * tree-scalar-evolution.c (add_to_evolution_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. (follow_ssa_edge_in_rhs): Handle POINTER_PLUS_EXPR like PLUS_EXPR except for the right hand side's type will be sizetype. (interpret_rhs_modify_stmt): Handle POINTER_PLUS_EXPR. (fold_used_pointer_cast): Kill. (pointer_offset_p): Kill. (fold_used_pointer): Kill. (pointer_used_p): Kill. (analyze_scalar_evolution_1 <case GIMPLE_MODIFY_STMT>): Don't call fold_used_pointer. (instantiate_parameters_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. Handle POINTER_PLUS_EXPR as PLUS_EXPR. * builtins.c (get_pointer_alignment): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (expand_builtin_strcat): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (std_gimplify_va_arg_expr): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (expand_builtin_memory_chk): Likewise. (fold_builtin_memory_chk): Likewise. (std_expand_builtin_va_start): Use sizetype for the call to make_tree and then convert to the pointer type. (fold_builtin_memchr): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for adding to a pointer. (std_gimplify_va_arg_expr): Use fold_build2 for the creating of POINTER_PLUS_EXPR. For the BIT_AND_EXPR, cast the operands to sizetype first and then cast the BIT_AND_EXPR back to the pointer type. * fold-const.c (build_range_check): Handle pointer types specially. (extract_array_ref): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Make sure the offset is converted to sizetype. (try_move_mult_to_index): Strip the NOPs from the offset. Remove code argument and replace all uses with PLUS_EXPR. (fold_to_nonsharp_ineq_using_bound): Handle pointer types specially. Don't use a pointer type for MINUS_EXPR. (fold_unary): Handle for (T1)(X op Y), only p+ as that is the only as that can be handled for binary operators now. (fold_binary <case POINTER_PLUS_EXPR>): Add folding of POINTER_PLUS_EXPR. <case PLUS_EXPR>: Add folding of PTR+INT into PTR p+ INT. Don't call try_move_mult_to_index. <case MINUS_EXPR>: Fold (PTR0 p+ A) - (PTR1 p+ B) into (PTR0 - PTR1) + (A - B). Fold (PTR0 p+ A) - PTR1 into (PTR0 - PTR1) + A iff (PTR0 - PTR1) simplifies. Don't call try_move_mult_to_index. (tree_expr_nonnegative_warnv_p): Handle POINTER_PLUS_EXPR. (tree_expr_nonzero_p): Likewise. (fold_indirect_ref_1): Look at POINTER_PLUS_EXPR instead of PLUS_EXPR for the complex expression folding. * tree-chrec.c (chrec_fold_plus_poly_poly): If the first chrec is a pointer type, then the second should be sizetype and not the first's type. For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus_1): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus): For pointer types, use POINTER_PLUS_EXPR instead of PLUS_EXPR. When either operand is zero, convert the other operand. (chrec_apply): Use chrec_convert_rhs on the argument x instead of chrec_convert. (reset_evolution_in_loop): For pointer types, the new_evol should be sizetype. (convert_affine_scev): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_convert_rhs): New function. (chrec_convert_aggressive): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. * tree-chrec.h (chrec_convert_rhs): New prototype. (build_polynomial_chrec): For pointer types, the right hand * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Remove subtraction case as it is always addition now. Make sure the offset is converted to sizetype. (fold_stmt_r): Don't handle PLUS_EXPR/MINUS_EXPR specially. Handle POINTER_PLUS_EXPR like PLUS_EXPR was handled before. * tree-ssa-loop-ivopts.c (determine_base_object): Abort for PLUS_EXPR in pointer type. Handle POINTER_PLUS_EXPR. (tree_to_aff_combination): Likewise. (force_expr_to_var_cost): Likewise. (force_expr_to_var_cost): Likewise. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * c-format.c (check_format_arg): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR of pointer types. * tree-stdarg.c (va_list_counter_bump): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (check_va_list_escapes): Likewise. (check_all_va_list_escapes): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1): Handle POINT_PLUS_EXPR as a PLUS_EXPR. * expr.c (expand_expr_real_1): Handle POINTER_PLUS_EXPR. (string_constant): Likewise. * tree-ssa-address.c (tree_mem_ref_addr): When adding the offset to the base, use POINTER_PLUS_EXPR. (add_to_parts): Convert the index to sizetype. (create_mem_ref): Create A POINTER_PLUS_EXPR for the one case. * matrix-reorg.c (collect_data_for_malloc_call): Stmt will now only be either INDIRECT_REF and POINTER_PLUS_EXPR. Offset only holds something for PLUS_EXPR. (ssa_accessed_in_tree): Handle POINTER_PLUS_EXPR just as a PLUS_EXPR. (analyze_transpose): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. (analyze_accesses_for_modify_stmt): Likewise. Remove comment about the type being integral type as it is wrong now. (can_calculate_expr_before_stmt): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (transform_access_sites): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. Correct the type which the artimentic is done in (is now sizetype). Reindent one loop. * tree-data-ref.c (split_constant_offset): Handle POINTER_PLUS_EXPR * tree-affine.c (tree_to_aff_combination): Likewise. * c-typeck.c (build_unary_op): For pointers create the increment as a sizetype. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * gimplify.c (gimplify_self_mod_expr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (gimplify_omp_atomic_fetch_op): Handle POINTER_PLUS_EXPR. * tree.def (POINTER_PLUS_EXPR): New tree code. * tree-predcom.c (ref_at_iteration): If we have a pointer type do the multiplication in sizetype. * tree-mudflap.c (mf_xform_derefs_1): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_array_index): Don't expect there to be a cast for the index as that does not exist anymore. (forward_propagate_addr_expr_1): Check for POINTER_PLUS_EXPR instead of PLUS_EXPR. Don't check for the first operand of the POINTER_PLUS_EXPR was the index as it cannot be. Call forward_propagate_addr_into_variable_array_index with the SSA_NAME instead of the statement. * varasm.c (const_hash_1): Handle POINTER_PLUS_EXPR. (compare_constant): Likewise. (copy_constant): Likewise. (compute_reloc_for_constant): Likewise. (output_addressed_constants): Likewise. (initializer_constant_valid_p): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion_1): Convert the MIN/MAX of the inner type to the outer type before comparing them. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (issue_prefetch_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-inline.c (estimate_num_insns_1): Handle POINTER_PLUS_EXPR. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (bump_vector_ptr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for the pointer increment statement. (vect_update_ivs_after_vectorizer): For pointer types, create POINTER_PLUS_EXPR instead of PLUS_EXPR and also create MULT_EXPR in sizetype. (vect_gen_niters_for_prolog_loop): Add a cast when creating byte_misalign. * tree-object-size.c (plus_expr_object_size): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. (check_for_plus_in_loops_1): Likewise. (check_for_plus_in_loops): Likewise. * c-common.c (pointer_int_sum): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-structalias.c (handle_ptr_arith): Handle only POINTER_PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. * tree-cfg.c (verify_expr): Add extra checking for pointers and PLUS_EXPR and MINUS_EXPR. Also add checking to make sure the operands of POINTER_PLUS_EXPR are correct. * config/frv/frv.c (frv_expand_builtin_va_start): Use sizetype with make_tree, instead of a pointer type. * config/s390/s390.c (s390_va_start): Use POINTER_PLUS_EXPR for pointers instead of PLUS_EXPR. (s390_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_va_start): Create POINTER_PLUS_EXPR instead of PLUS_EXPR when doing addition on pointer types. Use sizetype for the second operand. (spu_gimplify_va_arg_expr): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use POINTER_PLUS_EXPR instead of PLUS_EXPR when the operand was a pointer. Don't create a BIT_AND_EXPR for pointer types. * config/i386/i386.c (ix86_va_start): Use POINTER_PLUS_EXPR for the pointer addition and also use size_int/sizetype for the offset. (ix86_gimplify_va_arg): Likewise. Perform BIT_AND_EXPR on sizetype arguments. * config/sh/sh.c (sh_va_start): Call make_tree with sizetype and convert its result to a pointer type. Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. (sh_gimplify_va_arg_expr): Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. Perform BIT_AND_EXPR on sizetype arguments. * config/ia64/ia64.c (ia64_gimplify_va_arg): Use POINTER_PLUS_EXPR for pointers and create the BIT_AND_EXPR in sizetype. * config/rs6000/rs6000.c (rs6000_va_start): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. (rs6000_va_start): Likewise. Also use sizetype for the offset. * config/pa/pa.c (reloc_needed): Handle POINTER_PLUS_EXPR as PLUS_EXPR/MINUS_EXPR. (hppa_gimplify_va_arg_expr): Don't create MINUS_EXPR or PLUS_EXPR for pointers, instead use POINTER_PLUS_EXPR. Don't use BIT_AND_EXPR on a pointer type, convert the expression to sizetype first. * config/mips/mips.c (mips_va_start): Use POINTER_PLUS_EXPR for pointers. (mips_gimplify_va_arg_expr): Likewise. Don't create BIT_AND_EXPR in a pointer type. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. * trans-expr.c (gfc_trans_string_copy): Create POINTER_PLUS_EXPR instead of a PLUS_EXPR for pointer types. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * typeck.c (build_binary_op): For templates build the expression in pieces to avoid the assert in build2_stat. (get_member_function_from_ptrfunc): Change over to using POINTER_PLUS_EXPR and convert the second operand to sizetype. * typeck2.c (build_m_component_ref): Likewise. * init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_vec_delete): Likewise. * class.c (build_base_path): Likewise. (build_base_path): Likewise. (convert_to_base_statically): Likewise. (fixed_type_or_null): Handle POINTER_PLUS_EXPR. (get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * call.c (build_special_member_call): Likewise. * rtti.c (build_headof): Likewise. Use sizetype instead of ptrdiff_type_node. (tinfo_base_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * except.c (expand_start_catch_block): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. * cp-gimplify.c (cxx_omp_clause_apply_fn): Convert PLUS_EXPR on pointer types over to use POINTER_PLUS_EXPR and remove the conversion to the pointer types. * method.c (thunk_adjust): Use POINTER_PLUS_EXPR for adding to a pointer type. Use size_int instead of ssize_int. Convert the index to sizetype before adding it to the pointer. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans.c (Attribute_to_gnu): When subtracting an offset from a pointer, use POINTER_PLUS_EXPR with NEGATE_EXPR instead of MINUS_EXPR. (gnat_to_gnu): Likewise. * utils.c (convert): When converting between thin pointers, use POINTER_PLUS_EXPR and sizetype for the offset. * utils2.c (known_alignment): POINTER_PLUS_EXPR have the same semantics as PLUS_EXPR for alignment. (build_binary_op): Add support for the semantics of POINTER_PLUS_EXPR's operands. When adding an offset to a pointer, use POINTER_PLUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * class.c (make_class_data): Build the index in sizetype. Use POINTER_PLUS_EXPR instead of PLUS_EXPR when adding to a pointer type. (build_symbol_entry): Likewise. * expr.c (build_java_arrayaccess): Likewise. (build_field_ref): Likewise. (build_known_method_ref): Likewise. (build_invokevirtual): Likewise. * except.c (build_exception_object_ref): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32225 * gcc.c-torture/compile/20070605-1.c: New test. * gcc.c-torture/compile/20070603-1.c: New testcase. * gcc.c-torture/compile/20070603-2.c: New testcase. * gcc.c-torture/compile/20070531-1.c: New test. PR tree-opt/32167 * gcc.c-torture/compile/20070531-2.c: New test. PR tree-opt/32144 * gcc.c-torture/compile/20070529-1.c: New test. PR tree-opt/32145 * gcc.c-torture/compile/20070529-2.c: New test. PR tree-opt/32015 * gcc.c-torture/compile/20070520-1.c: New test. * g++.dg/ext/java-1.C: New test. * gcc.dg/vect/vect-106.c: We are now able to vectorize two loops instead of one. Remove the "can't determine dependence" check. * gcc.dg/tree-ssa/20030815-1.c: Remove testcase which is no longer needed as the cast is gone in the first place. * gcc.dg/max-1.c: Change local variable a to be a global one. * gcc.dg/tree-ssa/ssa-pre-8.c: Update testcase since we don't have a cast which is PREd. From-SVN: r125755
2007-06-16 07:42:36 +02:00
For POINTER_PLUS_EXPR where second operand is a constant integer,
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
object size is object size of the first operand minus the constant.
If the constant is bigger than the number of remaining bytes until the
end of the object, object size is 0, but if it is instead a pointer
subtraction, object size is unknown[object_size_type].
To differentiate addition from subtraction, ADDR_EXPR returns
unknown[object_size_type] for all objects bigger than half of the address
space, and constants less than half of the address space are considered
addition, while bigger constants subtraction.
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
For a memcpy like GIMPLE_CALL that always returns one of its arguments, the
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
object size is object size of that argument.
Otherwise, object size is the maximum of object sizes of variables
that it might be set to. */
static void
collect_object_sizes_for (struct object_size_info *osi, tree var)
{
int object_size_type = osi->object_size_type;
unsigned int varno = SSA_NAME_VERSION (var);
gimple *stmt;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
bool reexamine;
if (bitmap_bit_p (computed[object_size_type], varno))
return;
if (osi->pass == 0)
{
cfgloop.c (get_loop_body_in_bfs_order): Avoid redundant call to bitmap_bit_p. * cfgloop.c (get_loop_body_in_bfs_order): Avoid redundant call to bitmap_bit_p. * config/bfin/bifn.c (bfin_discover_loop): Likewise. * dominance.c (iterate_fix_dominators): Likewise. * dse.c (set_usage_bits): Likewise. (set_position_unneeded, record_store): Likewise. * gimple-fold.c (get_maxval_strlen): Likewise. * haifa-sched.c (fix_inter_tick, fix_recovery_deps): Likewise. * ipa-inline.c (update_caller_keys): Likewise. * ipa-split.c (verify_non_ssa_vars): Likewise. * ipa-type-escape.c (mark_type, close_type_seen): Likewise. (close_type_exposed_parameter, close_type_full_escape): Likewise. (close_addressof_down): Likewise. * ira-color.c (assign_hard_reg, push_allocno_to_stack): Likewise. (setup_allocno_left_conflicts_size): Likewise. (ira_reassign_conflict_allocnos): Likewise. (ira_reassign_pseudos): Likewise. * ira-emit.c (change_loop): Likewise. * loop-invariant.c (mark_regno_live, mark_regno_death): Likewise. * lto-streamer-out.c (write_symbol): Likewise. * predict.c (expr_expected_value_1): Likewise. * regstat.c (regstat_bb_compute_ri): Likewise. * sel-sched.c (create_block_for_bookkeeping): Likewise. (track_scheduled_insns_and_blocks, sel_sched_region_1): Likewise. * stmt.c (expand_case): Likewise. * tree-eh.c (emit_eh_dispatch): Likewise. * tree-into-ssa.c (prune_unused_phi_nodes): Likewise. * tree-loop-distribution.c (make_nodes_having_upstream_mem_writes): Likewise. (rdg_flag_vertex, rdg_flag_loop_exits): Likewise. (rdg_build_components): Likewise. * tree-object-size.c (collect_object_sizes_for): Likewise. * tree-sra.c (convert_callers): Likewise. * tree-ssa-coalesce.c (live_track_add_partition): Likewise. * tree-ssa-live.c (mark_all_vars_used_1): Likewise. * tree-ssa-pre.c (bitmap_set_replace_value): Likewise. From-SVN: r163378
2010-08-19 18:51:39 +02:00
if (bitmap_set_bit (osi->visited, varno))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
object_sizes[object_size_type][varno]
= (object_size_type & 2) ? -1 : 0;
}
else
{
/* Found a dependency loop. Mark the variable for later
re-examination. */
bitmap_set_bit (osi->reexamine, varno);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found a dependency loop at ");
print_generic_expr (dump_file, var, dump_flags);
fprintf (dump_file, "\n");
}
return;
}
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Visiting use-def links for ");
print_generic_expr (dump_file, var, dump_flags);
fprintf (dump_file, "\n");
}
stmt = SSA_NAME_DEF_STMT (var);
reexamine = false;
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
switch (gimple_code (stmt))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_ASSIGN:
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
re PR middle-end/42834 (memcpy folding overeager) 2010-07-01 Richard Guenther <rguenther@suse.de> PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR <T1, MEM_REF <T2, ...>> to MEM_REF <T1, ...>. (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. From-SVN: r161655
2010-07-01 10:49:19 +02:00
tree rhs = gimple_assign_rhs1 (stmt);
if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
|| (gimple_assign_rhs_code (stmt) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == MEM_REF))
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
reexamine = plus_stmt_object_size (osi, var, stmt);
else if (gimple_assign_rhs_code (stmt) == COND_EXPR)
reexamine = cond_expr_object_size (osi, var, stmt);
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
else if (gimple_assign_single_p (stmt)
|| gimple_assign_unary_nop_p (stmt))
{
if (TREE_CODE (rhs) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (rhs)))
reexamine = merge_object_sizes (osi, var, rhs, 0);
else
expr_object_size (osi, var, rhs);
}
else
unknown_object_size (osi, var);
break;
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_CALL:
{
Merger of git branch "gimple-classes-v2-option-3" gcc/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * coretypes.h (struct gcond): Add forward decl. (struct gdebug): Likewise. (struct ggoto): Likewise. (struct glabel): Likewise. (struct gswitch): Likewise. (struct gassign): Likewise. (struct gasm): Likewise. (struct gcall): Likewise. (struct gtransaction): Likewise. (struct greturn): Likewise. (struct gbind): Likewise. (struct gcatch): Likewise. (struct geh_filter): Likewise. (struct geh_mnt): Likewise. (struct geh_else): Likewise. (struct gresx): Likewise. (struct geh_dispatch): Likewise. (struct gphi): Likewise. (struct gtry): Likewise. (struct gomp_atomic_load): Likewise. (struct gomp_atomic_store): Likewise. (struct gomp_continue): Likewise. (struct gomp_critical): Likewise. (struct gomp_for): Likewise. (struct gomp_parallel): Likewise. (struct gomp_task): Likewise. (struct gomp_sections): Likewise. (struct gomp_single): Likewise. (struct gomp_target): Likewise. (struct gomp_teams): Likewise. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple subclasses. * gdbhooks.py: Update. * gimple-iterator.c (gsi_for_phi): New. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. * gimple-iterator.h (struct gphi_iterator): New subclass of gimple_stmt_iterator. (gsi_for_phi): New prototype. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. (gsi_next_nonvirtual_phi): Strengthen param from gimple_stmt_iterator * to gphi_iterator *, and local "phi" from gimple to gphi *. * gsstruct.def: Update for renamings of classes. * gimple.c (gimple_build_return): Strengthen return type from gimple to greturn *. (gimple_call_reset_alias_info): Strengthen param to gcall *. (gimple_build_call_1): Strengthen return type from gimple to gcall *. (gimple_build_call_vec): Likewise. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal_1): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Strengthen return type from gimple to gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Strengthen return type from gimple to gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Strengthen return type from gimple to glabel *. (gimple_build_goto): Strengthen return type from gimple to ggoto *. (gimple_build_bind): Strengthen return type from gimple to gbind *. (gimple_build_asm_1): Strengthen return type from gimple to gasm *. (gimple_build_asm_vec): Likewise. (gimple_build_catch): Strengthen return type from gimple to gcatch *. (gimple_build_eh_filter): Strengthen return type from gimple to geh_filter *. (gimple_build_eh_must_not_throw): Strengthen return type from gimple to geh_mnt *. (gimple_build_eh_else): Strengthen return type from gimple to geh_else *. (gimple_build_try): Update for renaming of gimple_statement_try to gtry. (gimple_build_resx): Strengthen return type from gimple to gresx *. (gimple_build_switch_nlabels): Strengthen return type from gimple to gswitch *. (gimple_build_switch): Likewise. (gimple_build_eh_dispatch): Strengthen return type from gimple to geh_dispatch *. (gimple_build_debug_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_debug_source_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_omp_critical): Strengthen return type from gimple to gomp_critical *. (gimple_build_omp_for): Strengthen return type from gimple to gomp_for *. (gimple_build_omp_parallel): Strengthen return type from gimple to gomp_parallel *. (gimple_build_omp_task): Strengthen return type from gimple to gomp_task *. (gimple_build_omp_continue): Strengthen return type from gimple to gomp_continue *. (gimple_build_omp_sections): Strengthen return type from gimple to gomp_sections *. (gimple_build_omp_single): Strengthen return type from gimple to gomp_single *. (gimple_build_omp_target): Strengthen return type from gimple to gomp_target *. (gimple_build_omp_teams): Strengthen return type from gimple to gomp_teams *. (gimple_build_omp_atomic_load): Strengthen return type from gimple to gomp_atomic_load *. (gimple_build_omp_atomic_store): Strengthen return type from gimple to gomp_atomic_store *. (gimple_build_transaction): Strengthen return type from gimple to gtransaction *. (empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast. (gimple_call_fnspec): Require a const gcall *. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. (gimple_set_bb): Add a checked cast. (gimple_copy): Within the cases, add locals of the appropriate subclass and use in place of "stmt" and "copy" for typesafety. (gimple_has_side_effects): Add a checked cast. (gimple_could_trap_p_1): Likewise. (gimple_call_copy_skip_args): Require a gcall *, and return one. (gimple_asm_clobbers_memory_p): Require a const gasm *. (infer_nonnull_range): Replace a check for GIMPLE_RETURN with a dyn_cast, introducing local "return_stmt" and using ti in place of "stmt". * gimple.h (gimple_vec): Eliminate this typedef. (struct gimple_statement_call): Rename to... (struct gcall): ...this. (struct gimple_statement_bind): Rename to... (struct gbind): ...this. (struct gimple_statement_catch): Rename to... (struct gcatch): ...this. (struct gimple_statement_eh_filter): Rename to... (struct geh_filter): ...this. (struct gimple_statement_eh_else): Rename to... (struct geh_else): ...this. (struct gimple_statement_eh_mnt): Rename to... (struct geh_mnt): ...this. (struct gimple_statement_phi): Rename to... (struct gphi): ...this. (struct gimple_statement_resx): Rename to... (struct gresx): ...this. (struct gimple_statement_eh_dispatch): Rename to... (struct geh_dispatch): ...this. (struct gimple_statement_try): Rename to... (struct gtry): ...this. (struct gimple_statement_asm): Rename to... (struct gasm): ...this. (struct gimple_statement_omp_critical): Rename to... (struct gomp_critical): ...this. (struct gimple_statement_omp_for): Rename to... (struct gomp_for): ...this. (struct gimple_statement_omp_parallel): Rename to... (struct gomp_parallel): ...this. (struct gimple_statement_omp_target): Rename to... (struct gomp_target): ...this. (struct gimple_statement_omp_task): Rename to... (struct gomp_task): ...this. (struct gimple_statement_omp_sections): Rename to... (struct gomp_sections): ...this. (struct gimple_statement_omp_continue): Rename to... (struct gomp_continue): ...this. (struct gimple_statement_omp_single): Rename to... (struct gomp_single): ...this. (struct gimple_statement_omp_teams): Rename to... (struct gomp_teams): ...this. (struct gimple_statement_omp_atomic_load): Rename to... (struct gomp_atomic_load): ...this. (struct gimple_statement_omp_atomic_store :): Rename to... (struct gomp_atomic_store :): ...this. (struct gimple_statement_transaction): Rename to... (struct gtransaction): ...this. (struct gcond): New subclass. (struct gdebug): New subclass. (struct ggoto): New subclass. (struct glabel): New subclass. (struct gswitch): New subclass. (struct gassign): New subclass. (struct greturn): New subclass. (is_a_helper <gimple_statement_asm *>::test): Rename to... (is_a_helper <gasm *>::test): ...this. (is_a_helper <gimple_statement_bind *>::test): Rename to... (is_a_helper <gbind *>::test): ...this. (is_a_helper <gassign *>::test): New. (is_a_helper <gimple_statement_call *>::test): Rename to... (is_a_helper <gcall *>::test): ...this. (is_a_helper <gimple_statement_catch *>::test): Rename to... (is_a_helper <gcatch *>::test): ...this. (is_a_helper <gimple_statement_resx *>::test): Rename to... (is_a_helper <gresx *>::test): ...this. (is_a_helper <gcond *>::test): New. (is_a_helper <gdebug *>::test): New. (is_a_helper <ggoto *>::test): New. (is_a_helper <glabel *>::test): New. (is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <geh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else *>::test): Rename to... (is_a_helper <geh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <geh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt *>::test): Rename to... (is_a_helper <geh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <gomp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <gomp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <gomp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <gomp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for *>::test): Rename to... (is_a_helper <gomp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <gomp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target *>::test): Rename to... (is_a_helper <gomp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <gomp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single *>::test): Rename to... (is_a_helper <gomp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <gomp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task *>::test): Rename to... (is_a_helper <gomp_task *>::test): ...this. (is_a_helper <gimple_statement_phi *>::test): Rename to... (is_a_helper <gphi *>::test): ...this. (is_a_helper <gimple_statement_transaction *>::test): Rename to... (is_a_helper <gtransaction *>::test): ...this. (is_a_helper <greturn *>::test): New. (is_a_helper <gswitch *>::test): New. (is_a_helper <gimple_statement_try *>::test): Rename to... (is_a_helper <gtry *>::test): ...this. (is_a_helper <const gimple_statement_asm *>::test): Rename to... (is_a_helper <const gasm *>::test): ...this. (is_a_helper <const gimple_statement_bind *>::test): Rename to... (is_a_helper <const gbind *>::test): ...this. (is_a_helper <const gimple_statement_call *>::test): Rename to... (is_a_helper <const gcall *>::test): ...this. (is_a_helper <const gimple_statement_catch *>::test): Rename to... (is_a_helper <const gcatch *>::test): ...this. (is_a_helper <const gimple_statement_resx *>::test): Rename to... (is_a_helper <const gresx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <const geh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <const geh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <const gomp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <const gomp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <const gomp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <const gomp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for *>::test): Rename to... (is_a_helper <const gomp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <const gomp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target *>::test): Rename to... (is_a_helper <const gomp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <const gomp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single *>::test): Rename to... (is_a_helper <const gomp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <const gomp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task *>::test): Rename to... (is_a_helper <const gomp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi *>::test): Rename to... (is_a_helper <const gphi *>::test): ...this. (is_a_helper <const gimple_statement_transaction *>::test): Rename to... (is_a_helper <const gtransaction *>::test): ...this. (gimple_build_return): Strengthen return type to greturn *. (gimple_call_reset_alias_info): Require a gcall *. (gimple_build_call_vec): Return a gcall *. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Return a gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Return a gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Return a glabel *. (gimple_build_goto): Return a ggoto *. (gimple_build_bind): Return a gbind *. (gimple_build_asm_vec): Return a gasm *. (gimple_build_catch): Return a gcatch *. (gimple_build_eh_filter): Return a geh_filter *. (gimple_build_eh_must_not_throw): Return a geh_mnt *. (gimple_build_eh_else): Return a geh_else *. (gimple_build_try): Return a gtry *. (gimple_build_resx): Return a gresx *. (gimple_build_switch_nlabels): Return a gswitch *. (gimple_build_switch): Return a gswitch *. (gimple_build_eh_dispatch): Return a geh_dispatch *. (gimple_build_debug_bind_stat): Return a gdebug *. (gimple_build_debug_source_bind_stat): Return a gdebug *. (gimple_build_omp_critical): Return a gomp_critical *. (gimple_build_omp_for): Return a gomp_for *. (gimple_build_omp_parallel): Return a gomp_parallel *. (gimple_build_omp_task): Return a gomp_task *. (gimple_build_omp_continue): Return a gomp_continue *. (gimple_build_omp_sections): Return a gomp_sections *. (gimple_build_omp_single): Return a gomp_single *. (gimple_build_omp_target): Return a gomp_target *. (gimple_build_omp_teams): Return a gomp_teams *. (gimple_build_omp_atomic_load): Return a gomp_atomic_load *. (gimple_build_omp_atomic_store): Return a gomp_atomic_store *. (gimple_build_transaction): Return a gtransaction *. (gimple_call_arg_flags): Require a const gcall *. (gimple_call_return_flags): Likewise. (gimple_call_copy_skip_args): Require and return a gcall *. (gimple_asm_clobbers_memory_p): Require a const gasm *. (gimple_seq_first_stmt_as_a_bind): New. (gimple_assign_nontemporal_move_p): Require a const gassign * rather than a const_gimple. (gimple_call_internal_fn): Update for renaming to gcall. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Require a gcall * rather than a gimple. (gimple_call_set_fn): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_set_tail): Likewise. (gimple_call_tail_p): Likewise. (gimple_call_set_return_slot_opt): Likewise. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_set_from_thunk): Likewise. (gimple_call_from_thunk_p): Likewise. (gimple_call_set_va_arg_pack): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_set_nothrow): Likewise. (gimple_call_nothrow_p): Likewise. (gimple_call_set_alloca_for_var): Likewise. (gimple_call_alloca_for_var_p): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_call_return_type): Require a const gcall * rather than a const_gimple. (gimple_call_chain_ptr): Likewise. (gimple_call_copy_flags): Require a pair of gcall *. (gimple_cond_set_code): Require a gcond * rather than a gimple (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_cond_make_false): Likewise. (gimple_cond_make_true): Likewise. (gimple_cond_lhs_ptr): Require a const gcond * rather than a const_gimple. (gimple_cond_rhs_ptr): Likewise. (gimple_cond_true_label): Likewise. (gimple_cond_false_label): Likewise. (gimple_cond_true_p): Likewise. (gimple_cond_false_p): Likewise. (gimple_cond_set_condition): Likewise. (gimple_label_label): Require a const glabel *. (gimple_label_set_label): Require a glabel *. (gimple_goto_set_dest): Require a ggoto *. (gimple_bind_vars): Require a const gbind *. (gimple_bind_block): Likewise. (gimple_bind_set_vars): Require a gbind *. (gimple_bind_append_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_body): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_add_seq): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Require a const gasm *. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gasm *. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. (gimple_catch_types): Require a const gcatch *. (gimple_catch_types_ptr): Require a gcatch *. (gimple_catch_handler_ptr): Likewise. (gimple_catch_handler): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Update for renaming of subclass to geh_filter. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Require a geh_filter *. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Require a geh_mnt *. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Require a geh_else *. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_set_kind): Require a gtry *. (gimple_try_set_catch_is_cleanup): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_try_eval_ptr): Update for renaming of subclass to gtry. (gimple_try_cleanup_ptr): Likewise. (gimple_phi_capacity): Update for renaming of subclass to gphi. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_result): Require a gphi *. (gimple_phi_set_arg): Likewise. (gimple_phi_arg_def_ptr): Likewise. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_location_from_edge): Likewise. (gimple_phi_arg_set_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_resx_region): Require a const gresx *. (gimple_resx_set_region): Require a gresx *. (gimple_eh_dispatch_region): Require a const geh_dispatch *. (gimple_eh_dispatch_set_region): Require a geh_dispatch *. (gimple_switch_num_labels): Require a const gswitch *. (gimple_switch_set_num_labels): Likewise. (gimple_switch_index): Likewise. (gimple_switch_index_ptr): Likewise. (gimple_switch_label): Likewise. (gimple_switch_default_label): Likewise. (gimple_switch_set_index): Require a gswitch *. (gimple_switch_set_label): Likewise. (gimple_switch_set_default_label): Likewise. (gimple_omp_critical_name): Require a const gomp_critical *. (gimple_omp_critical_name_ptr): Require a gomp_critical *. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_set_kind): Require a gomp_for *. (gimple_omp_for_set_combined_p): Likewise. (gimple_omp_for_set_combined_into_p): Likewise. (gimple_omp_for_clauses): Update for renaming of subclass to gomp_for. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Update for renaming of subclass to gomp_parallel. (gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn): Require a const gomp_parallel *. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_task_clauses): Update for renaming of subclass to gomp_task. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Whitespace fixes. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Update for renaming of subclass to gomp_task. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Update for renaming of subclass to gomp_single. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Update for renaming of subclass to gomp_target. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Require a gomp_target *. (gimple_omp_target_set_kind): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_target_child_fn): Require a const gomp_target *. (gimple_omp_target_data_arg): Likewise. (gimple_omp_teams_clauses): Update for renaming of subclass to gomp_teams. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Require a gomp_teams *. (gimple_omp_sections_clauses): Update for renaming of subclass to gomp_sections. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_store_val): Require a const gomp_atomic_store *. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Require a const gomp_continue *. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gomp_continue *. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Require a gtransaction *. (gimple_transaction_body): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_label): Require a const gtransaction *. (gimple_transaction_subcode): Likewise. (gimple_transaction_set_body): Require a gtransaction *. (gimple_transaction_set_label): Likewise. (gimple_transaction_set_subcode): Likewise. (gimple_return_retval_ptr): Require a const greturn *. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a greturn *. (gimple_expr_type): Introduce local "call_stmt" and use in place of "stmt" for typesafety. * asan.c: Use gimple subclasses. * auto-profile.c: Likewise. * builtins.c: Likewise. * builtins.h: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * expr.h: Likewise. * gimple-builder.c: Likewise. * gimple-builder.h: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * gimplify.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * internal-fn.def:: Likewise. * internal-fn.h: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sanopt.c: Likewise. * sese.c: Likewise. * ssa-iterators.h: Likewise. * stmt.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp.c: Likewise. * tree-chkp.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-eh.h: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-into-ssa.h: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h * tree-sra.cn_function): * tree-ssa-alias.c: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c * tree-ssa-structalias.c * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadedge.h: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * vtable-verify.c: Likewise. gcc/c-family/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack" from being just a vec<gimple> to a vec<gbind *>. gcc/java/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * java-gimplify.c (java_gimplify_block): Strengthen local "outer" from gimple to gbind *. From-SVN: r217787
2014-11-19 18:00:54 +01:00
gcall *call_stmt = as_a <gcall *> (stmt);
tree arg = pass_through_call (call_stmt);
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
if (arg)
{
if (TREE_CODE (arg) == SSA_NAME
&& POINTER_TYPE_P (TREE_TYPE (arg)))
reexamine = merge_object_sizes (osi, var, arg, 0);
else
expr_object_size (osi, var, arg);
}
else
Merger of git branch "gimple-classes-v2-option-3" gcc/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * coretypes.h (struct gcond): Add forward decl. (struct gdebug): Likewise. (struct ggoto): Likewise. (struct glabel): Likewise. (struct gswitch): Likewise. (struct gassign): Likewise. (struct gasm): Likewise. (struct gcall): Likewise. (struct gtransaction): Likewise. (struct greturn): Likewise. (struct gbind): Likewise. (struct gcatch): Likewise. (struct geh_filter): Likewise. (struct geh_mnt): Likewise. (struct geh_else): Likewise. (struct gresx): Likewise. (struct geh_dispatch): Likewise. (struct gphi): Likewise. (struct gtry): Likewise. (struct gomp_atomic_load): Likewise. (struct gomp_atomic_store): Likewise. (struct gomp_continue): Likewise. (struct gomp_critical): Likewise. (struct gomp_for): Likewise. (struct gomp_parallel): Likewise. (struct gomp_task): Likewise. (struct gomp_sections): Likewise. (struct gomp_single): Likewise. (struct gomp_target): Likewise. (struct gomp_teams): Likewise. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple subclasses. * gdbhooks.py: Update. * gimple-iterator.c (gsi_for_phi): New. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. * gimple-iterator.h (struct gphi_iterator): New subclass of gimple_stmt_iterator. (gsi_for_phi): New prototype. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. (gsi_next_nonvirtual_phi): Strengthen param from gimple_stmt_iterator * to gphi_iterator *, and local "phi" from gimple to gphi *. * gsstruct.def: Update for renamings of classes. * gimple.c (gimple_build_return): Strengthen return type from gimple to greturn *. (gimple_call_reset_alias_info): Strengthen param to gcall *. (gimple_build_call_1): Strengthen return type from gimple to gcall *. (gimple_build_call_vec): Likewise. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal_1): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Strengthen return type from gimple to gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Strengthen return type from gimple to gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Strengthen return type from gimple to glabel *. (gimple_build_goto): Strengthen return type from gimple to ggoto *. (gimple_build_bind): Strengthen return type from gimple to gbind *. (gimple_build_asm_1): Strengthen return type from gimple to gasm *. (gimple_build_asm_vec): Likewise. (gimple_build_catch): Strengthen return type from gimple to gcatch *. (gimple_build_eh_filter): Strengthen return type from gimple to geh_filter *. (gimple_build_eh_must_not_throw): Strengthen return type from gimple to geh_mnt *. (gimple_build_eh_else): Strengthen return type from gimple to geh_else *. (gimple_build_try): Update for renaming of gimple_statement_try to gtry. (gimple_build_resx): Strengthen return type from gimple to gresx *. (gimple_build_switch_nlabels): Strengthen return type from gimple to gswitch *. (gimple_build_switch): Likewise. (gimple_build_eh_dispatch): Strengthen return type from gimple to geh_dispatch *. (gimple_build_debug_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_debug_source_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_omp_critical): Strengthen return type from gimple to gomp_critical *. (gimple_build_omp_for): Strengthen return type from gimple to gomp_for *. (gimple_build_omp_parallel): Strengthen return type from gimple to gomp_parallel *. (gimple_build_omp_task): Strengthen return type from gimple to gomp_task *. (gimple_build_omp_continue): Strengthen return type from gimple to gomp_continue *. (gimple_build_omp_sections): Strengthen return type from gimple to gomp_sections *. (gimple_build_omp_single): Strengthen return type from gimple to gomp_single *. (gimple_build_omp_target): Strengthen return type from gimple to gomp_target *. (gimple_build_omp_teams): Strengthen return type from gimple to gomp_teams *. (gimple_build_omp_atomic_load): Strengthen return type from gimple to gomp_atomic_load *. (gimple_build_omp_atomic_store): Strengthen return type from gimple to gomp_atomic_store *. (gimple_build_transaction): Strengthen return type from gimple to gtransaction *. (empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast. (gimple_call_fnspec): Require a const gcall *. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. (gimple_set_bb): Add a checked cast. (gimple_copy): Within the cases, add locals of the appropriate subclass and use in place of "stmt" and "copy" for typesafety. (gimple_has_side_effects): Add a checked cast. (gimple_could_trap_p_1): Likewise. (gimple_call_copy_skip_args): Require a gcall *, and return one. (gimple_asm_clobbers_memory_p): Require a const gasm *. (infer_nonnull_range): Replace a check for GIMPLE_RETURN with a dyn_cast, introducing local "return_stmt" and using ti in place of "stmt". * gimple.h (gimple_vec): Eliminate this typedef. (struct gimple_statement_call): Rename to... (struct gcall): ...this. (struct gimple_statement_bind): Rename to... (struct gbind): ...this. (struct gimple_statement_catch): Rename to... (struct gcatch): ...this. (struct gimple_statement_eh_filter): Rename to... (struct geh_filter): ...this. (struct gimple_statement_eh_else): Rename to... (struct geh_else): ...this. (struct gimple_statement_eh_mnt): Rename to... (struct geh_mnt): ...this. (struct gimple_statement_phi): Rename to... (struct gphi): ...this. (struct gimple_statement_resx): Rename to... (struct gresx): ...this. (struct gimple_statement_eh_dispatch): Rename to... (struct geh_dispatch): ...this. (struct gimple_statement_try): Rename to... (struct gtry): ...this. (struct gimple_statement_asm): Rename to... (struct gasm): ...this. (struct gimple_statement_omp_critical): Rename to... (struct gomp_critical): ...this. (struct gimple_statement_omp_for): Rename to... (struct gomp_for): ...this. (struct gimple_statement_omp_parallel): Rename to... (struct gomp_parallel): ...this. (struct gimple_statement_omp_target): Rename to... (struct gomp_target): ...this. (struct gimple_statement_omp_task): Rename to... (struct gomp_task): ...this. (struct gimple_statement_omp_sections): Rename to... (struct gomp_sections): ...this. (struct gimple_statement_omp_continue): Rename to... (struct gomp_continue): ...this. (struct gimple_statement_omp_single): Rename to... (struct gomp_single): ...this. (struct gimple_statement_omp_teams): Rename to... (struct gomp_teams): ...this. (struct gimple_statement_omp_atomic_load): Rename to... (struct gomp_atomic_load): ...this. (struct gimple_statement_omp_atomic_store :): Rename to... (struct gomp_atomic_store :): ...this. (struct gimple_statement_transaction): Rename to... (struct gtransaction): ...this. (struct gcond): New subclass. (struct gdebug): New subclass. (struct ggoto): New subclass. (struct glabel): New subclass. (struct gswitch): New subclass. (struct gassign): New subclass. (struct greturn): New subclass. (is_a_helper <gimple_statement_asm *>::test): Rename to... (is_a_helper <gasm *>::test): ...this. (is_a_helper <gimple_statement_bind *>::test): Rename to... (is_a_helper <gbind *>::test): ...this. (is_a_helper <gassign *>::test): New. (is_a_helper <gimple_statement_call *>::test): Rename to... (is_a_helper <gcall *>::test): ...this. (is_a_helper <gimple_statement_catch *>::test): Rename to... (is_a_helper <gcatch *>::test): ...this. (is_a_helper <gimple_statement_resx *>::test): Rename to... (is_a_helper <gresx *>::test): ...this. (is_a_helper <gcond *>::test): New. (is_a_helper <gdebug *>::test): New. (is_a_helper <ggoto *>::test): New. (is_a_helper <glabel *>::test): New. (is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <geh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else *>::test): Rename to... (is_a_helper <geh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <geh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt *>::test): Rename to... (is_a_helper <geh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <gomp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <gomp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <gomp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <gomp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for *>::test): Rename to... (is_a_helper <gomp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <gomp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target *>::test): Rename to... (is_a_helper <gomp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <gomp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single *>::test): Rename to... (is_a_helper <gomp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <gomp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task *>::test): Rename to... (is_a_helper <gomp_task *>::test): ...this. (is_a_helper <gimple_statement_phi *>::test): Rename to... (is_a_helper <gphi *>::test): ...this. (is_a_helper <gimple_statement_transaction *>::test): Rename to... (is_a_helper <gtransaction *>::test): ...this. (is_a_helper <greturn *>::test): New. (is_a_helper <gswitch *>::test): New. (is_a_helper <gimple_statement_try *>::test): Rename to... (is_a_helper <gtry *>::test): ...this. (is_a_helper <const gimple_statement_asm *>::test): Rename to... (is_a_helper <const gasm *>::test): ...this. (is_a_helper <const gimple_statement_bind *>::test): Rename to... (is_a_helper <const gbind *>::test): ...this. (is_a_helper <const gimple_statement_call *>::test): Rename to... (is_a_helper <const gcall *>::test): ...this. (is_a_helper <const gimple_statement_catch *>::test): Rename to... (is_a_helper <const gcatch *>::test): ...this. (is_a_helper <const gimple_statement_resx *>::test): Rename to... (is_a_helper <const gresx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <const geh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <const geh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <const gomp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <const gomp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <const gomp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <const gomp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for *>::test): Rename to... (is_a_helper <const gomp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <const gomp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target *>::test): Rename to... (is_a_helper <const gomp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <const gomp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single *>::test): Rename to... (is_a_helper <const gomp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <const gomp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task *>::test): Rename to... (is_a_helper <const gomp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi *>::test): Rename to... (is_a_helper <const gphi *>::test): ...this. (is_a_helper <const gimple_statement_transaction *>::test): Rename to... (is_a_helper <const gtransaction *>::test): ...this. (gimple_build_return): Strengthen return type to greturn *. (gimple_call_reset_alias_info): Require a gcall *. (gimple_build_call_vec): Return a gcall *. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Return a gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Return a gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Return a glabel *. (gimple_build_goto): Return a ggoto *. (gimple_build_bind): Return a gbind *. (gimple_build_asm_vec): Return a gasm *. (gimple_build_catch): Return a gcatch *. (gimple_build_eh_filter): Return a geh_filter *. (gimple_build_eh_must_not_throw): Return a geh_mnt *. (gimple_build_eh_else): Return a geh_else *. (gimple_build_try): Return a gtry *. (gimple_build_resx): Return a gresx *. (gimple_build_switch_nlabels): Return a gswitch *. (gimple_build_switch): Return a gswitch *. (gimple_build_eh_dispatch): Return a geh_dispatch *. (gimple_build_debug_bind_stat): Return a gdebug *. (gimple_build_debug_source_bind_stat): Return a gdebug *. (gimple_build_omp_critical): Return a gomp_critical *. (gimple_build_omp_for): Return a gomp_for *. (gimple_build_omp_parallel): Return a gomp_parallel *. (gimple_build_omp_task): Return a gomp_task *. (gimple_build_omp_continue): Return a gomp_continue *. (gimple_build_omp_sections): Return a gomp_sections *. (gimple_build_omp_single): Return a gomp_single *. (gimple_build_omp_target): Return a gomp_target *. (gimple_build_omp_teams): Return a gomp_teams *. (gimple_build_omp_atomic_load): Return a gomp_atomic_load *. (gimple_build_omp_atomic_store): Return a gomp_atomic_store *. (gimple_build_transaction): Return a gtransaction *. (gimple_call_arg_flags): Require a const gcall *. (gimple_call_return_flags): Likewise. (gimple_call_copy_skip_args): Require and return a gcall *. (gimple_asm_clobbers_memory_p): Require a const gasm *. (gimple_seq_first_stmt_as_a_bind): New. (gimple_assign_nontemporal_move_p): Require a const gassign * rather than a const_gimple. (gimple_call_internal_fn): Update for renaming to gcall. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Require a gcall * rather than a gimple. (gimple_call_set_fn): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_set_tail): Likewise. (gimple_call_tail_p): Likewise. (gimple_call_set_return_slot_opt): Likewise. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_set_from_thunk): Likewise. (gimple_call_from_thunk_p): Likewise. (gimple_call_set_va_arg_pack): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_set_nothrow): Likewise. (gimple_call_nothrow_p): Likewise. (gimple_call_set_alloca_for_var): Likewise. (gimple_call_alloca_for_var_p): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_call_return_type): Require a const gcall * rather than a const_gimple. (gimple_call_chain_ptr): Likewise. (gimple_call_copy_flags): Require a pair of gcall *. (gimple_cond_set_code): Require a gcond * rather than a gimple (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_cond_make_false): Likewise. (gimple_cond_make_true): Likewise. (gimple_cond_lhs_ptr): Require a const gcond * rather than a const_gimple. (gimple_cond_rhs_ptr): Likewise. (gimple_cond_true_label): Likewise. (gimple_cond_false_label): Likewise. (gimple_cond_true_p): Likewise. (gimple_cond_false_p): Likewise. (gimple_cond_set_condition): Likewise. (gimple_label_label): Require a const glabel *. (gimple_label_set_label): Require a glabel *. (gimple_goto_set_dest): Require a ggoto *. (gimple_bind_vars): Require a const gbind *. (gimple_bind_block): Likewise. (gimple_bind_set_vars): Require a gbind *. (gimple_bind_append_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_body): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_add_seq): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Require a const gasm *. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gasm *. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. (gimple_catch_types): Require a const gcatch *. (gimple_catch_types_ptr): Require a gcatch *. (gimple_catch_handler_ptr): Likewise. (gimple_catch_handler): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Update for renaming of subclass to geh_filter. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Require a geh_filter *. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Require a geh_mnt *. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Require a geh_else *. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_set_kind): Require a gtry *. (gimple_try_set_catch_is_cleanup): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_try_eval_ptr): Update for renaming of subclass to gtry. (gimple_try_cleanup_ptr): Likewise. (gimple_phi_capacity): Update for renaming of subclass to gphi. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_result): Require a gphi *. (gimple_phi_set_arg): Likewise. (gimple_phi_arg_def_ptr): Likewise. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_location_from_edge): Likewise. (gimple_phi_arg_set_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_resx_region): Require a const gresx *. (gimple_resx_set_region): Require a gresx *. (gimple_eh_dispatch_region): Require a const geh_dispatch *. (gimple_eh_dispatch_set_region): Require a geh_dispatch *. (gimple_switch_num_labels): Require a const gswitch *. (gimple_switch_set_num_labels): Likewise. (gimple_switch_index): Likewise. (gimple_switch_index_ptr): Likewise. (gimple_switch_label): Likewise. (gimple_switch_default_label): Likewise. (gimple_switch_set_index): Require a gswitch *. (gimple_switch_set_label): Likewise. (gimple_switch_set_default_label): Likewise. (gimple_omp_critical_name): Require a const gomp_critical *. (gimple_omp_critical_name_ptr): Require a gomp_critical *. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_set_kind): Require a gomp_for *. (gimple_omp_for_set_combined_p): Likewise. (gimple_omp_for_set_combined_into_p): Likewise. (gimple_omp_for_clauses): Update for renaming of subclass to gomp_for. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Update for renaming of subclass to gomp_parallel. (gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn): Require a const gomp_parallel *. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_task_clauses): Update for renaming of subclass to gomp_task. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Whitespace fixes. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Update for renaming of subclass to gomp_task. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Update for renaming of subclass to gomp_single. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Update for renaming of subclass to gomp_target. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Require a gomp_target *. (gimple_omp_target_set_kind): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_target_child_fn): Require a const gomp_target *. (gimple_omp_target_data_arg): Likewise. (gimple_omp_teams_clauses): Update for renaming of subclass to gomp_teams. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Require a gomp_teams *. (gimple_omp_sections_clauses): Update for renaming of subclass to gomp_sections. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_store_val): Require a const gomp_atomic_store *. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Require a const gomp_continue *. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gomp_continue *. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Require a gtransaction *. (gimple_transaction_body): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_label): Require a const gtransaction *. (gimple_transaction_subcode): Likewise. (gimple_transaction_set_body): Require a gtransaction *. (gimple_transaction_set_label): Likewise. (gimple_transaction_set_subcode): Likewise. (gimple_return_retval_ptr): Require a const greturn *. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a greturn *. (gimple_expr_type): Introduce local "call_stmt" and use in place of "stmt" for typesafety. * asan.c: Use gimple subclasses. * auto-profile.c: Likewise. * builtins.c: Likewise. * builtins.h: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * expr.h: Likewise. * gimple-builder.c: Likewise. * gimple-builder.h: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * gimplify.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * internal-fn.def:: Likewise. * internal-fn.h: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sanopt.c: Likewise. * sese.c: Likewise. * ssa-iterators.h: Likewise. * stmt.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp.c: Likewise. * tree-chkp.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-eh.h: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-into-ssa.h: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h * tree-sra.cn_function): * tree-ssa-alias.c: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c * tree-ssa-structalias.c * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadedge.h: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * vtable-verify.c: Likewise. gcc/c-family/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack" from being just a vec<gimple> to a vec<gbind *>. gcc/java/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * java-gimplify.c (java_gimplify_block): Strengthen local "outer" from gimple to gbind *. From-SVN: r217787
2014-11-19 18:00:54 +01:00
call_object_size (osi, var, call_stmt);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
break;
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_ASM:
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
/* Pointers defined by __asm__ statements can point anywhere. */
object_sizes[object_size_type][varno] = unknown[object_size_type];
break;
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_NOP:
tree.h (SSA_NAME_VAR): Return NULL_TREE if an IDENTIFIER_NODE is recorded as var. 2012-08-10 Richard Guenther <rguenther@suse.de> * tree.h (SSA_NAME_VAR): Return NULL_TREE if an IDENTIFIER_NODE is recorded as var. (SSA_NAME_IDENTIFIER): Return the IDENTIFIER_NODE of the SSA_NAME or its SSA_NAME_VAR. (SET_SSA_NAME_VAR_OR_IDENTIFIER): New setter. * tree-ssanames.c (make_ssa_name_fn): Handle creating anonymous SSA names by passing a type instead of a variable decl. (release_ssa_name): Use SET_SSA_NAME_VAR_OR_IDENTIFIER. (copy_ssa_name_fn): Handle anonymous SSA names. (replace_ssa_name_symbol): Use SET_SSA_NAME_VAR_OR_IDENTIFIER. * tree-flow-inline.h (make_temp_ssa_name): New inline function. * tree-pretty-print.c (dump_generic_node): Use SSA_NAME_IDENTIFIER, dump SSA names without a name as <anon>. * cfgexpand.c (expand_used_vars): Assing anonymous SSA names we are going to expand a decl. (gimple_expand_cfg): Assign all SSA names of a partition the decl we created for its leader. * tree-ssa.c (target_for_debug_bind): Handle SSA_NAMEs. (verify_ssa_name): Handle anonymous SSA names. (verify_def): Likewise. * tree-predcom.c (eliminate_temp_copies): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-live.c (var_map_base_init): Compute conflicts for anonymous SSA names with the same type. (mark_all_vars_used_1): Handle anonymous SSA names. (verify_live_on_entry): Likewise. * tree-ssa-coalesce.c (abnormal_corrupt): Remove. (create_outofssa_var_map): Adjust with respect to conflicts we compute for anonymous SSA names. Do not restrict abnormal coalescing. (coalesce_partitions): Do not restrict abnormal coalescing. Assert we only ever coalesce variables we computed conflicts for. * tree-ssa-ter.c (process_replaceable): Do not restrict TER of anonymous names. * expr.c (expand_expr_real_1): Handle anonymous SSA names expanded from IVOPTs by creating a raw REG here. * tree-cfg.c (replace_ssa_name): Handle anonymous SSA names. (dump_function_to_file): Dump anonymous SSA names alongside with their types in the variable list. (verify_gimple_return): Guard use of SSA_NAME_VAR. * tree-into-ssa.c (mark_for_renaming): Handle a NULL symbol. (rewrite_into_ssa): Make SSA names anonymous. * tree-ssa-structalias.c (alias_get_name): Rewrite. * tree-ssa-uninit.c (ssa_undefined_value_p): Handle anonymous SSA names. (warn_uninitialized_phi): Likewise. * tree-ssa-loop-ivopts.c (prepare_decl_rtl): Defer expanding anonymous SSA names to the expander. (determine_iv_cost): Anonymous SSA names are artificial. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Handle anonymous SSA names. * lto-streamer-out.c (output_ssa_names): Stream SSA_NAME_VAR or if NULL, the type of the SSA name. * tree-inline.c (remap_ssa_name): Handle anonymous SSA names, remap names as anonymous where appropriate. (insert_init_stmt): Pass SSA names down to insert_init_debug_bind. * tree-ssa-uncprop.c (uncprop_into_successor_phis): Adjust according to what we create conflicts for in out-of-SSA coalescing. * tree-parloops.c (separate_decls_in_region_name): Handle anonymous SSA names. (add_field_for_name): Likewise. * tree.c (get_name): Handle SSA names. * tree-ssa-loop-im.c (gen_lsm_tmp_name): Defer to get_name for SSA_NAMEs. * tree-vect-loop-manip.c (adjust_debug_stmts): Use virtual_operand_p. * tree-sra.c (create_access_replacement): Give up generating a DECL_DEBUG_EXPR for SSA names in the memory reference. (replace_removed_params_ssa_names): Guard use of SSA_NAME_VAR. * tree-complex.c (get_component_ssa_name): Handle anonymous SSA names. (set_component_ssa_name): Likewise. * tree-ssa-sccvn.c (visit_reference_op_load): Likewise. * tree-object-size.c (collect_object_sizes_for): Handle uninitialized SSA names properly. * ipa-inline-analysis.c (eliminated_by_inlining_prob): Guard use of SSA_NAME_VAR. * ipa-split.c (test_nonssa_use): Likewise. (consider_split): Likewise. (mark_nonssa_use): Likewise. c-family/ * c-pretty-print.c (pp_c_expression): Handle anonymous SSA names. cp/ * error.c (dump_expr): Likewise. * g++.dg/plugin/selfassign.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/strlenopt-11.c: Likewise. * gcc.dg/strlenopt-13.c: Likewise. * gcc.dg/no-strict-overflow-4.c: Likewise. * gcc.dg/strict-overflow-4.c: Likewise. * gcc.dg/tree-ssa/alias-11.c: Likewise. * gcc.dg/tree-ssa/alias-6.c: Likewise. * gcc.dg/tree-ssa/asm-3.c: Likewise. * gcc.dg/tree-ssa/pr18908.c: Likewise. * gcc.dg/tree-ssa/pr19431.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-21.c: Likewise. * gcc.dg/tree-ssa/phi-opt-10.c: Likewise. * gcc.dg/tree-ssa/phi-opt-7.c: Likewise. * gcc.dg/tree-ssa/slsr-27.c: Likewise. * gcc.dg/tree-ssa/slsr-28.c: Likewise. * gcc.dg/tree-ssa/slsr-29.c: Likewise. * gcc.dg/pr46309.c: Likewise. * gcc.dg/tree-ssa/loop-5.c: Likewise. From-SVN: r190284
2012-08-10 10:29:29 +02:00
if (SSA_NAME_VAR (var)
&& TREE_CODE (SSA_NAME_VAR (var)) == PARM_DECL)
expr_object_size (osi, var, SSA_NAME_VAR (var));
else
/* Uninitialized SSA names point nowhere. */
object_sizes[object_size_type][varno] = unknown[object_size_type];
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
break;
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_PHI:
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
unsigned i;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
for (i = 0; i < gimple_phi_num_args (stmt); i++)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
tree rhs = gimple_phi_arg (stmt, i)->def;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (object_sizes[object_size_type][varno]
== unknown[object_size_type])
break;
if (TREE_CODE (rhs) == SSA_NAME)
reexamine |= merge_object_sizes (osi, var, rhs, 0);
else if (osi->pass == 0)
expr_object_size (osi, var, rhs);
}
break;
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
default:
gcc_unreachable ();
}
if (! reexamine
|| object_sizes[object_size_type][varno] == unknown[object_size_type])
{
bitmap_set_bit (computed[object_size_type], varno);
bitmap_clear_bit (osi->reexamine, varno);
}
else
{
bitmap_set_bit (osi->reexamine, varno);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Need to reexamine ");
print_generic_expr (dump_file, var, dump_flags);
fprintf (dump_file, "\n");
}
}
}
/* Helper function for check_for_plus_in_loops. Called recursively
to detect loops. */
static void
check_for_plus_in_loops_1 (struct object_size_info *osi, tree var,
unsigned int depth)
{
gimple *stmt = SSA_NAME_DEF_STMT (var);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
unsigned int varno = SSA_NAME_VERSION (var);
if (osi->depths[varno])
{
if (osi->depths[varno] != depth)
{
unsigned int *sp;
/* Found a loop involving pointer addition. */
for (sp = osi->tos; sp > osi->stack; )
{
--sp;
bitmap_clear_bit (osi->reexamine, *sp);
bitmap_set_bit (computed[osi->object_size_type], *sp);
object_sizes[osi->object_size_type][*sp] = 0;
if (*sp == varno)
break;
}
}
return;
}
else if (! bitmap_bit_p (osi->reexamine, varno))
return;
osi->depths[varno] = depth;
*osi->tos++ = varno;
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
switch (gimple_code (stmt))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_ASSIGN:
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
if ((gimple_assign_single_p (stmt)
|| gimple_assign_unary_nop_p (stmt))
&& TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
{
tree rhs = gimple_assign_rhs1 (stmt);
check_for_plus_in_loops_1 (osi, rhs, depth);
}
else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
{
tree basevar = gimple_assign_rhs1 (stmt);
tree cst = gimple_assign_rhs2 (stmt);
gcc_assert (TREE_CODE (cst) == INTEGER_CST);
check_for_plus_in_loops_1 (osi, basevar,
depth + !integer_zerop (cst));
}
else
gcc_unreachable ();
break;
}
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_CALL:
{
Merger of git branch "gimple-classes-v2-option-3" gcc/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * coretypes.h (struct gcond): Add forward decl. (struct gdebug): Likewise. (struct ggoto): Likewise. (struct glabel): Likewise. (struct gswitch): Likewise. (struct gassign): Likewise. (struct gasm): Likewise. (struct gcall): Likewise. (struct gtransaction): Likewise. (struct greturn): Likewise. (struct gbind): Likewise. (struct gcatch): Likewise. (struct geh_filter): Likewise. (struct geh_mnt): Likewise. (struct geh_else): Likewise. (struct gresx): Likewise. (struct geh_dispatch): Likewise. (struct gphi): Likewise. (struct gtry): Likewise. (struct gomp_atomic_load): Likewise. (struct gomp_atomic_store): Likewise. (struct gomp_continue): Likewise. (struct gomp_critical): Likewise. (struct gomp_for): Likewise. (struct gomp_parallel): Likewise. (struct gomp_task): Likewise. (struct gomp_sections): Likewise. (struct gomp_single): Likewise. (struct gomp_target): Likewise. (struct gomp_teams): Likewise. * doc/gimple.texi (Class hierarchy of GIMPLE statements): Update for renaming of gimple subclasses. * gdbhooks.py: Update. * gimple-iterator.c (gsi_for_phi): New. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. * gimple-iterator.h (struct gphi_iterator): New subclass of gimple_stmt_iterator. (gsi_for_phi): New prototype. (gsi_start_phis): Strengthen return type from gimple_stmt_iterator to gphi_iterator. (gsi_next_nonvirtual_phi): Strengthen param from gimple_stmt_iterator * to gphi_iterator *, and local "phi" from gimple to gphi *. * gsstruct.def: Update for renamings of classes. * gimple.c (gimple_build_return): Strengthen return type from gimple to greturn *. (gimple_call_reset_alias_info): Strengthen param to gcall *. (gimple_build_call_1): Strengthen return type from gimple to gcall *. (gimple_build_call_vec): Likewise. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal_1): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Strengthen return type from gimple to gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Strengthen return type from gimple to gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Strengthen return type from gimple to glabel *. (gimple_build_goto): Strengthen return type from gimple to ggoto *. (gimple_build_bind): Strengthen return type from gimple to gbind *. (gimple_build_asm_1): Strengthen return type from gimple to gasm *. (gimple_build_asm_vec): Likewise. (gimple_build_catch): Strengthen return type from gimple to gcatch *. (gimple_build_eh_filter): Strengthen return type from gimple to geh_filter *. (gimple_build_eh_must_not_throw): Strengthen return type from gimple to geh_mnt *. (gimple_build_eh_else): Strengthen return type from gimple to geh_else *. (gimple_build_try): Update for renaming of gimple_statement_try to gtry. (gimple_build_resx): Strengthen return type from gimple to gresx *. (gimple_build_switch_nlabels): Strengthen return type from gimple to gswitch *. (gimple_build_switch): Likewise. (gimple_build_eh_dispatch): Strengthen return type from gimple to geh_dispatch *. (gimple_build_debug_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_debug_source_bind_stat): Strengthen return type from gimple to gdebug *. (gimple_build_omp_critical): Strengthen return type from gimple to gomp_critical *. (gimple_build_omp_for): Strengthen return type from gimple to gomp_for *. (gimple_build_omp_parallel): Strengthen return type from gimple to gomp_parallel *. (gimple_build_omp_task): Strengthen return type from gimple to gomp_task *. (gimple_build_omp_continue): Strengthen return type from gimple to gomp_continue *. (gimple_build_omp_sections): Strengthen return type from gimple to gomp_sections *. (gimple_build_omp_single): Strengthen return type from gimple to gomp_single *. (gimple_build_omp_target): Strengthen return type from gimple to gomp_target *. (gimple_build_omp_teams): Strengthen return type from gimple to gomp_teams *. (gimple_build_omp_atomic_load): Strengthen return type from gimple to gomp_atomic_load *. (gimple_build_omp_atomic_store): Strengthen return type from gimple to gomp_atomic_store *. (gimple_build_transaction): Strengthen return type from gimple to gtransaction *. (empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast. (gimple_call_fnspec): Require a const gcall *. (gimple_call_arg_flags): Likewise. (gimple_call_return_flags): Likewise. (gimple_set_bb): Add a checked cast. (gimple_copy): Within the cases, add locals of the appropriate subclass and use in place of "stmt" and "copy" for typesafety. (gimple_has_side_effects): Add a checked cast. (gimple_could_trap_p_1): Likewise. (gimple_call_copy_skip_args): Require a gcall *, and return one. (gimple_asm_clobbers_memory_p): Require a const gasm *. (infer_nonnull_range): Replace a check for GIMPLE_RETURN with a dyn_cast, introducing local "return_stmt" and using ti in place of "stmt". * gimple.h (gimple_vec): Eliminate this typedef. (struct gimple_statement_call): Rename to... (struct gcall): ...this. (struct gimple_statement_bind): Rename to... (struct gbind): ...this. (struct gimple_statement_catch): Rename to... (struct gcatch): ...this. (struct gimple_statement_eh_filter): Rename to... (struct geh_filter): ...this. (struct gimple_statement_eh_else): Rename to... (struct geh_else): ...this. (struct gimple_statement_eh_mnt): Rename to... (struct geh_mnt): ...this. (struct gimple_statement_phi): Rename to... (struct gphi): ...this. (struct gimple_statement_resx): Rename to... (struct gresx): ...this. (struct gimple_statement_eh_dispatch): Rename to... (struct geh_dispatch): ...this. (struct gimple_statement_try): Rename to... (struct gtry): ...this. (struct gimple_statement_asm): Rename to... (struct gasm): ...this. (struct gimple_statement_omp_critical): Rename to... (struct gomp_critical): ...this. (struct gimple_statement_omp_for): Rename to... (struct gomp_for): ...this. (struct gimple_statement_omp_parallel): Rename to... (struct gomp_parallel): ...this. (struct gimple_statement_omp_target): Rename to... (struct gomp_target): ...this. (struct gimple_statement_omp_task): Rename to... (struct gomp_task): ...this. (struct gimple_statement_omp_sections): Rename to... (struct gomp_sections): ...this. (struct gimple_statement_omp_continue): Rename to... (struct gomp_continue): ...this. (struct gimple_statement_omp_single): Rename to... (struct gomp_single): ...this. (struct gimple_statement_omp_teams): Rename to... (struct gomp_teams): ...this. (struct gimple_statement_omp_atomic_load): Rename to... (struct gomp_atomic_load): ...this. (struct gimple_statement_omp_atomic_store :): Rename to... (struct gomp_atomic_store :): ...this. (struct gimple_statement_transaction): Rename to... (struct gtransaction): ...this. (struct gcond): New subclass. (struct gdebug): New subclass. (struct ggoto): New subclass. (struct glabel): New subclass. (struct gswitch): New subclass. (struct gassign): New subclass. (struct greturn): New subclass. (is_a_helper <gimple_statement_asm *>::test): Rename to... (is_a_helper <gasm *>::test): ...this. (is_a_helper <gimple_statement_bind *>::test): Rename to... (is_a_helper <gbind *>::test): ...this. (is_a_helper <gassign *>::test): New. (is_a_helper <gimple_statement_call *>::test): Rename to... (is_a_helper <gcall *>::test): ...this. (is_a_helper <gimple_statement_catch *>::test): Rename to... (is_a_helper <gcatch *>::test): ...this. (is_a_helper <gimple_statement_resx *>::test): Rename to... (is_a_helper <gresx *>::test): ...this. (is_a_helper <gcond *>::test): New. (is_a_helper <gdebug *>::test): New. (is_a_helper <ggoto *>::test): New. (is_a_helper <glabel *>::test): New. (is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <geh_dispatch *>::test): ...this. (is_a_helper <gimple_statement_eh_else *>::test): Rename to... (is_a_helper <geh_else *>::test): ...this. (is_a_helper <gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <geh_filter *>::test): ...this. (is_a_helper <gimple_statement_eh_mnt *>::test): Rename to... (is_a_helper <geh_mnt *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <gomp_atomic_load *>::test): ...this. (is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <gomp_atomic_store *>::test): ...this. (is_a_helper <gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <gomp_continue *>::test): ...this. (is_a_helper <gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <gomp_critical *>::test): ...this. (is_a_helper <gimple_statement_omp_for *>::test): Rename to... (is_a_helper <gomp_for *>::test): ...this. (is_a_helper <gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <gomp_parallel *>::test): ...this. (is_a_helper <gimple_statement_omp_target *>::test): Rename to... (is_a_helper <gomp_target *>::test): ...this. (is_a_helper <gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <gomp_sections *>::test): ...this. (is_a_helper <gimple_statement_omp_single *>::test): Rename to... (is_a_helper <gomp_single *>::test): ...this. (is_a_helper <gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <gomp_teams *>::test): ...this. (is_a_helper <gimple_statement_omp_task *>::test): Rename to... (is_a_helper <gomp_task *>::test): ...this. (is_a_helper <gimple_statement_phi *>::test): Rename to... (is_a_helper <gphi *>::test): ...this. (is_a_helper <gimple_statement_transaction *>::test): Rename to... (is_a_helper <gtransaction *>::test): ...this. (is_a_helper <greturn *>::test): New. (is_a_helper <gswitch *>::test): New. (is_a_helper <gimple_statement_try *>::test): Rename to... (is_a_helper <gtry *>::test): ...this. (is_a_helper <const gimple_statement_asm *>::test): Rename to... (is_a_helper <const gasm *>::test): ...this. (is_a_helper <const gimple_statement_bind *>::test): Rename to... (is_a_helper <const gbind *>::test): ...this. (is_a_helper <const gimple_statement_call *>::test): Rename to... (is_a_helper <const gcall *>::test): ...this. (is_a_helper <const gimple_statement_catch *>::test): Rename to... (is_a_helper <const gcatch *>::test): ...this. (is_a_helper <const gimple_statement_resx *>::test): Rename to... (is_a_helper <const gresx *>::test): ...this. (is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to... (is_a_helper <const geh_dispatch *>::test): ...this. (is_a_helper <const gimple_statement_eh_filter *>::test): Rename to... (is_a_helper <const geh_filter *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_load *>::test): Rename to... (is_a_helper <const gomp_atomic_load *>::test): ...this. (is_a_helper <const gimple_statement_omp_atomic_store *>::test): Rename to... (is_a_helper <const gomp_atomic_store *>::test): ...this. (is_a_helper <const gimple_statement_omp_continue *>::test): Rename to... (is_a_helper <const gomp_continue *>::test): ...this. (is_a_helper <const gimple_statement_omp_critical *>::test): Rename to... (is_a_helper <const gomp_critical *>::test): ...this. (is_a_helper <const gimple_statement_omp_for *>::test): Rename to... (is_a_helper <const gomp_for *>::test): ...this. (is_a_helper <const gimple_statement_omp_parallel *>::test): Rename to... (is_a_helper <const gomp_parallel *>::test): ...this. (is_a_helper <const gimple_statement_omp_target *>::test): Rename to... (is_a_helper <const gomp_target *>::test): ...this. (is_a_helper <const gimple_statement_omp_sections *>::test): Rename to... (is_a_helper <const gomp_sections *>::test): ...this. (is_a_helper <const gimple_statement_omp_single *>::test): Rename to... (is_a_helper <const gomp_single *>::test): ...this. (is_a_helper <const gimple_statement_omp_teams *>::test): Rename to... (is_a_helper <const gomp_teams *>::test): ...this. (is_a_helper <const gimple_statement_omp_task *>::test): Rename to... (is_a_helper <const gomp_task *>::test): ...this. (is_a_helper <const gimple_statement_phi *>::test): Rename to... (is_a_helper <const gphi *>::test): ...this. (is_a_helper <const gimple_statement_transaction *>::test): Rename to... (is_a_helper <const gtransaction *>::test): ...this. (gimple_build_return): Strengthen return type to greturn *. (gimple_call_reset_alias_info): Require a gcall *. (gimple_build_call_vec): Return a gcall *. (gimple_build_call): Likewise. (gimple_build_call_valist): Likewise. (gimple_build_call_internal): Likewise. (gimple_build_call_internal_vec): Likewise. (gimple_build_call_from_tree): Likewise. (gimple_build_assign_stat): Return a gassign *. (gimple_build_assign_with_ops): Likewise. (gimple_build_cond): Return a gcond *. (gimple_build_cond_from_tree): Likewise. (gimple_cond_set_condition_from_tree): Require a gcond *. (gimple_build_label): Return a glabel *. (gimple_build_goto): Return a ggoto *. (gimple_build_bind): Return a gbind *. (gimple_build_asm_vec): Return a gasm *. (gimple_build_catch): Return a gcatch *. (gimple_build_eh_filter): Return a geh_filter *. (gimple_build_eh_must_not_throw): Return a geh_mnt *. (gimple_build_eh_else): Return a geh_else *. (gimple_build_try): Return a gtry *. (gimple_build_resx): Return a gresx *. (gimple_build_switch_nlabels): Return a gswitch *. (gimple_build_switch): Return a gswitch *. (gimple_build_eh_dispatch): Return a geh_dispatch *. (gimple_build_debug_bind_stat): Return a gdebug *. (gimple_build_debug_source_bind_stat): Return a gdebug *. (gimple_build_omp_critical): Return a gomp_critical *. (gimple_build_omp_for): Return a gomp_for *. (gimple_build_omp_parallel): Return a gomp_parallel *. (gimple_build_omp_task): Return a gomp_task *. (gimple_build_omp_continue): Return a gomp_continue *. (gimple_build_omp_sections): Return a gomp_sections *. (gimple_build_omp_single): Return a gomp_single *. (gimple_build_omp_target): Return a gomp_target *. (gimple_build_omp_teams): Return a gomp_teams *. (gimple_build_omp_atomic_load): Return a gomp_atomic_load *. (gimple_build_omp_atomic_store): Return a gomp_atomic_store *. (gimple_build_transaction): Return a gtransaction *. (gimple_call_arg_flags): Require a const gcall *. (gimple_call_return_flags): Likewise. (gimple_call_copy_skip_args): Require and return a gcall *. (gimple_asm_clobbers_memory_p): Require a const gasm *. (gimple_seq_first_stmt_as_a_bind): New. (gimple_assign_nontemporal_move_p): Require a const gassign * rather than a const_gimple. (gimple_call_internal_fn): Update for renaming to gcall. (gimple_call_fntype): Likewise. (gimple_call_set_fntype): Require a gcall * rather than a gimple. (gimple_call_set_fn): Likewise. (gimple_call_set_internal_fn): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_set_tail): Likewise. (gimple_call_tail_p): Likewise. (gimple_call_set_return_slot_opt): Likewise. (gimple_call_return_slot_opt_p): Likewise. (gimple_call_set_from_thunk): Likewise. (gimple_call_from_thunk_p): Likewise. (gimple_call_set_va_arg_pack): Likewise. (gimple_call_va_arg_pack_p): Likewise. (gimple_call_set_nothrow): Likewise. (gimple_call_nothrow_p): Likewise. (gimple_call_set_alloca_for_var): Likewise. (gimple_call_alloca_for_var_p): Likewise. (gimple_call_use_set): Likewise. (gimple_call_clobber_set): Likewise. (gimple_call_return_type): Require a const gcall * rather than a const_gimple. (gimple_call_chain_ptr): Likewise. (gimple_call_copy_flags): Require a pair of gcall *. (gimple_cond_set_code): Require a gcond * rather than a gimple (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_cond_make_false): Likewise. (gimple_cond_make_true): Likewise. (gimple_cond_lhs_ptr): Require a const gcond * rather than a const_gimple. (gimple_cond_rhs_ptr): Likewise. (gimple_cond_true_label): Likewise. (gimple_cond_false_label): Likewise. (gimple_cond_true_p): Likewise. (gimple_cond_false_p): Likewise. (gimple_cond_set_condition): Likewise. (gimple_label_label): Require a const glabel *. (gimple_label_set_label): Require a glabel *. (gimple_goto_set_dest): Require a ggoto *. (gimple_bind_vars): Require a const gbind *. (gimple_bind_block): Likewise. (gimple_bind_set_vars): Require a gbind *. (gimple_bind_append_vars): Likewise. (gimple_bind_body_ptr): Likewise. (gimple_bind_body): Likewise. (gimple_bind_set_body): Likewise. (gimple_bind_add_stmt): Likewise. (gimple_bind_add_seq): Likewise. (gimple_bind_set_block): Likewise. (gimple_asm_ninputs): Require a const gasm *. (gimple_asm_noutputs): Likewise. (gimple_asm_nclobbers): Likewise. (gimple_asm_nlabels): Likewise. (gimple_asm_input_op): Likewise. (gimple_asm_input_op_ptr): Likewise. (gimple_asm_output_op): Likewise. (gimple_asm_output_op_ptr): Likewise. (gimple_asm_clobber_op): Likewise. (gimple_asm_label_op): Likewise. (gimple_asm_string): Likewise. (gimple_asm_volatile_p): Likewise. (gimple_asm_input_p): Likewise. (gimple_asm_set_input_op): Require a gasm *. (gimple_asm_set_output_op): Likewise. (gimple_asm_set_clobber_op): Likewise. (gimple_asm_set_label_op): Likewise. (gimple_asm_set_volatile): Likewise. (gimple_asm_set_input): Likewise. (gimple_catch_types): Require a const gcatch *. (gimple_catch_types_ptr): Require a gcatch *. (gimple_catch_handler_ptr): Likewise. (gimple_catch_handler): Likewise. (gimple_catch_set_types): Likewise. (gimple_catch_set_handler): Likewise. (gimple_eh_filter_types): Update for renaming of subclass to geh_filter. (gimple_eh_filter_types_ptr): Likewise. (gimple_eh_filter_failure_ptr): Likewise. (gimple_eh_filter_set_types): Require a geh_filter *. (gimple_eh_filter_set_failure): Likewise. (gimple_eh_must_not_throw_fndecl): Require a geh_mnt *. (gimple_eh_must_not_throw_set_fndecl): Likewise. (gimple_eh_else_n_body_ptr): Require a geh_else *. (gimple_eh_else_n_body): Likewise. (gimple_eh_else_e_body_ptr): Likewise. (gimple_eh_else_e_body): Likewise. (gimple_eh_else_set_n_body): Likewise. (gimple_eh_else_set_e_body): Likewise. (gimple_try_set_kind): Require a gtry *. (gimple_try_set_catch_is_cleanup): Likewise. (gimple_try_set_eval): Likewise. (gimple_try_set_cleanup): Likewise. (gimple_try_eval_ptr): Update for renaming of subclass to gtry. (gimple_try_cleanup_ptr): Likewise. (gimple_phi_capacity): Update for renaming of subclass to gphi. (gimple_phi_num_args): Likewise. (gimple_phi_result): Likewise. (gimple_phi_result_ptr): Likewise. (gimple_phi_arg): Likewise. (gimple_phi_set_result): Require a gphi *. (gimple_phi_set_arg): Likewise. (gimple_phi_arg_def_ptr): Likewise. (gimple_phi_arg_edge): Likewise. (gimple_phi_arg_location): Likewise. (gimple_phi_arg_location_from_edge): Likewise. (gimple_phi_arg_set_location): Likewise. (gimple_phi_arg_has_location): Likewise. (gimple_resx_region): Require a const gresx *. (gimple_resx_set_region): Require a gresx *. (gimple_eh_dispatch_region): Require a const geh_dispatch *. (gimple_eh_dispatch_set_region): Require a geh_dispatch *. (gimple_switch_num_labels): Require a const gswitch *. (gimple_switch_set_num_labels): Likewise. (gimple_switch_index): Likewise. (gimple_switch_index_ptr): Likewise. (gimple_switch_label): Likewise. (gimple_switch_default_label): Likewise. (gimple_switch_set_index): Require a gswitch *. (gimple_switch_set_label): Likewise. (gimple_switch_set_default_label): Likewise. (gimple_omp_critical_name): Require a const gomp_critical *. (gimple_omp_critical_name_ptr): Require a gomp_critical *. (gimple_omp_critical_set_name): Likewise. (gimple_omp_for_set_kind): Require a gomp_for *. (gimple_omp_for_set_combined_p): Likewise. (gimple_omp_for_set_combined_into_p): Likewise. (gimple_omp_for_clauses): Update for renaming of subclass to gomp_for. (gimple_omp_for_clauses_ptr): Likewise. (gimple_omp_for_set_clauses): Likewise. (gimple_omp_for_collapse): Likewise. (gimple_omp_for_index): Likewise. (gimple_omp_for_index_ptr): Likewise. (gimple_omp_for_set_index): Likewise. (gimple_omp_for_initial): Likewise. (gimple_omp_for_initial_ptr): Likewise. (gimple_omp_for_set_initial): Likewise. (gimple_omp_for_final): Likewise. (gimple_omp_for_final_ptr): Likewise. (gimple_omp_for_set_final): Likewise. (gimple_omp_for_incr): Likewise. (gimple_omp_for_incr_ptr): Likewise. (gimple_omp_for_set_incr): Likewise. (gimple_omp_for_pre_body): Likewise. (gimple_omp_for_set_pre_body): Likewise. (gimple_omp_parallel_clauses): Update for renaming of subclass to gomp_parallel. (gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *. (gimple_omp_parallel_set_clauses): Likewise. (gimple_omp_parallel_child_fn_ptr): Likewise. (gimple_omp_parallel_set_child_fn): Likewise. (gimple_omp_parallel_data_arg_ptr): Likewise. (gimple_omp_parallel_set_data_arg): Likewise. (gimple_omp_parallel_child_fn): Require a const gomp_parallel *. (gimple_omp_parallel_data_arg): Likewise. (gimple_omp_task_clauses): Update for renaming of subclass to gomp_task. (gimple_omp_task_clauses_ptr): Likewise. (gimple_omp_task_set_clauses): Likewise. (gimple_omp_task_child_fn): Likewise. (gimple_omp_task_child_fn_ptr): Likewise. (gimple_omp_task_set_child_fn): Likewise. (gimple_omp_task_data_arg): Likewise. (gimple_omp_task_data_arg_ptr): Likewise. (gimple_omp_task_set_data_arg): Likewise. (gimple_omp_taskreg_clauses): Whitespace fixes. (gimple_omp_taskreg_clauses_ptr): Likewise. (gimple_omp_taskreg_set_clauses): Likewise. (gimple_omp_taskreg_child_fn): Likewise. (gimple_omp_taskreg_child_fn_ptr): Likewise. (gimple_omp_taskreg_set_child_fn): Likewise. (gimple_omp_taskreg_data_arg): Likewise. (gimple_omp_taskreg_data_arg_ptr): Likewise. (gimple_omp_taskreg_set_data_arg): Likewise. (gimple_omp_task_copy_fn): Update for renaming of subclass to gomp_task. (gimple_omp_task_copy_fn_ptr): Likewise. (gimple_omp_task_set_copy_fn): Likewise. (gimple_omp_task_arg_size): Likewise. (gimple_omp_task_arg_size_ptr): Likewise. (gimple_omp_task_set_arg_size): Likewise. (gimple_omp_task_arg_align): Likewise. (gimple_omp_task_arg_align_ptr): Likewise. (gimple_omp_task_set_arg_align): Likewise. (gimple_omp_single_clauses): Update for renaming of subclass to gomp_single. (gimple_omp_single_clauses_ptr): Likewise. (gimple_omp_single_set_clauses): Likewise. (gimple_omp_target_clauses): Update for renaming of subclass to gomp_target. (gimple_omp_target_clauses_ptr): Likewise. (gimple_omp_target_set_clauses): Require a gomp_target *. (gimple_omp_target_set_kind): Likewise. (gimple_omp_target_child_fn_ptr): Likewise. (gimple_omp_target_set_child_fn): Likewise. (gimple_omp_target_data_arg_ptr): Likewise. (gimple_omp_target_set_data_arg): Likewise. (gimple_omp_target_child_fn): Require a const gomp_target *. (gimple_omp_target_data_arg): Likewise. (gimple_omp_teams_clauses): Update for renaming of subclass to gomp_teams. (gimple_omp_teams_clauses_ptr): Likewise. (gimple_omp_teams_set_clauses): Require a gomp_teams *. (gimple_omp_sections_clauses): Update for renaming of subclass to gomp_sections. (gimple_omp_sections_clauses_ptr): Likewise. (gimple_omp_sections_set_clauses): Likewise. (gimple_omp_sections_control): Likewise. (gimple_omp_sections_control_ptr): Likewise. (gimple_omp_sections_set_control): Likewise. (gimple_omp_for_set_cond): Likewise. (gimple_omp_for_cond): Likewise. (gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *. (gimple_omp_atomic_store_val_ptr): Likewise. (gimple_omp_atomic_load_set_lhs): Likewise. (gimple_omp_atomic_store_val): Require a const gomp_atomic_store *. (gimple_omp_atomic_load_lhs): Likewise. (gimple_omp_atomic_load_rhs): Likewise. (gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *. (gimple_omp_atomic_load_set_rhs): Likewise. (gimple_omp_atomic_load_rhs_ptr): Likewise. (gimple_omp_continue_control_def): Require a const gomp_continue *. (gimple_omp_continue_control_use): Likewise. (gimple_omp_continue_control_def_ptr): Require a gomp_continue *. (gimple_omp_continue_set_control_def): Likewise. (gimple_omp_continue_control_use_ptr): Likewise. (gimple_omp_continue_set_control_use): Likewise. (gimple_transaction_body_ptr): Require a gtransaction *. (gimple_transaction_body): Likewise. (gimple_transaction_label_ptr): Likewise. (gimple_transaction_label): Require a const gtransaction *. (gimple_transaction_subcode): Likewise. (gimple_transaction_set_body): Require a gtransaction *. (gimple_transaction_set_label): Likewise. (gimple_transaction_set_subcode): Likewise. (gimple_return_retval_ptr): Require a const greturn *. (gimple_return_retval): Likewise. (gimple_return_set_retval): Require a greturn *. (gimple_expr_type): Introduce local "call_stmt" and use in place of "stmt" for typesafety. * asan.c: Use gimple subclasses. * auto-profile.c: Likewise. * builtins.c: Likewise. * builtins.h: Likewise. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * expr.h: Likewise. * gimple-builder.c: Likewise. * gimple-builder.h: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimple-walk.c: Likewise. * gimplify-me.c: Likewise. * gimplify.c: Likewise. * gimplify.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * internal-fn.c: Likewise. * internal-fn.def:: Likewise. * internal-fn.h: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-icf-gimple.h: Likewise. * ipa-icf.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sanopt.c: Likewise. * sese.c: Likewise. * ssa-iterators.h: Likewise. * stmt.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chkp.c: Likewise. * tree-chkp.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-eh.h: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-into-ssa.h: Likewise. * tree-loop-distribution.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h * tree-sra.cn_function): * tree-ssa-alias.c: Likewise. * tree-ssa-alias.h: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c * tree-ssa-structalias.c * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadedge.h: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * vtable-verify.c: Likewise. gcc/c-family/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * c-gimplify.c (add_block_to_enclosing): Strengthen local "stack" from being just a vec<gimple> to a vec<gbind *>. gcc/java/ChangeLog: Merger of git branch "gimple-classes-v2-option-3". * ChangeLog.gimple-classes: New. * java-gimplify.c (java_gimplify_block): Strengthen local "outer" from gimple to gbind *. From-SVN: r217787
2014-11-19 18:00:54 +01:00
gcall *call_stmt = as_a <gcall *> (stmt);
tree arg = pass_through_call (call_stmt);
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
if (arg)
{
if (TREE_CODE (arg) == SSA_NAME)
check_for_plus_in_loops_1 (osi, arg, depth);
else
gcc_unreachable ();
}
break;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
case GIMPLE_PHI:
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
unsigned i;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
for (i = 0; i < gimple_phi_num_args (stmt); i++)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
tree rhs = gimple_phi_arg (stmt, i)->def;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (TREE_CODE (rhs) == SSA_NAME)
check_for_plus_in_loops_1 (osi, rhs, depth);
}
break;
}
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
default:
gcc_unreachable ();
}
osi->depths[varno] = 0;
osi->tos--;
}
/* Check if some pointer we are computing object size of is being increased
within a loop. If yes, assume all the SSA variables participating in
that loop have minimum object sizes 0. */
static void
check_for_plus_in_loops (struct object_size_info *osi, tree var)
{
gimple *stmt = SSA_NAME_DEF_STMT (var);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
/* NOTE: In the pre-tuples code, we handled a CALL_EXPR here,
and looked for a POINTER_PLUS_EXPR in the pass-through
argument, if any. In GIMPLE, however, such an expression
is not a valid call operand. */
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
if (is_gimple_assign (stmt)
&& gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
{
tree basevar = gimple_assign_rhs1 (stmt);
tree cst = gimple_assign_rhs2 (stmt);
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
gcc_assert (TREE_CODE (cst) == INTEGER_CST);
if (integer_zerop (cst))
return;
osi->depths[SSA_NAME_VERSION (basevar)] = 1;
*osi->tos++ = SSA_NAME_VERSION (basevar);
check_for_plus_in_loops_1 (osi, var, 2);
osi->depths[SSA_NAME_VERSION (basevar)] = 0;
osi->tos--;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
}
/* Initialize data structures for the object size computation. */
void
init_object_sizes (void)
{
int object_size_type;
if (computed[0])
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
return;
for (object_size_type = 0; object_size_type <= 3; object_size_type++)
{
object_sizes[object_size_type].safe_grow (num_ssa_names);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
computed[object_size_type] = BITMAP_ALLOC (NULL);
}
init_offset_limit ();
}
/* Destroy data structures after the object size computation. */
void
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
fini_object_sizes (void)
{
int object_size_type;
for (object_size_type = 0; object_size_type <= 3; object_size_type++)
{
object_sizes[object_size_type].release ();
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
BITMAP_FREE (computed[object_size_type]);
}
}
/* Simple pass to optimize all __builtin_object_size () builtins. */
pass cfun to pass::execute gcc/ * passes.c (opt_pass::execute): Adjust. (pass_manager::execute_pass_mode_switching): Likewise. (early_local_passes::execute): Likewise. (execute_one_pass): Pass cfun to the pass's execute method. * tree-pass.h (opt_pass::execute): Add function * argument. * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c, cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c, compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/i386/i386.c, config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c, config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c, gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c, graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c, lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c, store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c, tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c: Adjust. From-SVN: r209482
2014-04-17 14:37:34 +02:00
namespace {
const pass_data pass_data_object_sizes =
{
GIMPLE_PASS, /* type */
"objsz", /* name */
OPTGROUP_NONE, /* optinfo_flags */
TV_NONE, /* tv_id */
( PROP_cfg | PROP_ssa ), /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
tree-pass.h (TODO_verify_ssa, [...]): Remove. 2014-05-06 Richard Biener <rguenther@suse.de> * tree-pass.h (TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_verify_rtl_sharing): Remove. (TODO_verify_all): Adjust. * asan.c: Remove references to TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts and TODO_verify_rtl_sharing. * bb-reorder.c: Likewise. * cfgexpand.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * function.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * ipa-split.c: Likewise. * loop-init.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * modulo-sched.c: Likewise. * postreload-gcse.c: Likewise. * predict.c: Likewise. * recog.c: Likewise. * sched-rgn.c: Likewise. * store-motion.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-complex.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-object-size.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-sra.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tsan.c: Likewise. * var-tracking.c: Likewise. * bt-load.c: Likewise. * cfgcleanup.c: Likewise. * combine-stack-adj.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. * config/i386/i386.c: Likewise. * config/mips/mips.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh_treg_combine.cc: Likewise. * config/sparc/sparc.c: Likewise. * dce.c: Likewise. * dse.c: Likewise. * final.c: Likewise. * ifcvt.c: Likewise. * mode-switching.c: Likewise. * passes.c: Likewise. * postreload.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * regrename.c: Likewise. * web.c: Likewise. From-SVN: r210106
2014-05-06 15:35:40 +02:00
0, /* todo_flags_finish */
pass cfun to pass::execute gcc/ * passes.c (opt_pass::execute): Adjust. (pass_manager::execute_pass_mode_switching): Likewise. (early_local_passes::execute): Likewise. (execute_one_pass): Pass cfun to the pass's execute method. * tree-pass.h (opt_pass::execute): Add function * argument. * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c, cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c, compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/i386/i386.c, config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c, config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c, gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c, graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c, lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c, store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c, tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c: Adjust. From-SVN: r209482
2014-04-17 14:37:34 +02:00
};
class pass_object_sizes : public gimple_opt_pass
{
public:
pass_object_sizes (gcc::context *ctxt)
: gimple_opt_pass (pass_data_object_sizes, ctxt), insert_min_max_p (false)
pass cfun to pass::execute gcc/ * passes.c (opt_pass::execute): Adjust. (pass_manager::execute_pass_mode_switching): Likewise. (early_local_passes::execute): Likewise. (execute_one_pass): Pass cfun to the pass's execute method. * tree-pass.h (opt_pass::execute): Add function * argument. * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c, cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c, compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/i386/i386.c, config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c, config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c, gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c, graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c, lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c, store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c, tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c: Adjust. From-SVN: r209482
2014-04-17 14:37:34 +02:00
{}
/* opt_pass methods: */
opt_pass * clone () { return new pass_object_sizes (m_ctxt); }
void set_pass_param (unsigned int n, bool param)
{
gcc_assert (n == 0);
insert_min_max_p = param;
}
pass cfun to pass::execute gcc/ * passes.c (opt_pass::execute): Adjust. (pass_manager::execute_pass_mode_switching): Likewise. (early_local_passes::execute): Likewise. (execute_one_pass): Pass cfun to the pass's execute method. * tree-pass.h (opt_pass::execute): Add function * argument. * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c, cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c, compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/i386/i386.c, config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c, config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c, gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c, graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c, lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c, store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c, tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c: Adjust. From-SVN: r209482
2014-04-17 14:37:34 +02:00
virtual unsigned int execute (function *);
private:
/* Determines whether the pass instance creates MIN/MAX_EXPRs. */
bool insert_min_max_p;
pass cfun to pass::execute gcc/ * passes.c (opt_pass::execute): Adjust. (pass_manager::execute_pass_mode_switching): Likewise. (early_local_passes::execute): Likewise. (execute_one_pass): Pass cfun to the pass's execute method. * tree-pass.h (opt_pass::execute): Add function * argument. * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c, cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c, compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/i386/i386.c, config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c, config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c, gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c, graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c, lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c, store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c, tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c: Adjust. From-SVN: r209482
2014-04-17 14:37:34 +02:00
}; // class pass_object_sizes
/* Dummy valueize function. */
static tree
do_valueize (tree t)
{
return t;
}
pass cfun to pass::execute gcc/ * passes.c (opt_pass::execute): Adjust. (pass_manager::execute_pass_mode_switching): Likewise. (early_local_passes::execute): Likewise. (execute_one_pass): Pass cfun to the pass's execute method. * tree-pass.h (opt_pass::execute): Add function * argument. * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c, cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c, compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/i386/i386.c, config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c, config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c, gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c, graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c, lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c, store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c, tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c: Adjust. From-SVN: r209482
2014-04-17 14:37:34 +02:00
unsigned int
pass_object_sizes::execute (function *fun)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
basic_block bb;
pass cfun to pass::execute gcc/ * passes.c (opt_pass::execute): Adjust. (pass_manager::execute_pass_mode_switching): Likewise. (early_local_passes::execute): Likewise. (execute_one_pass): Pass cfun to the pass's execute method. * tree-pass.h (opt_pass::execute): Add function * argument. * asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c, cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c, compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/i386/i386.c, config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c, config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c, except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c, gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c, graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c, lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c, postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c, store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c, tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c, tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c, tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c: Adjust. From-SVN: r209482
2014-04-17 14:37:34 +02:00
FOR_EACH_BB_FN (bb, fun)
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
gimple_stmt_iterator i;
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
tree result;
gimple *call = gsi_stmt (i);
if (!gimple_call_builtin_p (call, BUILT_IN_OBJECT_SIZE))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
continue;
init_object_sizes ();
/* If insert_min_max_p, only attempt to fold
__builtin_object_size (x, 1) and __builtin_object_size (x, 3),
and rather than folding the builtin to the constant if any,
create a MIN_EXPR or MAX_EXPR of the __builtin_object_size
call result and the computed constant. */
if (insert_min_max_p)
{
tree ost = gimple_call_arg (call, 1);
if (tree_fits_uhwi_p (ost))
{
unsigned HOST_WIDE_INT object_size_type = tree_to_uhwi (ost);
tree ptr = gimple_call_arg (call, 0);
tree lhs = gimple_call_lhs (call);
if ((object_size_type == 1 || object_size_type == 3)
&& (TREE_CODE (ptr) == ADDR_EXPR
|| TREE_CODE (ptr) == SSA_NAME)
&& lhs)
{
tree type = TREE_TYPE (lhs);
unsigned HOST_WIDE_INT bytes;
if (compute_builtin_object_size (ptr, object_size_type,
&bytes)
&& wi::fits_to_tree_p (bytes, type))
{
tree tem = make_ssa_name (type);
gimple_call_set_lhs (call, tem);
enum tree_code code
= object_size_type == 1 ? MIN_EXPR : MAX_EXPR;
tree cst = build_int_cstu (type, bytes);
gimple *g
= gimple_build_assign (lhs, code, tem, cst);
gsi_insert_after (&i, g, GSI_NEW_STMT);
update_stmt (call);
}
}
}
continue;
}
tree lhs = gimple_call_lhs (call);
if (!lhs)
continue;
result = gimple_fold_stmt_to_constant (call, do_valueize);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (!result)
{
tree ost = gimple_call_arg (call, 1);
if (tree_fits_uhwi_p (ost))
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
{
unsigned HOST_WIDE_INT object_size_type = tree_to_uhwi (ost);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (object_size_type < 2)
result = fold_convert (size_type_node,
integer_minus_one_node);
else if (object_size_type < 4)
result = build_zero_cst (size_type_node);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
if (!result)
continue;
}
gcc_assert (TREE_CODE (result) == INTEGER_CST);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Simplified\n ");
backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch. 2008-07-28 Richard Guenther <rguenther@suse.de> Merge from gimple-tuples-branch. * ChangeLog.tuples: ChangeLog from gimple-tuples-branch. * gimple.def: New file. * gsstruct.def: Likewise. * gimple-iterator.c: Likewise. * gimple-pretty-print.c: Likewise. * tree-gimple.c: Removed. Merged into ... * gimple.c: ... here. New file. * tree-gimple.h: Removed. Merged into ... * gimple.h: ... here. New file. * Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h. * configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the --enable-checking=gimple flag. * config.in: Likewise. * configure: Regenerated. * tree-ssa-operands.h: Tuplified. * tree-vrp.c: Likewise. * tree-loop-linear.c: Likewise. * tree-into-ssa.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-dump.c: Likewise. * tree-complex.c: Likewise. * cgraphbuild.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-pretty-print.c: Likewise. * tracer.c: Likewise. * gengtype.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * tree-ssa-loop-manip.c: Likewise. * value-prof.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-tailcall.c: Likewise. * value-prof.h: Likewise. * tree.c: Likewise. * tree.h: Likewise. * tree-pass.h: Likewise. * ipa-cp.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-scalar-evolution.h: Likewise. * target.h: Likewise. * lambda-mat.c: Likewise. * tree-phinodes.c: Likewise. * diagnostic.h: Likewise. * builtins.c: Likewise. * tree-ssa-alias-warnings.c: Likewise. * cfghooks.c: Likewise. * fold-const.c: Likewise. * cfghooks.h: Likewise. * omp-low.c: Likewise. * tree-ssa-dse.c: Likewise. * ipa-reference.c: Likewise. * tree-ssa-uncprop.c: Likewise. * toplev.c: Likewise. * tree-gimple.c: Likewise. * tree-gimple.h: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * cgraphunit.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-nomudflap.c: Likewise. * tree-call-cdce.c: Likewise. * ipa-pure-const.c: Likewise. * c-format.c: Likewise. * tree-stdarg.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-nrv.c: Likewise. * tree-ssa-propagate.c: Likewise. * ipa-utils.c: Likewise. * tree-ssa-propagate.h: Likewise. * tree-ssa-alias.c: Likewise. * gimple-low.c: Likewise. * tree-ssa-sink.c: Likewise. * ipa-inline.c: Likewise. * c-semantics.c: Likewise. * dwarf2out.c: Likewise. * expr.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * predict.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-parloops.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * matrix-reorg.c: Likewise. * c-decl.c: Likewise. * tree-eh.c: Likewise. * c-pretty-print.c: Likewise. * lambda-trans.c: Likewise. * function.c: Likewise. * langhooks.c: Likewise. * ebitmap.h: Likewise. * tree-vectorizer.c: Likewise. * function.h: Likewise. * langhooks.h: Likewise. * tree-vectorizer.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * domwalk.c: Likewise. * tree-if-conv.c: Likewise. * profile.c: Likewise. * domwalk.h: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-flow-inline.h: Likewise. * tree-affine.c: Likewise. * tree-vect-analyze.c: Likewise. * c-typeck.c: Likewise. * gimplify.c: Likewise. * coretypes.h: Likewise. * tree-ssa-phiopt.c: Likewise. * calls.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree.def: Likewise. * tree-dfa.c: Likewise. * except.c: Likewise. * except.h: Likewise. * cfgexpand.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-live.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.h: Likewise. * tree-predcom.c: Likewise. * lambda.h: Likewise. * tree-mudflap.c: Likewise. * ipa-prop.c: Likewise. * print-tree.c: Likewise. * tree-ssa-copy.c: Likewise. * ipa-prop.h: Likewise. * tree-ssa-forwprop.c: Likewise. * ggc-page.c: Likewise. * c-omp.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-nested.c: Likewise. * tree-ssa.c: Likewise. * lambda-code.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-iterator.c: Likewise. * tree-optimize.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-vect-transform.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * cfgloop.c: Likewise. * system.h: Likewise. * tree-profile.c: Likewise. * cfgloop.h: Likewise. * c-gimplify.c: Likewise. * c-common.c: Likewise. * tree-vect-generic.c: Likewise. * tree-flow.h: Likewise. * c-common.h: Likewise. * basic-block.h: Likewise. * tree-ssa-structalias.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-ssa-structalias.h: Likewise. * tree-cfg.c: Likewise. * passes.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * tree-ssa-reassoc.c: Likewise. * cfgrtl.c: Likewise. * varpool.c: Likewise. * stmt.c: Likewise. * tree-ssanames.c: Likewise. * tree-ssa-threadedge.c: Likewise. * langhooks-def.h: Likewise. * tree-ssa-operands.c: Likewise. * config/alpha/alpha.c: Likewise. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32c/m32c-protos.h: Likewise. * config/spu/spu.c: Likewise. * config/sparc/sparc.c: Likewise. * config/i386/i386.c: Likewise. * config/sh/sh.c: Likewise. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. From-SVN: r138207
2008-07-28 16:33:56 +02:00
print_gimple_stmt (dump_file, call, 0, dump_flags);
fprintf (dump_file, " to ");
print_generic_expr (dump_file, result, 0);
fprintf (dump_file, "\n");
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
/* Propagate into all uses and fold those stmts. */
replace_uses_by (lhs, result);
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
}
fini_object_sizes ();
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
return 0;
builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. * builtin-attrs.def (DEF_ATTR_FOR_INT): Add for 5 and 6. (DEF_LIST_INT_INT): Add for 4,0, 4,5, 5,0, 5,6. (ATTR_NOTHROW_NONNULL_4, ATTR_NOTHROW_NONNULL_5): Define. (ATTR_FORMAT_PRINTF_4_0, ATTR_FORMAT_PRINTF_4_5, ATTR_FORMAT_PRINTF_5_0, ATTR_FORMAT_PRINTF_5_6): Define. * builtins.c: Include tree-flow.h. (expand_builtin_mempcpy, expand_builtin_memmove): Comment fixes. (expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning, compute_object_offset, compute_builtin_object_size, fold_builtin_object_size): New functions. (expand_builtin): Handle BUILT_IN_OBJECT_SIZE and BUILT_IN_*_CHK. (fold_builtin_1): Likewise. Handle BUILT_IN_{,V}{,F}PRINTF and BUILT_IN_{,F}PRINTF_UNLOCKED. (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_strcat_chk, fold_builtin_strncat_chk, fold_builtin_sprintf_chk, fold_builtin_snprintf_chk, fold_builtin_printf, fold_builtin_fprintf): New functions. * builtins.def (BUILT_IN_OBJECT_SIZE, BUILT_IN_MEMCPY_CHK, BUILT_IN_MEMMOVE_CHK, BUILT_IN_MEMPCPY_CHK, BUILT_IN_MEMSET_CHK, BUILT_IN_STPCPY_CHK, BUILT_IN_STRCAT_CHK, BUILT_IN_STRCPY_CHK, BUILT_IN_STRNCAT_CHK, BUILT_IN_STRNCPY_CHK, BUILT_IN_SNPRINTF_CHK, BUILT_IN_SPRINTF_CHK, BUILT_IN_VSNPRINTF_CHK, BUILT_IN_VSPRINTF_CHK, BUILT_IN_FPRINTF_CHK, BUILT_IN_PRINTF_CHK, BUILT_IN_VFPRINTF_CHK, BUILT_IN_VPRINTF_CHK): New builtins. * builtin-types.def (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_VAR_4): Document. (BT_FN_SIZE_CONST_PTR_INT, BT_FN_INT_INT_CONST_STRING_VALIST_ARG, BT_FN_PTR_PTR_CONST_PTR_SIZE_SIZE, BT_FN_PTR_PTR_INT_SIZE_SIZE, BT_FN_STRING_STRING_CONST_STRING_SIZE_SIZE, BT_FN_INT_FILEPTR_INT_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VALIST_ARG, BT_FN_INT_INT_CONST_STRING_VAR, BT_FN_INT_FILEPTR_INT_CONST_STRING_VAR, BT_FN_INT_STRING_INT_SIZE_CONST_STRING_VAR, BT_FN_INT_STRING_SIZE_INT_SIZE_CONST_STRING_VAR): New types. * c-common.c (DEF_FUNCTION_TYPE_5, DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_VAR_4, DEF_FUNCTION_TYPE_VAR_5): Define. * Makefile.in (OBJS-common): Add tree-object-size.o. (tree-object-size.o): Add dependencies. * tree-pass.h (pass_object_sizes): Add. * tree-optimize.c (init_tree_optimization_passes): Add pass_object_sizes. * tree-object-size.c: New file. * tree.h (fold_builtin_memory_chk, fold_builtin_stxcpy_chk, fold_builtin_strncpy_chk, fold_builtin_snprintf_chk, compute_builtin_object_size, init_object_sizes, fini_object_sizes): New prototypes. * tree-ssa-ccp.c (get_strlen): Rename to ... (get_maxval_strlen): ...this function. Handle also computing of maximum string length and maximum integral value. (ccp_fold_builtin): Handle BUILT_IN_*_CHK. Use get_maxval_strlen instead of get_strlen. Pass CALLEE and ARGLIST variables to the folding functions instead of computing them again. (execute_fold_all_builtins): Retry ccp_fold_builtin if a builtin changed into some other builtin. * doc/extend.texi (Object Size Checking): Document. * gcc.c-torture/execute/builtins/lib/main.c (abort): Add prototype. * gcc.c-torture/execute/builtins/lib/strncat.c (strncat): Avoid testing uninitialized var. * gcc.c-torture/execute/builtins/chk.h: New. * gcc.c-torture/execute/builtins/lib/chk.c: New. * gcc.c-torture/execute/builtins/memcpy-chk.c: New test. * gcc.c-torture/execute/builtins/memcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memmove-chk.c: New test. * gcc.c-torture/execute/builtins/memmove-chk-lib.c: New. * gcc.c-torture/execute/builtins/mempcpy-chk.c: New test. * gcc.c-torture/execute/builtins/mempcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/memset-chk.c: New test. * gcc.c-torture/execute/builtins/memset-chk-lib.c: New. * gcc.c-torture/execute/builtins/snprintf-chk.c: New test. * gcc.c-torture/execute/builtins/snprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/sprintf-chk.c: New test. * gcc.c-torture/execute/builtins/sprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/stpcpy-chk.c: New test. * gcc.c-torture/execute/builtins/stpcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcat-chk.c: New test. * gcc.c-torture/execute/builtins/strcat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strcpy-chk.c: New test. * gcc.c-torture/execute/builtins/strcpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncat-chk.c: New test. * gcc.c-torture/execute/builtins/strncat-chk-lib.c: New. * gcc.c-torture/execute/builtins/strncpy-chk.c: New test. * gcc.c-torture/execute/builtins/strncpy-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsnprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsnprintf-chk-lib.c: New. * gcc.c-torture/execute/builtins/vsprintf-chk.c: New test. * gcc.c-torture/execute/builtins/vsprintf-chk-lib.c: New. * gcc.dg/builtin-object-size-1.c: New test. * gcc.dg/builtin-object-size-2.c: New test. * gcc.dg/builtin-object-size-3.c: New test. * gcc.dg/builtin-object-size-4.c: New test. * gcc.dg/builtin-object-size-5.c: New test. * gcc.dg/builtin-stringop-chk-1.c: New test. * gcc.dg/builtin-stringop-chk-2.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-1.c: New test. * gcc.dg/tree-ssa/builtin-printf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-1.c: New test. * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: New test. * gcc.c-torture/execute/printf-1.c: New test. * gcc.c-torture/execute/fprintf-1.c: New test. * gcc.c-torture/execute/vprintf-1.c: New test. * gcc.c-torture/execute/vfprintf-1.c: New test. * gcc.c-torture/execute/printf-chk-1.c: New test. * gcc.c-torture/execute/fprintf-chk-1.c: New test. * gcc.c-torture/execute/vprintf-chk-1.c: New test. * gcc.c-torture/execute/vfprintf-chk-1.c: New test. From-SVN: r101352
2005-06-27 14:17:39 +02:00
}
Automated conversion of passes to C++ classes gcc/ Patch autogenerated by refactor_passes.py from https://github.com/davidmalcolm/gcc-refactoring-scripts revision 03fe39476a4c4ea450b49e087cfa817b5f92021e * asan.c (pass_asan): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_asan): ...new pass_data instance and... (make_pass_asan): ...new function. (pass_asan_O0): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_asan_O0): ...new pass_data instance and... (make_pass_asan_O0): ...new function. * auto-inc-dec.c (pass_inc_dec): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_inc_dec): ...new pass_data instance and... (make_pass_inc_dec): ...new function. * bb-reorder.c (pass_reorder_blocks): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_reorder_blocks): ...new pass_data instance and... (make_pass_reorder_blocks): ...new function. (pass_duplicate_computed_gotos): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_duplicate_computed_gotos): ...new pass_data instance and... (make_pass_duplicate_computed_gotos): ...new function. (pass_partition_blocks): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_partition_blocks): ...new pass_data instance and... (make_pass_partition_blocks): ...new function. * bt-load.c (pass_branch_target_load_optimize1): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_branch_target_load_optimize1): ...new pass_data instance and... (make_pass_branch_target_load_optimize1): ...new function. (pass_branch_target_load_optimize2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_branch_target_load_optimize2): ...new pass_data instance and... (make_pass_branch_target_load_optimize2): ...new function. * cfgcleanup.c (pass_jump): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_jump): ...new pass_data instance and... (make_pass_jump): ...new function. (pass_jump2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_jump2): ...new pass_data instance and... (make_pass_jump2): ...new function. * cfgexpand.c (pass_expand): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_expand): ...new pass_data instance and... (make_pass_expand): ...new function. * cfgrtl.c (pass_free_cfg): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_free_cfg): ...new pass_data instance and... (make_pass_free_cfg): ...new function. (pass_into_cfg_layout_mode): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_into_cfg_layout_mode): ...new pass_data instance and... (make_pass_into_cfg_layout_mode): ...new function. (pass_outof_cfg_layout_mode): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_outof_cfg_layout_mode): ...new pass_data instance and... (make_pass_outof_cfg_layout_mode): ...new function. * cgraphbuild.c (pass_build_cgraph_edges): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_build_cgraph_edges): ...new pass_data instance and... (make_pass_build_cgraph_edges): ...new function. (pass_rebuild_cgraph_edges): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_rebuild_cgraph_edges): ...new pass_data instance and... (make_pass_rebuild_cgraph_edges): ...new function. (pass_remove_cgraph_callee_edges): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_remove_cgraph_callee_edges): ...new pass_data instance and... (make_pass_remove_cgraph_callee_edges): ...new function. * combine-stack-adj.c (pass_stack_adjustments): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_stack_adjustments): ...new pass_data instance and... (make_pass_stack_adjustments): ...new function. * combine.c (pass_combine): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_combine): ...new pass_data instance and... (make_pass_combine): ...new function. * compare-elim.c (pass_compare_elim_after_reload): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_compare_elim_after_reload): ...new pass_data instance and... (make_pass_compare_elim_after_reload): ...new function. * cprop.c (pass_rtl_cprop): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_cprop): ...new pass_data instance and... (make_pass_rtl_cprop): ...new function. * cse.c (pass_cse): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_cse): ...new pass_data instance and... (make_pass_cse): ...new function. (pass_cse2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_cse2): ...new pass_data instance and... (make_pass_cse2): ...new function. (pass_cse_after_global_opts): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_cse_after_global_opts): ...new pass_data instance and... (make_pass_cse_after_global_opts): ...new function. * dce.c (pass_ud_rtl_dce): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_ud_rtl_dce): ...new pass_data instance and... (make_pass_ud_rtl_dce): ...new function. (pass_fast_rtl_dce): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_fast_rtl_dce): ...new pass_data instance and... (make_pass_fast_rtl_dce): ...new function. * df-core.c (pass_df_initialize_opt): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_df_initialize_opt): ...new pass_data instance and... (make_pass_df_initialize_opt): ...new function. (pass_df_initialize_no_opt): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_df_initialize_no_opt): ...new pass_data instance and... (make_pass_df_initialize_no_opt): ...new function. (pass_df_finish): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_df_finish): ...new pass_data instance and... (make_pass_df_finish): ...new function. * dse.c (pass_rtl_dse1): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_dse1): ...new pass_data instance and... (make_pass_rtl_dse1): ...new function. (pass_rtl_dse2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_dse2): ...new pass_data instance and... (make_pass_rtl_dse2): ...new function. * dwarf2cfi.c (pass_dwarf2_frame): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_dwarf2_frame): ...new pass_data instance and... (make_pass_dwarf2_frame): ...new function. * except.c (pass_set_nothrow_function_flags): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_set_nothrow_function_flags): ...new pass_data instance and... (make_pass_set_nothrow_function_flags): ...new function. (pass_convert_to_eh_region_ranges): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_convert_to_eh_region_ranges): ...new pass_data instance and... (make_pass_convert_to_eh_region_ranges): ...new function. * final.c (pass_compute_alignments): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_compute_alignments): ...new pass_data instance and... (make_pass_compute_alignments): ...new function. (pass_final): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_final): ...new pass_data instance and... (make_pass_final): ...new function. (pass_shorten_branches): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_shorten_branches): ...new pass_data instance and... (make_pass_shorten_branches): ...new function. (pass_clean_state): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_clean_state): ...new pass_data instance and... (make_pass_clean_state): ...new function. * function.c (pass_instantiate_virtual_regs): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_instantiate_virtual_regs): ...new pass_data instance and... (make_pass_instantiate_virtual_regs): ...new function. (pass_leaf_regs): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_leaf_regs): ...new pass_data instance and... (make_pass_leaf_regs): ...new function. (pass_thread_prologue_and_epilogue): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_thread_prologue_and_epilogue): ...new pass_data instance and... (make_pass_thread_prologue_and_epilogue): ...new function. (pass_match_asm_constraints): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_match_asm_constraints): ...new pass_data instance and... (make_pass_match_asm_constraints): ...new function. * fwprop.c (pass_rtl_fwprop): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_fwprop): ...new pass_data instance and... (make_pass_rtl_fwprop): ...new function. (pass_rtl_fwprop_addr): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_fwprop_addr): ...new pass_data instance and... (make_pass_rtl_fwprop_addr): ...new function. * gcse.c (pass_rtl_pre): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_pre): ...new pass_data instance and... (make_pass_rtl_pre): ...new function. (pass_rtl_hoist): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_hoist): ...new pass_data instance and... (make_pass_rtl_hoist): ...new function. * gimple-low.c (pass_lower_cf): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_cf): ...new pass_data instance and... (make_pass_lower_cf): ...new function. * gimple-ssa-strength-reduction.c (pass_strength_reduction): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_strength_reduction): ...new pass_data instance and... (make_pass_strength_reduction): ...new function. * ifcvt.c (pass_rtl_ifcvt): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_ifcvt): ...new pass_data instance and... (make_pass_rtl_ifcvt): ...new function. (pass_if_after_combine): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_if_after_combine): ...new pass_data instance and... (make_pass_if_after_combine): ...new function. (pass_if_after_reload): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_if_after_reload): ...new pass_data instance and... (make_pass_if_after_reload): ...new function. * init-regs.c (pass_initialize_regs): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_initialize_regs): ...new pass_data instance and... (make_pass_initialize_regs): ...new function. * ipa-cp.c (pass_ipa_cp): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_cp): ...new pass_data instance and... (make_pass_ipa_cp): ...new function. * ipa-inline-analysis.c (pass_inline_parameters): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_inline_parameters): ...new pass_data instance and... (make_pass_inline_parameters): ...new function. * ipa-inline.c (pass_early_inline): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_early_inline): ...new pass_data instance and... (make_pass_early_inline): ...new function. (pass_ipa_inline): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_inline): ...new pass_data instance and... (make_pass_ipa_inline): ...new function. * ipa-pure-const.c (pass_local_pure_const): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_local_pure_const): ...new pass_data instance and... (make_pass_local_pure_const): ...new function. (pass_ipa_pure_const): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_pure_const): ...new pass_data instance and... (make_pass_ipa_pure_const): ...new function. * ipa-reference.c (pass_ipa_reference): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_reference): ...new pass_data instance and... (make_pass_ipa_reference): ...new function. * ipa-split.c (pass_split_functions): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_split_functions): ...new pass_data instance and... (make_pass_split_functions): ...new function. (pass_feedback_split_functions): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_feedback_split_functions): ...new pass_data instance and... (make_pass_feedback_split_functions): ...new function. * ipa.c (pass_ipa_function_and_variable_visibility): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_function_and_variable_visibility): ...new pass_data instance and... (make_pass_ipa_function_and_variable_visibility): ...new function. (pass_ipa_free_inline_summary): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_free_inline_summary): ...new pass_data instance and... (make_pass_ipa_free_inline_summary): ...new function. (pass_ipa_whole_program_visibility): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_whole_program_visibility): ...new pass_data instance and... (make_pass_ipa_whole_program_visibility): ...new function. (pass_ipa_profile): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_profile): ...new pass_data instance and... (make_pass_ipa_profile): ...new function. (pass_ipa_cdtor_merge): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_cdtor_merge): ...new pass_data instance and... (make_pass_ipa_cdtor_merge): ...new function. * ira.c (pass_ira): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_ira): ...new pass_data instance and... (make_pass_ira): ...new function. (pass_reload): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_reload): ...new pass_data instance and... (make_pass_reload): ...new function. * jump.c (pass_cleanup_barriers): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_cleanup_barriers): ...new pass_data instance and... (make_pass_cleanup_barriers): ...new function. * loop-init.c (pass_loop2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_loop2): ...new pass_data instance and... (make_pass_loop2): ...new function. (pass_rtl_loop_init): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_loop_init): ...new pass_data instance and... (make_pass_rtl_loop_init): ...new function. (pass_rtl_loop_done): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_loop_done): ...new pass_data instance and... (make_pass_rtl_loop_done): ...new function. (pass_rtl_move_loop_invariants): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_move_loop_invariants): ...new pass_data instance and... (make_pass_rtl_move_loop_invariants): ...new function. (pass_rtl_unswitch): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_unswitch): ...new pass_data instance and... (make_pass_rtl_unswitch): ...new function. (pass_rtl_unroll_and_peel_loops): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_unroll_and_peel_loops): ...new pass_data instance and... (make_pass_rtl_unroll_and_peel_loops): ...new function. (pass_rtl_doloop): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_doloop): ...new pass_data instance and... (make_pass_rtl_doloop): ...new function. * lower-subreg.c (pass_lower_subreg): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_lower_subreg): ...new pass_data instance and... (make_pass_lower_subreg): ...new function. (pass_lower_subreg2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_lower_subreg2): ...new pass_data instance and... (make_pass_lower_subreg2): ...new function. * lto-streamer-out.c (pass_ipa_lto_gimple_out): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_lto_gimple_out): ...new pass_data instance and... (make_pass_ipa_lto_gimple_out): ...new function. (pass_ipa_lto_finish_out): Convert from a global struct to a subclass of ipa_opt_pass_d along with... (pass_data_ipa_lto_finish_out): ...new pass_data instance and... (make_pass_ipa_lto_finish_out): ...new function. * mode-switching.c (pass_mode_switching): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_mode_switching): ...new pass_data instance and... (make_pass_mode_switching): ...new function. * modulo-sched.c (pass_sms): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_sms): ...new pass_data instance and... (make_pass_sms): ...new function. * omp-low.c (pass_expand_omp): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_expand_omp): ...new pass_data instance and... (make_pass_expand_omp): ...new function. (pass_lower_omp): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_omp): ...new pass_data instance and... (make_pass_lower_omp): ...new function. (pass_diagnose_omp_blocks): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_diagnose_omp_blocks): ...new pass_data instance and... (make_pass_diagnose_omp_blocks): ...new function. * passes.c (pass_early_local_passes): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_early_local_passes): ...new pass_data instance and... (make_pass_early_local_passes): ...new function. (pass_all_early_optimizations): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_all_early_optimizations): ...new pass_data instance and... (make_pass_all_early_optimizations): ...new function. (pass_all_optimizations): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_all_optimizations): ...new pass_data instance and... (make_pass_all_optimizations): ...new function. (pass_all_optimizations_g): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_all_optimizations_g): ...new pass_data instance and... (make_pass_all_optimizations_g): ...new function. (pass_rest_of_compilation): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rest_of_compilation): ...new pass_data instance and... (make_pass_rest_of_compilation): ...new function. (pass_postreload): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_postreload): ...new pass_data instance and... (make_pass_postreload): ...new function. * postreload-gcse.c (pass_gcse2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_gcse2): ...new pass_data instance and... (make_pass_gcse2): ...new function. * postreload.c (pass_postreload_cse): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_postreload_cse): ...new pass_data instance and... (make_pass_postreload_cse): ...new function. * predict.c (pass_profile): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_profile): ...new pass_data instance and... (make_pass_profile): ...new function. (pass_strip_predict_hints): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_strip_predict_hints): ...new pass_data instance and... (make_pass_strip_predict_hints): ...new function. * recog.c (pass_peephole2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_peephole2): ...new pass_data instance and... (make_pass_peephole2): ...new function. (pass_split_all_insns): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_split_all_insns): ...new pass_data instance and... (make_pass_split_all_insns): ...new function. (pass_split_after_reload): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_split_after_reload): ...new pass_data instance and... (make_pass_split_after_reload): ...new function. (pass_split_before_regstack): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_split_before_regstack): ...new pass_data instance and... (make_pass_split_before_regstack): ...new function. (pass_split_before_sched2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_split_before_sched2): ...new pass_data instance and... (make_pass_split_before_sched2): ...new function. (pass_split_for_shorten_branches): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_split_for_shorten_branches): ...new pass_data instance and... (make_pass_split_for_shorten_branches): ...new function. * ree.c (pass_ree): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_ree): ...new pass_data instance and... (make_pass_ree): ...new function. * reg-stack.c (pass_stack_regs): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_stack_regs): ...new pass_data instance and... (make_pass_stack_regs): ...new function. (pass_stack_regs_run): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_stack_regs_run): ...new pass_data instance and... (make_pass_stack_regs_run): ...new function. * regcprop.c (pass_cprop_hardreg): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_cprop_hardreg): ...new pass_data instance and... (make_pass_cprop_hardreg): ...new function. * reginfo.c (pass_reginfo_init): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_reginfo_init): ...new pass_data instance and... (make_pass_reginfo_init): ...new function. * regmove.c (pass_regmove): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_regmove): ...new pass_data instance and... (make_pass_regmove): ...new function. * regrename.c (pass_regrename): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_regrename): ...new pass_data instance and... (make_pass_regrename): ...new function. * reorg.c (pass_delay_slots): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_delay_slots): ...new pass_data instance and... (make_pass_delay_slots): ...new function. (pass_machine_reorg): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_machine_reorg): ...new pass_data instance and... (make_pass_machine_reorg): ...new function. * sched-rgn.c (pass_sched): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_sched): ...new pass_data instance and... (make_pass_sched): ...new function. (pass_sched2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_sched2): ...new pass_data instance and... (make_pass_sched2): ...new function. * stack-ptr-mod.c (pass_stack_ptr_mod): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_stack_ptr_mod): ...new pass_data instance and... (make_pass_stack_ptr_mod): ...new function. * store-motion.c (pass_rtl_store_motion): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_rtl_store_motion): ...new pass_data instance and... (make_pass_rtl_store_motion): ...new function. * tracer.c (pass_tracer): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tracer): ...new pass_data instance and... (make_pass_tracer): ...new function. * trans-mem.c (pass_diagnose_tm_blocks): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_diagnose_tm_blocks): ...new pass_data instance and... (make_pass_diagnose_tm_blocks): ...new function. (pass_lower_tm): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_tm): ...new pass_data instance and... (make_pass_lower_tm): ...new function. (pass_tm_init): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tm_init): ...new pass_data instance and... (make_pass_tm_init): ...new function. (pass_tm_mark): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tm_mark): ...new pass_data instance and... (make_pass_tm_mark): ...new function. (pass_tm_edges): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tm_edges): ...new pass_data instance and... (make_pass_tm_edges): ...new function. (pass_tm_memopt): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tm_memopt): ...new pass_data instance and... (make_pass_tm_memopt): ...new function. (pass_ipa_tm): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_tm): ...new pass_data instance and... (make_pass_ipa_tm): ...new function. * tree-call-cdce.c (pass_call_cdce): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_call_cdce): ...new pass_data instance and... (make_pass_call_cdce): ...new function. * tree-cfg.c (pass_build_cfg): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_build_cfg): ...new pass_data instance and... (make_pass_build_cfg): ...new function. (pass_split_crit_edges): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_split_crit_edges): ...new pass_data instance and... (make_pass_split_crit_edges): ...new function. (pass_warn_function_return): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_warn_function_return): ...new pass_data instance and... (make_pass_warn_function_return): ...new function. (pass_warn_function_noreturn): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_warn_function_noreturn): ...new pass_data instance and... (make_pass_warn_function_noreturn): ...new function. (pass_warn_unused_result): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_warn_unused_result): ...new pass_data instance and... (make_pass_warn_unused_result): ...new function. * tree-cfgcleanup.c (pass_merge_phi): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_merge_phi): ...new pass_data instance and... (make_pass_merge_phi): ...new function. * tree-complex.c (pass_lower_complex): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_complex): ...new pass_data instance and... (make_pass_lower_complex): ...new function. (pass_lower_complex_O0): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_complex_O0): ...new pass_data instance and... (make_pass_lower_complex_O0): ...new function. * tree-eh.c (pass_lower_eh): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_eh): ...new pass_data instance and... (make_pass_lower_eh): ...new function. (pass_refactor_eh): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_refactor_eh): ...new pass_data instance and... (make_pass_refactor_eh): ...new function. (pass_lower_resx): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_resx): ...new pass_data instance and... (make_pass_lower_resx): ...new function. (pass_lower_eh_dispatch): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_eh_dispatch): ...new pass_data instance and... (make_pass_lower_eh_dispatch): ...new function. (pass_cleanup_eh): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_cleanup_eh): ...new pass_data instance and... (make_pass_cleanup_eh): ...new function. * tree-emutls.c (pass_ipa_lower_emutls): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_lower_emutls): ...new pass_data instance and... (make_pass_ipa_lower_emutls): ...new function. * tree-if-conv.c (pass_if_conversion): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_if_conversion): ...new pass_data instance and... (make_pass_if_conversion): ...new function. * tree-into-ssa.c (pass_build_ssa): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_build_ssa): ...new pass_data instance and... (make_pass_build_ssa): ...new function. * tree-loop-distribution.c (pass_loop_distribution): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_loop_distribution): ...new pass_data instance and... (make_pass_loop_distribution): ...new function. * tree-mudflap.c (pass_mudflap_1): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_mudflap_1): ...new pass_data instance and... (make_pass_mudflap_1): ...new function. (pass_mudflap_2): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_mudflap_2): ...new pass_data instance and... (make_pass_mudflap_2): ...new function. * tree-nomudflap.c (pass_mudflap_1): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_mudflap_1): ...new pass_data instance and... (make_pass_mudflap_1): ...new function. (pass_mudflap_2): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_mudflap_2): ...new pass_data instance and... (make_pass_mudflap_2): ...new function. * tree-nrv.c (pass_nrv): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_nrv): ...new pass_data instance and... (make_pass_nrv): ...new function. (pass_return_slot): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_return_slot): ...new pass_data instance and... (make_pass_return_slot): ...new function. * tree-object-size.c (pass_object_sizes): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_object_sizes): ...new pass_data instance and... (make_pass_object_sizes): ...new function. * tree-optimize.c (pass_cleanup_cfg_post_optimizing): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_cleanup_cfg_post_optimizing): ...new pass_data instance and... (make_pass_cleanup_cfg_post_optimizing): ...new function. (pass_fixup_cfg): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_fixup_cfg): ...new pass_data instance and... (make_pass_fixup_cfg): ...new function. * tree-pass.h (pass_mudflap_1): Replace declaration with that of... (make_pass_mudflap_1): ...new function. (pass_mudflap_2): Replace declaration with that of... (make_pass_mudflap_2): ...new function. (pass_asan): Replace declaration with that of... (make_pass_asan): ...new function. (pass_asan_O0): Replace declaration with that of... (make_pass_asan_O0): ...new function. (pass_tsan): Replace declaration with that of... (make_pass_tsan): ...new function. (pass_tsan_O0): Replace declaration with that of... (make_pass_tsan_O0): ...new function. (pass_lower_cf): Replace declaration with that of... (make_pass_lower_cf): ...new function. (pass_refactor_eh): Replace declaration with that of... (make_pass_refactor_eh): ...new function. (pass_lower_eh): Replace declaration with that of... (make_pass_lower_eh): ...new function. (pass_lower_eh_dispatch): Replace declaration with that of... (make_pass_lower_eh_dispatch): ...new function. (pass_lower_resx): Replace declaration with that of... (make_pass_lower_resx): ...new function. (pass_build_cfg): Replace declaration with that of... (make_pass_build_cfg): ...new function. (pass_early_tree_profile): Replace declaration with that of... (make_pass_early_tree_profile): ...new function. (pass_cleanup_eh): Replace declaration with that of... (make_pass_cleanup_eh): ...new function. (pass_sra): Replace declaration with that of... (make_pass_sra): ...new function. (pass_sra_early): Replace declaration with that of... (make_pass_sra_early): ...new function. (pass_early_ipa_sra): Replace declaration with that of... (make_pass_early_ipa_sra): ...new function. (pass_tail_recursion): Replace declaration with that of... (make_pass_tail_recursion): ...new function. (pass_tail_calls): Replace declaration with that of... (make_pass_tail_calls): ...new function. (pass_tree_loop): Replace declaration with that of... (make_pass_tree_loop): ...new function. (pass_tree_loop_init): Replace declaration with that of... (make_pass_tree_loop_init): ...new function. (pass_lim): Replace declaration with that of... (make_pass_lim): ...new function. (pass_tree_unswitch): Replace declaration with that of... (make_pass_tree_unswitch): ...new function. (pass_predcom): Replace declaration with that of... (make_pass_predcom): ...new function. (pass_iv_canon): Replace declaration with that of... (make_pass_iv_canon): ...new function. (pass_scev_cprop): Replace declaration with that of... (make_pass_scev_cprop): ...new function. (pass_empty_loop): Replace declaration with that of... (make_pass_empty_loop): ...new function. (pass_record_bounds): Replace declaration with that of... (make_pass_record_bounds): ...new function. (pass_graphite): Replace declaration with that of... (make_pass_graphite): ...new function. (pass_graphite_transforms): Replace declaration with that of... (make_pass_graphite_transforms): ...new function. (pass_if_conversion): Replace declaration with that of... (make_pass_if_conversion): ...new function. (pass_loop_distribution): Replace declaration with that of... (make_pass_loop_distribution): ...new function. (pass_vectorize): Replace declaration with that of... (make_pass_vectorize): ...new function. (pass_slp_vectorize): Replace declaration with that of... (make_pass_slp_vectorize): ...new function. (pass_complete_unroll): Replace declaration with that of... (make_pass_complete_unroll): ...new function. (pass_complete_unrolli): Replace declaration with that of... (make_pass_complete_unrolli): ...new function. (pass_parallelize_loops): Replace declaration with that of... (make_pass_parallelize_loops): ...new function. (pass_loop_prefetch): Replace declaration with that of... (make_pass_loop_prefetch): ...new function. (pass_iv_optimize): Replace declaration with that of... (make_pass_iv_optimize): ...new function. (pass_tree_loop_done): Replace declaration with that of... (make_pass_tree_loop_done): ...new function. (pass_ch): Replace declaration with that of... (make_pass_ch): ...new function. (pass_ccp): Replace declaration with that of... (make_pass_ccp): ...new function. (pass_phi_only_cprop): Replace declaration with that of... (make_pass_phi_only_cprop): ...new function. (pass_build_ssa): Replace declaration with that of... (make_pass_build_ssa): ...new function. (pass_build_alias): Replace declaration with that of... (make_pass_build_alias): ...new function. (pass_build_ealias): Replace declaration with that of... (make_pass_build_ealias): ...new function. (pass_dominator): Replace declaration with that of... (make_pass_dominator): ...new function. (pass_dce): Replace declaration with that of... (make_pass_dce): ...new function. (pass_dce_loop): Replace declaration with that of... (make_pass_dce_loop): ...new function. (pass_cd_dce): Replace declaration with that of... (make_pass_cd_dce): ...new function. (pass_call_cdce): Replace declaration with that of... (make_pass_call_cdce): ...new function. (pass_merge_phi): Replace declaration with that of... (make_pass_merge_phi): ...new function. (pass_split_crit_edges): Replace declaration with that of... (make_pass_split_crit_edges): ...new function. (pass_pre): Replace declaration with that of... (make_pass_pre): ...new function. (pass_profile): Replace declaration with that of... (make_pass_profile): ...new function. (pass_strip_predict_hints): Replace declaration with that of... (make_pass_strip_predict_hints): ...new function. (pass_lower_complex_O0): Replace declaration with that of... (make_pass_lower_complex_O0): ...new function. (pass_lower_complex): Replace declaration with that of... (make_pass_lower_complex): ...new function. (pass_lower_vector): Replace declaration with that of... (make_pass_lower_vector): ...new function. (pass_lower_vector_ssa): Replace declaration with that of... (make_pass_lower_vector_ssa): ...new function. (pass_lower_omp): Replace declaration with that of... (make_pass_lower_omp): ...new function. (pass_diagnose_omp_blocks): Replace declaration with that of... (make_pass_diagnose_omp_blocks): ...new function. (pass_expand_omp): Replace declaration with that of... (make_pass_expand_omp): ...new function. (pass_expand_omp_ssa): Replace declaration with that of... (make_pass_expand_omp_ssa): ...new function. (pass_object_sizes): Replace declaration with that of... (make_pass_object_sizes): ...new function. (pass_strlen): Replace declaration with that of... (make_pass_strlen): ...new function. (pass_fold_builtins): Replace declaration with that of... (make_pass_fold_builtins): ...new function. (pass_stdarg): Replace declaration with that of... (make_pass_stdarg): ...new function. (pass_early_warn_uninitialized): Replace declaration with that of... (make_pass_early_warn_uninitialized): ...new function. (pass_late_warn_uninitialized): Replace declaration with that of... (make_pass_late_warn_uninitialized): ...new function. (pass_cse_reciprocals): Replace declaration with that of... (make_pass_cse_reciprocals): ...new function. (pass_cse_sincos): Replace declaration with that of... (make_pass_cse_sincos): ...new function. (pass_optimize_bswap): Replace declaration with that of... (make_pass_optimize_bswap): ...new function. (pass_optimize_widening_mul): Replace declaration with that of... (make_pass_optimize_widening_mul): ...new function. (pass_warn_function_return): Replace declaration with that of... (make_pass_warn_function_return): ...new function. (pass_warn_function_noreturn): Replace declaration with that of... (make_pass_warn_function_noreturn): ...new function. (pass_cselim): Replace declaration with that of... (make_pass_cselim): ...new function. (pass_phiopt): Replace declaration with that of... (make_pass_phiopt): ...new function. (pass_forwprop): Replace declaration with that of... (make_pass_forwprop): ...new function. (pass_phiprop): Replace declaration with that of... (make_pass_phiprop): ...new function. (pass_tree_ifcombine): Replace declaration with that of... (make_pass_tree_ifcombine): ...new function. (pass_dse): Replace declaration with that of... (make_pass_dse): ...new function. (pass_nrv): Replace declaration with that of... (make_pass_nrv): ...new function. (pass_rename_ssa_copies): Replace declaration with that of... (make_pass_rename_ssa_copies): ...new function. (pass_sink_code): Replace declaration with that of... (make_pass_sink_code): ...new function. (pass_fre): Replace declaration with that of... (make_pass_fre): ...new function. (pass_check_data_deps): Replace declaration with that of... (make_pass_check_data_deps): ...new function. (pass_copy_prop): Replace declaration with that of... (make_pass_copy_prop): ...new function. (pass_vrp): Replace declaration with that of... (make_pass_vrp): ...new function. (pass_uncprop): Replace declaration with that of... (make_pass_uncprop): ...new function. (pass_return_slot): Replace declaration with that of... (make_pass_return_slot): ...new function. (pass_reassoc): Replace declaration with that of... (make_pass_reassoc): ...new function. (pass_rebuild_cgraph_edges): Replace declaration with that of... (make_pass_rebuild_cgraph_edges): ...new function. (pass_remove_cgraph_callee_edges): Replace declaration with that of... (make_pass_remove_cgraph_callee_edges): ...new function. (pass_build_cgraph_edges): Replace declaration with that of... (make_pass_build_cgraph_edges): ...new function. (pass_local_pure_const): Replace declaration with that of... (make_pass_local_pure_const): ...new function. (pass_tracer): Replace declaration with that of... (make_pass_tracer): ...new function. (pass_warn_unused_result): Replace declaration with that of... (make_pass_warn_unused_result): ...new function. (pass_diagnose_tm_blocks): Replace declaration with that of... (make_pass_diagnose_tm_blocks): ...new function. (pass_lower_tm): Replace declaration with that of... (make_pass_lower_tm): ...new function. (pass_tm_init): Replace declaration with that of... (make_pass_tm_init): ...new function. (pass_tm_mark): Replace declaration with that of... (make_pass_tm_mark): ...new function. (pass_tm_memopt): Replace declaration with that of... (make_pass_tm_memopt): ...new function. (pass_tm_edges): Replace declaration with that of... (make_pass_tm_edges): ...new function. (pass_split_functions): Replace declaration with that of... (make_pass_split_functions): ...new function. (pass_feedback_split_functions): Replace declaration with that of... (make_pass_feedback_split_functions): ...new function. (pass_strength_reduction): Replace declaration with that of... (make_pass_strength_reduction): ...new function. (pass_ipa_lower_emutls): Replace declaration with that of... (make_pass_ipa_lower_emutls): ...new function. (pass_ipa_function_and_variable_visibility): Replace declaration with that of... (make_pass_ipa_function_and_variable_visibility): ...new function. (pass_ipa_tree_profile): Replace declaration with that of... (make_pass_ipa_tree_profile): ...new function. (pass_early_local_passes): Replace declaration with that of... (make_pass_early_local_passes): ...new function. (pass_ipa_whole_program_visibility): Replace declaration with that of... (make_pass_ipa_whole_program_visibility): ...new function. (pass_ipa_lto_gimple_out): Replace declaration with that of... (make_pass_ipa_lto_gimple_out): ...new function. (pass_ipa_increase_alignment): Replace declaration with that of... (make_pass_ipa_increase_alignment): ...new function. (pass_ipa_inline): Replace declaration with that of... (make_pass_ipa_inline): ...new function. (pass_ipa_free_lang_data): Replace declaration with that of... (make_pass_ipa_free_lang_data): ...new function. (pass_ipa_free_inline_summary): Replace declaration with that of... (make_pass_ipa_free_inline_summary): ...new function. (pass_ipa_cp): Replace declaration with that of... (make_pass_ipa_cp): ...new function. (pass_ipa_reference): Replace declaration with that of... (make_pass_ipa_reference): ...new function. (pass_ipa_pure_const): Replace declaration with that of... (make_pass_ipa_pure_const): ...new function. (pass_ipa_pta): Replace declaration with that of... (make_pass_ipa_pta): ...new function. (pass_ipa_lto_finish_out): Replace declaration with that of... (make_pass_ipa_lto_finish_out): ...new function. (pass_ipa_tm): Replace declaration with that of... (make_pass_ipa_tm): ...new function. (pass_ipa_profile): Replace declaration with that of... (make_pass_ipa_profile): ...new function. (pass_ipa_cdtor_merge): Replace declaration with that of... (make_pass_ipa_cdtor_merge): ...new function. (pass_cleanup_cfg_post_optimizing): Replace declaration with that of... (make_pass_cleanup_cfg_post_optimizing): ...new function. (pass_init_datastructures): Replace declaration with that of... (make_pass_init_datastructures): ...new function. (pass_fixup_cfg): Replace declaration with that of... (make_pass_fixup_cfg): ...new function. (pass_expand): Replace declaration with that of... (make_pass_expand): ...new function. (pass_instantiate_virtual_regs): Replace declaration with that of... (make_pass_instantiate_virtual_regs): ...new function. (pass_rtl_fwprop): Replace declaration with that of... (make_pass_rtl_fwprop): ...new function. (pass_rtl_fwprop_addr): Replace declaration with that of... (make_pass_rtl_fwprop_addr): ...new function. (pass_jump): Replace declaration with that of... (make_pass_jump): ...new function. (pass_jump2): Replace declaration with that of... (make_pass_jump2): ...new function. (pass_lower_subreg): Replace declaration with that of... (make_pass_lower_subreg): ...new function. (pass_cse): Replace declaration with that of... (make_pass_cse): ...new function. (pass_fast_rtl_dce): Replace declaration with that of... (make_pass_fast_rtl_dce): ...new function. (pass_ud_rtl_dce): Replace declaration with that of... (make_pass_ud_rtl_dce): ...new function. (pass_rtl_dce): Replace declaration with that of... (make_pass_rtl_dce): ...new function. (pass_rtl_dse1): Replace declaration with that of... (make_pass_rtl_dse1): ...new function. (pass_rtl_dse2): Replace declaration with that of... (make_pass_rtl_dse2): ...new function. (pass_rtl_dse3): Replace declaration with that of... (make_pass_rtl_dse3): ...new function. (pass_rtl_cprop): Replace declaration with that of... (make_pass_rtl_cprop): ...new function. (pass_rtl_pre): Replace declaration with that of... (make_pass_rtl_pre): ...new function. (pass_rtl_hoist): Replace declaration with that of... (make_pass_rtl_hoist): ...new function. (pass_rtl_store_motion): Replace declaration with that of... (make_pass_rtl_store_motion): ...new function. (pass_cse_after_global_opts): Replace declaration with that of... (make_pass_cse_after_global_opts): ...new function. (pass_rtl_ifcvt): Replace declaration with that of... (make_pass_rtl_ifcvt): ...new function. (pass_into_cfg_layout_mode): Replace declaration with that of... (make_pass_into_cfg_layout_mode): ...new function. (pass_outof_cfg_layout_mode): Replace declaration with that of... (make_pass_outof_cfg_layout_mode): ...new function. (pass_loop2): Replace declaration with that of... (make_pass_loop2): ...new function. (pass_rtl_loop_init): Replace declaration with that of... (make_pass_rtl_loop_init): ...new function. (pass_rtl_move_loop_invariants): Replace declaration with that of... (make_pass_rtl_move_loop_invariants): ...new function. (pass_rtl_unswitch): Replace declaration with that of... (make_pass_rtl_unswitch): ...new function. (pass_rtl_unroll_and_peel_loops): Replace declaration with that of... (make_pass_rtl_unroll_and_peel_loops): ...new function. (pass_rtl_doloop): Replace declaration with that of... (make_pass_rtl_doloop): ...new function. (pass_rtl_loop_done): Replace declaration with that of... (make_pass_rtl_loop_done): ...new function. (pass_web): Replace declaration with that of... (make_pass_web): ...new function. (pass_cse2): Replace declaration with that of... (make_pass_cse2): ...new function. (pass_df_initialize_opt): Replace declaration with that of... (make_pass_df_initialize_opt): ...new function. (pass_df_initialize_no_opt): Replace declaration with that of... (make_pass_df_initialize_no_opt): ...new function. (pass_reginfo_init): Replace declaration with that of... (make_pass_reginfo_init): ...new function. (pass_inc_dec): Replace declaration with that of... (make_pass_inc_dec): ...new function. (pass_stack_ptr_mod): Replace declaration with that of... (make_pass_stack_ptr_mod): ...new function. (pass_initialize_regs): Replace declaration with that of... (make_pass_initialize_regs): ...new function. (pass_combine): Replace declaration with that of... (make_pass_combine): ...new function. (pass_if_after_combine): Replace declaration with that of... (make_pass_if_after_combine): ...new function. (pass_ree): Replace declaration with that of... (make_pass_ree): ...new function. (pass_partition_blocks): Replace declaration with that of... (make_pass_partition_blocks): ...new function. (pass_match_asm_constraints): Replace declaration with that of... (make_pass_match_asm_constraints): ...new function. (pass_regmove): Replace declaration with that of... (make_pass_regmove): ...new function. (pass_split_all_insns): Replace declaration with that of... (make_pass_split_all_insns): ...new function. (pass_fast_rtl_byte_dce): Replace declaration with that of... (make_pass_fast_rtl_byte_dce): ...new function. (pass_lower_subreg2): Replace declaration with that of... (make_pass_lower_subreg2): ...new function. (pass_mode_switching): Replace declaration with that of... (make_pass_mode_switching): ...new function. (pass_sms): Replace declaration with that of... (make_pass_sms): ...new function. (pass_sched): Replace declaration with that of... (make_pass_sched): ...new function. (pass_ira): Replace declaration with that of... (make_pass_ira): ...new function. (pass_reload): Replace declaration with that of... (make_pass_reload): ...new function. (pass_clean_state): Replace declaration with that of... (make_pass_clean_state): ...new function. (pass_branch_prob): Replace declaration with that of... (make_pass_branch_prob): ...new function. (pass_value_profile_transformations): Replace declaration with that of... (make_pass_value_profile_transformations): ...new function. (pass_postreload_cse): Replace declaration with that of... (make_pass_postreload_cse): ...new function. (pass_gcse2): Replace declaration with that of... (make_pass_gcse2): ...new function. (pass_split_after_reload): Replace declaration with that of... (make_pass_split_after_reload): ...new function. (pass_branch_target_load_optimize1): Replace declaration with that of... (make_pass_branch_target_load_optimize1): ...new function. (pass_thread_prologue_and_epilogue): Replace declaration with that of... (make_pass_thread_prologue_and_epilogue): ...new function. (pass_stack_adjustments): Replace declaration with that of... (make_pass_stack_adjustments): ...new function. (pass_peephole2): Replace declaration with that of... (make_pass_peephole2): ...new function. (pass_if_after_reload): Replace declaration with that of... (make_pass_if_after_reload): ...new function. (pass_regrename): Replace declaration with that of... (make_pass_regrename): ...new function. (pass_cprop_hardreg): Replace declaration with that of... (make_pass_cprop_hardreg): ...new function. (pass_reorder_blocks): Replace declaration with that of... (make_pass_reorder_blocks): ...new function. (pass_branch_target_load_optimize2): Replace declaration with that of... (make_pass_branch_target_load_optimize2): ...new function. (pass_leaf_regs): Replace declaration with that of... (make_pass_leaf_regs): ...new function. (pass_split_before_sched2): Replace declaration with that of... (make_pass_split_before_sched2): ...new function. (pass_compare_elim_after_reload): Replace declaration with that of... (make_pass_compare_elim_after_reload): ...new function. (pass_sched2): Replace declaration with that of... (make_pass_sched2): ...new function. (pass_stack_regs): Replace declaration with that of... (make_pass_stack_regs): ...new function. (pass_stack_regs_run): Replace declaration with that of... (make_pass_stack_regs_run): ...new function. (pass_df_finish): Replace declaration with that of... (make_pass_df_finish): ...new function. (pass_compute_alignments): Replace declaration with that of... (make_pass_compute_alignments): ...new function. (pass_duplicate_computed_gotos): Replace declaration with that of... (make_pass_duplicate_computed_gotos): ...new function. (pass_variable_tracking): Replace declaration with that of... (make_pass_variable_tracking): ...new function. (pass_free_cfg): Replace declaration with that of... (make_pass_free_cfg): ...new function. (pass_machine_reorg): Replace declaration with that of... (make_pass_machine_reorg): ...new function. (pass_cleanup_barriers): Replace declaration with that of... (make_pass_cleanup_barriers): ...new function. (pass_delay_slots): Replace declaration with that of... (make_pass_delay_slots): ...new function. (pass_split_for_shorten_branches): Replace declaration with that of... (make_pass_split_for_shorten_branches): ...new function. (pass_split_before_regstack): Replace declaration with that of... (make_pass_split_before_regstack): ...new function. (pass_convert_to_eh_region_ranges): Replace declaration with that of... (make_pass_convert_to_eh_region_ranges): ...new function. (pass_shorten_branches): Replace declaration with that of... (make_pass_shorten_branches): ...new function. (pass_set_nothrow_function_flags): Replace declaration with that of... (make_pass_set_nothrow_function_flags): ...new function. (pass_dwarf2_frame): Replace declaration with that of... (make_pass_dwarf2_frame): ...new function. (pass_final): Replace declaration with that of... (make_pass_final): ...new function. (pass_rtl_seqabstr): Replace declaration with that of... (make_pass_rtl_seqabstr): ...new function. (pass_release_ssa_names): Replace declaration with that of... (make_pass_release_ssa_names): ...new function. (pass_early_inline): Replace declaration with that of... (make_pass_early_inline): ...new function. (pass_inline_parameters): Replace declaration with that of... (make_pass_inline_parameters): ...new function. (pass_update_address_taken): Replace declaration with that of... (make_pass_update_address_taken): ...new function. (pass_convert_switch): Replace declaration with that of... (make_pass_convert_switch): ...new function. * tree-profile.c (pass_ipa_tree_profile): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_tree_profile): ...new pass_data instance and... (make_pass_ipa_tree_profile): ...new function. * tree-sra.c (pass_sra_early): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_sra_early): ...new pass_data instance and... (make_pass_sra_early): ...new function. (pass_sra): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_sra): ...new pass_data instance and... (make_pass_sra): ...new function. (pass_early_ipa_sra): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_early_ipa_sra): ...new pass_data instance and... (make_pass_early_ipa_sra): ...new function. * tree-ssa-ccp.c (pass_ccp): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_ccp): ...new pass_data instance and... (make_pass_ccp): ...new function. (pass_fold_builtins): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_fold_builtins): ...new pass_data instance and... (make_pass_fold_builtins): ...new function. * tree-ssa-copy.c (pass_copy_prop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_copy_prop): ...new pass_data instance and... (make_pass_copy_prop): ...new function. * tree-ssa-copyrename.c (pass_rename_ssa_copies): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_rename_ssa_copies): ...new pass_data instance and... (make_pass_rename_ssa_copies): ...new function. * tree-ssa-dce.c (pass_dce): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_dce): ...new pass_data instance and... (make_pass_dce): ...new function. (pass_dce_loop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_dce_loop): ...new pass_data instance and... (make_pass_dce_loop): ...new function. (pass_cd_dce): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_cd_dce): ...new pass_data instance and... (make_pass_cd_dce): ...new function. * tree-ssa-dom.c (pass_dominator): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_dominator): ...new pass_data instance and... (make_pass_dominator): ...new function. (pass_phi_only_cprop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_phi_only_cprop): ...new pass_data instance and... (make_pass_phi_only_cprop): ...new function. * tree-ssa-dse.c (pass_dse): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_dse): ...new pass_data instance and... (make_pass_dse): ...new function. * tree-ssa-forwprop.c (pass_forwprop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_forwprop): ...new pass_data instance and... (make_pass_forwprop): ...new function. * tree-ssa-ifcombine.c (pass_tree_ifcombine): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tree_ifcombine): ...new pass_data instance and... (make_pass_tree_ifcombine): ...new function. * tree-ssa-loop-ch.c (pass_ch): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_ch): ...new pass_data instance and... (make_pass_ch): ...new function. * tree-ssa-loop.c (pass_tree_loop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tree_loop): ...new pass_data instance and... (make_pass_tree_loop): ...new function. (pass_tree_loop_init): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tree_loop_init): ...new pass_data instance and... (make_pass_tree_loop_init): ...new function. (pass_lim): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lim): ...new pass_data instance and... (make_pass_lim): ...new function. (pass_tree_unswitch): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tree_unswitch): ...new pass_data instance and... (make_pass_tree_unswitch): ...new function. (pass_predcom): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_predcom): ...new pass_data instance and... (make_pass_predcom): ...new function. (pass_vectorize): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_vectorize): ...new pass_data instance and... (make_pass_vectorize): ...new function. (pass_graphite): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_graphite): ...new pass_data instance and... (make_pass_graphite): ...new function. (pass_graphite_transforms): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_graphite_transforms): ...new pass_data instance and... (make_pass_graphite_transforms): ...new function. (pass_check_data_deps): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_check_data_deps): ...new pass_data instance and... (make_pass_check_data_deps): ...new function. (pass_iv_canon): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_iv_canon): ...new pass_data instance and... (make_pass_iv_canon): ...new function. (pass_scev_cprop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_scev_cprop): ...new pass_data instance and... (make_pass_scev_cprop): ...new function. (pass_record_bounds): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_record_bounds): ...new pass_data instance and... (make_pass_record_bounds): ...new function. (pass_complete_unroll): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_complete_unroll): ...new pass_data instance and... (make_pass_complete_unroll): ...new function. (pass_complete_unrolli): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_complete_unrolli): ...new pass_data instance and... (make_pass_complete_unrolli): ...new function. (pass_parallelize_loops): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_parallelize_loops): ...new pass_data instance and... (make_pass_parallelize_loops): ...new function. (pass_loop_prefetch): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_loop_prefetch): ...new pass_data instance and... (make_pass_loop_prefetch): ...new function. (pass_iv_optimize): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_iv_optimize): ...new pass_data instance and... (make_pass_iv_optimize): ...new function. (pass_tree_loop_done): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tree_loop_done): ...new pass_data instance and... (make_pass_tree_loop_done): ...new function. * tree-ssa-math-opts.c (pass_cse_reciprocals): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_cse_reciprocals): ...new pass_data instance and... (make_pass_cse_reciprocals): ...new function. (pass_cse_sincos): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_cse_sincos): ...new pass_data instance and... (make_pass_cse_sincos): ...new function. (pass_optimize_bswap): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_optimize_bswap): ...new pass_data instance and... (make_pass_optimize_bswap): ...new function. (pass_optimize_widening_mul): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_optimize_widening_mul): ...new pass_data instance and... (make_pass_optimize_widening_mul): ...new function. * tree-ssa-phiopt.c (pass_phiopt): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_phiopt): ...new pass_data instance and... (make_pass_phiopt): ...new function. (pass_cselim): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_cselim): ...new pass_data instance and... (make_pass_cselim): ...new function. * tree-ssa-phiprop.c (pass_phiprop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_phiprop): ...new pass_data instance and... (make_pass_phiprop): ...new function. * tree-ssa-pre.c (pass_pre): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_pre): ...new pass_data instance and... (make_pass_pre): ...new function. (pass_fre): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_fre): ...new pass_data instance and... (make_pass_fre): ...new function. * tree-ssa-reassoc.c (pass_reassoc): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_reassoc): ...new pass_data instance and... (make_pass_reassoc): ...new function. * tree-ssa-sink.c (pass_sink_code): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_sink_code): ...new pass_data instance and... (make_pass_sink_code): ...new function. * tree-ssa-strlen.c (pass_strlen): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_strlen): ...new pass_data instance and... (make_pass_strlen): ...new function. * tree-ssa-structalias.c (pass_build_alias): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_build_alias): ...new pass_data instance and... (make_pass_build_alias): ...new function. (pass_build_ealias): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_build_ealias): ...new pass_data instance and... (make_pass_build_ealias): ...new function. (pass_ipa_pta): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_pta): ...new pass_data instance and... (make_pass_ipa_pta): ...new function. * tree-ssa-uncprop.c (pass_uncprop): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_uncprop): ...new pass_data instance and... (make_pass_uncprop): ...new function. * tree-ssa-uninit.c (pass_late_warn_uninitialized): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_late_warn_uninitialized): ...new pass_data instance and... (make_pass_late_warn_uninitialized): ...new function. * tree-ssa.c (pass_init_datastructures): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_init_datastructures): ...new pass_data instance and... (make_pass_init_datastructures): ...new function. (pass_early_warn_uninitialized): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_early_warn_uninitialized): ...new pass_data instance and... (make_pass_early_warn_uninitialized): ...new function. (pass_update_address_taken): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_update_address_taken): ...new pass_data instance and... (make_pass_update_address_taken): ...new function. * tree-ssanames.c (pass_release_ssa_names): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_release_ssa_names): ...new pass_data instance and... (make_pass_release_ssa_names): ...new function. * tree-stdarg.c (pass_stdarg): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_stdarg): ...new pass_data instance and... (make_pass_stdarg): ...new function. * tree-switch-conversion.c (pass_convert_switch): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_convert_switch): ...new pass_data instance and... (make_pass_convert_switch): ...new function. * tree-tailcall.c (pass_tail_recursion): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tail_recursion): ...new pass_data instance and... (make_pass_tail_recursion): ...new function. (pass_tail_calls): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tail_calls): ...new pass_data instance and... (make_pass_tail_calls): ...new function. * tree-vect-generic.c (pass_lower_vector): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_vector): ...new pass_data instance and... (make_pass_lower_vector): ...new function. (pass_lower_vector_ssa): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_lower_vector_ssa): ...new pass_data instance and... (make_pass_lower_vector_ssa): ...new function. * tree-vectorizer.c (pass_slp_vectorize): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_slp_vectorize): ...new pass_data instance and... (make_pass_slp_vectorize): ...new function. (pass_ipa_increase_alignment): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_increase_alignment): ...new pass_data instance and... (make_pass_ipa_increase_alignment): ...new function. * tree-vrp.c (pass_vrp): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_vrp): ...new pass_data instance and... (make_pass_vrp): ...new function. * tree.c (pass_ipa_free_lang_data): Convert from a global struct to a subclass of simple_ipa_opt_pass along with... (pass_data_ipa_free_lang_data): ...new pass_data instance and... (make_pass_ipa_free_lang_data): ...new function. * tsan.c (pass_tsan): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tsan): ...new pass_data instance and... (make_pass_tsan): ...new function. (pass_tsan_O0): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_tsan_O0): ...new pass_data instance and... (make_pass_tsan_O0): ...new function. * var-tracking.c (pass_variable_tracking): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_variable_tracking): ...new pass_data instance and... (make_pass_variable_tracking): ...new function. * web.c (pass_web): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_web): ...new pass_data instance and... (make_pass_web): ...new function. * config/epiphany/epiphany.h (pass_mode_switch_use): Replace declaration with that of... (make_pass_mode_switch_use): ...new function. (pass_resolve_sw_modes): Replace declaration with that of... (make_pass_resolve_sw_modes): ...new function. * config/epiphany/mode-switch-use.c (pass_mode_switch_use): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_mode_switch_use): ...new pass_data instance and... (make_pass_mode_switch_use): ...new function. * config/epiphany/resolve-sw-modes.c (pass_resolve_sw_modes): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_resolve_sw_modes): ...new pass_data instance and... (make_pass_resolve_sw_modes): ...new function. * config/i386/i386.c (pass_insert_vzeroupper): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_insert_vzeroupper): ...new pass_data instance and... (make_pass_insert_vzeroupper): ...new function. * config/sparc/sparc.c (pass_work_around_errata): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_work_around_errata): ...new pass_data instance and... (make_pass_work_around_errata): ...new function. * config/mips/mips.c (pass_mips_machine_reorg2): Convert from a global struct to a subclass of rtl_opt_pass along with... (pass_data_mips_machine_reorg2): ...new pass_data instance and... (make_pass_mips_machine_reorg2): ...new function. gcc/testsuite/ Patch autogenerated by refactor_passes.py from https://github.com/davidmalcolm/gcc-refactoring-scripts revision 03fe39476a4c4ea450b49e087cfa817b5f92021e * gcc.dg/plugin/one_time_plugin.c (one_pass): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_one_pass): ...new pass_data instance and... (make_one_pass): ...new function. * gcc.dg/plugin/selfassign.c (pass_warn_self_assign): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_warn_self_assign): ...new pass_data instance and... (make_pass_warn_self_assign): ...new function. * g++.dg/plugin/dumb_plugin.c (pass_dumb_plugin_example): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_dumb_plugin_example): ...new pass_data instance and... (make_pass_dumb_plugin_example): ...new function. * g++.dg/plugin/selfassign.c (pass_warn_self_assign): Convert from a global struct to a subclass of gimple_opt_pass along with... (pass_data_warn_self_assign): ...new pass_data instance and... (make_pass_warn_self_assign): ...new function. From-SVN: r201508
2013-08-05 22:16:05 +02:00
} // anon namespace
gimple_opt_pass *
make_pass_object_sizes (gcc::context *ctxt)
{
return new pass_object_sizes (ctxt);
}