This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [3.4 PATCH] Fix ICE in store_field


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]