diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2012-08-08 17:59:47 +0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2012-08-08 18:02:07 +0800 |
commit | 0b76eed807691ef39e9c7e37d662dd4a9362f412 (patch) | |
tree | 61bf5f96237a233b75a5a18b98b7a68ad9d18275 /gcc-4.6 | |
parent | 57cfd7a03820d1241333e059feda0ab04829f575 (diff) | |
download | toolchain_gcc-0b76eed807691ef39e9c7e37d662dd4a9362f412.tar.gz toolchain_gcc-0b76eed807691ef39e9c7e37d662dd4a9362f412.tar.bz2 toolchain_gcc-0b76eed807691ef39e9c7e37d662dd4a9362f412.zip |
Backport fix to bug 50380: cc1 hangs eating 100% CPU
This seems to affect MIPS GCC 4.6 only
Change-Id: Idb1cf411396d909a40e1b6fcbfb5729879b6cf59
Related:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50380
http://gcc.gnu.org/viewcvs/trunk/gcc/cse.c?r1=177852&r2=182498&pathrev=182498
Diffstat (limited to 'gcc-4.6')
-rw-r--r-- | gcc-4.6/gcc/cse.c | 6 | ||||
-rw-r--r-- | gcc-4.6/gcc/testsuite/gcc.c-torture/compile/pr50380.c | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc-4.6/gcc/cse.c b/gcc-4.6/gcc/cse.c index 078977fbc..760911424 100644 --- a/gcc-4.6/gcc/cse.c +++ b/gcc-4.6/gcc/cse.c @@ -3054,6 +3054,12 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2, if (! exp_equiv_p (p->exp, p->exp, 1, false)) continue; + /* If it's the same comparison we're already looking at, skip it. */ + if (COMPARISON_P (p->exp) + && XEXP (p->exp, 0) == arg1 + && XEXP (p->exp, 1) == arg2) + continue; + if (GET_CODE (p->exp) == COMPARE /* Another possibility is that this machine has a compare insn that includes the comparison code. In that case, ARG1 would diff --git a/gcc-4.6/gcc/testsuite/gcc.c-torture/compile/pr50380.c b/gcc-4.6/gcc/testsuite/gcc.c-torture/compile/pr50380.c new file mode 100644 index 000000000..ffd044263 --- /dev/null +++ b/gcc-4.6/gcc/testsuite/gcc.c-torture/compile/pr50380.c @@ -0,0 +1,12 @@ +/* This test used to get stuck in an infinite loop in find_comparison_args + when compiling for MIPS at -O2. */ + +__attribute__ ((__noreturn__)) extern void fail (void); + +char x; + +void foo (const unsigned char y) +{ + ((void) (__builtin_expect((!! y == y), 1) ? 0 : (fail (), 0))); + x = ! y; +} |