diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0227-PR-fortran-48894.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0227-PR-fortran-48894.patch | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0227-PR-fortran-48894.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0227-PR-fortran-48894.patch new file mode 100644 index 0000000000..0c6de4ff54 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0227-PR-fortran-48894.patch | |||
@@ -0,0 +1,136 @@ | |||
1 | From ae55117ab726f901303318a546b5c8c66273579c Mon Sep 17 00:00:00 2001 | ||
2 | From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Fri, 6 May 2011 10:11:59 +0000 | ||
4 | Subject: [PATCH] PR fortran/48894 | ||
5 | * fortran.c: Include limits.h. | ||
6 | (TO_INT): Define. | ||
7 | (omp_set_dynamic_8_, omp_set_num_threads_8_): Use !!*set instead of | ||
8 | *set. | ||
9 | (omp_set_num_threads_8_, omp_set_schedule_8_, | ||
10 | omp_set_max_active_levels_8_, omp_get_ancestor_thread_num_8_, | ||
11 | omp_get_team_size_8_): Use TO_INT macro. | ||
12 | * testsuite/libgomp.fortran/pr48894.f90: New test. | ||
13 | |||
14 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173477 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
15 | |||
16 | index 53469f5..39bd748 100644 | ||
17 | --- a/libgomp/fortran.c | ||
18 | +++ b/libgomp/fortran.c | ||
19 | @@ -1,4 +1,4 @@ | ||
20 | -/* Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. | ||
21 | +/* Copyright (C) 2005, 2007, 2008, 2009, 2011 Free Software Foundation, Inc. | ||
22 | Contributed by Jakub Jelinek <jakub@redhat.com>. | ||
23 | |||
24 | This file is part of the GNU OpenMP Library (libgomp). | ||
25 | @@ -27,6 +27,7 @@ | ||
26 | #include "libgomp.h" | ||
27 | #include "libgomp_f.h" | ||
28 | #include <stdlib.h> | ||
29 | +#include <limits.h> | ||
30 | |||
31 | #ifdef HAVE_ATTRIBUTE_ALIAS | ||
32 | /* Use internal aliases if possible. */ | ||
33 | @@ -244,6 +245,8 @@ omp_lock_symver (omp_unset_nest_lock_) | ||
34 | omp_lock_symver (omp_test_nest_lock_) | ||
35 | #endif | ||
36 | |||
37 | +#define TO_INT(x) ((x) > INT_MIN ? (x) < INT_MAX ? (x) : INT_MAX : INT_MIN) | ||
38 | + | ||
39 | void | ||
40 | omp_set_dynamic_ (const int32_t *set) | ||
41 | { | ||
42 | @@ -253,7 +256,7 @@ omp_set_dynamic_ (const int32_t *set) | ||
43 | void | ||
44 | omp_set_dynamic_8_ (const int64_t *set) | ||
45 | { | ||
46 | - omp_set_dynamic (*set); | ||
47 | + omp_set_dynamic (!!*set); | ||
48 | } | ||
49 | |||
50 | void | ||
51 | @@ -265,7 +268,7 @@ omp_set_nested_ (const int32_t *set) | ||
52 | void | ||
53 | omp_set_nested_8_ (const int64_t *set) | ||
54 | { | ||
55 | - omp_set_nested (*set); | ||
56 | + omp_set_nested (!!*set); | ||
57 | } | ||
58 | |||
59 | void | ||
60 | @@ -277,7 +280,7 @@ omp_set_num_threads_ (const int32_t *set) | ||
61 | void | ||
62 | omp_set_num_threads_8_ (const int64_t *set) | ||
63 | { | ||
64 | - omp_set_num_threads (*set); | ||
65 | + omp_set_num_threads (TO_INT (*set)); | ||
66 | } | ||
67 | |||
68 | int32_t | ||
69 | @@ -343,7 +346,7 @@ omp_set_schedule_ (const int32_t *kind, const int32_t *modifier) | ||
70 | void | ||
71 | omp_set_schedule_8_ (const int32_t *kind, const int64_t *modifier) | ||
72 | { | ||
73 | - omp_set_schedule (*kind, *modifier); | ||
74 | + omp_set_schedule (*kind, TO_INT (*modifier)); | ||
75 | } | ||
76 | |||
77 | void | ||
78 | @@ -381,7 +384,7 @@ omp_set_max_active_levels_ (const int32_t *levels) | ||
79 | void | ||
80 | omp_set_max_active_levels_8_ (const int64_t *levels) | ||
81 | { | ||
82 | - omp_set_max_active_levels (*levels); | ||
83 | + omp_set_max_active_levels (TO_INT (*levels)); | ||
84 | } | ||
85 | |||
86 | int32_t | ||
87 | @@ -405,7 +408,7 @@ omp_get_ancestor_thread_num_ (const int32_t *level) | ||
88 | int32_t | ||
89 | omp_get_ancestor_thread_num_8_ (const int64_t *level) | ||
90 | { | ||
91 | - return omp_get_ancestor_thread_num (*level); | ||
92 | + return omp_get_ancestor_thread_num (TO_INT (*level)); | ||
93 | } | ||
94 | |||
95 | int32_t | ||
96 | @@ -417,7 +420,7 @@ omp_get_team_size_ (const int32_t *level) | ||
97 | int32_t | ||
98 | omp_get_team_size_8_ (const int64_t *level) | ||
99 | { | ||
100 | - return omp_get_team_size (*level); | ||
101 | + return omp_get_team_size (TO_INT (*level)); | ||
102 | } | ||
103 | |||
104 | int32_t | ||
105 | diff --git a/libgomp/testsuite/libgomp.fortran/pr48894.f90 b/libgomp/testsuite/libgomp.fortran/pr48894.f90 | ||
106 | new file mode 100644 | ||
107 | index 0000000..af35112 | ||
108 | --- /dev/null | ||
109 | +++ b/libgomp/testsuite/libgomp.fortran/pr48894.f90 | ||
110 | @@ -0,0 +1,23 @@ | ||
111 | +! PR fortran/48894 | ||
112 | +! { dg-do run } | ||
113 | +! { dg-options "-fdefault-integer-8" } | ||
114 | + | ||
115 | + use omp_lib | ||
116 | + integer, parameter :: zero = 0 | ||
117 | + integer :: err | ||
118 | + logical :: l | ||
119 | + err = 0 | ||
120 | + !$omp parallel | ||
121 | + !$omp parallel private (l) | ||
122 | + l = omp_get_ancestor_thread_num (-HUGE (zero)) .ne. -1 | ||
123 | + l = l .or. (omp_get_ancestor_thread_num (HUGE (zero)) .ne. -1) | ||
124 | + l = l .or. (omp_get_team_size (-HUGE (zero)) .ne. -1) | ||
125 | + l = l .or. (omp_get_team_size (HUGE (zero)) .ne. -1) | ||
126 | + if (l) then | ||
127 | + !$omp atomic | ||
128 | + err = err + 1 | ||
129 | + endif | ||
130 | + !$omp end parallel | ||
131 | + !$omp end parallel | ||
132 | + if (err .ne. 0) call abort | ||
133 | +end | ||
134 | -- | ||
135 | 1.7.0.4 | ||
136 | |||