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]

i370 - negative indexes


Hi.

On the i370 port of GCC 3.2.3, I am
getting the following issue.


This code:

C:\scratch\bug>type bug.c
const char *p;

void foo(void)
{
   printf("p-1 is %x\n", p[-1]);
}


generates:

...
L     2,=F'-1'
...
IC    4,0(2,3)

ie it is using a value of x’FFFFFFFF’ in R2 as an index.

This works fine in AM24 and AM31 environments, but
fails for AM64 where an address above 4 GiB is
computed.

Such code is very rare, so I would like to just have
a rule that the index must always be a positive
value, and for negative indexes like the above,
different code is generated to do an actual
subtract instead of trying to do everything via
the index.

Any idea how to achieve that? I can't see
anywhere in i370.md where I can put some
sort of constraint.

Note that I am producing 32-bit modules, but
setting them to AM64 so that they can use
the full 4 GiB on certain environments (like
MVS/380), instead of having a 2 GiB limit.

Thanks. Paul.


---
This email has been checked for viruses by AVG.
http://www.avg.com


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