Commit 5dfa45d0 by Jakub Jelinek Committed by Jakub Jelinek

configure.in (--enable-checking): Add fold category.

	* configure.in (--enable-checking): Add fold category.
	(ENABLE_FOLD_CHECKING): Define if requested.
	* configure: Rebuilt.
	* config.in: Rebuilt.
	* doc/install.texi: Document it.
	* fold-const.c: Include md5.h.
	[ENABLE_FOLD_CHECKING] (fold): Define to fold_1.
	[ENABLE_FOLD_CHECKING] (fold, fold_checksum_tree, fold_check_failed,
	print_fold_checksum): New functions.

	* fold-const.c (fold): Never modify argument passed to fold, instead
	change a copy and return it.
	* convert.c (convert_to_integer): Likewise.
testsuite/
	* gcc.c-torture/compile/20030725-1.c: New test.

From-SVN: r69886
parent 66584e64
2003-07-28 Jakub Jelinek <jakub@redhat.com>
* configure.in (--enable-checking): Add fold category.
(ENABLE_FOLD_CHECKING): Define if requested.
* configure: Rebuilt.
* config.in: Rebuilt.
* doc/install.texi: Document it.
* fold-const.c: Include md5.h.
[ENABLE_FOLD_CHECKING] (fold): Define to fold_1.
[ENABLE_FOLD_CHECKING] (fold, fold_checksum_tree, fold_check_failed,
print_fold_checksum): New functions.
* fold-const.c (fold): Never modify argument passed to fold, instead
change a copy and return it.
* convert.c (convert_to_integer): Likewise.
2003-07-27 Nathanael Nerode <neroden@gcc.gnu.org> 2003-07-27 Nathanael Nerode <neroden@gcc.gnu.org>
* fixinc/fixinc.svr4: Remove dead code. Remove now-unnecessary * fixinc/fixinc.svr4: Remove dead code. Remove now-unnecessary
......
/* config.in. Generated automatically from configure.in by autoheader 2.13. */ /* config.in. Generated automatically from configure.in by autoheader. */
/* Define to the type of elements in the array set by `getgroups'. /* Define to the type of elements in the array set by `getgroups'.
Usually this is either `int' or `gid_t'. */ Usually this is either `int' or `gid_t'. */
...@@ -236,6 +236,10 @@ ...@@ -236,6 +236,10 @@
every opportunity. This is extremely expensive. */ every opportunity. This is extremely expensive. */
#undef ENABLE_GC_ALWAYS_COLLECT #undef ENABLE_GC_ALWAYS_COLLECT
/* Define if you want fold checked that it never destructs its argument.
This is quite expensive. */
#undef ENABLE_FOLD_CHECKING
/* Define if you want to run subprograms and generated programs /* Define if you want to run subprograms and generated programs
through valgrind (a memory checker). This is extremely expensive. */ through valgrind (a memory checker). This is extremely expensive. */
#undef ENABLE_VALGRIND_CHECKING #undef ENABLE_VALGRIND_CHECKING
......
...@@ -34,7 +34,7 @@ ac_help="$ac_help ...@@ -34,7 +34,7 @@ ac_help="$ac_help
--enable-checking[=LIST] --enable-checking[=LIST]
enable expensive run-time checks. With LIST, enable expensive run-time checks. With LIST,
enable only specific categories of checks. enable only specific categories of checks.
Categories are: misc,tree,rtl,rtlflag,gc,gcac; Categories are: misc,tree,rtl,rtlflag,gc,gcac,fold;
default is misc,tree,gc,rtlflag" default is misc,tree,gc,rtlflag"
ac_help="$ac_help ac_help="$ac_help
--enable-coverage[=LEVEL] --enable-coverage[=LEVEL]
...@@ -1933,6 +1933,7 @@ ac_rtl_checking= ...@@ -1933,6 +1933,7 @@ ac_rtl_checking=
ac_rtlflag_checking= ac_rtlflag_checking=
ac_gc_checking= ac_gc_checking=
ac_gc_always_collect= ac_gc_always_collect=
ac_fold_checking=
case "${enableval}" in case "${enableval}" in
yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ; yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;
ac_rtlflag_checking=1 ;; ac_rtlflag_checking=1 ;;
...@@ -1949,6 +1950,7 @@ no) ;; ...@@ -1949,6 +1950,7 @@ no) ;;
rtl) ac_rtl_checking=1 ;; rtl) ac_rtl_checking=1 ;;
gc) ac_gc_checking=1 ;; gc) ac_gc_checking=1 ;;
gcac) ac_gc_always_collect=1 ;; gcac) ac_gc_always_collect=1 ;;
fold) ac_fold_checking=1 ;;
valgrind) ac_checking_valgrind=1 ;; valgrind) ac_checking_valgrind=1 ;;
*) { echo "configure: error: unknown check category $check" 1>&2; exit 1; } ;; *) { echo "configure: error: unknown check category $check" 1>&2; exit 1; } ;;
esac esac
...@@ -2000,6 +2002,12 @@ if test x$ac_gc_always_collect != x ; then ...@@ -2000,6 +2002,12 @@ if test x$ac_gc_always_collect != x ; then
EOF EOF
fi fi
if test x$ac_fold_checking != x ; then
cat >> confdefs.h <<\EOF
#define ENABLE_FOLD_CHECKING 1
EOF
fi
valgrind_path_defines= valgrind_path_defines=
valgrind_command= valgrind_command=
if test x$ac_checking_valgrind != x ; then if test x$ac_checking_valgrind != x ; then
......
...@@ -318,7 +318,7 @@ AC_ARG_ENABLE(checking, ...@@ -318,7 +318,7 @@ AC_ARG_ENABLE(checking,
[ --enable-checking[=LIST] [ --enable-checking[=LIST]
enable expensive run-time checks. With LIST, enable expensive run-time checks. With LIST,
enable only specific categories of checks. enable only specific categories of checks.
Categories are: misc,tree,rtl,rtlflag,gc,gcac; Categories are: misc,tree,rtl,rtlflag,gc,gcac,fold;
default is misc,tree,gc,rtlflag], default is misc,tree,gc,rtlflag],
[ac_checking= [ac_checking=
ac_tree_checking= ac_tree_checking=
...@@ -326,6 +326,7 @@ ac_rtl_checking= ...@@ -326,6 +326,7 @@ ac_rtl_checking=
ac_rtlflag_checking= ac_rtlflag_checking=
ac_gc_checking= ac_gc_checking=
ac_gc_always_collect= ac_gc_always_collect=
ac_fold_checking=
case "${enableval}" in case "${enableval}" in
yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ; yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ;
ac_rtlflag_checking=1 ;; ac_rtlflag_checking=1 ;;
...@@ -342,6 +343,7 @@ no) ;; ...@@ -342,6 +343,7 @@ no) ;;
rtl) ac_rtl_checking=1 ;; rtl) ac_rtl_checking=1 ;;
gc) ac_gc_checking=1 ;; gc) ac_gc_checking=1 ;;
gcac) ac_gc_always_collect=1 ;; gcac) ac_gc_always_collect=1 ;;
fold) ac_fold_checking=1 ;;
valgrind) ac_checking_valgrind=1 ;; valgrind) ac_checking_valgrind=1 ;;
*) AC_MSG_ERROR(unknown check category $check) ;; *) AC_MSG_ERROR(unknown check category $check) ;;
esac esac
...@@ -388,6 +390,11 @@ if test x$ac_gc_always_collect != x ; then ...@@ -388,6 +390,11 @@ if test x$ac_gc_always_collect != x ; then
paranoid mode, validating the entire heap and collecting garbage at paranoid mode, validating the entire heap and collecting garbage at
every opportunity. This is extremely expensive.]) every opportunity. This is extremely expensive.])
fi fi
if test x$ac_fold_checking != x ; then
AC_DEFINE(ENABLE_FOLD_CHECKING, 1,
[Define if you want fold checked that it never destructs its argument.
This is quite expensive.])
fi
valgrind_path_defines= valgrind_path_defines=
valgrind_command= valgrind_command=
if test x$ac_checking_valgrind != x ; then if test x$ac_checking_valgrind != x ; then
......
...@@ -320,6 +320,7 @@ convert_to_integer (tree type, tree expr) ...@@ -320,6 +320,7 @@ convert_to_integer (tree type, tree expr)
if (TREE_CODE_CLASS (ex_form) == '<') if (TREE_CODE_CLASS (ex_form) == '<')
{ {
expr = copy_node (expr);
TREE_TYPE (expr) = type; TREE_TYPE (expr) = type;
return expr; return expr;
} }
...@@ -328,6 +329,7 @@ convert_to_integer (tree type, tree expr) ...@@ -328,6 +329,7 @@ convert_to_integer (tree type, tree expr)
|| ex_form == TRUTH_OR_EXPR || ex_form == TRUTH_ORIF_EXPR || ex_form == TRUTH_OR_EXPR || ex_form == TRUTH_ORIF_EXPR
|| ex_form == TRUTH_XOR_EXPR) || ex_form == TRUTH_XOR_EXPR)
{ {
expr = copy_node (expr);
TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0)); TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0));
TREE_OPERAND (expr, 1) = convert (type, TREE_OPERAND (expr, 1)); TREE_OPERAND (expr, 1) = convert (type, TREE_OPERAND (expr, 1));
TREE_TYPE (expr) = type; TREE_TYPE (expr) = type;
...@@ -336,6 +338,7 @@ convert_to_integer (tree type, tree expr) ...@@ -336,6 +338,7 @@ convert_to_integer (tree type, tree expr)
else if (ex_form == TRUTH_NOT_EXPR) else if (ex_form == TRUTH_NOT_EXPR)
{ {
expr = copy_node (expr);
TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0)); TREE_OPERAND (expr, 0) = convert (type, TREE_OPERAND (expr, 0));
TREE_TYPE (expr) = type; TREE_TYPE (expr) = type;
return expr; return expr;
......
...@@ -1038,8 +1038,8 @@ with GCC@. This is on by default when building from CVS or snapshots, ...@@ -1038,8 +1038,8 @@ with GCC@. This is on by default when building from CVS or snapshots,
but off for releases. More control over the checks may be had by but off for releases. More control over the checks may be had by
specifying @var{list}; the categories of checks available are specifying @var{list}; the categories of checks available are
@samp{misc}, @samp{tree}, @samp{gc}, @samp{rtl}, @samp{rtlflag}, @samp{misc}, @samp{tree}, @samp{gc}, @samp{rtl}, @samp{rtlflag},
@samp{gcac} and @samp{valgrind}. The check @samp{valgrind} requires the @samp{fold}, @samp{gcac} and @samp{valgrind}. The check @samp{valgrind}
external @command{valgrind} simulator, available from requires the external @command{valgrind} simulator, available from
@uref{http://developer.kde.org/~sewardj/}. The default when @var{list} is @uref{http://developer.kde.org/~sewardj/}. The default when @var{list} is
not specified is @samp{misc,tree,gc,rtlflag}; the checks @samp{rtl}, not specified is @samp{misc,tree,gc,rtlflag}; the checks @samp{rtl},
@samp{gcac} and @samp{valgrind} are very expensive. @samp{gcac} and @samp{valgrind} are very expensive.
......
2003-07-28 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20030725-1.c: New test.
2003-07-28 Aldy Hernandez <aldyh@redhat.com> 2003-07-28 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/20030505.c: Only run for SPE. * gcc.dg/20030505.c: Only run for SPE.
......
/* This testcase caused ICE on any 64-bit arch at -O2/-O3 due to
fold/extract_muldiv/convert destroying its argument. */
int x, *y, z, *p;
void
foo (void)
{
p = y + (8 * (x == 1 || x == 3) + z);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment