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 expansion ICE on stores into parts of hard registers (PR middle-end/80173)


On 03/30/2017 02:38 PM, Jakub Jelinek wrote:
Hi!

On some arches like x86_64 we allow some aggregates in named register
variables.  If those registers are wider than word, store_bit_field_1
was assuming it must be multiple registers and attempted to pick
a word sized subregister of it, which is fine for pseudos, but if the
destination is a hard register, sometimes such subreg will fail.
If it is a hard register and we know that its mode means a single
register (otherwise we wouldn't allow creating a named register variable for
it), then that subreg is certainly counter-productive, we just want to store
into the whole register.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2017-03-30  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/80173
	* expmed.c (store_bit_field_1): Don't attempt to create
	a word subreg out of hard registers wider than word if they
	have HARD_REGNO_NREGS of 1 for their mode.

	* gcc.target/i386/pr80173.c: New test.
I could easily argue that we shouldn't ever create subregs of hardregs. They should either be rejected or simplified into normal reg expressions. There's been many bugs in the past due to these kinds of problems.

This patch clearly fits that general guidance.

OK for the trunk and any release branches where you want to backport it.

jeff


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