Re: Problems in array access

2021-08-31 Thread Utkarsh Singh via Gcc
On 2021-08-31, 09:08 -0600, Martin Sebor wrote: > To refine Jonathan's answer: In cases where the index is constant > like this one the warning could be issued even with no optimization. > That it isn't is the result of the choice to depend on optimizations > unconditionally. It's worth revisiti

PING: [RFC] Whole Program Devirtualization

2021-08-31 Thread Feng Xue OS via Gcc
Honza, How do you think about proposal in this RFC? Thanks a lot. Best Regards, Feng From: Martin Liška Sent: Friday, August 20, 2021 9:45 PM To: Feng Xue OS; gcc@gcc.gnu.org Cc: JiangNing OS; Jan Hubicka Subject: Re: [RFC] Whole Program Devirtualizatio

Re: Problems in array access

2021-08-31 Thread Martin Sebor via Gcc
On 8/31/21 2:39 AM, Utkarsh Singh via Gcc wrote: On 2021-08-31, 09:28 +0100, Jonathan Wakely wrote: On Tue, 31 Aug 2021 at 09:11, Utkarsh Singh wrote: Hello GCC mailing list, In one of my friend's C programming class, they asked him a question on the topic of array bounds based on the follw

Re: Problems in array access

2021-08-31 Thread Utkarsh Singh via Gcc
On 2021-08-31, 09:28 +0100, Jonathan Wakely wrote: > On Tue, 31 Aug 2021 at 09:11, Utkarsh Singh wrote: >> >> Hello GCC mailing list, >> >> In one of my friend's C programming class, they asked him a question on >> the topic of array bounds based on the follwing code snippet: >> >> #include >> >

Re: Problems in array access

2021-08-31 Thread Jonathan Wakely via Gcc
On Tue, 31 Aug 2021 at 09:11, Utkarsh Singh wrote: > > Hello GCC mailing list, > > In one of my friend's C programming class, they asked him a question on > the topic of array bounds based on the follwing code snippet: > > #include > > int main(void) > { > char str[] = {'G' , 'C' , 'C' };

Problems in array access

2021-08-31 Thread Utkarsh Singh via Gcc
Hello GCC mailing list, In one of my friend's C programming class, they asked him a question on the topic of array bounds based on the follwing code snippet: #include int main(void) { char str[] = {'G' , 'C' , 'C' }; str[3] = '\0' ; /* Isn't this invalid? */ printf("%s\n