On Wed, 22 Oct 2014, Martin Uecker wrote:

> 
> 
> Sorry for bringing this up again, but this could work:
> 
> void foo(int x, int (*s)[x])
> {
>         (*s)[x] = 1;  // <- undefined behaviour

Yes, I believe that's undefined (even if the array is part of a larger 
object, as the same principle as "An array subscript is out of range, even 
if an object is apparently accessible with the given subscript (as in the 
lvalue expression a[1][7] given the declaration int a[4][5]) (6.5.6)." 
(Annex J) applies).

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to