r236041 - in /trunk/gcc: ChangeLog cfgexpand.c

rsandifo@gcc.gnu.org rsandifo@gcc.gnu.org
Mon May 9 15:30:00 GMT 2016


Author: rsandifo
Date: Mon May  9 15:30:32 2016
New Revision: 236041

URL: https://gcc.gnu.org/viewcvs?rev=236041&root=gcc&view=rev
Log:
Fix handling of negative bitpos in expand_debug_expr

expand_debug_expr handled negative bit positions using:

                else if (bitpos < 0)
                  {
                    HOST_WIDE_INT units
                      = (-bitpos + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
                    op0 = adjust_address_nv (op0, mode1, units);
                    bitpos += units * BITS_PER_UNIT;
                  }

Here "units" is the negative of the (negative) byte offset, so I think
we should be offsetting OP0 by -units instead.  E.g. a bitpos of -17
would give units==3, so this code would move OP0 up by 3 bytes and set
bitpos to 7, giving a total bitpos of 31.

Just noticed by inspection.  An assert triggered for:

        gcc.target/i386/mpx/bitfields-1-lbv.c
        gcc.target/i386/mpx/field-addr-7-lbv.c
        gcc.target/i386/mpx/reference-3-lbv.cpp
        gcc.target/i386/mpx/reference-4-lbv.cpp

at -m32 but otherwise this case doesn't seem to trigger during a
bootstrap and regtest.

Tested on x86_64-linux-gnu.

gcc/
	* cfgexpand.c (expand_debug_expr): Fix address offset for negative
	bitpos.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c



More information about the Gcc-cvs mailing list