Re: [PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-25 Thread Chet Ramey
On 4/19/21 11:09 AM, konsolebox wrote: Attached patch demonstrates a solution that solves the current issues of unset discussed in https://lists.gnu.org/archive/html/bug-bash/2021-03/msg00056.html while avoiding breakage of scripts and keeping the expansion of subscripts consistent with

Re: [PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread konsolebox
On Tue, Apr 20, 2021 at 9:35 AM Koichi Murase wrote: > In addition, you need to change `1 << 31' to `1u << 31'. The literal > `1' has the type `(signed) int'. One needs to use `1u'---the literal > of the type `unsigned int'. I see, but I think I'll just skip that as I would also have to modify

Re: [PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread Koichi Murase
2021年4月20日(火) 9:14 konsolebox : > On Tue, Apr 20, 2021 at 2:08 AM Koichi Murase wrote: > > AFAIK `1 << 31' causes undefined behavior when int is 32-bit signed > > integer. Instead, I think you may write `(int)(1u << 31)' for > > conforming C compilers. `u << 31' is defined for unsigned integers,

Re: [PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread konsolebox
On Tue, Apr 20, 2021 at 2:08 AM Koichi Murase wrote: > AFAIK `1 << 31' causes undefined behavior when int is 32-bit signed > integer. Instead, I think you may write `(int)(1u << 31)' for > conforming C compilers. `u << 31' is defined for unsigned integers, > and the conversion between signed and

Re: [PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread Koichi Murase
2021年4月20日(火) 0:16 konsolebox : > Attached patch demonstrates a solution that solves the current issues > of unset discussed in > https://lists.gnu.org/archive/html/bug-bash/2021-03/msg00056.html > while avoiding breakage of scripts and keeping the expansion of > subscripts consistent with

[PATCH] Skip initial expansion of valid array reference tokens in unset

2021-04-19 Thread konsolebox
Attached patch demonstrates a solution that solves the current issues of unset discussed in https://lists.gnu.org/archive/html/bug-bash/2021-03/msg00056.html while avoiding breakage of scripts and keeping the expansion of subscripts consistent with expansion in references. The patched code is