This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [3.4 PATCH] Fix ICE in store_field
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: 27 Oct 2005 19:57:53 +0200
- Subject: Re: [3.4 PATCH] Fix ICE in store_field
- References: <200510271449.j9REngdl003276@53v30g15.boeblingen.de.ibm.com>
Ulrich Weigand <uweigand@de.ibm.com> writes:
| Hello,
|
| we've noticed a problem in the old 3.x increment queue handling.
|
| The following code ICEs on s390 (and presumably all platforms
| where CONST_INTs are not accepted by CONSTANT_ADDRESS_P):
|
| struct test { unsigned int x; };
| return ++((struct test *) 0)->x;
|
| This function, while obviously invoking undefined behaviour when
| executed, is still valid C code as far as I can see, and shouldn't
| cause an ICE. (This is extracted from real-world source code,
| resulting from debug assertion-checking macros -- in the actual
| scenario, it is guaranteed that the code can never be executed ...)
|
| The reason for the ICE is that store_field thinks it needs to copy
| the pre-increment address (i.e. const_int 0) to a register, and
| tries to do so with copy_to_reg. This ICEs because the mode is
| VOIDmode. The following patch fixes this by using the function
| copy_to_addr_reg instead.
|
| Note that on GCC 4.x this problem no longer exists as the whole
| increment queue handling was removed.
|
| Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux
| on the 3.4 branch. OK for the branch?
Have this double-checked with RTH and install it if it is OK -- I'm
not familiar with that part of the compiler.
-- Gaby