Werror=nonnull in dataloader.cpp (part of tests)
Labels: module: dataloader, triaged

### 🐛 Describe the bug

**FAILED: test_api/CMakeFiles/test_api.dir/dataloader.cpp.o** 
```
/usr/bin/ccache /usr/bin/c++ -DGFLAGS_IS_A_DLL=0 -DGLOG_CUSTOM_PREFIX_SUPPORT -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MMAP=1 -DHAVE_SHM_OPEN=1 -DHAVE_SHM_UNLINK=1 -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DUSE_EXTERNAL_MZCRC -D_FILE_OFFSET_BITS=64 -I./pytorch/build/aten/src -I./pytorch/aten/src -I./pytorch/build -I./pytorch -I./pytorch/cmake/../third_party/benchmark/include -I./pytorch/third_party/onnx -I./pytorch/build/third_party/onnx -I./pytorch/third_party/foxi -I./pytorch/build/third_party/foxi -I./pytorch/build/caffe2/../aten/src -I./pytorch/torch/csrc/api -I./pytorch/torch/csrc/api/include -I./pytorch/c10/.. -isystem ./pytorch/cmake/../third_party/googletest/googlemock/include -isystem ./pytorch/cmake/../third_party/googletest/googletest/include -isystem ./pytorch/third_party/gemmlowp -isystem ./pytorch/third_party/neon2sse -isystem ./pytorch/third_party/XNNPACK/include -isystem /usr/include/opencv4 -isystem ./pytorch/cmake/../third_party/eigen -isystem ./pytorch/third_party/ideep/include -isystem ./pytorch/third_party/ideep/mkl-dnn/include -isystem ./pytorch/third_party/googletest/googletest/include -isystem ./pytorch/third_party/googletest/googletest -march=native -mtune=native -O3 -pipe -fno-plt -Wno-deprecated-declarations -Wno-maybe-uninitialized -Wno-array-bounds -Wno-uninitialized -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION -O3 -DNDEBUG -DNDEBUG -fPIE -DTH_HAVE_THREAD -Wno-unused-variable -Wno-maybe-uninitialized -Wno-unused-but-set-parameter -std=gnu++14 -MD -MT test_api/CMakeFiles/test_api.dir/dataloader.cpp.o -MF test_api/CMakeFiles/test_api.dir/dataloader.cpp.o.d -o test_api/CMakeFiles/test_api.dir/dataloader.cpp.o -c ./pytorch/test/cpp/api/dataloader.cpp
In Datei, eingebunden von /usr/include/c++/12.1.0/memory:63,
                 von ./pytorch/third_party/googletest/googletest/include/gtest/gtest.h:57,
                 von ./pytorch/test/cpp/api/dataloader.cpp:1:
In statischer Elementfunktion »static _Tp* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(const _Tp*, const _Tp*, _Tp*) [with _Tp = long unsigned int; bool _IsMove = false]«,
    eingefügt von »_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = const long unsigned int*; _OI = long unsigned int*]« bei /usr/include/c++/12.1.0/bits/stl_algobase.h:495:30,
    eingefügt von »_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = const long unsigned int*; _OI = long unsigned int*]« bei /usr/include/c++/12.1.0/bits/stl_algobase.h:522:42,
    eingefügt von »_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = __gnu_cxx::__normal_iterator<const long unsigned int*, vector<long unsigned int> >; _OI = __gnu_cxx::__normal_iterator<long unsigned int*, vector<long unsigned int> >]« bei /usr/include/c++/12.1.0/bits/stl_algobase.h:529:31,
    eingefügt von »_OI std::copy(_II, _II, _OI) [with _II = __gnu_cxx::__normal_iterator<const long unsigned int*, vector<long unsigned int> >; _OI = __gnu_cxx::__normal_iterator<long unsigned int*, vector<long unsigned int> >]« bei /usr/include/c++/12.1.0/bits/stl_algobase.h:620:7,
    eingefügt von »std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long unsigned int; _Alloc = std::allocator<long unsigned int>]« bei /usr/include/c++/12.1.0/bits/vector.tcc:244:21:
/usr/include/c++/12.1.0/bits/stl_algobase.h:431:30: Fehler: Argument 1 ist null, aber nichtnull wird erwartet [-Werror=nonnull]
  431 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/12.1.0/bits/stl_algobase.h:431:30: Anmerkung: in einem Aufruf der eingebauten Funktion »void* __builtin_memmove(void*, const void*, long unsigned int)«
```

### Versions

PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Arch Linux (x86_64)
GCC version: (GCC) 12.1.0
Clang version: 13.0.1
CMake version: version 3.23.1
Libc version: glibc-2.35

Python version: 3.10.4 (main, May 14 2022, 05:21:19) [GCC 12.1.0] (64-bit runtime)
Python platform: Linux-5.17.8-1-x86_64-with-glibc2.35
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A

GPU: _Radeon RX 460_: No interest in CUDA or ROCm

cc @SsnL @VitalyFedyunin @ejguan @NivekT