https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881
Bug ID: 80881 Summary: [7.1 Regression] null pointer access in libgomp.h Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: daniel.f.starke at freenet dot de CC: jakub at gcc dot gnu.org Target Milestone: --- GCC 7.1.0 compiled OpenMP applications fail with invalid memory access to address 0. Used configuration: ../../src/gcc-7.1.0/configure --host=x86_64-w64-mingw32 --enable-languages=c,c++ --enable-seh-exceptions --enable-threads=posix --enable-tls --disable-nls --disable-shared --enable-static --enable-fully-dynamic-string --enable-lto --enable-plugins --enable-libgomp --with-dwarf2 --disable-win32-registry --enable-version-specific-runtime-libs --prefix=/mingw64-64 --with-sysroot=/mingw64-64 --target=x86_64-w64-mingw32 --enable-targets=all --enable-checking=release --with-gmp=/usr/new-gcc/lib/gmp-5.0.5 --with-mpfr=/usr/new-gcc/lib/mpfr-2.4.2 --with-mpc=/usr/new-gcc/lib/mpc-0.9 --with-isl=/usr/new-gcc/lib/isl-0.18 --with-cloog=/usr/new-gcc/lib/cloog-0.18.4 --with-host-libstdcxx='-lstdc++ -lsupc++' --disable-cloog-version-check --enable-cloog-backend=isl Thread model: posix gcc version 7.1.0 (GCC) Sample application: #include <stdlib.h> #include <stdio.h> #define N 1024 int main() { int i; float var[N]; volatile float PI = 3.1415927; # pragma omp parallel for private(i) for (i = 0; i < N; i++) { var[i] = (1024.0f / PI) + 0.5f; } return EXIT_SUCCESS; } Error message from Dr.Memory (32-bit variant): Error #1: UNADDRESSABLE ACCESS: reading 0x00000000-0x00000004 4 byte(s) # 0 GOMP_parallel [../../../../../src/gcc-7.1.0/libgomp/libgomp.h:677] # 1 main [h:\Temp\cpp017/test.c:11] Note: @0:00:00.642 in thread 6700 Note: instruction: mov %gs:0x00 -> %esi Error message from Dr.Memory (64-bit variant): Error #1: UNADDRESSABLE ACCESS: reading 0x0000000000000000-0x0000000000000008 8 byte(s) # 0 GOMP_parallel [../../../../src/gcc-7.1.0/libgomp/libgomp.h:677] # 1 main [h:\Temp\cpp017/test.c:11] Note: @0:00:00.170 in thread 1320 Note: instruction: mov %fs:0x00 -> %rdi