re PR middle-end/21085 (Virtual memory exhausted with g++)

2005-04-18  James A. Morrison  <phython@gcc.gnu.org>

        PR tree-optimization/21085
        * fold-const (fold_binary): Don't change X % -C to X % C if C has
        overflowed.

From-SVN: r98365
This commit is contained in:
James A. Morrison 2005-04-19 02:36:04 +00:00
parent f4d7734c57
commit a3885f5477
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-04-18 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/21085
* fold-const (fold_binary): Don't change X % -C to X % C if C has
overflowed.
2005-04-19 Ben Elliston <bje@au.ibm.com>
* doc/invoke.texi (Optimize Options): Refer to the correct

View File

@ -8504,6 +8504,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
if (code == TRUNC_MOD_EXPR
&& !TYPE_UNSIGNED (type)
&& TREE_CODE (arg1) == INTEGER_CST
&& !TREE_CONSTANT_OVERFLOW (arg1)
&& TREE_INT_CST_HIGH (arg1) < 0
&& !flag_trapv
/* Avoid this transformation if C is INT_MIN, i.e. C == -C. */

View File

@ -1,3 +1,7 @@
2005-04-18 James A. Morrison <phython@gcc.gnu.org>
* gcc.dg/pr21085.c: New test.
2005-04-18 Richard Sandiford <rsandifo@redhat.com>
* gcc.target/mips/mips.exp: Minor formatting. Call setup_mips_tests.

View File

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* This used to cause excessive use, or a stack overflow, depending on which
came first. */
void foo (void)
{
int maxstringlen = 1;
int limit = 0, maxblock = 0, maxblockrem = 0;
maxblockrem = (maxstringlen) % (2147483647 + 1); /* { dg-warning "overflow" } */
}