Hi Andrew
On 12/13/22 20:18, Andrew Pinski wrote:
[...]
GCC only warns during VRP which is only enabled at -O2:
:8:12: warning: array subscript 6 is outside array bounds of
'char[5]' [-Warray-bounds=]
8 | p = buf + 6;
| ~~^
:6:19: note: at offset 6 into o
On Tue, 13 Dec 2022, 19:23 Paul Koning via Gcc, wrote:
>
>
>
> > On Dec 13, 2022, at 2:08 PM, Alejandro Colomar via Gcc
> > wrote:
> >
> > Hi!
> >
> > For the following program:
> >
> >
> >$ cat buf.c
> >#include
> >
> >int main(void)
> >{
> >char *p, buf[5];
> >
> >
Hi Paul,
On 12/13/22 20:22, Paul Koning wrote:
On Dec 13, 2022, at 2:08 PM, Alejandro Colomar via Gcc wrote:
Hi!
For the following program:
$ cat buf.c
#include
int main(void)
{
char *p, buf[5];
p = buf + 6;
printf("%p\n", p);
}
There are
> On Dec 13, 2022, at 2:08 PM, Alejandro Colomar via Gcc
> wrote:
>
> Hi!
>
> For the following program:
>
>
>$ cat buf.c
>#include
>
>int main(void)
>{
>char *p, buf[5];
>
>p = buf + 6;
>printf("%p\n", p);
>}
>
>
> There are no warnings in
On Tue, 2022-12-13 at 20:15 +0100, Alejandro Colomar via Gcc wrote:
>
>
> On 12/13/22 20:08, Alejandro Colomar wrote:
> > Hi!
> >
> > For the following program:
> >
> >
> > $ cat buf.c
> > #include
> >
> > int main(void)
> > {
> > char *p, buf[5];
> >
> >
On Tue, Dec 13, 2022 at 11:16 AM Alejandro Colomar via Gcc
wrote:
>
>
>
> On 12/13/22 20:08, Alejandro Colomar wrote:
> > Hi!
> >
> > For the following program:
> >
> >
> > $ cat buf.c
> > #include
> >
> > int main(void)
> > {
> > char *p, buf[5];
> >
> > p =
On 12/13/22 20:08, Alejandro Colomar wrote:
Hi!
For the following program:
$ cat buf.c
#include
int main(void)
{
char *p, buf[5];
p = buf + 6;
printf("%p\n", p);
}
There are no warnings in gcc, as I would expect:
I just re-read my te
Hi!
For the following program:
$ cat buf.c
#include
int main(void)
{
char *p, buf[5];
p = buf + 6;
printf("%p\n", p);
}
There are no warnings in gcc, as I would expect:
$ gcc -Wall -Wextra buf.c -O0
Clang does warn, however:
$ clang -W