+2011-05-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/48894
+ * fortran.c: Include limits.h.
+ (TO_INT): Define.
+ (omp_set_dynamic_8_, omp_set_num_threads_8_): Use !!*set instead of
+ *set.
+ (omp_set_num_threads_8_, omp_set_schedule_8_,
+ omp_set_max_active_levels_8_, omp_get_ancestor_thread_num_8_,
+ omp_get_team_size_8_): Use TO_INT macro.
+ * testsuite/libgomp.fortran/pr48894.f90: New test.
+
2011-04-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/48591
-/* Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
#include "libgomp.h"
#include "libgomp_f.h"
#include <stdlib.h>
+#include <limits.h>
#ifdef HAVE_ATTRIBUTE_ALIAS
/* Use internal aliases if possible. */
omp_lock_symver (omp_test_nest_lock_)
#endif
+#define TO_INT(x) ((x) > INT_MIN ? (x) < INT_MAX ? (x) : INT_MAX : INT_MIN)
+
void
omp_set_dynamic_ (const int32_t *set)
{
void
omp_set_dynamic_8_ (const int64_t *set)
{
- omp_set_dynamic (*set);
+ omp_set_dynamic (!!*set);
}
void
void
omp_set_nested_8_ (const int64_t *set)
{
- omp_set_nested (*set);
+ omp_set_nested (!!*set);
}
void
void
omp_set_num_threads_8_ (const int64_t *set)
{
- omp_set_num_threads (*set);
+ omp_set_num_threads (TO_INT (*set));
}
int32_t
void
omp_set_schedule_8_ (const int32_t *kind, const int64_t *modifier)
{
- omp_set_schedule (*kind, *modifier);
+ omp_set_schedule (*kind, TO_INT (*modifier));
}
void
void
omp_set_max_active_levels_8_ (const int64_t *levels)
{
- omp_set_max_active_levels (*levels);
+ omp_set_max_active_levels (TO_INT (*levels));
}
int32_t
int32_t
omp_get_ancestor_thread_num_8_ (const int64_t *level)
{
- return omp_get_ancestor_thread_num (*level);
+ return omp_get_ancestor_thread_num (TO_INT (*level));
}
int32_t
int32_t
omp_get_team_size_8_ (const int64_t *level)
{
- return omp_get_team_size (*level);
+ return omp_get_team_size (TO_INT (*level));
}
int32_t
--- /dev/null
+! PR fortran/48894
+! { dg-do run }
+! { dg-options "-fdefault-integer-8" }
+
+ use omp_lib
+ integer, parameter :: zero = 0
+ integer :: err
+ logical :: l
+ err = 0
+ !$omp parallel
+ !$omp parallel private (l)
+ l = omp_get_ancestor_thread_num (-HUGE (zero)) .ne. -1
+ l = l .or. (omp_get_ancestor_thread_num (HUGE (zero)) .ne. -1)
+ l = l .or. (omp_get_team_size (-HUGE (zero)) .ne. -1)
+ l = l .or. (omp_get_team_size (HUGE (zero)) .ne. -1)
+ if (l) then
+ !$omp atomic
+ err = err + 1
+ endif
+ !$omp end parallel
+ !$omp end parallel
+ if (err .ne. 0) call abort
+end