diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-12-06 13:47:15 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-12-06 13:47:15 +0100 |
commit | b77856544be1bccf962f5864fb6280b612667905 (patch) | |
tree | b36f60923bc3c922dc157a24313e6e54382bdf74 /gcc/fold-const.c | |
parent | fb7ca5a762a94ab5c7f3d16831b3dc037dfa6619 (diff) | |
download | gcc-b77856544be1bccf962f5864fb6280b612667905.zip gcc-b77856544be1bccf962f5864fb6280b612667905.tar.gz gcc-b77856544be1bccf962f5864fb6280b612667905.tar.bz2 |
re PR middle-end/38422 (union/bitfield causes cc1/cc1plus to run out of memory.)
PR middle-end/38422
* fold-const.c (fold_unary) <CASE_CONVERT>: Don't convert MULT_EXPR
operands to mult_type if it isn't narrower than op0's type.
* gcc.c-torture/execute/pr38422.c: New test.
From-SVN: r142521
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 719b787..8c0cb1d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8351,11 +8351,16 @@ fold_unary (enum tree_code code, tree type, tree op0) mult_type = type; else mult_type = unsigned_type_for (type); - - tem = fold_build2 (MULT_EXPR, mult_type, - fold_convert (mult_type, TREE_OPERAND (op0, 0)), - fold_convert (mult_type, TREE_OPERAND (op0, 1))); - return fold_convert (type, tem); + + if (TYPE_PRECISION (mult_type) < TYPE_PRECISION (TREE_TYPE (op0))) + { + tem = fold_build2 (MULT_EXPR, mult_type, + fold_convert (mult_type, + TREE_OPERAND (op0, 0)), + fold_convert (mult_type, + TREE_OPERAND (op0, 1))); + return fold_convert (type, tem); + } } tem = fold_convert_const (code, type, op0); |