From 38769add25b9fb5b4d60e98c60ab2d6fb8bf0854 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Wed, 1 Mar 2000 00:54:49 +0000 Subject: [PATCH] fold-const.c (size_binop): Don't asert inputs are the same and have TYPE_IS_SIZETYPE set. * fold-const.c (size_binop): Don't asert inputs are the same and have TYPE_IS_SIZETYPE set. (size_diffop): Likewise. From-SVN: r32273 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 8 ++++---- gcc/testsuite/g++.old-deja/g++.other/crash13.C | 11 +++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/crash13.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a325ef40e13..c65598e2214 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-02-29 Mark Mitchell + + * fold-const.c (size_binop): Don't asert inputs are the same and + have TYPE_IS_SIZETYPE set. + (size_diffop): Likewise. + 2000-02-29 Jason Merrill * dwarfout.c (output_block): Output abstract blocks even if they diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 24bf6f1af4a..097650f46ec 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1868,8 +1868,8 @@ size_binop (code, arg0, arg1) { tree type = TREE_TYPE (arg0); - if (type != TREE_TYPE (arg1) - || TREE_CODE (type) != INTEGER_TYPE || ! TYPE_IS_SIZETYPE (type)) + if (TREE_CODE (type) != INTEGER_TYPE + || TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE) abort (); /* Handle the special case of two integer constants faster. */ @@ -1905,8 +1905,8 @@ size_diffop (arg0, arg1) tree type = TREE_TYPE (arg0); tree ctype; - if (TREE_TYPE (arg1) != type || TREE_CODE (type) != INTEGER_TYPE - || ! TYPE_IS_SIZETYPE (type)) + if (TREE_CODE (type) != INTEGER_TYPE + || TREE_CODE (TREE_TYPE (arg1)) != INTEGER_TYPE) abort (); /* If the type is already signed, just do the simple thing. */ diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash13.C b/gcc/testsuite/g++.old-deja/g++.other/crash13.C new file mode 100644 index 00000000000..7593f4315ab --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/crash13.C @@ -0,0 +1,11 @@ +struct Base_bitset { + unsigned M_w[2]; + void M_do_right_shift(); +}; + + +void Base_bitset::M_do_right_shift () +{ + unsigned n = 0; + M_w[0] = M_w[n + 1] ; +} -- 2.30.2