This is the mail archive of the gcc@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: c/8023 -- bit_field_ref question


There seems to be a problem with bit_field_refs on big-endian machines.
This code is miscompiled on hppa64-hp-hpux11.00:

      if ((specbits & 1 << (int) RID_LONG)
	  && (specbits & 1 << (int) RID_SHORT))
	error ("both long and short specified for `%s'", name);

The tree for this if has

        arg 0 <bit_field_ref 800003ffefa284c0 type <integer_type 800003ffefebb948 unsigned int>
	    unsigned arg 0 <var_decl 800003ffefa9e510 specbits>
	    arg 1 <integer_cst 800003ffefea7580 constant 32>
	    arg 2 <integer_cst 800003ffefea7380 constant 0>>
	arg 1 <integer_cst 800003ffefa28500 constant 132>>

As can be seen, arg0 is a 32 bit field at position 0 of specbits.  However,
specbits is associated with reg/v:DI 74 and we end up with the following
rtl

(insn 884 883 885 0000000000000000 (set (reg:SI 327)
        (and:SI (subreg:SI (reg/v:DI 74) 0)
	    (reg:SI 328))) -1 (nil)
    (nil))

The subreg offset is incorrect for big-endian.

I think the problem is in the rtl generation but I am not entirely
sure.  Pointers to where this should be happening would be appreciated.

Dave
--
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


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