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: [PATCH] Fix postreload constant merging (PR target/84899)


On 03/16/2018 02:17 PM, Jakub Jelinek wrote:
> Hi!
> 
> The following testcase ICEs on powerpc-linux, because we merge
> SImode constants 0x7fffffff and 1 into 0x80000000, which is not valid SImode
> CONST_INT - -0x80000000 is.  Fixed by calling trunc_int_for_mode, and to
> avoid UB in the compiler do the addition in unsigned type.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux and tested on the
> testcase with powerpc64-linux cross with -m32, ok for trunk?
> 
> 2018-03-16  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/84899
> 	* postreload.c (reload_combine_recognize_pattern): Perform
> 	INTVAL addition in unsigned HOST_WIDE_INT type to avoid UB and
> 	truncate_int_for_mode the result for the destination's mode.
> 
> 	* gcc.dg/pr84899.c: New test.
OK.
jeff


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