From 2eaa0a1672c2d87d390584a93bacefa2c0c14b1d Mon Sep 17 00:00:00 2001 From: Andrea Ornstein Date: Mon, 20 Apr 2009 16:01:19 +0000 Subject: merge from trunk revisions 127002-132392, 6/N git-svn-id: https://gcc.gnu.org/svn/gcc/branches/st/cli-be@146437 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 102 ++++++++++++++++++ libgomp/Makefile.am | 4 +- libgomp/Makefile.in | 34 +++--- libgomp/aclocal.m4 | 1 + libgomp/config/mingw32/proc.c | 82 ++++++++++++++ libgomp/configure | 108 ++++++++++--------- libgomp/configure.ac | 52 +-------- libgomp/configure.tgt | 2 +- libgomp/omp.h.in | 49 +++++---- libgomp/testsuite/libgomp.c++/atomic-1.C | 53 +++++++++ libgomp/testsuite/libgomp.c++/pr34513.C | 32 ++++++ libgomp/testsuite/libgomp.c/atomic-1.c | 10 +- libgomp/testsuite/libgomp.c/atomic-2.c | 15 ++- libgomp/testsuite/libgomp.c/pr33880.c | 123 +++++++++++++++++++++ libgomp/testsuite/libgomp.c/pr34513.c | 33 ++++++ libgomp/testsuite/libgomp.c/pr35130.c | 131 +++++++++++++++++++++++ libgomp/testsuite/libgomp.c/pr35196.c | 43 ++++++++ libgomp/testsuite/libgomp.c/private-1.c | 54 ++++++++++ libgomp/testsuite/libgomp.fortran/crayptr2.f90 | 1 + libgomp/testsuite/libgomp.fortran/omp_parse3.f90 | 5 +- libgomp/testsuite/libgomp.fortran/pr32550.f90 | 1 + libgomp/testsuite/libgomp.fortran/pr33880.f90 | 18 ++++ libgomp/testsuite/libgomp.fortran/pr34020.f90 | 19 ++++ libgomp/testsuite/libgomp.fortran/pr35130.f90 | 20 ++++ libgomp/testsuite/libgomp.fortran/stack.f90 | 21 ++++ 25 files changed, 862 insertions(+), 151 deletions(-) create mode 100644 libgomp/config/mingw32/proc.c create mode 100644 libgomp/testsuite/libgomp.c++/atomic-1.C create mode 100644 libgomp/testsuite/libgomp.c++/pr34513.C create mode 100644 libgomp/testsuite/libgomp.c/pr33880.c create mode 100644 libgomp/testsuite/libgomp.c/pr34513.c create mode 100644 libgomp/testsuite/libgomp.c/pr35130.c create mode 100644 libgomp/testsuite/libgomp.c/pr35196.c create mode 100644 libgomp/testsuite/libgomp.c/private-1.c create mode 100644 libgomp/testsuite/libgomp.fortran/pr33880.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/pr34020.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/pr35130.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/stack.f90 diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 20be557df94..44286ca469f 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,105 @@ +2008-02-15 Jakub Jelinek + + PR middle-end/35196 + * testsuite/libgomp.c/pr35196.c: New test. + + PR middle-end/35130 + * testsuite/libgomp.fortran/pr35130.f90: New test. + * testsuite/libgomp.c/pr35130.c: New test. + +2008-01-25 Jakub Jelinek + + PR middle-end/33880 + * testsuite/libgomp.c/pr33880.c: New test. + * testsuite/libgomp.fortran/pr33880.f90: New test. + +2008-01-24 David Edelsohn + + * configure: Regenerate. + +2008-01-08 Jakub Jelinek + + * configure.ac: Move futex checking into ../config/futex.m4. + * configure: Rebuilt. + * aclocal.m4: Rebuilt. + * Makefile.in: Rebuilt. + + * configure.tgt: Rename have_tls to gcc_cv_have_tls to match + 2007-10-15 ../config/tls.m4 change. + +2007-12-19 Jakub Jelinek + + PR c++/34513 + * testsuite/libgomp.c/pr34513.c: New test. + * testsuite/libgomp.c++/pr34513.C: New test. + +2007-12-17 Jack Howarth + + PR target/32765 + * testsuite/libgomp.fortran/crayptr2.f90: Move dg-options for darwin. + +2007-12-04 Jakub Jelinek + + * omp.h.in (__GOMP_NOTHROW): Define. Use it on omp_* prototypes. + +2007-12-03 Jakub Jelinek + + * testsuite/libgomp.c/private-1.c: New test. + +2007-11-29 Andris Pavenis + Paolo Bonzini + + * Makefile.am: Use space as vpath separator. Use 'vpath %' + instead of 'VPATH ='. + * Makefile.in: Regenerate. + +2007-11-23 Matthias Klose + + * configure.ac: Adjust makeinfo version check. + * configure: Regenerate. + +2007-11-10 Jakub Jelinek + + PR fortran/34020 + * testsuite/libgomp.fortran/pr34020.f90: New test. + +2007-11-06 Jakub Jelinek + + PR c++/33894 + * testsuite/libgomp.c++/atomic-1.C: New test. + +2007-10-25 Jakub Jelinek + + PR libgomp/33275 + * testsuite/libgomp.fortran/omp_parse3.f90 (test_threadprivate): + Make x and y integers rather than (implicit) reals. Add private (j) + clause to the last omp parallel. + +2007-10-15 Maciej W. Rozycki + + * configure: Regenerate following changes to ../config/tls.m4. + +2007-09-28 Jakub Jelinek + + * testsuite/libgomp.fortran/stack.f90: New test. + +2007-09-10 Danny Smith + + * config/mingw32/proc.c: New file. + +2007-09-05 Uros Bizjak + + * testsuite/libgomp.c/atomic-1.c: Include cpuid.h for i386 targets. + (main): Use __get_cpuid to get i386 target fetaures. + * testsuite/libgomp.c/atomic-2.c: Include cpuid.h for x86_64 targets. + (main): Use __get_cpuid to get x86_64 target fetaures. + +2007-08-15 Jack Howarth + + PR target/32765 + * testsuite/libgomp.fortran/pr32550.f90: Use -static-libgcc on Darwin. + * testsuite/libgomp.fortran/crayptr2.f90: Likwise. + 2007-07-12 Jakub Jelinek PR fortran/32550 diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am index 18544c8fec5..55e3bf3ee15 100644 --- a/libgomp/Makefile.am +++ b/libgomp/Makefile.am @@ -12,9 +12,7 @@ search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir) fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/finclude libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include -empty = -space = $(empty) $(empty) -VPATH = $(subst $(space),:,$(strip $(search_path))) +vpath % $(strip $(search_path)) AM_CPPFLAGS = $(addprefix -I, $(search_path)) AM_CFLAGS = $(XCFLAGS) diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in index 4221dc02719..6ba3dcc9a28 100644 --- a/libgomp/Makefile.in +++ b/libgomp/Makefile.in @@ -17,6 +17,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ +VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -54,10 +55,11 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/multi.m4 \ $(top_srcdir)/../config/stdint.m4 \ - $(top_srcdir)/../config/tls.m4 $(top_srcdir)/../ltoptions.m4 \ + $(top_srcdir)/../config/tls.m4 \ + $(top_srcdir)/../config/futex.m4 $(top_srcdir)/../ltoptions.m4 \ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \ - $(top_srcdir)/acinclude.m4 $(top_srcdir)/../libtool.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/../lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -139,7 +141,6 @@ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print -VPATH = $(subst $(space),:,$(strip $(search_path))) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -216,12 +217,9 @@ USE_FORTRAN_TRUE = @USE_FORTRAN_TRUE@ VERSION = @VERSION@ XCFLAGS = @XCFLAGS@ XLDFLAGS = @XLDFLAGS@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_FC = @ac_ct_FC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ @@ -237,6 +235,9 @@ build_os = @build_os@ build_vendor = @build_vendor@ config_path = @config_path@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ enable_shared = @enable_shared@ enable_static = @enable_static@ exec_prefix = @exec_prefix@ @@ -245,6 +246,7 @@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ @@ -252,14 +254,17 @@ libdir = @libdir@ libexecdir = @libexecdir@ libtool_VERSION = @libtool_VERSION@ link_gomp = @link_gomp@ +localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ multi_basedir = @multi_basedir@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ @@ -276,8 +281,6 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) search_path = $(addprefix $(top_srcdir)/config/, $(config_path)) $(top_srcdir) fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/finclude libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include -empty = -space = $(empty) $(empty) AM_CPPFLAGS = $(addprefix -I, $(search_path)) AM_CFLAGS = $(XCFLAGS) AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) @@ -542,10 +545,13 @@ dist-info: $(INFO_DEPS) $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ - for file in $$d/$$base*; do \ - relfile=`expr "$$file" : "$$d/\(.*\)"`; \ - test -f $(distdir)/$$relfile || \ - cp -p $$file $(distdir)/$$relfile; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ + else :; fi; \ done; \ done @@ -1047,6 +1053,8 @@ uninstall-info: uninstall-info-recursive uninstall-toolexeclibLTLIBRARIES +vpath % $(strip $(search_path)) + omp_lib_kinds.mod: omp_lib.mod : omp_lib.mod: omp_lib.f90 diff --git a/libgomp/aclocal.m4 b/libgomp/aclocal.m4 index 505095df94c..1746f255949 100644 --- a/libgomp/aclocal.m4 +++ b/libgomp/aclocal.m4 @@ -863,6 +863,7 @@ m4_include([../config/lead-dot.m4]) m4_include([../config/multi.m4]) m4_include([../config/stdint.m4]) m4_include([../config/tls.m4]) +m4_include([../config/futex.m4]) m4_include([../ltoptions.m4]) m4_include([../ltsugar.m4]) m4_include([../ltversion.m4]) diff --git a/libgomp/config/mingw32/proc.c b/libgomp/config/mingw32/proc.c new file mode 100644 index 00000000000..def7bb5e8f4 --- /dev/null +++ b/libgomp/config/mingw32/proc.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + Contributed by Danny Smith + + This file is part of the GNU OpenMP Library (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + more details. + + You should have received a copy of the GNU Lesser General Public License + along with libgomp; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* As a special exception, if you link this library with other files, some + of which are compiled with GCC, to produce an executable, this library + does not by itself cause the resulting executable to be covered by the + GNU General Public License. This exception does not however invalidate + any other reasons why the executable file might be covered by the GNU + General Public License. */ + +/* This file contains system specific routines related to counting + online processors and dynamic load balancing. It is expected that + a system may well want to write special versions of each of these. + + The following implementation uses win32 API routines. */ + +#include "libgomp.h" +#include + +/* Count the CPU's currently available to this process. */ +static int +count_avail_process_cpus () +{ + DWORD_PTR process_cpus; + DWORD_PTR system_cpus; + + if (GetProcessAffinityMask (GetCurrentProcess (), + &process_cpus, &system_cpus)) + { + unsigned int count; + for (count = 0; process_cpus != 0; process_cpus >>= 1) + if (process_cpus & 1) + count++; + return count; + } + return 1; +} + +/* At startup, determine the default number of threads. It would seem + this should be related to the number of cpus available to the process. */ + +void +gomp_init_num_threads (void) +{ + gomp_nthreads_var = count_avail_process_cpus (); +} + +/* When OMP_DYNAMIC is set, at thread launch determine the number of + threads we should spawn for this team. FIXME: How do we adjust for + load average on MS Windows? */ + +unsigned +gomp_dynamic_max_threads (void) +{ + int n_onln = count_avail_process_cpus (); + return n_onln > gomp_nthreads_var ? gomp_nthreads_var : n_onln; +} + +int +omp_get_num_procs (void) +{ + return count_avail_process_cpus (); +} + +ialias (omp_get_num_procs) diff --git a/libgomp/configure b/libgomp/configure index d01039242a4..7f4be7676b4 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -1003,8 +1003,6 @@ Optional Features: --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory [default=no] - --enable-linux-futex Use the Linux futex system call - [default=default] --enable-generated-files-in-srcdir put copies of generated files in source dir intended for creating source tarballs for users without @@ -1021,6 +1019,8 @@ Optional Features: --disable-libtool-lock avoid locking (might break parallel builds) --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer + --enable-linux-futex use the Linux futex system call + [default=default] --enable-tls Use thread-local storage [default=yes] --enable-symvers=STYLE enables symbol versioning of the shared library [default=yes] @@ -1518,26 +1518,6 @@ fi; echo "$as_me:$LINENO: result: $enable_version_specific_runtime_libs" >&5 echo "${ECHO_T}$enable_version_specific_runtime_libs" >&6 -echo "$as_me:$LINENO: checking for --enable-linux-futex" >&5 -echo $ECHO_N "checking for --enable-linux-futex... $ECHO_C" >&6 - # Check whether --enable-linux-futex or --disable-linux-futex was given. -if test "${enable_linux_futex+set}" = set; then - enableval="$enable_linux_futex" - - case "$enableval" in - yes|no|default) ;; - *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable linux-futex" >&5 -echo "$as_me: error: Unknown argument to enable/disable linux-futex" >&2;} - { (exit 1); exit 1; }; } ;; - esac - -else - enable_linux_futex=default -fi; - -echo "$as_me:$LINENO: result: $enable_linux_futex" >&5 -echo "${ECHO_T}$enable_linux_futex" >&6 - # We would like our source tree to be readonly. However when releases or # pre-releases are generated, the flex/bison generated files as well as the # various formats of manuals need to be included along with the rest of the @@ -3679,7 +3659,7 @@ else case $ac_prog_version in '') gcc_cv_prog_makeinfo_modern=no;; - 4.[4-9]*) gcc_cv_prog_makeinfo_modern=yes;; + 4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*) gcc_cv_prog_makeinfo_modern=yes;; *) gcc_cv_prog_makeinfo_modern=no;; esac @@ -4512,7 +4492,7 @@ lt_cv_deplibs_check_method='unknown' # whether `pass_all' will *always* work, you probably want this one. case $host_os in -aix4* | aix5*) +aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; @@ -7031,7 +7011,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # See if GNU ld supports shared libraries. case $host_os in - aix3* | aix4* | aix5*) + aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no @@ -7265,7 +7245,7 @@ _LT_EOF fi ;; - aix4* | aix5*) + aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -7285,7 +7265,7 @@ _LT_EOF # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes @@ -8345,7 +8325,7 @@ aix3*) soname_spec='${libname}${release}${shared_ext}$major' ;; -aix4* | aix5*) +aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -9963,7 +9943,7 @@ echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 fi ;; - aix4* | aix5*) + aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi @@ -10639,7 +10619,7 @@ echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 postinstall_cmds='$RANLIB $lib' fi ;; - aix4* | aix5*) + aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi @@ -11383,7 +11363,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # See if GNU ld supports shared libraries. case $host_os in - aix3* | aix4* | aix5*) + aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs_FC=no @@ -11617,7 +11597,7 @@ _LT_EOF fi ;; - aix4* | aix5*) + aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. @@ -11637,7 +11617,7 @@ _LT_EOF # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes @@ -12524,7 +12504,7 @@ aix3*) soname_spec='${libname}${release}${shared_ext}$major' ;; -aix4* | aix5*) +aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no @@ -16661,6 +16641,24 @@ cat >>confdefs.h <<\_ACEOF _ACEOF ;; +esac + + # Check whether --enable-linux-futex or --disable-linux-futex was given. +if test "${enable_linux_futex+set}" = set; then + enableval="$enable_linux_futex" + + case "$enableval" in + yes|no|default) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable linux-futex" >&5 +echo "$as_me: error: Unknown argument to enable/disable linux-futex" >&2;} + { (exit 1); exit 1; }; } ;; + esac + +else + enable_linux_futex=default +fi; + +case "$target" in *-linux*) case "$enable_linux_futex" in default) @@ -16709,7 +16707,9 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cat >conftest.$ac_ext <<_ACEOF + save_LIBS="$LIBS" + LIBS="-lpthread $LIBS" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -16757,7 +16757,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 if test x$cross_compiling = xno; then if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null \ - | LC_ALL=C grep -i NPTL > /dev/null 2>/dev/null; then + | LC_ALL=C grep -i NPTL > /dev/null 2>/dev/null; then :; else { echo "$as_me:$LINENO: WARNING: The kernel might not support futex or gettid syscalls. If so, please configure with --disable-linux-futex" >&5 echo "$as_me: WARNING: The kernel might not support futex or gettid syscalls. @@ -16768,6 +16768,7 @@ If so, please configure with --disable-linux-futex" >&2;} fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -16776,7 +16777,7 @@ fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ;; - yes) + yes) cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -16829,7 +16830,14 @@ rm -f conftest.err conftest.$ac_objext \ ;; esac ;; + *) + enable_linux_futex=no + ;; esac +if test x$enable_linux_futex = xyes; then + : +fi + # Check for pthread_{,attr_}[sg]etaffinity_np. cat >conftest.$ac_ext <<_ACEOF @@ -16990,7 +16998,7 @@ fi; echo "$as_me:$LINENO: checking whether the target supports thread-local storage" >&5 echo $ECHO_N "checking whether the target supports thread-local storage... $ECHO_C" >&6 -if test "${have_tls+set}" = set; then +if test "${gcc_cv_have_tls+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -17020,12 +17028,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - have_tls=yes + gcc_cv_have_tls=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -have_tls=no +gcc_cv_have_tls=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext @@ -17094,14 +17102,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - have_tls=yes + gcc_cv_have_tls=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -have_tls=no +gcc_cv_have_tls=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -17109,12 +17117,12 @@ else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -have_tls=yes +gcc_cv_have_tls=yes fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$chktls_save_LDFLAGS" - if test $have_tls = yes; then + if test $gcc_cv_have_tls = yes; then chktls_save_CFLAGS="$CFLAGS" thread_CFLAGS=failed for flag in '' '-pthread' '-lpthread'; do @@ -17222,14 +17230,14 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - have_tls=yes + gcc_cv_have_tls=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -have_tls=no +gcc_cv_have_tls=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -17242,14 +17250,14 @@ echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -have_tls=no +gcc_cv_have_tls=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:$LINENO: result: $have_tls" >&5 -echo "${ECHO_T}$have_tls" >&6 - if test "$enable_tls $have_tls" = "yes yes"; then +echo "$as_me:$LINENO: result: $gcc_cv_have_tls" >&5 +echo "${ECHO_T}$gcc_cv_have_tls" >&6 + if test "$enable_tls $gcc_cv_have_tls" = "yes yes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_TLS 1 diff --git a/libgomp/configure.ac b/libgomp/configure.ac index 427c8f7c753..0cda749d593 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -15,12 +15,6 @@ LIBGOMP_ENABLE(version-specific-runtime-libs, no, , permit yes|no) AC_MSG_RESULT($enable_version_specific_runtime_libs) -AC_MSG_CHECKING([for --enable-linux-futex]) -LIBGOMP_ENABLE(linux-futex, default, , - [Use the Linux futex system call], - permit yes|no|default) -AC_MSG_RESULT($enable_linux_futex) - # We would like our source tree to be readonly. However when releases or # pre-releases are generated, the flex/bison generated files as well as the # various formats of manuals need to be included along with the rest of the @@ -134,7 +128,7 @@ AC_PROG_INSTALL # that we can use it. ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version], [GNU texinfo.* \([0-9][0-9.]*\)], - [4.[4-9]*]) + [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes") @@ -192,50 +186,10 @@ case "$host" in AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, Define if the POSIX Semaphores do not work on your system.) ;; - *-linux*) - case "$enable_linux_futex" in - default) - # If headers don't have gettid/futex syscalls definition, then - # default to no, otherwise there will be compile time failures. - # Otherwise, default to yes. If we don't detect we are - # compiled/linked against NPTL and not cross-compiling, check - # if programs are run by default against NPTL and if not, issue - # a warning. - enable_linux_futex=no - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include - int lk;], - [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#ifndef _GNU_SOURCE - #define _GNU_SOURCE 1 - #endif - #include - pthread_t th; void *status;], - [pthread_tryjoin_np (th, &status);])],[enable_linux_futex=yes], - [if test x$cross_compiling = xno; then - if getconf GNU_LIBPTHREAD_VERSION 2>/dev/null \ - | LC_ALL=C grep -i NPTL > /dev/null 2>/dev/null; then - AC_MSG_WARN([The kernel might not support futex or gettid syscalls. -If so, please configure with --disable-linux-futex]) - fi - fi - enable_linux_futex=yes])]) - ;; - yes) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include - int lk;], - [syscall (SYS_gettid); syscall (SYS_futex, &lk, 0, 0, 0);])],[], - [AC_MSG_ERROR([SYS_gettid and SYS_futex required for --enable-linux-futex])]) - ;; - esac - ;; esac +GCC_LINUX_FUTEX(:) + # Check for pthread_{,attr_}[sg]etaffinity_np. AC_LINK_IFELSE( [AC_LANG_PROGRAM( diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt index f46210c3647..68115abf71d 100644 --- a/libgomp/configure.tgt +++ b/libgomp/configure.tgt @@ -11,7 +11,7 @@ # XLDFLAGS Add extra link flags to use. # Optimize TLS usage by avoiding the overhead of dynamic allocation. -if test $have_tls = yes ; then +if test $gcc_cv_have_tls = yes ; then case "${target}" in *-*-linux*) diff --git a/libgomp/omp.h.in b/libgomp/omp.h.in index 44fda9088c3..5ebcdbb2735 100644 --- a/libgomp/omp.h.in +++ b/libgomp/omp.h.in @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2007 Free Software Foundation, Inc. Contributed by Richard Henderson . This file is part of the GNU OpenMP Library (libgomp). @@ -49,36 +49,39 @@ typedef struct #ifdef __cplusplus extern "C" { +# define __GOMP_NOTHROW throw () +#else +# define __GOMP_NOTHROW __attribute__((__nothrow__)) #endif -extern void omp_set_num_threads (int); -extern int omp_get_num_threads (void); -extern int omp_get_max_threads (void); -extern int omp_get_thread_num (void); -extern int omp_get_num_procs (void); +extern void omp_set_num_threads (int) __GOMP_NOTHROW; +extern int omp_get_num_threads (void) __GOMP_NOTHROW; +extern int omp_get_max_threads (void) __GOMP_NOTHROW; +extern int omp_get_thread_num (void) __GOMP_NOTHROW; +extern int omp_get_num_procs (void) __GOMP_NOTHROW; -extern int omp_in_parallel (void); +extern int omp_in_parallel (void) __GOMP_NOTHROW; -extern void omp_set_dynamic (int); -extern int omp_get_dynamic (void); +extern void omp_set_dynamic (int) __GOMP_NOTHROW; +extern int omp_get_dynamic (void) __GOMP_NOTHROW; -extern void omp_set_nested (int); -extern int omp_get_nested (void); +extern void omp_set_nested (int) __GOMP_NOTHROW; +extern int omp_get_nested (void) __GOMP_NOTHROW; -extern void omp_init_lock (omp_lock_t *); -extern void omp_destroy_lock (omp_lock_t *); -extern void omp_set_lock (omp_lock_t *); -extern void omp_unset_lock (omp_lock_t *); -extern int omp_test_lock (omp_lock_t *); +extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW; +extern void omp_destroy_lock (omp_lock_t *) __GOMP_NOTHROW; +extern void omp_set_lock (omp_lock_t *) __GOMP_NOTHROW; +extern void omp_unset_lock (omp_lock_t *) __GOMP_NOTHROW; +extern int omp_test_lock (omp_lock_t *) __GOMP_NOTHROW; -extern void omp_init_nest_lock (omp_nest_lock_t *); -extern void omp_destroy_nest_lock (omp_nest_lock_t *); -extern void omp_set_nest_lock (omp_nest_lock_t *); -extern void omp_unset_nest_lock (omp_nest_lock_t *); -extern int omp_test_nest_lock (omp_nest_lock_t *); +extern void omp_init_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW; +extern void omp_destroy_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW; +extern void omp_set_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW; +extern void omp_unset_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW; +extern int omp_test_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW; -extern double omp_get_wtime (void); -extern double omp_get_wtick (void); +extern double omp_get_wtime (void) __GOMP_NOTHROW; +extern double omp_get_wtick (void) __GOMP_NOTHROW; #ifdef __cplusplus } diff --git a/libgomp/testsuite/libgomp.c++/atomic-1.C b/libgomp/testsuite/libgomp.c++/atomic-1.C new file mode 100644 index 00000000000..73f6e7c4059 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/atomic-1.C @@ -0,0 +1,53 @@ +// PR c++/33894 +// { dg-do run } +// { dg-options "-O2" } + +extern "C" void abort (); + +int check; + +template void +foo () +{ + #pragma omp atomic + check |= sizeof (T); +} + +template void +bar (T *x, T y) +{ + #pragma omp atomic + *x += y; +} + +template void +baz () +{ + #pragma omp atomic + check++; +} + +int +main () +{ + int i = 0; + long l = 0; + + check = 0; + foo (); + if (check != sizeof (char)) + abort (); + foo (); + if (check != (sizeof (char) | sizeof (short))) + abort (); + bar(&i, 4); + bar(&l, 8L); + if (i != 4 || l != 8L) + abort (); + baz (); + if (check != (sizeof (char) | sizeof (short)) + 1) + abort (); + baz (); + if (check != (sizeof (char) | sizeof (short)) + 2) + abort (); +} diff --git a/libgomp/testsuite/libgomp.c++/pr34513.C b/libgomp/testsuite/libgomp.c++/pr34513.C new file mode 100644 index 00000000000..e5ad3bcb44d --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr34513.C @@ -0,0 +1,32 @@ +// PR c++/34513 +// { dg-do run } + +#include + +extern "C" void abort (); + +static int errors = 0; +static int thrs = 4; + +int +main () +{ + omp_set_dynamic (0); + + #pragma omp parallel num_threads (thrs) + { + static int shrd = 0; + + #pragma omp atomic + shrd += 1; + + #pragma omp barrier + + if (shrd != thrs) + #pragma omp atomic + errors += 1; + } + + if (errors) + abort (); +} diff --git a/libgomp/testsuite/libgomp.c/atomic-1.c b/libgomp/testsuite/libgomp.c/atomic-1.c index dfbcf851c44..b2be8f022ea 100644 --- a/libgomp/testsuite/libgomp.c/atomic-1.c +++ b/libgomp/testsuite/libgomp.c/atomic-1.c @@ -2,8 +2,7 @@ /* { dg-options "-O2 -march=pentium" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ #ifdef __i386__ -#include "../../../gcc/testsuite/gcc.dg/i386-cpuid.h" -#define bit_CX8 (1 << 8) +#include "cpuid.h" #endif extern void abort (void); @@ -41,11 +40,12 @@ int main (void) { #ifdef __i386__ - unsigned long cpu_facilities; + unsigned int eax, ebx, ecx, edx; - cpu_facilities = i386_cpuid (); + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; - if (!(cpu_facilities & bit_CX8)) + if (!(edx & bit_CMPXCHG8B)) return 0; #endif diff --git a/libgomp/testsuite/libgomp.c/atomic-2.c b/libgomp/testsuite/libgomp.c/atomic-2.c index 50529ebe675..c8779483b81 100644 --- a/libgomp/testsuite/libgomp.c/atomic-2.c +++ b/libgomp/testsuite/libgomp.c/atomic-2.c @@ -1,6 +1,10 @@ /* { dg-do run } */ /* { dg-options "-O2 -mcx16" { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +#ifdef __x86_64__ +#include "cpuid.h" +#endif + double d = 1.5; long double ld = 3; extern void abort (void); @@ -20,11 +24,12 @@ int main (void) { #ifdef __x86_64__ -# define bit_CX16 (1 << 13) - unsigned int ax, bx, cx, dx; - __asm__ ("cpuid" : "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) - : "0" (1) : "cc"); - if (!(cx & bit_CX16)) + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + if (!(ecx & bit_CMPXCHG16B)) return 0; #endif test (); diff --git a/libgomp/testsuite/libgomp.c/pr33880.c b/libgomp/testsuite/libgomp.c/pr33880.c new file mode 100644 index 00000000000..5d719cd635d --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr33880.c @@ -0,0 +1,123 @@ +/* PR middle-end/33880 */ +/* { dg-do run } */ + +extern void abort (void); + +void +test1 (void) +{ + int i = 0, j = 0; + void bar (void) + { + i++; + j++; + } + bar (); + #pragma omp parallel for num_threads(4) + for (i = 0; i < 100; i++) + #pragma omp atomic + j += 1; + if (j != 101) + abort (); + #pragma omp parallel for lastprivate(i) num_threads(2) + for (i = 0; i < 100; i++) + #pragma omp atomic + j += 1; + if (i != 100) + abort (); + i = 3; + bar (); + if (j != 202) + abort (); + if (i != 4) + abort (); +} + +void +test2 (void) +{ + int i = -1, j = 99, k, l = 9, m = 0; + void bar (void) + { + i++; + j++; + l++; + m++; + } + bar (); + #pragma omp parallel for num_threads(4) + for (k = i; k < j; k += l) + #pragma omp atomic + m += 1; + bar (); + if (i != 1 || j != 101 || l != 11 || m != 12) + abort (); +} + +void +test3 (void) +{ + int i, j, k, l, m; + void bar (void) + { + #pragma omp parallel for num_threads(4) + for (i = j; i < k; i += l) + #pragma omp atomic + m += 1; + } + void baz (void) + { + #pragma omp parallel for num_threads(2) lastprivate(i) + for (i = j; i < k * 2; i += l / 2) + #pragma omp atomic + m += 1; + } + i = 7; + j = 0; + k = 100; + l = 2; + m = 0; + bar (); + if (j != 0 || k != 100 || l != 2 || m != 50) + abort (); + baz (); + if (i != 200 || j != 0 || k != 100 || l != 2 || m != 250) + abort (); +} + +void +test4 (void) +{ + int i, j, k, l, m = 0; + int foo (void) + { + return j; + } + int bar (void) + { + return k; + } + int baz (void) + { + return l; + } + j = 0; + k = 1000; + l = 2; + #pragma omp parallel for num_threads(8) lastprivate(i) + for (i = foo (); i < bar (); i += baz ()) + #pragma omp atomic + m += 1; + if (i != 1000 || m != 500 || j != 0 || k != 1000 || l != 2) + abort (); +} + +int +main (void) +{ + test1 (); + test2 (); + test3 (); + test4 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr34513.c b/libgomp/testsuite/libgomp.c/pr34513.c new file mode 100644 index 00000000000..76c7ac1f3a5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr34513.c @@ -0,0 +1,33 @@ +/* PR c++/34513 */ +/* { dg-do run } */ + +#include + +extern void abort (); + +static int errors = 0; +static int thrs = 4; + +int +main () +{ + omp_set_dynamic (0); + + #pragma omp parallel num_threads (thrs) + { + static int shrd = 0; + + #pragma omp atomic + shrd += 1; + + #pragma omp barrier + + if (shrd != thrs) + #pragma omp atomic + errors += 1; + } + + if (errors) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr35130.c b/libgomp/testsuite/libgomp.c/pr35130.c new file mode 100644 index 00000000000..12962d80705 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr35130.c @@ -0,0 +1,131 @@ +/* PR middle-end/35130 */ + +extern void abort (void); + +void +f1 (void) +{ + int a[4], k; + void nested (int x) + { + a[x] = 42; + } + + for (k = 0; k < 4; k++) + a[k] = 0; +#pragma omp parallel for + for (k = 0; k < 4; k++) + nested (k); + + if (a[0] != 42 || a[1] != 42 || a[2] != 42 || a[3] != 42) + abort (); +} + +void +f2 (void) +{ + int a[4], k; + void nested (void) + { + int l; + void nested2 (int x) + { + a[x] = 42; + } +#pragma omp parallel for + for (l = 0; l < 4; l++) + nested2 (l); + } + + for (k = 0; k < 4; k++) + a[k] = 0; + + nested (); + + if (a[0] != 42 || a[1] != 42 || a[2] != 42 || a[3] != 42) + abort (); +} + +void +f3 (void) +{ + int a[4], b[4], c[4], k; + void nested (int x) + { + a[x] = b[x] = c[x] = 42; + } + + for (k = 0; k < 4; k++) + a[k] = b[k] = c[k] = 0; + nested (0); + +#pragma omp parallel + { + #pragma omp single + { + a[1] = 43; + b[1] = 43; + } + #pragma omp parallel + { + #pragma omp single + { + b[2] = 44; + c[2] = 44; + } + } + } + + if (a[0] != 42 || a[1] != 43 || a[2] != 0 || a[3] != 0) + abort (); + if (b[0] != 42 || b[1] != 43 || b[2] != 44 || b[3] != 0) + abort (); + if (c[0] != 42 || c[1] != 0 || c[2] != 44 || c[3] != 0) + abort (); +} + +void +f4 (void) +{ + int a[4], b[4], c[4], k; + void nested () + { + #pragma omp parallel + { + #pragma omp single + { + a[1] = 43; + b[1] = 43; + } + #pragma omp parallel + { + #pragma omp single + { + b[2] = 44; + c[2] = 44; + } + } + } + } + + for (k = 0; k < 4; k++) + a[k] = b[k] = c[k] = k == 0 ? 42 : 0; + nested (); + + if (a[0] != 42 || a[1] != 43 || a[2] != 0 || a[3] != 0) + abort (); + if (b[0] != 42 || b[1] != 43 || b[2] != 44 || b[3] != 0) + abort (); + if (c[0] != 42 || c[1] != 0 || c[2] != 44 || c[3] != 0) + abort (); +} + +int +main (void) +{ + f1 (); + f2 (); + f3 (); + f4 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr35196.c b/libgomp/testsuite/libgomp.c/pr35196.c new file mode 100644 index 00000000000..e92d9762931 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr35196.c @@ -0,0 +1,43 @@ +/* PR middle-end/35196 */ +/* { dg-do run } */ + +extern void abort (void); +extern void omp_set_dynamic (int); + +int +main (void) +{ + int i, j; + omp_set_dynamic (0); +#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static) + for (i = 0; i < 5; i++) + j = i; + if (i != 5 || j != 4) + abort (); +#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static, 2) + for (i = 0; i < 5; i++) + j = i; + if (i != 5 || j != 4) + abort (); +#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (dynamic) + for (i = 0; i < 5; i++) + j = i; + if (i != 5 || j != 4) + abort (); +#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static) + for (i = -12; i < 21; i += 3) + j = i; + if (i != 21 || j != 18) + abort (); +#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (static, 2) + for (i = -12; i < 21; i += 3) + j = i; + if (i != 21 || j != 18) + abort (); +#pragma omp parallel for lastprivate (i, j) num_threads (8) schedule (dynamic, 3) + for (i = -12; i < 21; i += 3) + j = i; + if (i != 21 || j != 18) + abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/private-1.c b/libgomp/testsuite/libgomp.c/private-1.c new file mode 100644 index 00000000000..1d3659b25fa --- /dev/null +++ b/libgomp/testsuite/libgomp.c/private-1.c @@ -0,0 +1,54 @@ +extern void abort (void); + +int a = 18; + +void +f1 (int i, int j, int k) +{ + int l = 6, m = 7, n = 8; +#pragma omp parallel private(j, m) shared(k, n) firstprivate(i, l) \ + num_threads(1) + { + j = 6; + m = 5; + if (++a != 19 || ++i != 9 || j != 6 || ++l != 7 || m != 5 || ++n != 9) + #pragma omp atomic + k++; + } + if (a != 19 || i != 8 || j != 26 || k != 0 || l != 6 || m != 7 || n != 9) + abort (); +} + +int v1 = 1, v2 = 2, v5 = 5; +int err; + +void +f2 (void) +{ + int v3 = 3; +#pragma omp sections private (v1) firstprivate (v2) + { + #pragma omp section + { + int v4 = 4; + v1 = 7; + #pragma omp parallel num_threads(1) firstprivate(v1, v2, v3, v4) + { + if (++v1 != 8 || ++v2 != 3 || ++v3 != 4 || ++v4 != 5 || ++v5 != 6) + err = 1; + } + if (v1 != 7 || v2 != 2 || v3 != 3 || v4 != 4 || v5 != 6) + abort (); + if (err) + abort (); + } + } +} + +int +main (void) +{ + f1 (8, 26, 0); + f2 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.fortran/crayptr2.f90 b/libgomp/testsuite/libgomp.fortran/crayptr2.f90 index f8fce6b4760..d174d0366dc 100644 --- a/libgomp/testsuite/libgomp.fortran/crayptr2.f90 +++ b/libgomp/testsuite/libgomp.fortran/crayptr2.f90 @@ -1,5 +1,6 @@ ! { dg-do run } ! { dg-options "-fopenmp -fcray-pointer" } +! { dg-options "-fopenmp -fcray-pointer -static-libgcc" { target *-*-darwin* } } use omp_lib integer :: a, b, c, d, p diff --git a/libgomp/testsuite/libgomp.fortran/omp_parse3.f90 b/libgomp/testsuite/libgomp.fortran/omp_parse3.f90 index 98c94b93b79..a39ff103ecd 100644 --- a/libgomp/testsuite/libgomp.fortran/omp_parse3.f90 +++ b/libgomp/testsuite/libgomp.fortran/omp_parse3.f90 @@ -55,7 +55,7 @@ contains subroutine test_threadprivate common /tlsblock/ x, y !$omp threadprivate (/tlsblock/) - integer :: i, j + integer :: i, j, x, y logical :: m, n call omp_set_num_threads (4) call omp_set_dynamic (.false.) @@ -83,7 +83,8 @@ contains !$omp end parallel m = m .or. n n = .false. -!$omp parallel num_threads (4), copyin (z) reduction (.or. : n) +!$omp parallel num_threads (4), copyin (z) reduction (.or. : n) & +!$omp&private (j) if (z .ne. 4096) n = .true. if (omp_get_num_threads () .eq. i) then j = omp_get_thread_num () diff --git a/libgomp/testsuite/libgomp.fortran/pr32550.f90 b/libgomp/testsuite/libgomp.fortran/pr32550.f90 index 907a768e6d5..3a49dcf0a18 100644 --- a/libgomp/testsuite/libgomp.fortran/pr32550.f90 +++ b/libgomp/testsuite/libgomp.fortran/pr32550.f90 @@ -1,5 +1,6 @@ ! PR fortran/32550 ! { dg-do run } +! { dg-options "-static-libgcc" { target *-*-darwin* } } integer, pointer, save :: ptr integer, target :: targ diff --git a/libgomp/testsuite/libgomp.fortran/pr33880.f90 b/libgomp/testsuite/libgomp.fortran/pr33880.f90 new file mode 100644 index 00000000000..679cab6822d --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr33880.f90 @@ -0,0 +1,18 @@ +! PR middle-end/33880 +! { dg-do run } + +program pr33880 + integer :: i, j + call something () + !$omp parallel do + do i = 1, 1000 + !$omp atomic + j = j + 1 + end do + if (j .ne. 1000) call abort +contains + subroutine something() + i = 0 + j = 0 + end subroutine something +end program pr33880 diff --git a/libgomp/testsuite/libgomp.fortran/pr34020.f90 b/libgomp/testsuite/libgomp.fortran/pr34020.f90 new file mode 100644 index 00000000000..3bb14f5fe3d --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr34020.f90 @@ -0,0 +1,19 @@ +! PR fortran/34020 +! { dg-do run } + + subroutine atomic_add(lhs, rhs) + real lhs, rhs +!$omp atomic + lhs = rhs + lhs + end + + real lhs, rhs + integer i + lhs = 0 + rhs = 1 +!$omp parallel do num_threads(8) shared(lhs, rhs) + do i = 1, 300000 + call atomic_add(lhs, rhs) + enddo + if (lhs .ne. 300000) call abort + end diff --git a/libgomp/testsuite/libgomp.fortran/pr35130.f90 b/libgomp/testsuite/libgomp.fortran/pr35130.f90 new file mode 100644 index 00000000000..50ff351527a --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr35130.f90 @@ -0,0 +1,20 @@ +! PR middle-end/35130 + +program pr35130 + implicit none + real, dimension(20) :: a + integer :: k + a(:) = 0.0 +!$omp parallel do private(k) + do k=1,size(a) + call inner(k) + end do +!$omp end parallel do + if (any (a.ne.42)) call abort +contains + subroutine inner(i) + implicit none + integer :: i + a(i) = 42 + end subroutine inner +end program pr35130 diff --git a/libgomp/testsuite/libgomp.fortran/stack.f90 b/libgomp/testsuite/libgomp.fortran/stack.f90 new file mode 100644 index 00000000000..b27673d01fd --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/stack.f90 @@ -0,0 +1,21 @@ +! { dg-do run } +program stack + implicit none + integer id + integer ilocs(2) + integer omp_get_thread_num, foo + call omp_set_num_threads (2) +!$omp parallel private (id) + id = omp_get_thread_num() + 1 + ilocs(id) = foo() +!$omp end parallel + ! Check that the two threads are not sharing a location for + ! the array x in foo() + if (ilocs(1) .eq. ilocs(2)) call abort +end program stack + +integer function foo () + implicit none + real x(100,100) + foo = loc(x) +end function foo -- cgit v1.2.3