foo.cc: In function ‘int main()’:
foo.cc:14:29: warning: iteration 9 invokes undefined behavior [-Waggressive-loop-optimizations]
14 | cout<<h[i]<<' ';
| ^~~
foo.cc:13:22: note: within this loop
13 | for(int i=1;i<=10;i++)
| ~^~~~
In file included from /nix/gcc-13.3.0/include/c++/13.3.0/bits/stl_pair.h:61,
from /nix/gcc-13.3.0/include/c++/13.3.0/bits/stl_algobase.h:64,
from /nix/gcc-13.3.0/include/c++/13.3.0/algorithm:60,
from stdc++.h:51:
In function ‘std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int]’,
inlined from ‘int main()’ at foo.cc:8:6:
/nix/gcc-13.3.0/include/c++/13.3.0/bits/move.h:198:11: warning: array subscript 10 is outside array bounds of ‘int [10]’ [-Warray-bounds=]
198 | __a = _GLIBCXX_MOVE(__b);
| ^
foo.cc: In function ‘int main()’:
foo.cc:3:5: note: at offset 40 into object ‘h’ of size 40
3 | int h[10];
| ^
In function ‘std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int]’,
inlined from ‘int main()’ at foo.cc:8:6:
/nix/gcc-13.3.0/include/c++/13.3.0/bits/move.h:199:11: warning: array subscript 10 is outside array bounds of ‘int [10]’ [-Warray-bounds=]
199 | __b = _GLIBCXX_MOVE(__tmp);
| ^
foo.cc: In function ‘int main()’:
foo.cc:3:5: note: at offset 40 into object ‘h’ of size 40
3 | int h[10];
| ^