Re: [PATCH] Reject too large string literals (PR middle-end/87854)

2018-11-16 Thread Jakub Jelinek
On Fri, Nov 16, 2018 at 11:25:15AM -0700, Martin Sebor wrote: > On 11/16/2018 01:43 AM, Jakub Jelinek wrote: > > > > + /* This matters only for targets where ssizetype has smaller precision > > + than 32 bits. */ > > + if (wi::lts_p (wi::to_wide (TYPE_MAX_VALUE (ssizetype)), length)) > > +

Re: [PATCH] Reject too large string literals (PR middle-end/87854)

2018-11-16 Thread Martin Sebor
On 11/16/2018 01:43 AM, Jakub Jelinek wrote: Hi! Both C and C++ FE diagnose arrays larger than half of the address space: /tmp/1.c:1:6: error: size of array ‘a’ is too large char a[__SIZE_MAX__ / 2 + 1]; ^ because one can't do pointer arithmetics on them. But we don't have anything simil

Re: [PATCH] Reject too large string literals (PR middle-end/87854)

2018-11-16 Thread Joseph Myers
On Fri, 16 Nov 2018, Jakub Jelinek wrote: > Hi! > > Both C and C++ FE diagnose arrays larger than half of the address space: > /tmp/1.c:1:6: error: size of array ‘a’ is too large > char a[__SIZE_MAX__ / 2 + 1]; > ^ > because one can't do pointer arithmetics on them. But we don't have > an

Re: [PATCH] Reject too large string literals (PR middle-end/87854)

2018-11-16 Thread Marek Polacek
On Fri, Nov 16, 2018 at 07:06:51AM -0500, Nathan Sidwell wrote: > On 11/16/18 3:43 AM, Jakub Jelinek wrote: > > Hi! > > > > Both C and C++ FE diagnose arrays larger than half of the address space: > > /tmp/1.c:1:6: error: size of array ‘a’ is too large > > char a[__SIZE_MAX__ / 2 + 1]; > >

Re: [PATCH] Reject too large string literals (PR middle-end/87854)

2018-11-16 Thread Nathan Sidwell
On 11/16/18 3:43 AM, Jakub Jelinek wrote: Hi! Both C and C++ FE diagnose arrays larger than half of the address space: /tmp/1.c:1:6: error: size of array ‘a’ is too large char a[__SIZE_MAX__ / 2 + 1]; ^ because one can't do pointer arithmetics on them. But we don't have anything simila

[PATCH] Reject too large string literals (PR middle-end/87854)

2018-11-16 Thread Jakub Jelinek
Hi! Both C and C++ FE diagnose arrays larger than half of the address space: /tmp/1.c:1:6: error: size of array ‘a’ is too large char a[__SIZE_MAX__ / 2 + 1]; ^ because one can't do pointer arithmetics on them. But we don't have anything similar for string literals. As internally we use h