Bug 34641 - [4.3 Regression] ICE in reload_cse_simplify_operands, at postreload.c:395
Summary: [4.3 Regression] ICE in reload_cse_simplify_operands, at postreload.c:395
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 34642 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-01-02 16:11 UTC by Richard Biener
Modified: 2008-05-26 19:25 UTC (History)
4 users (show)

See Also:
Host:
Target: s390-*-*, s390x-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-01-07 17:28:30


Attachments
testcase (208.37 KB, application/octet-stream)
2008-01-02 16:14 UTC, Richard Biener
Details
reduced testcase (1.24 KB, text/plain)
2008-01-03 09:52 UTC, Richard Biener
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2008-01-02 16:11:28 UTC
./cc1plus -fpreprocessed TextIterator.ii -quiet -march=z900 -m64 -O2 -version -fPIC -o /dev/null -w
GNU C++ (GCC) version 4.3.0 20080102 (experimental) (s390-linux-gnu)
        compiled by GNU C version 4.2.2 (SUSE Linux), GMP version 4.2.1, MPFR version 2.2.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 31c8074c01f903f38601f94b219eb8f8
../../WebCore/editing/TextIterator.cpp: In function 'UChar* WebCore::plainTextToMallocAllocatedBuffer(const WebCore::Range*, unsigned int&)':
../../WebCore/editing/TextIterator.cpp:1316: error: insn does not satisfy its constraints:
(insn 710 711 157 26 ../../JavaScriptCore/wtf/Vector.h:251 (set (reg:DI 3 %r3)
        (const_int 3148725999 [0xbbadbeef])) 50 {*movdi_64} (nil))
../../WebCore/editing/TextIterator.cpp:1316: internal compiler error: in reload_cse_simplify_operands, at postreload.c:395
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Richard Biener 2008-01-02 16:14:25 UTC
Created attachment 14854 [details]
testcase

Reducing...
Comment 2 Richard Biener 2008-01-02 16:20:04 UTC
Creative way of aborting the program on allocation failure might be the
cause:

    template<typename T>
    class VectorBufferBase {
    public:
        void allocateBuffer(size_t newCapacity)
        {
            ((void)0);
            m_capacity = newCapacity;
            if (newCapacity > std::numeric_limits<size_t>::max() / sizeof(T))
                *(int *)(uintptr_t)0xbbadbeef = 0;
            m_buffer = static_cast<T*>(fastMalloc(newCapacity * sizeof(T)));
        }

but a C testcase extracted from this part doesn't ICE.  Auto-reducing still
running.
Comment 3 Richard Biener 2008-01-02 16:28:16 UTC
*** Bug 34642 has been marked as a duplicate of this bug. ***
Comment 4 Richard Biener 2008-01-03 09:52:26 UTC
Created attachment 14865 [details]
reduced testcase
Comment 5 Andreas Krebbel 2008-01-07 17:28:30 UTC
The (const_int 3148725999 [0xbbadbeef]) is accepted by legitimate_constant_p since it is expected to end up in the literal pool.  But in this case the constant becomes part of a REG_EQUIV note of an insn moving the constant into a pseudo register. 

Generating a reload for a later insn using the pseudo as memory base register the REG_EQUIV note is used by push_reload to replace the pseudo directly with the constant.  The emitted move insn can't be recognized since none of the constraints of the move pattern accepts the large constant.

I think push_reload has to make sure that the move pattern to be emitted is able to deal with the constant taken from the reg_equiv_constant array.
Comment 6 Andreas Krebbel 2008-01-10 16:47:13 UTC
Subject: Bug 34641

Author: krebbel
Date: Thu Jan 10 16:46:26 2008
New Revision: 131445

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131445
Log:
2008-01-10  Andreas Krebbel  <krebbel1@de.ibm.com>

	PR middle-end/34641
	* reload.c (push_reload): Add assertions.  All constants from
	reg_equiv_constant should have been used for replacing the respective
	pseudo earlier.
	(find_reloads_address): Invoke find_reloads_address_part for
	constant taken from the reg_equiv_constant array.

2008-01-10  Andreas Krebbel  <krebbel1@de.ibm.com>

	PR middle-end/34641
	* g++.dg/torture/pr34641.C: New testcase.


Added:
    trunk/gcc/testsuite/g++.dg/torture/pr34641.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/reload.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 İsmail Dönmez 2008-01-11 02:31:44 UTC
Added testcase doesn't compile on i686-linux :

gcc/testsuite/g++.dg/torture/pr34641.C:16: error: 'operator new' takes type 'size_t' ('unsigned int') as first parameter

Comment 8 Andreas Krebbel 2008-01-11 09:03:41 UTC
Fixed with:
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00460.html