Martin Uecker :
> Marek Polacek :
>
> > > void foo(int (*x)[4])
> > > {
> > > (*x)[4] = 5;// warning
> > > }
> >
> > This is detected by -fsanitize=object-size, turned on by default in
> > -fsanitize=undefined. Since it makes use of __builtin_object_size,
> > it is necessary to compile w
On Sat, 21 Feb 2015, Marek Polacek wrote:
> option that detects a particular UB. Or say that a particular UB is a
> compile-time error (e.g. "declaring a function at block scope with an explicit
> storage-class specifier other than extern").
That one is already a hard error for cases such as sta
Marek Polacek :
> Sorry for late reply - I've found this in my inbox only today.
>
> On Mon, Jan 26, 2015 at 11:53:59AM -0800, Martin Uecker wrote:
>
> > Finally, what is missing is a way to diagnose problems inside
> > the called functions. -Warray-bounds=2 (with my recently
> > accepted patch
Sorry for late reply.
On Tue, Jan 27, 2015 at 12:07:58AM +, Joseph Myers wrote:
> On Mon, 26 Jan 2015, Martin Uecker wrote:
>
> > extern void bar2(int (*x)[5]);
>
> > int c = 4;
> > int y[c];
>
> > bar2(&y); // not diagnosed (found by asan)
>
> This is the undefined behav
Sorry for late reply - I've found this in my inbox only today.
On Mon, Jan 26, 2015 at 11:53:59AM -0800, Martin Uecker wrote:
>
> Hi all,
>
> I am writing numerical code, so I am trying to make the use
> of arrays in C (with gcc) suck a bit less. In general, the long term
> goal would be to hav
On Mon, 26 Jan 2015, Martin Uecker wrote:
> extern void bar2(int (*x)[5]);
> int c = 4;
> int y[c];
> bar2(&y); // not diagnosed (found by asan)
This is the undefined behavior "If the two array types are used in a
context which requires them to be compatible, it is unde
Hi all,
I am writing numerical code, so I am trying to make the use
of arrays in C (with gcc) suck a bit less. In general, the long term
goal would be to have either a compile-time warning or the possibility
to get a run-time error if one writes beyond the end of an array as
specified by its ty