Re: negative indexes

2021-03-14 Thread Richard Biener via Gcc
On March 14, 2021 6:55:32 AM GMT+01:00, Paul Edwards via Gcc wrote: >If I have code like this: > >char foo(char *p) >{ >return (p[-1]); >} > >It generates a negative index, like this: > >* Function foo code > L 2,=F'-1' > L 3,0(11) > SLR 15,15 > IC

Re: negative indexes

2021-03-14 Thread Paul Edwards via Gcc
Hi Richard. Thanks for your reply, but if I understand you correctly, you are saying this fix is for situations where the size of an integer is different from the size of a pointer? That is not my issue. The size is the same. Absolutely everything is 32-bits in the program (long, int, char *, voi

Re: negative indexes

2021-03-14 Thread Paul Edwards via Gcc
Basically the rule (which can be configurable if different machines behave differently) should be (for pure 32-bit code generation): 1. If your machine treats indexes as signed values: a) If the requested index is between -2 GiB and + 2 GiB, fine, do it. b) If the requested index is greater th

Re: negative indexes

2021-03-14 Thread Richard Biener via Gcc
On March 14, 2021 9:12:01 AM GMT+01:00, Paul Edwards wrote: >Hi Richard. Thanks for your reply, but if I understand >you correctly, you are saying this fix is for situations >where the size of an integer is different from the size >of a pointer? > >That is not my issue. The size is the same. Abso

gcc-11-20210314 is now available

2021-03-14 Thread GCC Administrator via Gcc
Snapshot gcc-11-20210314 is now available on https://gcc.gnu.org/pub/gcc/snapshots/11-20210314/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 11 git branch with the following options: git://gcc.gnu.org/git/gcc.git branch