]> git.pld-linux.org Git - packages/crossppc-gcc.git/blob - gcc-branch.diff
- updated.
[packages/crossppc-gcc.git] / gcc-branch.diff
1 Index: configure
2 ===================================================================
3 --- configure   (.../tags/gcc_4_2_0_release)    (revision 126002)
4 +++ configure   (.../branches/gcc-4_2-branch)   (revision 126002)
5 @@ -4769,12 +4769,14 @@
6    else
7      CC_FOR_TARGET="${ncn_target_tool_prefix}$2"
8    fi
9 +else
10 +  CC_FOR_TARGET="$ac_cv_prog_CC_FOR_TARGET"
11  fi
12  
13   if test -n "$with_build_time_tools"; then
14    for ncn_progname in c++ g++ cxx gxx; do
15      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
16 -echo "configure:4778: checking for ${ncn_progname} in $with_build_time_tools" >&5
17 +echo "configure:4780: checking for ${ncn_progname} in $with_build_time_tools" >&5
18      if test -x $with_build_time_tools/${ncn_progname}; then
19        ac_cv_prog_CXX_FOR_TARGET=$with_build_time_tools/${ncn_progname}
20        echo "$ac_t""yes" 1>&6
21 @@ -4791,7 +4793,7 @@
22        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
23  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
24  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
25 -echo "configure:4795: checking for $ac_word" >&5
26 +echo "configure:4797: checking for $ac_word" >&5
27  if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then
28    echo $ac_n "(cached) $ac_c" 1>&6
29  else
30 @@ -4822,7 +4824,7 @@
31        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
32  set dummy ${ncn_progname}; ac_word=$2
33  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
34 -echo "configure:4826: checking for $ac_word" >&5
35 +echo "configure:4828: checking for $ac_word" >&5
36  if eval "test \"`echo '$''{'ac_cv_prog_CXX_FOR_TARGET'+set}'`\" = set"; then
37    echo $ac_n "(cached) $ac_c" 1>&6
38  else
39 @@ -4860,12 +4862,14 @@
40    else
41      CXX_FOR_TARGET="${ncn_target_tool_prefix}$2"
42    fi
43 +else
44 +  CXX_FOR_TARGET="$ac_cv_prog_CXX_FOR_TARGET"
45  fi
46  
47   if test -n "$with_build_time_tools"; then
48    for ncn_progname in gcc; do
49      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
50 -echo "configure:4869: checking for ${ncn_progname} in $with_build_time_tools" >&5
51 +echo "configure:4873: checking for ${ncn_progname} in $with_build_time_tools" >&5
52      if test -x $with_build_time_tools/${ncn_progname}; then
53        ac_cv_prog_GCC_FOR_TARGET=$with_build_time_tools/${ncn_progname}
54        echo "$ac_t""yes" 1>&6
55 @@ -4882,7 +4886,7 @@
56        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
57  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
58  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
59 -echo "configure:4886: checking for $ac_word" >&5
60 +echo "configure:4890: checking for $ac_word" >&5
61  if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then
62    echo $ac_n "(cached) $ac_c" 1>&6
63  else
64 @@ -4913,7 +4917,7 @@
65        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
66  set dummy ${ncn_progname}; ac_word=$2
67  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
68 -echo "configure:4917: checking for $ac_word" >&5
69 +echo "configure:4921: checking for $ac_word" >&5
70  if eval "test \"`echo '$''{'ac_cv_prog_GCC_FOR_TARGET'+set}'`\" = set"; then
71    echo $ac_n "(cached) $ac_c" 1>&6
72  else
73 @@ -4946,12 +4950,14 @@
74    
75  if test -z "$ac_cv_prog_GCC_FOR_TARGET" ; then
76    GCC_FOR_TARGET="${CC_FOR_TARGET}"
77 +else
78 +  GCC_FOR_TARGET="$ac_cv_prog_GCC_FOR_TARGET"
79  fi
80  
81   if test -n "$with_build_time_tools"; then
82    for ncn_progname in gcj; do
83      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
84 -echo "configure:4955: checking for ${ncn_progname} in $with_build_time_tools" >&5
85 +echo "configure:4961: checking for ${ncn_progname} in $with_build_time_tools" >&5
86      if test -x $with_build_time_tools/${ncn_progname}; then
87        ac_cv_prog_GCJ_FOR_TARGET=$with_build_time_tools/${ncn_progname}
88        echo "$ac_t""yes" 1>&6
89 @@ -4968,7 +4974,7 @@
90        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
91  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
92  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
93 -echo "configure:4972: checking for $ac_word" >&5
94 +echo "configure:4978: checking for $ac_word" >&5
95  if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then
96    echo $ac_n "(cached) $ac_c" 1>&6
97  else
98 @@ -4999,7 +5005,7 @@
99        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
100  set dummy ${ncn_progname}; ac_word=$2
101  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
102 -echo "configure:5003: checking for $ac_word" >&5
103 +echo "configure:5009: checking for $ac_word" >&5
104  if eval "test \"`echo '$''{'ac_cv_prog_GCJ_FOR_TARGET'+set}'`\" = set"; then
105    echo $ac_n "(cached) $ac_c" 1>&6
106  else
107 @@ -5037,12 +5043,14 @@
108    else
109      GCJ_FOR_TARGET="${ncn_target_tool_prefix}$2"
110    fi
111 +else
112 +  GCJ_FOR_TARGET="$ac_cv_prog_GCJ_FOR_TARGET"
113  fi
114  
115   if test -n "$with_build_time_tools"; then
116    for ncn_progname in gfortran; do
117      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
118 -echo "configure:5046: checking for ${ncn_progname} in $with_build_time_tools" >&5
119 +echo "configure:5054: checking for ${ncn_progname} in $with_build_time_tools" >&5
120      if test -x $with_build_time_tools/${ncn_progname}; then
121        ac_cv_prog_GFORTRAN_FOR_TARGET=$with_build_time_tools/${ncn_progname}
122        echo "$ac_t""yes" 1>&6
123 @@ -5059,7 +5067,7 @@
124        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
125  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
126  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
127 -echo "configure:5063: checking for $ac_word" >&5
128 +echo "configure:5071: checking for $ac_word" >&5
129  if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then
130    echo $ac_n "(cached) $ac_c" 1>&6
131  else
132 @@ -5090,7 +5098,7 @@
133        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
134  set dummy ${ncn_progname}; ac_word=$2
135  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
136 -echo "configure:5094: checking for $ac_word" >&5
137 +echo "configure:5102: checking for $ac_word" >&5
138  if eval "test \"`echo '$''{'ac_cv_prog_GFORTRAN_FOR_TARGET'+set}'`\" = set"; then
139    echo $ac_n "(cached) $ac_c" 1>&6
140  else
141 @@ -5128,6 +5136,8 @@
142    else
143      GFORTRAN_FOR_TARGET="${ncn_target_tool_prefix}$2"
144    fi
145 +else
146 +  GFORTRAN_FOR_TARGET="$ac_cv_prog_GFORTRAN_FOR_TARGET"
147  fi
148  
149  
150 @@ -5197,7 +5207,7 @@
151  if test -z "$ac_cv_path_AR_FOR_TARGET" ; then
152    if test -n "$with_build_time_tools"; then
153      echo $ac_n "checking for ar in $with_build_time_tools""... $ac_c" 1>&6
154 -echo "configure:5201: checking for ar in $with_build_time_tools" >&5
155 +echo "configure:5211: checking for ar in $with_build_time_tools" >&5
156      if test -x $with_build_time_tools/ar; then
157        AR_FOR_TARGET=`cd $with_build_time_tools && pwd`/ar
158        ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET
159 @@ -5208,14 +5218,14 @@
160    elif test $build != $host && test $have_gcc_for_target = yes; then
161      AR_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ar`
162      test $AR_FOR_TARGET=ar && AR_FOR_TARGET=
163 -    ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET
164 +    test -n "$AR_FOR_TARGET" && ac_cv_path_AR_FOR_TARGET=$AR_FOR_TARGET
165    fi
166  fi
167  if test -z "$ac_cv_path_AR_FOR_TARGET" ; then
168    # Extract the first word of "ar", so it can be a program name with args.
169  set dummy ar; ac_word=$2
170  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
171 -echo "configure:5219: checking for $ac_word" >&5
172 +echo "configure:5229: checking for $ac_word" >&5
173  if eval "test \"`echo '$''{'ac_cv_path_AR_FOR_TARGET'+set}'`\" = set"; then
174    echo $ac_n "(cached) $ac_c" 1>&6
175  else
176 @@ -5252,7 +5262,7 @@
177     if test -n "$with_build_time_tools"; then
178    for ncn_progname in ar; do
179      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
180 -echo "configure:5256: checking for ${ncn_progname} in $with_build_time_tools" >&5
181 +echo "configure:5266: checking for ${ncn_progname} in $with_build_time_tools" >&5
182      if test -x $with_build_time_tools/${ncn_progname}; then
183        ac_cv_prog_AR_FOR_TARGET=$with_build_time_tools/${ncn_progname}
184        echo "$ac_t""yes" 1>&6
185 @@ -5269,7 +5279,7 @@
186        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
187  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
188  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
189 -echo "configure:5273: checking for $ac_word" >&5
190 +echo "configure:5283: checking for $ac_word" >&5
191  if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then
192    echo $ac_n "(cached) $ac_c" 1>&6
193  else
194 @@ -5300,7 +5310,7 @@
195        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
196  set dummy ${ncn_progname}; ac_word=$2
197  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
198 -echo "configure:5304: checking for $ac_word" >&5
199 +echo "configure:5314: checking for $ac_word" >&5
200  if eval "test \"`echo '$''{'ac_cv_prog_AR_FOR_TARGET'+set}'`\" = set"; then
201    echo $ac_n "(cached) $ac_c" 1>&6
202  else
203 @@ -5338,6 +5348,8 @@
204    else
205      AR_FOR_TARGET="${ncn_target_tool_prefix}$2"
206    fi
207 +else
208 +  AR_FOR_TARGET="$ac_cv_prog_AR_FOR_TARGET"
209  fi
210  
211  else
212 @@ -5350,7 +5362,7 @@
213  if test -z "$ac_cv_path_AS_FOR_TARGET" ; then
214    if test -n "$with_build_time_tools"; then
215      echo $ac_n "checking for as in $with_build_time_tools""... $ac_c" 1>&6
216 -echo "configure:5354: checking for as in $with_build_time_tools" >&5
217 +echo "configure:5366: checking for as in $with_build_time_tools" >&5
218      if test -x $with_build_time_tools/as; then
219        AS_FOR_TARGET=`cd $with_build_time_tools && pwd`/as
220        ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET
221 @@ -5361,14 +5373,14 @@
222    elif test $build != $host && test $have_gcc_for_target = yes; then
223      AS_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=as`
224      test $AS_FOR_TARGET=as && AS_FOR_TARGET=
225 -    ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET
226 +    test -n "$AS_FOR_TARGET" && ac_cv_path_AS_FOR_TARGET=$AS_FOR_TARGET
227    fi
228  fi
229  if test -z "$ac_cv_path_AS_FOR_TARGET" ; then
230    # Extract the first word of "as", so it can be a program name with args.
231  set dummy as; ac_word=$2
232  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
233 -echo "configure:5372: checking for $ac_word" >&5
234 +echo "configure:5384: checking for $ac_word" >&5
235  if eval "test \"`echo '$''{'ac_cv_path_AS_FOR_TARGET'+set}'`\" = set"; then
236    echo $ac_n "(cached) $ac_c" 1>&6
237  else
238 @@ -5405,7 +5417,7 @@
239     if test -n "$with_build_time_tools"; then
240    for ncn_progname in as; do
241      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
242 -echo "configure:5409: checking for ${ncn_progname} in $with_build_time_tools" >&5
243 +echo "configure:5421: checking for ${ncn_progname} in $with_build_time_tools" >&5
244      if test -x $with_build_time_tools/${ncn_progname}; then
245        ac_cv_prog_AS_FOR_TARGET=$with_build_time_tools/${ncn_progname}
246        echo "$ac_t""yes" 1>&6
247 @@ -5422,7 +5434,7 @@
248        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
249  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
250  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
251 -echo "configure:5426: checking for $ac_word" >&5
252 +echo "configure:5438: checking for $ac_word" >&5
253  if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then
254    echo $ac_n "(cached) $ac_c" 1>&6
255  else
256 @@ -5453,7 +5465,7 @@
257        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
258  set dummy ${ncn_progname}; ac_word=$2
259  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
260 -echo "configure:5457: checking for $ac_word" >&5
261 +echo "configure:5469: checking for $ac_word" >&5
262  if eval "test \"`echo '$''{'ac_cv_prog_AS_FOR_TARGET'+set}'`\" = set"; then
263    echo $ac_n "(cached) $ac_c" 1>&6
264  else
265 @@ -5491,6 +5503,8 @@
266    else
267      AS_FOR_TARGET="${ncn_target_tool_prefix}$2"
268    fi
269 +else
270 +  AS_FOR_TARGET="$ac_cv_prog_AS_FOR_TARGET"
271  fi
272  
273  else
274 @@ -5503,7 +5517,7 @@
275  if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then
276    if test -n "$with_build_time_tools"; then
277      echo $ac_n "checking for dlltool in $with_build_time_tools""... $ac_c" 1>&6
278 -echo "configure:5507: checking for dlltool in $with_build_time_tools" >&5
279 +echo "configure:5521: checking for dlltool in $with_build_time_tools" >&5
280      if test -x $with_build_time_tools/dlltool; then
281        DLLTOOL_FOR_TARGET=`cd $with_build_time_tools && pwd`/dlltool
282        ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET
283 @@ -5514,14 +5528,14 @@
284    elif test $build != $host && test $have_gcc_for_target = yes; then
285      DLLTOOL_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=dlltool`
286      test $DLLTOOL_FOR_TARGET=dlltool && DLLTOOL_FOR_TARGET=
287 -    ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET
288 +    test -n "$DLLTOOL_FOR_TARGET" && ac_cv_path_DLLTOOL_FOR_TARGET=$DLLTOOL_FOR_TARGET
289    fi
290  fi
291  if test -z "$ac_cv_path_DLLTOOL_FOR_TARGET" ; then
292    # Extract the first word of "dlltool", so it can be a program name with args.
293  set dummy dlltool; ac_word=$2
294  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
295 -echo "configure:5525: checking for $ac_word" >&5
296 +echo "configure:5539: checking for $ac_word" >&5
297  if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
298    echo $ac_n "(cached) $ac_c" 1>&6
299  else
300 @@ -5558,7 +5572,7 @@
301     if test -n "$with_build_time_tools"; then
302    for ncn_progname in dlltool; do
303      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
304 -echo "configure:5562: checking for ${ncn_progname} in $with_build_time_tools" >&5
305 +echo "configure:5576: checking for ${ncn_progname} in $with_build_time_tools" >&5
306      if test -x $with_build_time_tools/${ncn_progname}; then
307        ac_cv_prog_DLLTOOL_FOR_TARGET=$with_build_time_tools/${ncn_progname}
308        echo "$ac_t""yes" 1>&6
309 @@ -5575,7 +5589,7 @@
310        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
311  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
312  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
313 -echo "configure:5579: checking for $ac_word" >&5
314 +echo "configure:5593: checking for $ac_word" >&5
315  if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
316    echo $ac_n "(cached) $ac_c" 1>&6
317  else
318 @@ -5606,7 +5620,7 @@
319        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
320  set dummy ${ncn_progname}; ac_word=$2
321  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
322 -echo "configure:5610: checking for $ac_word" >&5
323 +echo "configure:5624: checking for $ac_word" >&5
324  if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then
325    echo $ac_n "(cached) $ac_c" 1>&6
326  else
327 @@ -5644,6 +5658,8 @@
328    else
329      DLLTOOL_FOR_TARGET="${ncn_target_tool_prefix}$2"
330    fi
331 +else
332 +  DLLTOOL_FOR_TARGET="$ac_cv_prog_DLLTOOL_FOR_TARGET"
333  fi
334  
335  else
336 @@ -5656,7 +5672,7 @@
337  if test -z "$ac_cv_path_LD_FOR_TARGET" ; then
338    if test -n "$with_build_time_tools"; then
339      echo $ac_n "checking for ld in $with_build_time_tools""... $ac_c" 1>&6
340 -echo "configure:5660: checking for ld in $with_build_time_tools" >&5
341 +echo "configure:5676: checking for ld in $with_build_time_tools" >&5
342      if test -x $with_build_time_tools/ld; then
343        LD_FOR_TARGET=`cd $with_build_time_tools && pwd`/ld
344        ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET
345 @@ -5667,14 +5683,14 @@
346    elif test $build != $host && test $have_gcc_for_target = yes; then
347      LD_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ld`
348      test $LD_FOR_TARGET=ld && LD_FOR_TARGET=
349 -    ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET
350 +    test -n "$LD_FOR_TARGET" && ac_cv_path_LD_FOR_TARGET=$LD_FOR_TARGET
351    fi
352  fi
353  if test -z "$ac_cv_path_LD_FOR_TARGET" ; then
354    # Extract the first word of "ld", so it can be a program name with args.
355  set dummy ld; ac_word=$2
356  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
357 -echo "configure:5678: checking for $ac_word" >&5
358 +echo "configure:5694: checking for $ac_word" >&5
359  if eval "test \"`echo '$''{'ac_cv_path_LD_FOR_TARGET'+set}'`\" = set"; then
360    echo $ac_n "(cached) $ac_c" 1>&6
361  else
362 @@ -5711,7 +5727,7 @@
363     if test -n "$with_build_time_tools"; then
364    for ncn_progname in ld; do
365      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
366 -echo "configure:5715: checking for ${ncn_progname} in $with_build_time_tools" >&5
367 +echo "configure:5731: checking for ${ncn_progname} in $with_build_time_tools" >&5
368      if test -x $with_build_time_tools/${ncn_progname}; then
369        ac_cv_prog_LD_FOR_TARGET=$with_build_time_tools/${ncn_progname}
370        echo "$ac_t""yes" 1>&6
371 @@ -5728,7 +5744,7 @@
372        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
373  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
374  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
375 -echo "configure:5732: checking for $ac_word" >&5
376 +echo "configure:5748: checking for $ac_word" >&5
377  if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then
378    echo $ac_n "(cached) $ac_c" 1>&6
379  else
380 @@ -5759,7 +5775,7 @@
381        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
382  set dummy ${ncn_progname}; ac_word=$2
383  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
384 -echo "configure:5763: checking for $ac_word" >&5
385 +echo "configure:5779: checking for $ac_word" >&5
386  if eval "test \"`echo '$''{'ac_cv_prog_LD_FOR_TARGET'+set}'`\" = set"; then
387    echo $ac_n "(cached) $ac_c" 1>&6
388  else
389 @@ -5797,6 +5813,8 @@
390    else
391      LD_FOR_TARGET="${ncn_target_tool_prefix}$2"
392    fi
393 +else
394 +  LD_FOR_TARGET="$ac_cv_prog_LD_FOR_TARGET"
395  fi
396  
397  else
398 @@ -5809,7 +5827,7 @@
399  if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then
400    if test -n "$with_build_time_tools"; then
401      echo $ac_n "checking for lipo in $with_build_time_tools""... $ac_c" 1>&6
402 -echo "configure:5813: checking for lipo in $with_build_time_tools" >&5
403 +echo "configure:5831: checking for lipo in $with_build_time_tools" >&5
404      if test -x $with_build_time_tools/lipo; then
405        LIPO_FOR_TARGET=`cd $with_build_time_tools && pwd`/lipo
406        ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET
407 @@ -5820,14 +5838,14 @@
408    elif test $build != $host && test $have_gcc_for_target = yes; then
409      LIPO_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=lipo`
410      test $LIPO_FOR_TARGET=lipo && LIPO_FOR_TARGET=
411 -    ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET
412 +    test -n "$LIPO_FOR_TARGET" && ac_cv_path_LIPO_FOR_TARGET=$LIPO_FOR_TARGET
413    fi
414  fi
415  if test -z "$ac_cv_path_LIPO_FOR_TARGET" ; then
416    # Extract the first word of "lipo", so it can be a program name with args.
417  set dummy lipo; ac_word=$2
418  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
419 -echo "configure:5831: checking for $ac_word" >&5
420 +echo "configure:5849: checking for $ac_word" >&5
421  if eval "test \"`echo '$''{'ac_cv_path_LIPO_FOR_TARGET'+set}'`\" = set"; then
422    echo $ac_n "(cached) $ac_c" 1>&6
423  else
424 @@ -5864,7 +5882,7 @@
425     if test -n "$with_build_time_tools"; then
426    for ncn_progname in lipo; do
427      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
428 -echo "configure:5868: checking for ${ncn_progname} in $with_build_time_tools" >&5
429 +echo "configure:5886: checking for ${ncn_progname} in $with_build_time_tools" >&5
430      if test -x $with_build_time_tools/${ncn_progname}; then
431        ac_cv_prog_LIPO_FOR_TARGET=$with_build_time_tools/${ncn_progname}
432        echo "$ac_t""yes" 1>&6
433 @@ -5881,7 +5899,7 @@
434        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
435  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
436  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
437 -echo "configure:5885: checking for $ac_word" >&5
438 +echo "configure:5903: checking for $ac_word" >&5
439  if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then
440    echo $ac_n "(cached) $ac_c" 1>&6
441  else
442 @@ -5912,7 +5930,7 @@
443        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
444  set dummy ${ncn_progname}; ac_word=$2
445  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
446 -echo "configure:5916: checking for $ac_word" >&5
447 +echo "configure:5934: checking for $ac_word" >&5
448  if eval "test \"`echo '$''{'ac_cv_prog_LIPO_FOR_TARGET'+set}'`\" = set"; then
449    echo $ac_n "(cached) $ac_c" 1>&6
450  else
451 @@ -5950,6 +5968,8 @@
452    else
453      LIPO_FOR_TARGET="${ncn_target_tool_prefix}$2"
454    fi
455 +else
456 +  LIPO_FOR_TARGET="$ac_cv_prog_LIPO_FOR_TARGET"
457  fi
458  
459  else
460 @@ -5962,7 +5982,7 @@
461  if test -z "$ac_cv_path_NM_FOR_TARGET" ; then
462    if test -n "$with_build_time_tools"; then
463      echo $ac_n "checking for nm in $with_build_time_tools""... $ac_c" 1>&6
464 -echo "configure:5966: checking for nm in $with_build_time_tools" >&5
465 +echo "configure:5986: checking for nm in $with_build_time_tools" >&5
466      if test -x $with_build_time_tools/nm; then
467        NM_FOR_TARGET=`cd $with_build_time_tools && pwd`/nm
468        ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET
469 @@ -5973,14 +5993,14 @@
470    elif test $build != $host && test $have_gcc_for_target = yes; then
471      NM_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=nm`
472      test $NM_FOR_TARGET=nm && NM_FOR_TARGET=
473 -    ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET
474 +    test -n "$NM_FOR_TARGET" && ac_cv_path_NM_FOR_TARGET=$NM_FOR_TARGET
475    fi
476  fi
477  if test -z "$ac_cv_path_NM_FOR_TARGET" ; then
478    # Extract the first word of "nm", so it can be a program name with args.
479  set dummy nm; ac_word=$2
480  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
481 -echo "configure:5984: checking for $ac_word" >&5
482 +echo "configure:6004: checking for $ac_word" >&5
483  if eval "test \"`echo '$''{'ac_cv_path_NM_FOR_TARGET'+set}'`\" = set"; then
484    echo $ac_n "(cached) $ac_c" 1>&6
485  else
486 @@ -6017,7 +6037,7 @@
487     if test -n "$with_build_time_tools"; then
488    for ncn_progname in nm; do
489      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
490 -echo "configure:6021: checking for ${ncn_progname} in $with_build_time_tools" >&5
491 +echo "configure:6041: checking for ${ncn_progname} in $with_build_time_tools" >&5
492      if test -x $with_build_time_tools/${ncn_progname}; then
493        ac_cv_prog_NM_FOR_TARGET=$with_build_time_tools/${ncn_progname}
494        echo "$ac_t""yes" 1>&6
495 @@ -6034,7 +6054,7 @@
496        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
497  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
498  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
499 -echo "configure:6038: checking for $ac_word" >&5
500 +echo "configure:6058: checking for $ac_word" >&5
501  if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then
502    echo $ac_n "(cached) $ac_c" 1>&6
503  else
504 @@ -6065,7 +6085,7 @@
505        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
506  set dummy ${ncn_progname}; ac_word=$2
507  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
508 -echo "configure:6069: checking for $ac_word" >&5
509 +echo "configure:6089: checking for $ac_word" >&5
510  if eval "test \"`echo '$''{'ac_cv_prog_NM_FOR_TARGET'+set}'`\" = set"; then
511    echo $ac_n "(cached) $ac_c" 1>&6
512  else
513 @@ -6103,6 +6123,8 @@
514    else
515      NM_FOR_TARGET="${ncn_target_tool_prefix}$2"
516    fi
517 +else
518 +  NM_FOR_TARGET="$ac_cv_prog_NM_FOR_TARGET"
519  fi
520  
521  else
522 @@ -6115,7 +6137,7 @@
523  if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then
524    if test -n "$with_build_time_tools"; then
525      echo $ac_n "checking for objdump in $with_build_time_tools""... $ac_c" 1>&6
526 -echo "configure:6119: checking for objdump in $with_build_time_tools" >&5
527 +echo "configure:6141: checking for objdump in $with_build_time_tools" >&5
528      if test -x $with_build_time_tools/objdump; then
529        OBJDUMP_FOR_TARGET=`cd $with_build_time_tools && pwd`/objdump
530        ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET
531 @@ -6126,14 +6148,14 @@
532    elif test $build != $host && test $have_gcc_for_target = yes; then
533      OBJDUMP_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=objdump`
534      test $OBJDUMP_FOR_TARGET=objdump && OBJDUMP_FOR_TARGET=
535 -    ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET
536 +    test -n "$OBJDUMP_FOR_TARGET" && ac_cv_path_OBJDUMP_FOR_TARGET=$OBJDUMP_FOR_TARGET
537    fi
538  fi
539  if test -z "$ac_cv_path_OBJDUMP_FOR_TARGET" ; then
540    # Extract the first word of "objdump", so it can be a program name with args.
541  set dummy objdump; ac_word=$2
542  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
543 -echo "configure:6137: checking for $ac_word" >&5
544 +echo "configure:6159: checking for $ac_word" >&5
545  if eval "test \"`echo '$''{'ac_cv_path_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then
546    echo $ac_n "(cached) $ac_c" 1>&6
547  else
548 @@ -6170,7 +6192,7 @@
549     if test -n "$with_build_time_tools"; then
550    for ncn_progname in objdump; do
551      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
552 -echo "configure:6174: checking for ${ncn_progname} in $with_build_time_tools" >&5
553 +echo "configure:6196: checking for ${ncn_progname} in $with_build_time_tools" >&5
554      if test -x $with_build_time_tools/${ncn_progname}; then
555        ac_cv_prog_OBJDUMP_FOR_TARGET=$with_build_time_tools/${ncn_progname}
556        echo "$ac_t""yes" 1>&6
557 @@ -6187,7 +6209,7 @@
558        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
559  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
560  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
561 -echo "configure:6191: checking for $ac_word" >&5
562 +echo "configure:6213: checking for $ac_word" >&5
563  if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then
564    echo $ac_n "(cached) $ac_c" 1>&6
565  else
566 @@ -6218,7 +6240,7 @@
567        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
568  set dummy ${ncn_progname}; ac_word=$2
569  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
570 -echo "configure:6222: checking for $ac_word" >&5
571 +echo "configure:6244: checking for $ac_word" >&5
572  if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP_FOR_TARGET'+set}'`\" = set"; then
573    echo $ac_n "(cached) $ac_c" 1>&6
574  else
575 @@ -6256,6 +6278,8 @@
576    else
577      OBJDUMP_FOR_TARGET="${ncn_target_tool_prefix}$2"
578    fi
579 +else
580 +  OBJDUMP_FOR_TARGET="$ac_cv_prog_OBJDUMP_FOR_TARGET"
581  fi
582  
583  else
584 @@ -6268,7 +6292,7 @@
585  if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then
586    if test -n "$with_build_time_tools"; then
587      echo $ac_n "checking for ranlib in $with_build_time_tools""... $ac_c" 1>&6
588 -echo "configure:6272: checking for ranlib in $with_build_time_tools" >&5
589 +echo "configure:6296: checking for ranlib in $with_build_time_tools" >&5
590      if test -x $with_build_time_tools/ranlib; then
591        RANLIB_FOR_TARGET=`cd $with_build_time_tools && pwd`/ranlib
592        ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET
593 @@ -6279,14 +6303,14 @@
594    elif test $build != $host && test $have_gcc_for_target = yes; then
595      RANLIB_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=ranlib`
596      test $RANLIB_FOR_TARGET=ranlib && RANLIB_FOR_TARGET=
597 -    ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET
598 +    test -n "$RANLIB_FOR_TARGET" && ac_cv_path_RANLIB_FOR_TARGET=$RANLIB_FOR_TARGET
599    fi
600  fi
601  if test -z "$ac_cv_path_RANLIB_FOR_TARGET" ; then
602    # Extract the first word of "ranlib", so it can be a program name with args.
603  set dummy ranlib; ac_word=$2
604  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
605 -echo "configure:6290: checking for $ac_word" >&5
606 +echo "configure:6314: checking for $ac_word" >&5
607  if eval "test \"`echo '$''{'ac_cv_path_RANLIB_FOR_TARGET'+set}'`\" = set"; then
608    echo $ac_n "(cached) $ac_c" 1>&6
609  else
610 @@ -6323,7 +6347,7 @@
611     if test -n "$with_build_time_tools"; then
612    for ncn_progname in ranlib; do
613      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
614 -echo "configure:6327: checking for ${ncn_progname} in $with_build_time_tools" >&5
615 +echo "configure:6351: checking for ${ncn_progname} in $with_build_time_tools" >&5
616      if test -x $with_build_time_tools/${ncn_progname}; then
617        ac_cv_prog_RANLIB_FOR_TARGET=$with_build_time_tools/${ncn_progname}
618        echo "$ac_t""yes" 1>&6
619 @@ -6340,7 +6364,7 @@
620        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
621  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
622  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
623 -echo "configure:6344: checking for $ac_word" >&5
624 +echo "configure:6368: checking for $ac_word" >&5
625  if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then
626    echo $ac_n "(cached) $ac_c" 1>&6
627  else
628 @@ -6371,7 +6395,7 @@
629        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
630  set dummy ${ncn_progname}; ac_word=$2
631  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
632 -echo "configure:6375: checking for $ac_word" >&5
633 +echo "configure:6399: checking for $ac_word" >&5
634  if eval "test \"`echo '$''{'ac_cv_prog_RANLIB_FOR_TARGET'+set}'`\" = set"; then
635    echo $ac_n "(cached) $ac_c" 1>&6
636  else
637 @@ -6409,6 +6433,8 @@
638    else
639      RANLIB_FOR_TARGET="${ncn_target_tool_prefix}$2"
640    fi
641 +else
642 +  RANLIB_FOR_TARGET="$ac_cv_prog_RANLIB_FOR_TARGET"
643  fi
644  
645  else
646 @@ -6421,7 +6447,7 @@
647  if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then
648    if test -n "$with_build_time_tools"; then
649      echo $ac_n "checking for strip in $with_build_time_tools""... $ac_c" 1>&6
650 -echo "configure:6425: checking for strip in $with_build_time_tools" >&5
651 +echo "configure:6451: checking for strip in $with_build_time_tools" >&5
652      if test -x $with_build_time_tools/strip; then
653        STRIP_FOR_TARGET=`cd $with_build_time_tools && pwd`/strip
654        ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET
655 @@ -6432,14 +6458,14 @@
656    elif test $build != $host && test $have_gcc_for_target = yes; then
657      STRIP_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=strip`
658      test $STRIP_FOR_TARGET=strip && STRIP_FOR_TARGET=
659 -    ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET
660 +    test -n "$STRIP_FOR_TARGET" && ac_cv_path_STRIP_FOR_TARGET=$STRIP_FOR_TARGET
661    fi
662  fi
663  if test -z "$ac_cv_path_STRIP_FOR_TARGET" ; then
664    # Extract the first word of "strip", so it can be a program name with args.
665  set dummy strip; ac_word=$2
666  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
667 -echo "configure:6443: checking for $ac_word" >&5
668 +echo "configure:6469: checking for $ac_word" >&5
669  if eval "test \"`echo '$''{'ac_cv_path_STRIP_FOR_TARGET'+set}'`\" = set"; then
670    echo $ac_n "(cached) $ac_c" 1>&6
671  else
672 @@ -6476,7 +6502,7 @@
673     if test -n "$with_build_time_tools"; then
674    for ncn_progname in strip; do
675      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
676 -echo "configure:6480: checking for ${ncn_progname} in $with_build_time_tools" >&5
677 +echo "configure:6506: checking for ${ncn_progname} in $with_build_time_tools" >&5
678      if test -x $with_build_time_tools/${ncn_progname}; then
679        ac_cv_prog_STRIP_FOR_TARGET=$with_build_time_tools/${ncn_progname}
680        echo "$ac_t""yes" 1>&6
681 @@ -6493,7 +6519,7 @@
682        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
683  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
684  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
685 -echo "configure:6497: checking for $ac_word" >&5
686 +echo "configure:6523: checking for $ac_word" >&5
687  if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then
688    echo $ac_n "(cached) $ac_c" 1>&6
689  else
690 @@ -6524,7 +6550,7 @@
691        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
692  set dummy ${ncn_progname}; ac_word=$2
693  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
694 -echo "configure:6528: checking for $ac_word" >&5
695 +echo "configure:6554: checking for $ac_word" >&5
696  if eval "test \"`echo '$''{'ac_cv_prog_STRIP_FOR_TARGET'+set}'`\" = set"; then
697    echo $ac_n "(cached) $ac_c" 1>&6
698  else
699 @@ -6562,6 +6588,8 @@
700    else
701      STRIP_FOR_TARGET="${ncn_target_tool_prefix}$2"
702    fi
703 +else
704 +  STRIP_FOR_TARGET="$ac_cv_prog_STRIP_FOR_TARGET"
705  fi
706  
707  else
708 @@ -6574,7 +6602,7 @@
709  if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then
710    if test -n "$with_build_time_tools"; then
711      echo $ac_n "checking for windres in $with_build_time_tools""... $ac_c" 1>&6
712 -echo "configure:6578: checking for windres in $with_build_time_tools" >&5
713 +echo "configure:6606: checking for windres in $with_build_time_tools" >&5
714      if test -x $with_build_time_tools/windres; then
715        WINDRES_FOR_TARGET=`cd $with_build_time_tools && pwd`/windres
716        ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET
717 @@ -6585,14 +6613,14 @@
718    elif test $build != $host && test $have_gcc_for_target = yes; then
719      WINDRES_FOR_TARGET=`$GCC_FOR_TARGET --print-prog-name=windres`
720      test $WINDRES_FOR_TARGET=windres && WINDRES_FOR_TARGET=
721 -    ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET
722 +    test -n "$WINDRES_FOR_TARGET" && ac_cv_path_WINDRES_FOR_TARGET=$WINDRES_FOR_TARGET
723    fi
724  fi
725  if test -z "$ac_cv_path_WINDRES_FOR_TARGET" ; then
726    # Extract the first word of "windres", so it can be a program name with args.
727  set dummy windres; ac_word=$2
728  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
729 -echo "configure:6596: checking for $ac_word" >&5
730 +echo "configure:6624: checking for $ac_word" >&5
731  if eval "test \"`echo '$''{'ac_cv_path_WINDRES_FOR_TARGET'+set}'`\" = set"; then
732    echo $ac_n "(cached) $ac_c" 1>&6
733  else
734 @@ -6629,7 +6657,7 @@
735     if test -n "$with_build_time_tools"; then
736    for ncn_progname in windres; do
737      echo $ac_n "checking for ${ncn_progname} in $with_build_time_tools""... $ac_c" 1>&6
738 -echo "configure:6633: checking for ${ncn_progname} in $with_build_time_tools" >&5
739 +echo "configure:6661: checking for ${ncn_progname} in $with_build_time_tools" >&5
740      if test -x $with_build_time_tools/${ncn_progname}; then
741        ac_cv_prog_WINDRES_FOR_TARGET=$with_build_time_tools/${ncn_progname}
742        echo "$ac_t""yes" 1>&6
743 @@ -6646,7 +6674,7 @@
744        # Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
745  set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
746  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
747 -echo "configure:6650: checking for $ac_word" >&5
748 +echo "configure:6678: checking for $ac_word" >&5
749  if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then
750    echo $ac_n "(cached) $ac_c" 1>&6
751  else
752 @@ -6677,7 +6705,7 @@
753        # Extract the first word of "${ncn_progname}", so it can be a program name with args.
754  set dummy ${ncn_progname}; ac_word=$2
755  echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
756 -echo "configure:6681: checking for $ac_word" >&5
757 +echo "configure:6709: checking for $ac_word" >&5
758  if eval "test \"`echo '$''{'ac_cv_prog_WINDRES_FOR_TARGET'+set}'`\" = set"; then
759    echo $ac_n "(cached) $ac_c" 1>&6
760  else
761 @@ -6715,6 +6743,8 @@
762    else
763      WINDRES_FOR_TARGET="${ncn_target_tool_prefix}$2"
764    fi
765 +else
766 +  WINDRES_FOR_TARGET="$ac_cv_prog_WINDRES_FOR_TARGET"
767  fi
768  
769  else
770 @@ -6725,7 +6755,7 @@
771  RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
772  
773  echo $ac_n "checking where to find the target ar""... $ac_c" 1>&6
774 -echo "configure:6729: checking where to find the target ar" >&5
775 +echo "configure:6759: checking where to find the target ar" >&5
776  if test "x${build}" != "x${host}" ; then
777    if expr "x$AR_FOR_TARGET" : "x/" > /dev/null; then
778      # We already found the complete path
779 @@ -6758,7 +6788,7 @@
780    fi
781  fi
782  echo $ac_n "checking where to find the target as""... $ac_c" 1>&6
783 -echo "configure:6762: checking where to find the target as" >&5
784 +echo "configure:6792: checking where to find the target as" >&5
785  if test "x${build}" != "x${host}" ; then
786    if expr "x$AS_FOR_TARGET" : "x/" > /dev/null; then
787      # We already found the complete path
788 @@ -6791,7 +6821,7 @@
789    fi
790  fi
791  echo $ac_n "checking where to find the target cc""... $ac_c" 1>&6
792 -echo "configure:6795: checking where to find the target cc" >&5
793 +echo "configure:6825: checking where to find the target cc" >&5
794  if test "x${build}" != "x${host}" ; then
795    if expr "x$CC_FOR_TARGET" : "x/" > /dev/null; then
796      # We already found the complete path
797 @@ -6824,7 +6854,7 @@
798    fi
799  fi
800  echo $ac_n "checking where to find the target c++""... $ac_c" 1>&6
801 -echo "configure:6828: checking where to find the target c++" >&5
802 +echo "configure:6858: checking where to find the target c++" >&5
803  if test "x${build}" != "x${host}" ; then
804    if expr "x$CXX_FOR_TARGET" : "x/" > /dev/null; then
805      # We already found the complete path
806 @@ -6860,7 +6890,7 @@
807    fi
808  fi
809  echo $ac_n "checking where to find the target c++ for libstdc++""... $ac_c" 1>&6
810 -echo "configure:6864: checking where to find the target c++ for libstdc++" >&5
811 +echo "configure:6894: checking where to find the target c++ for libstdc++" >&5
812  if test "x${build}" != "x${host}" ; then
813    if expr "x$RAW_CXX_FOR_TARGET" : "x/" > /dev/null; then
814      # We already found the complete path
815 @@ -6896,7 +6926,7 @@
816    fi
817  fi
818  echo $ac_n "checking where to find the target dlltool""... $ac_c" 1>&6
819 -echo "configure:6900: checking where to find the target dlltool" >&5
820 +echo "configure:6930: checking where to find the target dlltool" >&5
821  if test "x${build}" != "x${host}" ; then
822    if expr "x$DLLTOOL_FOR_TARGET" : "x/" > /dev/null; then
823      # We already found the complete path
824 @@ -6929,7 +6959,7 @@
825    fi
826  fi
827  echo $ac_n "checking where to find the target gcc""... $ac_c" 1>&6
828 -echo "configure:6933: checking where to find the target gcc" >&5
829 +echo "configure:6963: checking where to find the target gcc" >&5
830  if test "x${build}" != "x${host}" ; then
831    if expr "x$GCC_FOR_TARGET" : "x/" > /dev/null; then
832      # We already found the complete path
833 @@ -6962,7 +6992,7 @@
834    fi
835  fi
836  echo $ac_n "checking where to find the target gcj""... $ac_c" 1>&6
837 -echo "configure:6966: checking where to find the target gcj" >&5
838 +echo "configure:6996: checking where to find the target gcj" >&5
839  if test "x${build}" != "x${host}" ; then
840    if expr "x$GCJ_FOR_TARGET" : "x/" > /dev/null; then
841      # We already found the complete path
842 @@ -6998,7 +7028,7 @@
843    fi
844  fi
845  echo $ac_n "checking where to find the target gfortran""... $ac_c" 1>&6
846 -echo "configure:7002: checking where to find the target gfortran" >&5
847 +echo "configure:7032: checking where to find the target gfortran" >&5
848  if test "x${build}" != "x${host}" ; then
849    if expr "x$GFORTRAN_FOR_TARGET" : "x/" > /dev/null; then
850      # We already found the complete path
851 @@ -7034,7 +7064,7 @@
852    fi
853  fi
854  echo $ac_n "checking where to find the target ld""... $ac_c" 1>&6
855 -echo "configure:7038: checking where to find the target ld" >&5
856 +echo "configure:7068: checking where to find the target ld" >&5
857  if test "x${build}" != "x${host}" ; then
858    if expr "x$LD_FOR_TARGET" : "x/" > /dev/null; then
859      # We already found the complete path
860 @@ -7067,7 +7097,7 @@
861    fi
862  fi
863  echo $ac_n "checking where to find the target lipo""... $ac_c" 1>&6
864 -echo "configure:7071: checking where to find the target lipo" >&5
865 +echo "configure:7101: checking where to find the target lipo" >&5
866  if test "x${build}" != "x${host}" ; then
867    if expr "x$LIPO_FOR_TARGET" : "x/" > /dev/null; then
868      # We already found the complete path
869 @@ -7090,7 +7120,7 @@
870    fi
871  fi
872  echo $ac_n "checking where to find the target nm""... $ac_c" 1>&6
873 -echo "configure:7094: checking where to find the target nm" >&5
874 +echo "configure:7124: checking where to find the target nm" >&5
875  if test "x${build}" != "x${host}" ; then
876    if expr "x$NM_FOR_TARGET" : "x/" > /dev/null; then
877      # We already found the complete path
878 @@ -7123,7 +7153,7 @@
879    fi
880  fi
881  echo $ac_n "checking where to find the target objdump""... $ac_c" 1>&6
882 -echo "configure:7127: checking where to find the target objdump" >&5
883 +echo "configure:7157: checking where to find the target objdump" >&5
884  if test "x${build}" != "x${host}" ; then
885    if expr "x$OBJDUMP_FOR_TARGET" : "x/" > /dev/null; then
886      # We already found the complete path
887 @@ -7156,7 +7186,7 @@
888    fi
889  fi
890  echo $ac_n "checking where to find the target ranlib""... $ac_c" 1>&6
891 -echo "configure:7160: checking where to find the target ranlib" >&5
892 +echo "configure:7190: checking where to find the target ranlib" >&5
893  if test "x${build}" != "x${host}" ; then
894    if expr "x$RANLIB_FOR_TARGET" : "x/" > /dev/null; then
895      # We already found the complete path
896 @@ -7189,7 +7219,7 @@
897    fi
898  fi
899  echo $ac_n "checking where to find the target strip""... $ac_c" 1>&6
900 -echo "configure:7193: checking where to find the target strip" >&5
901 +echo "configure:7223: checking where to find the target strip" >&5
902  if test "x${build}" != "x${host}" ; then
903    if expr "x$STRIP_FOR_TARGET" : "x/" > /dev/null; then
904      # We already found the complete path
905 @@ -7222,7 +7252,7 @@
906    fi
907  fi
908  echo $ac_n "checking where to find the target windres""... $ac_c" 1>&6
909 -echo "configure:7226: checking where to find the target windres" >&5
910 +echo "configure:7256: checking where to find the target windres" >&5
911  if test "x${build}" != "x${host}" ; then
912    if expr "x$WINDRES_FOR_TARGET" : "x/" > /dev/null; then
913      # We already found the complete path
914 @@ -7283,7 +7313,7 @@
915  
916  
917  echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
918 -echo "configure:7287: checking whether to enable maintainer-specific portions of Makefiles" >&5
919 +echo "configure:7317: checking whether to enable maintainer-specific portions of Makefiles" >&5
920  # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
921  if test "${enable_maintainer_mode+set}" = set; then
922    enableval="$enable_maintainer_mode"
923 @@ -7332,16 +7362,22 @@
924    # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it.
925    CFLAGS="$CFLAGS -fkeep-inline-functions"
926    echo $ac_n "checking whether -fkeep-inline-functions is supported""... $ac_c" 1>&6
927 -echo "configure:7336: checking whether -fkeep-inline-functions is supported" >&5
928 +echo "configure:7366: checking whether -fkeep-inline-functions is supported" >&5
929    cat > conftest.$ac_ext <<EOF
930 -#line 7338 "configure"
931 +#line 7368 "configure"
932  #include "confdefs.h"
933  
934 +#if (__GNUC__ < 3) \
935 +    || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \
936 +                         || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1)))
937 +#error http://gcc.gnu.org/PR29382
938 +#endif
939 +    
940  int main() {
941  
942  ; return 0; }
943  EOF
944 -if { (eval echo configure:7345: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
945 +if { (eval echo configure:7381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
946    rm -rf conftest*
947    echo "$ac_t""yes" 1>&6; stage1_cflags="$stage1_cflags -fkeep-inline-functions"
948  else
949 Index: libgomp/ChangeLog
950 ===================================================================
951 --- libgomp/ChangeLog   (.../tags/gcc_4_2_0_release)    (revision 126002)
952 +++ libgomp/ChangeLog   (.../branches/gcc-4_2-branch)   (revision 126002)
953 @@ -1,3 +1,10 @@
954 +2007-06-21  Jakub Jelinek  <jakub@redhat.com>
955 +
956 +       PR middle-end/32362
957 +       * testsuite/libgomp.c/pr32362-1.c: New test.
958 +       * testsuite/libgomp.c/pr32362-2.c: New test.
959 +       * testsuite/libgomp.c/pr32362-3.c: New test.
960 +
961  2007-05-13  Release Manager
962  
963         * GCC 4.2.0 released.
964 Index: libgomp/testsuite/libgomp.c/pr32362-1.c
965 ===================================================================
966 --- libgomp/testsuite/libgomp.c/pr32362-1.c     (.../tags/gcc_4_2_0_release)    (revision 0)
967 +++ libgomp/testsuite/libgomp.c/pr32362-1.c     (.../branches/gcc-4_2-branch)   (revision 126002)
968 @@ -0,0 +1,32 @@
969 +/* PR middle-end/32362 */
970 +/* { dg-do run } */
971 +/* { dg-options "-O2" } */
972 +
973 +#include <omp.h>
974 +#include <stdlib.h>
975 +
976 +int
977 +main ()
978 +{
979 +  int n[4] = { -1, -1, -1, -1 };
980 +  static int a = 2, b = 4;
981 +  omp_set_num_threads (4);
982 +  omp_set_dynamic (0);
983 +  omp_set_nested (1);
984 +#pragma omp parallel private(b)
985 +  {
986 +    b = omp_get_thread_num ();
987 +#pragma omp parallel firstprivate(a)
988 +    {
989 +      a = (omp_get_thread_num () + a) + 1;
990 +      if (b == omp_get_thread_num ())
991 +       n[omp_get_thread_num ()] = a + (b << 4);
992 +    }
993 +  }
994 +  if (n[0] != 3)
995 +    abort ();
996 +  if (n[3] != -1
997 +      && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
998 +    abort ();
999 +  return 0;
1000 +}
1001 Index: libgomp/testsuite/libgomp.c/pr32362-3.c
1002 ===================================================================
1003 --- libgomp/testsuite/libgomp.c/pr32362-3.c     (.../tags/gcc_4_2_0_release)    (revision 0)
1004 +++ libgomp/testsuite/libgomp.c/pr32362-3.c     (.../branches/gcc-4_2-branch)   (revision 126002)
1005 @@ -0,0 +1,34 @@
1006 +/* PR middle-end/32362 */
1007 +/* { dg-do run } */
1008 +/* { dg-options "-O2" } */
1009 +
1010 +#include <omp.h>
1011 +#include <stdlib.h>
1012 +
1013 +int a = 2;
1014 +
1015 +int
1016 +main ()
1017 +{
1018 +  int n[4] = { -1, -1, -1, -1 };
1019 +  int b = 4;
1020 +  omp_set_num_threads (4);
1021 +  omp_set_dynamic (0);
1022 +  omp_set_nested (1);
1023 +#pragma omp parallel private(b)
1024 +  {
1025 +    b = omp_get_thread_num ();
1026 +#pragma omp parallel firstprivate(a)
1027 +    {
1028 +      a = (omp_get_thread_num () + a) + 1;
1029 +      if (b == omp_get_thread_num ())
1030 +       n[omp_get_thread_num ()] = a + (b << 4);
1031 +    }
1032 +  }
1033 +  if (n[0] != 3)
1034 +    abort ();
1035 +  if (n[3] != -1
1036 +      && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
1037 +    abort ();
1038 +  return 0;
1039 +}
1040 Index: libgomp/testsuite/libgomp.c/pr32362-2.c
1041 ===================================================================
1042 --- libgomp/testsuite/libgomp.c/pr32362-2.c     (.../tags/gcc_4_2_0_release)    (revision 0)
1043 +++ libgomp/testsuite/libgomp.c/pr32362-2.c     (.../branches/gcc-4_2-branch)   (revision 126002)
1044 @@ -0,0 +1,33 @@
1045 +/* PR middle-end/32362 */
1046 +/* { dg-do run } */
1047 +/* { dg-options "-O2" } */
1048 +
1049 +#include <omp.h>
1050 +#include <stdlib.h>
1051 +
1052 +int a = 2, b = 4;
1053 +
1054 +int
1055 +main ()
1056 +{
1057 +  int n[4] = { -1, -1, -1, -1 };
1058 +  omp_set_num_threads (4);
1059 +  omp_set_dynamic (0);
1060 +  omp_set_nested (1);
1061 +#pragma omp parallel private(b)
1062 +  {
1063 +    b = omp_get_thread_num ();
1064 +#pragma omp parallel firstprivate(a)
1065 +    {
1066 +      a = (omp_get_thread_num () + a) + 1;
1067 +      if (b == omp_get_thread_num ())
1068 +       n[omp_get_thread_num ()] = a + (b << 4);
1069 +    }
1070 +  }
1071 +  if (n[0] != 3)
1072 +    abort ();
1073 +  if (n[3] != -1
1074 +      && (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36))
1075 +    abort ();
1076 +  return 0;
1077 +}
1078 Index: gcc/tree-vrp.c
1079 ===================================================================
1080 --- gcc/tree-vrp.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
1081 +++ gcc/tree-vrp.c      (.../branches/gcc-4_2-branch)   (revision 126002)
1082 @@ -195,7 +195,28 @@
1083               || operand_equal_p (val, TYPE_MIN_VALUE (TREE_TYPE (val)), 0)));
1084  }
1085  
1086 +/* If VAL is now an overflow infinity, return VAL.  Otherwise, return
1087 +   the same value with TREE_OVERFLOW clear.  This can be used to avoid
1088 +   confusing a regular value with an overflow value.  */
1089  
1090 +static inline tree
1091 +avoid_overflow_infinity (tree val)
1092 +{
1093 +  if (!is_overflow_infinity (val))
1094 +    return val;
1095 +
1096 +  if (operand_equal_p (val, TYPE_MAX_VALUE (TREE_TYPE (val)), 0))
1097 +    return TYPE_MAX_VALUE (TREE_TYPE (val));
1098 +  else
1099 +    {
1100 +#ifdef ENABLE_CHECKING
1101 +      gcc_assert (operand_equal_p (val, TYPE_MIN_VALUE (TREE_TYPE (val)), 0));
1102 +#endif
1103 +      return TYPE_MIN_VALUE (TREE_TYPE (val));
1104 +    }
1105 +}
1106 +
1107 +
1108  /* Return whether VAL is equal to the maximum value of its type.  This
1109     will be true for a positive overflow infinity.  We can't do a
1110     simple equality comparison with TYPE_MAX_VALUE because C typedefs
1111 @@ -351,23 +372,11 @@
1112     infinity when we shouldn't.  */
1113  
1114  static inline void
1115 -set_value_range_to_value (value_range_t *vr, tree val)
1116 +set_value_range_to_value (value_range_t *vr, tree val, bitmap equiv)
1117  {
1118    gcc_assert (is_gimple_min_invariant (val));
1119 -  if (is_overflow_infinity (val))
1120 -    {
1121 -      if (operand_equal_p (val, TYPE_MAX_VALUE (TREE_TYPE (val)), 0))
1122 -       val = TYPE_MAX_VALUE (TREE_TYPE (val));
1123 -      else
1124 -       {
1125 -#ifdef ENABLE_CHECKING
1126 -         gcc_assert (operand_equal_p (val,
1127 -                                      TYPE_MIN_VALUE (TREE_TYPE (val)), 0));
1128 -#endif
1129 -         val = TYPE_MIN_VALUE (TREE_TYPE (val));
1130 -       }
1131 -    }
1132 -  set_value_range (vr, VR_RANGE, val, val, NULL);
1133 +  val = avoid_overflow_infinity (val);
1134 +  set_value_range (vr, VR_RANGE, val, val, equiv);
1135  }
1136  
1137  /* Set value range VR to a non-negative range of type TYPE.
1138 @@ -411,8 +420,7 @@
1139  static inline void
1140  set_value_range_to_null (value_range_t *vr, tree type)
1141  {
1142 -  tree zero = build_int_cst (type, 0);
1143 -  set_value_range (vr, VR_RANGE, zero, zero, vr->equiv);
1144 +  set_value_range_to_value (vr, build_int_cst (type, 0), vr->equiv);
1145  }
1146  
1147  
1148 @@ -763,7 +771,9 @@
1149        if (!TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (val1)))
1150         return -2;
1151  
1152 -      if (strict_overflow_p != NULL)
1153 +      if (strict_overflow_p != NULL
1154 +         && (code1 == SSA_NAME || !TREE_NO_WARNING (val1))
1155 +         && (code2 == SSA_NAME || !TREE_NO_WARNING (val2)))
1156         *strict_overflow_p = true;
1157  
1158        if (code1 == SSA_NAME)
1159 @@ -1028,6 +1038,8 @@
1160        cond_code = swap_tree_comparison (TREE_CODE (cond));
1161      }
1162  
1163 +  limit = avoid_overflow_infinity (limit);
1164 +
1165    type = TREE_TYPE (limit);
1166    gcc_assert (limit != var);
1167  
1168 @@ -1167,6 +1179,8 @@
1169             {
1170               tree one = build_int_cst (type, 1);
1171               max = fold_build2 (MINUS_EXPR, type, max, one);
1172 +             if (EXPR_P (max))
1173 +               TREE_NO_WARNING (max) = 1;
1174             }
1175  
1176           set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
1177 @@ -1200,6 +1214,8 @@
1178             {
1179               tree one = build_int_cst (type, 1);
1180               min = fold_build2 (PLUS_EXPR, type, min, one);
1181 +             if (EXPR_P (min))
1182 +               TREE_NO_WARNING (min) = 1;
1183             }
1184  
1185           set_value_range (vr_p, VR_RANGE, min, max, vr_p->equiv);
1186 @@ -1619,7 +1635,7 @@
1187    if (TREE_CODE (op0) == SSA_NAME)
1188      vr0 = *(get_value_range (op0));
1189    else if (is_gimple_min_invariant (op0))
1190 -    set_value_range_to_value (&vr0, op0);
1191 +    set_value_range_to_value (&vr0, op0, NULL);
1192    else
1193      set_value_range_to_varying (&vr0);
1194  
1195 @@ -1627,7 +1643,7 @@
1196    if (TREE_CODE (op1) == SSA_NAME)
1197      vr1 = *(get_value_range (op1));
1198    else if (is_gimple_min_invariant (op1))
1199 -    set_value_range_to_value (&vr1, op1);
1200 +    set_value_range_to_value (&vr1, op1, NULL);
1201    else
1202      set_value_range_to_varying (&vr1);
1203  
1204 @@ -2006,7 +2022,7 @@
1205    if (TREE_CODE (op0) == SSA_NAME)
1206      vr0 = *(get_value_range (op0));
1207    else if (is_gimple_min_invariant (op0))
1208 -    set_value_range_to_value (&vr0, op0);
1209 +    set_value_range_to_value (&vr0, op0, NULL);
1210    else
1211      set_value_range_to_varying (&vr0);
1212  
1213 @@ -2091,6 +2107,8 @@
1214               && is_gimple_val (new_max)
1215               && tree_int_cst_equal (new_min, orig_min)
1216               && tree_int_cst_equal (new_max, orig_max)
1217 +             && (!is_overflow_infinity (new_min)
1218 +                 || !is_overflow_infinity (new_max))
1219               && compare_values (new_min, new_max) <= 0
1220               && compare_values (new_min, new_max) >= -1)
1221             {
1222 @@ -2393,7 +2411,10 @@
1223          its type may be different from _Bool.  Convert VAL to EXPR's
1224          type.  */
1225        val = fold_convert (TREE_TYPE (expr), val);
1226 -      set_value_range (vr, VR_RANGE, val, val, vr->equiv);
1227 +      if (is_gimple_min_invariant (val))
1228 +       set_value_range_to_value (vr, val, vr->equiv);
1229 +      else
1230 +       set_value_range (vr, VR_RANGE, val, val, vr->equiv);
1231      }
1232    else
1233      set_value_range_to_varying (vr);
1234 @@ -2424,7 +2445,7 @@
1235    else if (TREE_CODE_CLASS (code) == tcc_comparison)
1236      extract_range_from_comparison (vr, expr);
1237    else if (is_gimple_min_invariant (expr))
1238 -    set_value_range_to_value (vr, expr);
1239 +    set_value_range_to_value (vr, expr, NULL);
1240    else
1241      set_value_range_to_varying (vr);
1242  
1243 @@ -2545,6 +2566,13 @@
1244               if (compare_values (min, max) == 1)
1245                 return;
1246             }
1247 +
1248 +         /* According to the loop information, the variable does not
1249 +            overflow.  If we think it does, probably because of an
1250 +            overflow due to arithmetic on a different INF value,
1251 +            reset now.  */
1252 +         if (is_negative_overflow_infinity (min))
1253 +           min = tmin;
1254         }
1255        else
1256         {
1257 @@ -2557,13 +2585,62 @@
1258               if (compare_values (min, max) == 1)
1259                 return;
1260             }
1261 +
1262 +         if (is_positive_overflow_infinity (max))
1263 +           max = tmax;
1264         }
1265  
1266        set_value_range (vr, VR_RANGE, min, max, vr->equiv);
1267      }
1268  }
1269  
1270 +/* Return true if VAR may overflow at STMT.  This checks any available
1271 +   loop information to see if we can determine that VAR does not
1272 +   overflow.  */
1273  
1274 +static bool
1275 +vrp_var_may_overflow (tree var, tree stmt)
1276 +{
1277 +  struct loop *l;
1278 +  tree chrec, init, step;
1279 +
1280 +  if (current_loops == NULL)
1281 +    return true;
1282 +
1283 +  l = loop_containing_stmt (stmt);
1284 +  if (l == NULL)
1285 +    return true;
1286 +
1287 +  chrec = instantiate_parameters (l, analyze_scalar_evolution (l, var));
1288 +  if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
1289 +    return true;
1290 +
1291 +  init = initial_condition_in_loop_num (chrec, l->num);
1292 +  step = evolution_part_in_loop_num (chrec, l->num);
1293 +
1294 +  if (step == NULL_TREE
1295 +      || !is_gimple_min_invariant (step)
1296 +      || !valid_value_p (init))
1297 +    return true;
1298 +
1299 +  /* If we get here, we know something useful about VAR based on the
1300 +     loop information.  If it wraps, it may overflow.  */
1301 +
1302 +  if (scev_probably_wraps_p (init, step, stmt,
1303 +                            current_loops->parray[CHREC_VARIABLE (chrec)],
1304 +                            true))
1305 +    return true;
1306 +
1307 +  if (dump_file && (dump_flags & TDF_DETAILS) != 0)
1308 +    {
1309 +      print_generic_expr (dump_file, var, 0);
1310 +      fprintf (dump_file, ": loop information indicates does not overflow\n");
1311 +    }
1312 +
1313 +  return false;
1314 +}
1315 +
1316 +
1317  /* Given two numeric value ranges VR0, VR1 and a comparison code COMP:
1318     
1319     - Return BOOLEAN_TRUE_NODE if VR0 COMP VR1 always returns true for
1320 @@ -4156,7 +4233,7 @@
1321        t = retval = NULL_TREE;
1322        EXECUTE_IF_SET_IN_BITMAP (e2, 0, i2, bi2)
1323         {
1324 -         bool sop;
1325 +         bool sop = false;
1326  
1327           value_range_t vr2 = *(vr_value[i2]);
1328  
1329 @@ -4773,7 +4850,8 @@
1330               if (vrp_val_is_max (vr_result.max))
1331                 goto varying;
1332  
1333 -             if (!needs_overflow_infinity (TREE_TYPE (vr_result.min)))
1334 +             if (!needs_overflow_infinity (TREE_TYPE (vr_result.min))
1335 +                 || !vrp_var_may_overflow (lhs, phi))
1336                 vr_result.min = TYPE_MIN_VALUE (TREE_TYPE (vr_result.min));
1337               else if (supports_overflow_infinity (TREE_TYPE (vr_result.min)))
1338                 vr_result.min =
1339 @@ -4791,7 +4869,8 @@
1340               if (vrp_val_is_min (vr_result.min))
1341                 goto varying;
1342  
1343 -             if (!needs_overflow_infinity (TREE_TYPE (vr_result.max)))
1344 +             if (!needs_overflow_infinity (TREE_TYPE (vr_result.max))
1345 +                 || !vrp_var_may_overflow (lhs, phi))
1346                 vr_result.max = TYPE_MAX_VALUE (TREE_TYPE (vr_result.max));
1347               else if (supports_overflow_infinity (TREE_TYPE (vr_result.max)))
1348                 vr_result.max =
1349 @@ -4971,6 +5050,8 @@
1350         {
1351           tree one = build_int_cst (TREE_TYPE (op0), 1);
1352           max = fold_build2 (MINUS_EXPR, TREE_TYPE (op0), max, one);
1353 +         if (EXPR_P (max))
1354 +           TREE_NO_WARNING (max) = 1;
1355         }
1356      }
1357    else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
1358 @@ -4984,6 +5065,8 @@
1359         {
1360           tree one = build_int_cst (TREE_TYPE (op0), 1);
1361           min = fold_build2 (PLUS_EXPR, TREE_TYPE (op0), min, one);
1362 +         if (EXPR_P (min))
1363 +           TREE_NO_WARNING (min) = 1;
1364         }
1365      }
1366  
1367 Index: gcc/DATESTAMP
1368 ===================================================================
1369 --- gcc/DATESTAMP       (.../tags/gcc_4_2_0_release)    (revision 126002)
1370 +++ gcc/DATESTAMP       (.../branches/gcc-4_2-branch)   (revision 126002)
1371 @@ -1 +1 @@
1372 -20070514
1373 +20070625
1374 Index: gcc/reload.c
1375 ===================================================================
1376 --- gcc/reload.c        (.../tags/gcc_4_2_0_release)    (revision 126002)
1377 +++ gcc/reload.c        (.../branches/gcc-4_2-branch)   (revision 126002)
1378 @@ -1180,7 +1180,7 @@
1379  
1380    /* If IN appears in OUT, we can't share any input-only reload for IN.  */
1381    if (in != 0 && out != 0 && MEM_P (out)
1382 -      && (REG_P (in) || MEM_P (in))
1383 +      && (REG_P (in) || MEM_P (in) || GET_CODE (in) == PLUS)
1384        && reg_overlap_mentioned_for_reload_p (in, XEXP (out, 0)))
1385      dont_share = 1;
1386  
1387 @@ -6540,7 +6540,8 @@
1388        if (REG_P (in))
1389         return 0;
1390        else if (GET_CODE (in) == PLUS)
1391 -       return (reg_overlap_mentioned_for_reload_p (x, XEXP (in, 0))
1392 +       return (rtx_equal_p (x, in)
1393 +               || reg_overlap_mentioned_for_reload_p (x, XEXP (in, 0))
1394                 || reg_overlap_mentioned_for_reload_p (x, XEXP (in, 1)));
1395        else return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in)
1396                    || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in));
1397 Index: gcc/pointer-set.c
1398 ===================================================================
1399 --- gcc/pointer-set.c   (.../tags/gcc_4_2_0_release)    (revision 126002)
1400 +++ gcc/pointer-set.c   (.../branches/gcc-4_2-branch)   (revision 126002)
1401 @@ -22,13 +22,12 @@
1402  #include "system.h"
1403  #include "pointer-set.h"
1404  
1405 -/* A pointer sets is represented as a simple open-addressing hash
1406 +/* A pointer set is represented as a simple open-addressing hash
1407     table.  Simplifications: The hash code is based on the value of the
1408     pointer, not what it points to.  The number of buckets is always a
1409     power of 2.  Null pointers are a reserved value.  Deletion is not
1410 -   supported.  There is no mechanism for user control of hash
1411 -   function, equality comparison, initial size, or resizing policy.
1412 -*/
1413 +   supported (yet).  There is no mechanism for user control of hash
1414 +   function, equality comparison, initial size, or resizing policy.  */
1415  
1416  struct pointer_set_t
1417  {
1418 @@ -114,22 +113,16 @@
1419      }
1420  }
1421  
1422 -/* Subroutine of pointer_set_insert.  Inserts P into an empty
1423 -   element of SLOTS, an array of length N_SLOTS.  Returns nonzero
1424 -   if P was already present in N_SLOTS.  */
1425 -static int
1426 +/* Subroutine of pointer_set_insert.  Return the insertion slot for P into
1427 +   an empty element of SLOTS, an array of length N_SLOTS.  */
1428 +static inline size_t
1429  insert_aux (void *p, void **slots, size_t n_slots, size_t log_slots)
1430  {
1431    size_t n = hash1 (p, n_slots, log_slots);
1432    while (true)
1433      {
1434 -      if (slots[n] == p)
1435 -       return 1;
1436 -      else if (slots[n] == 0)
1437 -       {
1438 -         slots[n] = p;
1439 -         return 0;
1440 -       }
1441 +      if (slots[n] == p || slots[n] == 0)
1442 +       return n;
1443        else
1444         {
1445           ++n;
1446 @@ -144,12 +137,10 @@
1447  int
1448  pointer_set_insert (struct pointer_set_t *pset, void *p)
1449  {
1450 -  if (insert_aux (p, pset->slots, pset->n_slots, pset->log_slots))
1451 -    return 1;
1452 -      
1453 -  /* We've inserted a new element.  Expand the table if necessary to keep
1454 -     the load factor small.  */
1455 -  ++pset->n_elements;
1456 +  size_t n;
1457 +
1458 +  /* For simplicity, expand the set even if P is already there.  This can be
1459 +     superfluous but can happen at most once.  */
1460    if (pset->n_elements > pset->n_slots / 4)
1461      {
1462        size_t new_log_slots = pset->log_slots + 1;
1463 @@ -158,9 +149,10 @@
1464        size_t i;
1465  
1466        for (i = 0; i < pset->n_slots; ++i)
1467 -       {
1468 -         if (pset->slots[i])
1469 -           insert_aux (pset->slots[i], new_slots, new_n_slots, new_log_slots);
1470 +        {
1471 +         void *value = pset->slots[i];
1472 +         n = insert_aux (value, new_slots, new_n_slots, new_log_slots);
1473 +         new_slots[n] = value;
1474         }
1475  
1476        XDELETEVEC (pset->slots);
1477 @@ -169,5 +161,144 @@
1478        pset->slots = new_slots;
1479      }
1480  
1481 +  n = insert_aux (p, pset->slots, pset->n_slots, pset->log_slots);
1482 +  if (pset->slots[n])
1483 +    return 1;
1484 +
1485 +  pset->slots[n] = p;
1486 +  ++pset->n_elements;
1487    return 0;
1488  }
1489 +
1490 +/* Pass each pointer in PSET to the function in FN, together with the fixed
1491 +   parameter DATA.  If FN returns false, the iteration stops.  */
1492 +
1493 +void pointer_set_traverse (struct pointer_set_t *pset,
1494 +                          bool (*fn) (void *, void *), void *data)
1495 +{
1496 +  size_t i;
1497 +  for (i = 0; i < pset->n_slots; ++i)
1498 +    if (pset->slots[i] && !fn (pset->slots[i], data))
1499 +      break;
1500 +}
1501 +
1502 +\f
1503 +/* A pointer map is represented the same way as a pointer_set, so
1504 +   the hash code is based on the address of the key, rather than
1505 +   its contents.  Null keys are a reserved value.  Deletion is not
1506 +   supported (yet).  There is no mechanism for user control of hash
1507 +   function, equality comparison, initial size, or resizing policy.  */
1508 +
1509 +struct pointer_map_t
1510 +{
1511 +  size_t log_slots;
1512 +  size_t n_slots;              /* n_slots = 2^log_slots */
1513 +  size_t n_elements;
1514 +
1515 +  void **keys;
1516 +  void **values;
1517 +};
1518 +
1519 +/* Allocate an empty pointer map.  */
1520 +struct pointer_map_t *
1521 +pointer_map_create (void)
1522 +{
1523 +  struct pointer_map_t *result = XNEW (struct pointer_map_t);
1524 +
1525 +  result->n_elements = 0;
1526 +  result->log_slots = 8;
1527 +  result->n_slots = (size_t) 1 << result->log_slots;
1528 +
1529 +  result->keys = XCNEWVEC (void *, result->n_slots);
1530 +  result->values = XCNEWVEC (void *, result->n_slots);
1531 +  return result;
1532 +}
1533 +
1534 +/* Reclaims all memory associated with PMAP.  */
1535 +void pointer_map_destroy (struct pointer_map_t *pmap)
1536 +{
1537 +  XDELETEVEC (pmap->keys);
1538 +  XDELETEVEC (pmap->values);
1539 +  XDELETE (pmap);
1540 +}
1541 +
1542 +/* Returns a pointer to the value to which P maps, if PMAP contains P.  P
1543 +   must be nonnull.  Return NULL if PMAP does not contain P.
1544 +
1545 +   Collisions are resolved by linear probing.  */
1546 +void **
1547 +pointer_map_contains (struct pointer_map_t *pmap, void *p)
1548 +{
1549 +  size_t n = hash1 (p, pmap->n_slots, pmap->log_slots);
1550 +
1551 +  while (true)
1552 +    {
1553 +      if (pmap->keys[n] == p)
1554 +       return &pmap->values[n];
1555 +      else if (pmap->keys[n] == 0)
1556 +       return NULL;
1557 +      else
1558 +       {
1559 +         ++n;
1560 +         if (n == pmap->n_slots)
1561 +           n = 0;
1562 +       }
1563 +    }
1564 +}
1565 +
1566 +/* Inserts P into PMAP if it wasn't already there.  Returns a pointer
1567 +   to the value.  P must be nonnull.  */
1568 +void **
1569 +pointer_map_insert (struct pointer_map_t *pmap, void *p)
1570 +{
1571 +  size_t n;
1572 +
1573 +  /* For simplicity, expand the map even if P is already there.  This can be
1574 +     superfluous but can happen at most once.  */
1575 +  if (pmap->n_elements > pmap->n_slots / 4)
1576 +    {
1577 +      size_t new_log_slots = pmap->log_slots + 1;
1578 +      size_t new_n_slots = pmap->n_slots * 2;
1579 +      void **new_keys = XCNEWVEC (void *, new_n_slots);
1580 +      void **new_values = XCNEWVEC (void *, new_n_slots);
1581 +      size_t i;
1582 +
1583 +      for (i = 0; i < pmap->n_slots; ++i)
1584 +       if (pmap->keys[i])
1585 +         {
1586 +           void *key = pmap->keys[i];
1587 +           n = insert_aux (key, new_keys, new_n_slots, new_log_slots);
1588 +           new_keys[n] = key;
1589 +           new_values[n] = pmap->values[i];
1590 +         }
1591 +
1592 +      XDELETEVEC (pmap->keys);
1593 +      XDELETEVEC (pmap->values);
1594 +      pmap->n_slots = new_n_slots;
1595 +      pmap->log_slots = new_log_slots;
1596 +      pmap->keys = new_keys;
1597 +      pmap->values = new_values;
1598 +    }
1599 +
1600 +  n = insert_aux (p, pmap->keys, pmap->n_slots, pmap->log_slots);
1601 +  if (!pmap->keys[n])
1602 +    {
1603 +      ++pmap->n_elements;
1604 +      pmap->keys[n] = p;
1605 +    }
1606 +
1607 +  return &pmap->values[n];
1608 +}
1609 +
1610 +/* Pass each pointer in PMAP to the function in FN, together with the pointer
1611 +   to the value and the fixed parameter DATA.  If FN returns false, the
1612 +   iteration stops.  */
1613 +
1614 +void pointer_map_traverse (struct pointer_map_t *pmap,
1615 +                          bool (*fn) (void *, void **, void *), void *data)
1616 +{
1617 +  size_t i;
1618 +  for (i = 0; i < pmap->n_slots; ++i)
1619 +    if (pmap->keys[i] && !fn (pmap->keys[i], &pmap->values[i], data))
1620 +      break;
1621 +}
1622 Index: gcc/pointer-set.h
1623 ===================================================================
1624 --- gcc/pointer-set.h   (.../tags/gcc_4_2_0_release)    (revision 126002)
1625 +++ gcc/pointer-set.h   (.../branches/gcc-4_2-branch)   (revision 126002)
1626 @@ -22,11 +22,21 @@
1627  #define POINTER_SET_H
1628  
1629  struct pointer_set_t;
1630 -
1631  struct pointer_set_t *pointer_set_create (void);
1632  void pointer_set_destroy (struct pointer_set_t *pset);
1633  
1634  int pointer_set_contains (struct pointer_set_t *pset, void *p);
1635  int pointer_set_insert (struct pointer_set_t *pset, void *p);
1636 +void pointer_set_traverse (struct pointer_set_t *, bool (*) (void *, void *),
1637 +                          void *);
1638  
1639 +struct pointer_map_t;
1640 +struct pointer_map_t *pointer_map_create (void);
1641 +void pointer_map_destroy (struct pointer_map_t *pmap);
1642 +
1643 +void **pointer_map_contains (struct pointer_map_t *pmap, void *p);
1644 +void **pointer_map_insert (struct pointer_map_t *pmap, void *p);
1645 +void pointer_map_traverse (struct pointer_map_t *,
1646 +                          bool (*) (void *, void **, void *), void *);
1647 +
1648  #endif  /* POINTER_SET_H  */
1649 Index: gcc/fold-const.c
1650 ===================================================================
1651 --- gcc/fold-const.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
1652 +++ gcc/fold-const.c    (.../branches/gcc-4_2-branch)   (revision 126002)
1653 @@ -4450,13 +4450,24 @@
1654         {
1655           low = range_successor (high1);
1656           high = high0;
1657 -         in_p = (low != 0);
1658 +         in_p = 1;
1659 +         if (low == 0)
1660 +           {
1661 +             /* We are in the weird situation where high0 > high1 but
1662 +                high1 has no successor.  Punt.  */
1663 +             return 0;
1664 +           }
1665         }
1666        else if (! subset || highequal)
1667         {
1668           low = low0;
1669           high = range_predecessor (low1);
1670 -         in_p = (high != 0);
1671 +         in_p = 1;
1672 +         if (high == 0)
1673 +           {
1674 +             /* low0 < low1 but low1 has no predecessor.  Punt.  */
1675 +             return 0;
1676 +           }
1677         }
1678        else
1679         return 0;
1680 @@ -4476,7 +4487,12 @@
1681         {
1682           low = range_successor (high0);
1683           high = high1;
1684 -         in_p = (low != 0);
1685 +         in_p = 1;
1686 +         if (low == 0)
1687 +           {
1688 +             /* high1 > high0 but high0 has no successor.  Punt.  */
1689 +             return 0;
1690 +           }
1691         }
1692      }
1693  
1694 @@ -12634,9 +12650,14 @@
1695        /* ... fall through ...  */
1696  
1697      default:
1698 -      if (truth_value_p (TREE_CODE (t)))
1699 -       /* Truth values evaluate to 0 or 1, which is nonnegative.  */
1700 -       return 1;
1701 +      {
1702 +       tree type = TREE_TYPE (t);
1703 +       if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
1704 +           && truth_value_p (TREE_CODE (t)))
1705 +         /* Truth values evaluate to 0 or 1, which is nonnegative unless we
1706 +             have a signed:1 type (where the value is -1 and 0).  */
1707 +         return true;
1708 +      }
1709      }
1710  
1711    /* We don't know sign of `t', so be conservative and return false.  */
1712 Index: gcc/omp-low.c
1713 ===================================================================
1714 --- gcc/omp-low.c       (.../tags/gcc_4_2_0_release)    (revision 126002)
1715 +++ gcc/omp-low.c       (.../branches/gcc-4_2-branch)   (revision 126002)
1716 @@ -1505,9 +1505,9 @@
1717    for (up = ctx->outer, t = NULL; up && t == NULL; up = up->outer)
1718      t = maybe_lookup_decl (decl, up);
1719  
1720 -  gcc_assert (t);
1721 +  gcc_assert (t || is_global_var (decl));
1722  
1723 -  return t;
1724 +  return t ? t : decl;
1725  }
1726  
1727  
1728 Index: gcc/DEV-PHASE
1729 ===================================================================
1730 --- gcc/DEV-PHASE       (.../tags/gcc_4_2_0_release)    (revision 126002)
1731 +++ gcc/DEV-PHASE       (.../branches/gcc-4_2-branch)   (revision 126002)
1732 @@ -0,0 +1 @@
1733 +prerelease
1734 Index: gcc/ChangeLog
1735 ===================================================================
1736 --- gcc/ChangeLog       (.../tags/gcc_4_2_0_release)    (revision 126002)
1737 +++ gcc/ChangeLog       (.../branches/gcc-4_2-branch)   (revision 126002)
1738 @@ -1,3 +1,285 @@
1739 +2007-06-21  H.J. Lu  <hongjiu.lu@intel.com>
1740 +
1741 +       * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_VEC_EXT_V16QI.
1742 +       (ix86_init_mmx_sse_builtins): Add __builtin_ia32_vec_ext_v16qi.
1743 +       (ix86_expand_builtin): Handle IX86_BUILTIN_VEC_EXT_V16QI.
1744 +
1745 +2007-06-21  Jakub Jelinek  <jakub@redhat.com>
1746 +
1747 +       PR middle-end/32362
1748 +       * omp-low.c (lookup_decl_in_outer_ctx): Don't ICE if t is NULL,
1749 +       but decl is a global var, instead return decl.
1750 +       * gimplify.c (gimplify_adjust_omp_clauses_1): Add shared clauses
1751 +       even for is_global_var decls, if they are private in some outer
1752 +       context.
1753 +
1754 +2007-06-21  Uros Bizjak  <ubizjak@gmail.com>
1755 +
1756 +       PR target/32389
1757 +       * config/i386/i386.h (enum ix86_stack_slot): Add SLOT_VIRTUAL.
1758 +       * config/i386/i386.c (assign_386_stack_local): Assert that
1759 +       SLOT_VIRTUAL is valid only before virtual regs are instantiated.
1760 +       (ix86_expand_builtin) [IX86_BUILTIN_LDMXCSR, IX86_BUILTIN_STMXCSR]:
1761 +       Use SLOT_VIRTUAL stack slot instead of SLOT_TEMP.
1762 +       * config/i386/i386.md (truncdfsf2, truncxfsf2, truncxfdf2): Ditto.
1763 +
1764 +2007-06-20  Jakub Jelinek  <jakub@redhat.com>
1765 +
1766 +       PR inline-asm/32109
1767 +       * gimplify.c (gimplify_asm_expr): Issue error if type is addressable
1768 +       and !allows_mem.
1769 +
1770 +       PR middle-end/32285
1771 +       * calls.c (precompute_arguments): Also precompute CALL_EXPR arguments
1772 +       if ACCUMULATE_OUTGOING_ARGS.
1773 +
1774 +2007-06-20  Kaz Kojima  <kkojima@gcc.gnu.org>
1775 +
1776 +       PR rtl-optimization/28011
1777 +       Backport from mainline.
1778 +       * reload.c (push_reload): Set dont_share if IN appears in OUT
1779 +       also when IN is a PLUS rtx.
1780 +       (reg_overlap_mentioned_for_reload_p): Return true if X and IN
1781 +       are same PLUS rtx.
1782 +
1783 +2007-06-19  Richard Guenther  <rguenther@suse.de>
1784 +       Michael Matz  <matz@suse.de>
1785 +
1786 +       PR tree-optimization/30252
1787 +       * tree-ssa-structalias.c (solution_set_add): Make sure to
1788 +       preserve all relevant vars.
1789 +       (handle_ptr_arith): Make sure to only handle positive
1790 +       offsets.
1791 +       (push_fields_onto_fieldstack): Create fields for empty
1792 +       bases.
1793 +
1794 +2007-06-19  Jakub Jelinek  <jakub@redhat.com>
1795 +
1796 +       PR tree-optimization/32353
1797 +       * tree-ssa-structalias.c (set_uids_in_ptset): Also handle RESULT_DECL.
1798 +
1799 +2007-06-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
1800 +
1801 +       * config/sparc/sparc.c (sparc_vis_init_builtins): Retrieve the
1802 +       return mode from the builtin itself.
1803 +       (sparc_fold_builtin): Fix cast of zero constant.
1804 +
1805 +2007-06-15  Diego Novillo  <dnovillo@google.com>
1806 +
1807 +       PR 32327
1808 +       * tree-ssa-operands.c (build_ssa_operands): Initially assume
1809 +       that the statement does not take any addresses.
1810 +
1811 +2007-06-13  Eric Botcazou  <ebotcazou@libertysurf.fr>
1812 +
1813 +       * config/sparc/sparc.c (sparc_override_options): Initialize
1814 +       fpu mask correctly.
1815 +
1816 +2007-06-09  Ian Lance Taylor  <iant@google.com>
1817 +
1818 +       PR tree-optimization/32169
1819 +       * tree-vrp.c (extract_range_from_unary_expr): For NOP_EXPR and
1820 +       CONVERT_EXPR, check whether min and max both converted to an
1821 +       overflow infinity representation.
1822 +
1823 +2007-06-08  Kaz Kojima  <kkojima@gcc.gnu.org>
1824 +
1825 +       PR target/32163
1826 +       Backport from mainline.
1827 +       * config/sh/sh.md (symGOT_load): Don't schedule insns when
1828 +       the symbol is generated with the stack protector.
1829 +
1830 +2007-06-06  Ian Lance Taylor  <iant@google.com>
1831 +
1832 +       * fold-const.c (merge_ranges): If range_successor or
1833 +       range_predecessor fail, just return 0.
1834 +
1835 +2007-06-05  Ian Lance Taylor  <iant@google.com>
1836 +
1837 +       * tree-vrp.c (compare_values_warnv): Check TREE_NO_WARNING on a
1838 +       PLUS_EXPR or MINUS_EXPR node before setting *strict_overflow_p.
1839 +       (extract_range_from_assert): Set TREE_NO_WARNING when creating an
1840 +       expression.
1841 +       (test_for_singularity): Likewise.
1842 +
1843 +2007-06-04  Ian Lance Taylor  <iant@google.com>
1844 +
1845 +       * tree-vrp.c (adjust_range_with_scev): When loop is not expected
1846 +       to overflow, reduce overflow infinity to regular infinity.
1847 +       (vrp_var_may_overflow): New static function.
1848 +       (vrp_visit_phi_node): Check vrp_var_may_overflow.
1849 +
1850 +2007-05-31  H.J. Lu  <hongjiu.lu@intel.com>
1851 +
1852 +       Backport from mainline:
1853 +       2007-05-25  H.J. Lu  <hongjiu.lu@intel.com>
1854 +
1855 +       * config/i386/i386.c (__builtin_ia32_vec_ext_v2df): Mark it
1856 +       with MASK_SSE2.
1857 +       (__builtin_ia32_vec_ext_v2di): Likewise.
1858 +       (__builtin_ia32_vec_ext_v4si): Likewise.
1859 +       (__builtin_ia32_vec_ext_v8hi): Likewise.
1860 +       (__builtin_ia32_vec_set_v8hi): Likewise.
1861 +
1862 +2007-05-31  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
1863 +
1864 +       Backport from mainline:
1865 +       2007-05-05  Aurelien Jarno  <aurelien@aurel32.net>
1866 +
1867 +       * config/pa/pa.md: Split tgd_load, tld_load and tie_load
1868 +       into pic and non-pic versions. Mark r19 as used for 
1869 +       tgd_load_pic, tld_load_pic and tie_load_pic. Mark r27 as used 
1870 +       for tgd_load, tld_load and tie_load .
1871 +       * config/pa/pa.c (legitimize_tls_address): Emit pic or non-pic
1872 +       version of tgd_load, tld_load and tie_load depending on the 
1873 +       value of flag_pic.
1874 +
1875 +2007-05-27  Daniel Berlin <dberlin@dberlin.org>
1876 +
1877 +       Fix PR/30052
1878 +       Backport PTA solver from mainline
1879 +
1880 +       * pointer-set.c: Copy from mainline
1881 +       * pointer-set.h: Ditto.
1882 +       * tree-ssa-structalias.c: Copy solver portions from mainline.
1883 +       * Makefile.in (tree-ssa-structalias.o): Update dependencies
1884 +
1885 +2007-05-30  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1886 +
1887 +       * tree-vrp.c (compare_names): Initialize sop.
1888 +
1889 +2007-05-30  Jakub Jelinek  <jakub@redhat.com>
1890 +
1891 +       PR tree-optimization/31769
1892 +       * except.c (duplicate_eh_regions): Clear prev_try if
1893 +       ERT_MUST_NOT_THROW region is inside of ERT_TRY region.
1894 +
1895 +2007-05-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>
1896 +
1897 +       PR tree-opt/32100
1898 +       * fold-const.c (tree_expr_nonnegative_warnv_p): Don't
1899 +       return true when truth_value_p is true and the type
1900 +       is of signed:1.
1901 +
1902 +2007-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1903 +
1904 +       Backport from mainline:
1905 +       2007-05-25  Uros Bizjak  <ubizjak@gmail.com>
1906 +
1907 +       * config/i386/sse.md (*vec_extractv2di_1_sse2): Do not calculate
1908 +       "memory" attribute for "sseishft" type insn without operands[2].
1909 +
1910 +       2007-05-25  H.J. Lu  <hongjiu.lu@intel.com>
1911 +
1912 +       * config/i386/sse.md (*vec_extractv2di_1_sse2): Correct shift.
1913 +
1914 +2007-05-22  Ian Lance Taylor  <iant@google.com>
1915 +
1916 +       * tree-vrp.c (avoid_overflow_infinity): New static function,
1917 +       broken out of set_value_range_to_value.
1918 +       (set_value_range_to_value): Call avoid_overflow_infinity.
1919 +       (extract_range_from_assert): Likewise.
1920 +
1921 +2007-05-23  Chen Liqin  <liqin@sunnorth.com.cn>
1922 +
1923 +       PR target/30987
1924 +       * config/score/misc.md (bitclr_c, bitset_c, bittgl_c): remove.
1925 +       * config/score/predicate.md (const_pow2, const_npow2): remove.
1926 +       * config/score/score.h (ASM_OUTPUT_EXTERNAL): add ASM_OUTPUT_EXTERNAL undef.
1927 +       PR target/30474
1928 +       * config/score/score.c (score_print_operand): makes sure that only lower 
1929 +       bits are used.
1930 +       
1931 +2007-05-21  Uros Bizjak  <ubizjak@gmail.com>
1932 +
1933 +       PR target/31167
1934 +       Backport from mainline.
1935 +       * config/i386/i386.md (*addti3_1, *addti3_1 splitter): Use
1936 +       x86_64_general_operand as operand[2] predicate.  Remove "iF"
1937 +       from operand constraints and use "e" constraint instead.
1938 +       (*subti3_1, *subti3_1 splitter): Ditto.
1939 +       (*negti2_1, *negti2_1 splitter): Use nonimmediate_operand as
1940 +       operand[1] predicate.
1941 +
1942 +2007-05-21  Uros Bizjak  <ubizjak@gmail.com>
1943 +
1944 +       PR target/30041
1945 +       Backport from mainline.
1946 +       * config/i386/sse.md ("*sse3_movddup"): Use operands[0] and
1947 +       operands[1] in insn constraint.  Correct type attribute to sselog1.
1948 +
1949 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
1950 +
1951 +       PR target/31701
1952 +       Backport from mainline.
1953 +       * config/sh/sh.c (output_stack_adjust): Avoid using the frame
1954 +       register itself to hold the offset constant.  Tell flow the use
1955 +       of r4 and r5 when they are used.
1956 +
1957 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
1958 +
1959 +       PR target/31480
1960 +       Backport from mainline.
1961 +       * config/sh/sh.md (length): Check if prev_nonnote_insn (insn)
1962 +       is null.
1963 +
1964 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
1965 +
1966 +       PR target/31022
1967 +       Backport from mainline.
1968 +       * config/sh/sh.c (sh_adjust_cost): Use the result of single_set
1969 +       instead of PATTERN.
1970 +
1971 +2007-05-20  Kaz Kojima  <kkojima@gcc.gnu.org>
1972 +
1973 +       PR target/27405
1974 +       Backport from mainline.
1975 +       * config/sh/sh.md (cmp{eq,gt,gtu}{si,di}_media): Remove.
1976 +       (cmpsi{eq,gt,gtu}{si,di}_media): Rename to
1977 +       cmp{eq,gt,gtu}{si,di}_media.
1978 +       (*cmpne0si_media): Remove.
1979 +       (*movsicc_umin): Adjust gen_cmp*_media call.
1980 +       (unordered): Change the mode of unordered and operands[1] to
1981 +       SImode.
1982 +       (seq): Adjust gen_cmp*_media calls.  Make the mode of
1983 +       a temporary result of compare SImode if needed.  If the mode
1984 +       of operands[0] is DImode, extend the temporary result to DImode.
1985 +       (slt, sle, sgt, sge, sgtu, sltu, sleu, sgue, sne): Likewise.
1986 +       (sunorderd): Change the mode of match_operand and unorderd to
1987 +       SImode.
1988 +       (cmpeq{sf,df}_media): Remove.
1989 +       (cmpsieq{sf,df}_media): Rename to cmpeq{sf,df}_media.
1990 +       (cmp{gt,ge,un}{sf,df}_media): Change the mode of match_operand
1991 +       and compare operation to SImode.
1992 +
1993 +2007-05-18  Joseph Myers  <joseph@codesourcery.com>
1994 +
1995 +       * config/soft-fp/double.h, config/soft-fp/extended.h,
1996 +       config/soft-fp/floatundidf.c, config/soft-fp/floatundisf.c,
1997 +       config/soft-fp/floatunsidf.c, config/soft-fp/floatunsisf.c,
1998 +       config/soft-fp/op-2.h, config/soft-fp/op-4.h,
1999 +       config/soft-fp/op-common.h, config/soft-fp/quad.h: Update from
2000 +       glibc CVS.
2001 +
2002 +2007-05-17  Ian Lance Taylor  <iant@google.com>
2003 +
2004 +       PR tree-optimization/31953
2005 +       * tree-vrp.c (set_value_range_to_value): Add equiv parameter.
2006 +       Change all callers.
2007 +       (set_value_range_to_null): Call set_value_range_to_value.
2008 +       (extract_range_from_comparison): Likewise.
2009 +
2010 +2007-05-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
2011 +
2012 +       PR rtl-optimization/31691
2013 +       * combine.c (simplify_set): Build a new src pattern instead of
2014 +       substituting its operands in the COMPARE case.
2015 +
2016 +2007-05-14  Mark Mitchell  <mark@codesourcery.com>
2017 +
2018 +       * BASE-VER: Set to 4.2.1.
2019 +       * DEV-PHASE: Set to prerelease.
2020 +
2021  2007-05-13  Release Manager
2022  
2023         * GCC 4.2.0 released.
2024 @@ -307,7 +589,8 @@
2025  2007-04-03  Stuart Hastings  <stuart@apple.com>
2026  
2027         PR 31281
2028 -       * objc/objc-act.c (next_sjlj_build_catch_list): Delete volatile from rethrow decl.
2029 +       * objc/objc-act.c (next_sjlj_build_catch_list): Delete volatile
2030 +       from rethrow decl.
2031         * cse.c (record_jump_equiv): Bail out on CCmode comparisons.
2032  
2033  2007-04-03  Jakub Jelinek  <jakub@redhat.com>
2034 Index: gcc/testsuite/gcc.c-torture/execute/20070614-1.c
2035 ===================================================================
2036 --- gcc/testsuite/gcc.c-torture/execute/20070614-1.c    (.../tags/gcc_4_2_0_release)    (revision 0)
2037 +++ gcc/testsuite/gcc.c-torture/execute/20070614-1.c    (.../branches/gcc-4_2-branch)   (revision 126002)
2038 @@ -0,0 +1,33 @@
2039 +extern void abort (void);
2040 +
2041 +_Complex v = 3.0 + 1.0iF;
2042 +
2043 +void
2044 +foo (_Complex z, int *x)
2045 +{
2046 +  if (z != v)
2047 +    abort ();
2048 +}
2049 +
2050 +_Complex bar (_Complex z) __attribute__ ((pure));
2051 +_Complex
2052 +bar (_Complex z)
2053 +{
2054 +  return v;
2055 +}
2056 +
2057 +int
2058 +baz (void)
2059 +{
2060 +  int a, i;
2061 +  for (i = 0; i < 6; i++)
2062 +    foo (bar (1.0iF * i), &a);
2063 +  return 0;
2064 +}
2065 +
2066 +int
2067 +main ()
2068 +{
2069 +  baz ();
2070 +  return 0;
2071 +}
2072 Index: gcc/testsuite/gcc.c-torture/execute/vrp-7.c
2073 ===================================================================
2074 --- gcc/testsuite/gcc.c-torture/execute/vrp-7.c (.../tags/gcc_4_2_0_release)    (revision 0)
2075 +++ gcc/testsuite/gcc.c-torture/execute/vrp-7.c (.../branches/gcc-4_2-branch)   (revision 126002)
2076 @@ -0,0 +1,20 @@
2077 +
2078 +void abort (void);
2079 +
2080 +struct T
2081 +{
2082 +  int b : 1;
2083 +} t;
2084 +
2085 +void __attribute__((noinline)) foo (int f)
2086 +{
2087 +  t.b = (f & 0x10) ? 1 : 0;
2088 +}
2089 +
2090 +int main (void)
2091 +{
2092 +  foo (0x10);
2093 +  if (!t.b)
2094 +    abort ();
2095 +  return 0;
2096 +}
2097 Index: gcc/testsuite/gcc.c-torture/execute/20070517-1.c
2098 ===================================================================
2099 --- gcc/testsuite/gcc.c-torture/execute/20070517-1.c    (.../tags/gcc_4_2_0_release)    (revision 0)
2100 +++ gcc/testsuite/gcc.c-torture/execute/20070517-1.c    (.../branches/gcc-4_2-branch)   (revision 126002)
2101 @@ -0,0 +1,41 @@
2102 +/* PR rtl-optimization/31691 */
2103 +/* Origin: Chi-Hua Chen <stephaniechc-gccbug@yahoo.com> */
2104 +
2105 +extern void abort (void);
2106 +
2107 +static int get_kind(int) __attribute__ ((noinline));
2108 +
2109 +static int get_kind(int v)
2110 +{
2111 +  volatile int k = v;
2112 +  return k;
2113 +}
2114 +
2115 +static int some_call(void) __attribute__ ((noinline));
2116 +
2117 +static int some_call(void)
2118 +{
2119 +  return 0;
2120 +}
2121 +
2122 +static void example (int arg)
2123 +{
2124 +  int tmp, kind = get_kind (arg);
2125 +
2126 +  if (kind == 9 || kind == 10 || kind == 5)
2127 +    {
2128 +      if (some_call() == 0)
2129 +        {
2130 +          if (kind == 9 || kind == 10)
2131 +            tmp = arg;
2132 +          else
2133 +            abort();
2134 +        }
2135 +    }
2136 +} 
2137 +
2138 +int main(void)
2139 +{
2140 +  example(10);
2141 +  return 0;
2142 +}
2143 Index: gcc/testsuite/gcc.c-torture/compile/pr32169.c
2144 ===================================================================
2145 --- gcc/testsuite/gcc.c-torture/compile/pr32169.c       (.../tags/gcc_4_2_0_release)    (revision 0)
2146 +++ gcc/testsuite/gcc.c-torture/compile/pr32169.c       (.../branches/gcc-4_2-branch)   (revision 126002)
2147 @@ -0,0 +1,17 @@
2148 +void f(char);
2149 +static inline
2150 +void * __memset_generic(char c)
2151 +{
2152 +  f(c);
2153 +}
2154 +int prepare_startup_playback_urb(
2155 +     int b,
2156 +     int c
2157 +)
2158 +{
2159 +  char d;
2160 +  if (b)
2161 +    __memset_generic(c == ( 1) ? 0x80 : 0);
2162 +  else
2163 +    __memset_generic (c == ( 1) ? 0x80 : 0);
2164 +}
2165 Index: gcc/testsuite/gcc.c-torture/compile/pr31953.c
2166 ===================================================================
2167 --- gcc/testsuite/gcc.c-torture/compile/pr31953.c       (.../tags/gcc_4_2_0_release)    (revision 0)
2168 +++ gcc/testsuite/gcc.c-torture/compile/pr31953.c       (.../branches/gcc-4_2-branch)   (revision 126002)
2169 @@ -0,0 +1,14 @@
2170 +struct WView
2171 +{
2172 +  int hexedit_mode:1;
2173 +};
2174 +toggle_hexedit_mode (struct WView *view)
2175 +{
2176 +  if (view->hexedit_mode)
2177 +    {
2178 +    }
2179 +  else
2180 +    {
2181 +      view->hexedit_mode = !view->hexedit_mode;
2182 +    }
2183 +}
2184 Index: gcc/testsuite/gcc.target/sparc/combined-2.c
2185 ===================================================================
2186 --- gcc/testsuite/gcc.target/sparc/combined-2.c (.../tags/gcc_4_2_0_release)    (revision 126002)
2187 +++ gcc/testsuite/gcc.target/sparc/combined-2.c (.../branches/gcc-4_2-branch)   (revision 126002)
2188 @@ -1,7 +1,7 @@
2189  /* { dg-do compile } */
2190  /* { dg-options "-O2 -mcpu=ultrasparc -mvis" } */
2191 -typedef char pixel __attribute__((vector_size(4)));
2192 -typedef char vec8 __attribute__((vector_size(8)));
2193 +typedef unsigned char pixel __attribute__((vector_size(4)));
2194 +typedef unsigned char vec8 __attribute__((vector_size(8)));
2195  typedef short vec16 __attribute__((vector_size(8)));
2196  
2197  vec16 foo (pixel a, pixel b) {
2198 Index: gcc/testsuite/gcc.target/sparc/fpmul.c
2199 ===================================================================
2200 --- gcc/testsuite/gcc.target/sparc/fpmul.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
2201 +++ gcc/testsuite/gcc.target/sparc/fpmul.c      (.../branches/gcc-4_2-branch)   (revision 126002)
2202 @@ -2,9 +2,9 @@
2203  /* { dg-options "-mcpu=ultrasparc -mvis" } */
2204  typedef int vec32 __attribute__((vector_size(8)));
2205  typedef short vec16 __attribute__((vector_size(8)));
2206 -typedef char pixel __attribute__((vector_size(4)));
2207 +typedef unsigned char pixel __attribute__((vector_size(4)));
2208  typedef short pixel16 __attribute__((vector_size(4)));
2209 -typedef char vec8 __attribute__((vector_size(8)));
2210 +typedef unsigned char vec8 __attribute__((vector_size(8)));
2211  
2212  vec16 foo1 (pixel a, vec16 b) {
2213    return __builtin_vis_fmul8x16 (a, b);
2214 Index: gcc/testsuite/gcc.target/sparc/pdist.c
2215 ===================================================================
2216 --- gcc/testsuite/gcc.target/sparc/pdist.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
2217 +++ gcc/testsuite/gcc.target/sparc/pdist.c      (.../branches/gcc-4_2-branch)   (revision 126002)
2218 @@ -1,8 +1,7 @@
2219  /* { dg-do compile } */
2220  /* { dg-options "-mcpu=ultrasparc -mvis" } */
2221 -
2222  typedef long long int64_t;
2223 -typedef char vec8 __attribute__((vector_size(8)));
2224 +typedef unsigned char vec8 __attribute__((vector_size(8)));
2225  
2226  int64_t foo (vec8 a, vec8 b) {
2227    int64_t d = 0;
2228 Index: gcc/testsuite/gcc.target/sparc/fexpand.c
2229 ===================================================================
2230 --- gcc/testsuite/gcc.target/sparc/fexpand.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
2231 +++ gcc/testsuite/gcc.target/sparc/fexpand.c    (.../branches/gcc-4_2-branch)   (revision 126002)
2232 @@ -1,7 +1,7 @@
2233  /* { dg-do compile } */
2234  /* { dg-options "-mcpu=ultrasparc -mvis" } */
2235  typedef short vec16 __attribute__((vector_size(8)));
2236 -typedef char vec8 __attribute__((vector_size(4)));
2237 +typedef unsigned char vec8 __attribute__((vector_size(4)));
2238  
2239  vec16 foo (vec8 a) {
2240    return __builtin_vis_fexpand (a);
2241 Index: gcc/testsuite/gcc.target/sparc/fnot.c
2242 ===================================================================
2243 --- gcc/testsuite/gcc.target/sparc/fnot.c       (.../tags/gcc_4_2_0_release)    (revision 126002)
2244 +++ gcc/testsuite/gcc.target/sparc/fnot.c       (.../branches/gcc-4_2-branch)   (revision 126002)
2245 @@ -1,8 +1,8 @@
2246  /* { dg-do compile } */
2247  /* { dg-options "-O -mcpu=ultrasparc -mvis" } */
2248 -typedef char  vec8 __attribute__((vector_size(8)));
2249 +typedef unsigned char vec8 __attribute__((vector_size(8)));
2250  typedef short vec16 __attribute__((vector_size(8)));
2251 -typedef int   vec32 __attribute__((vector_size(8)));
2252 +typedef int vec32 __attribute__((vector_size(8)));
2253  
2254  extern vec8 foo1_8(void);
2255  extern void foo2_8(vec8);
2256 @@ -21,7 +21,7 @@
2257  #endif
2258  
2259  extern vec16 foo1_16(void);
2260 -extern void foo2_16(vec8);
2261 +extern void foo2_16(vec16);
2262  
2263  
2264  vec16 fun16(void)
2265 @@ -38,7 +38,7 @@
2266  #endif
2267  
2268  extern vec32 foo1_32(void);
2269 -extern void foo2_32(vec8);
2270 +extern void foo2_32(vec32);
2271  
2272  vec32 fun32(void)
2273  {
2274 Index: gcc/testsuite/gcc.target/sparc/mfpu.c
2275 ===================================================================
2276 --- gcc/testsuite/gcc.target/sparc/mfpu.c       (.../tags/gcc_4_2_0_release)    (revision 0)
2277 +++ gcc/testsuite/gcc.target/sparc/mfpu.c       (.../branches/gcc-4_2-branch)   (revision 126002)
2278 @@ -0,0 +1,11 @@
2279 +/* Reported by Peter A. Krauss <peter.a.krauss@web.de> */
2280 +
2281 +/* { dg-do compile } */
2282 +/* { dg-options "-mfpu" } */
2283 +
2284 +float square(float x)
2285 +{
2286 +  return x * x;
2287 +}
2288 +
2289 +/* { dg-final { scan-assembler "fmuls" } } */
2290 Index: gcc/testsuite/gcc.target/sparc/noresult.c
2291 ===================================================================
2292 --- gcc/testsuite/gcc.target/sparc/noresult.c   (.../tags/gcc_4_2_0_release)    (revision 126002)
2293 +++ gcc/testsuite/gcc.target/sparc/noresult.c   (.../branches/gcc-4_2-branch)   (revision 126002)
2294 @@ -1,7 +1,6 @@
2295  /* { dg-do compile } */
2296  /* { dg-options "-mcpu=ultrasparc -mvis" } */
2297  typedef short vec16 __attribute__((vector_size(8)));
2298 -typedef char vec8 __attribute__((vector_size(4)));
2299  
2300  void foo (vec16 a) {
2301    __builtin_vis_fpack16 (a);
2302 Index: gcc/testsuite/gcc.target/sparc/fpmerge.c
2303 ===================================================================
2304 --- gcc/testsuite/gcc.target/sparc/fpmerge.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
2305 +++ gcc/testsuite/gcc.target/sparc/fpmerge.c    (.../branches/gcc-4_2-branch)   (revision 126002)
2306 @@ -1,7 +1,7 @@
2307  /* { dg-do compile } */
2308  /* { dg-options "-mcpu=ultrasparc -mvis" } */
2309 -typedef char pixel __attribute__((vector_size(8)));
2310 -typedef char vec8 __attribute__((vector_size(4)));
2311 +typedef unsigned char pixel __attribute__((vector_size(8)));
2312 +typedef unsigned char vec8 __attribute__((vector_size(4)));
2313  
2314  pixel foo (vec8 a, vec8 b) {
2315    return __builtin_vis_fpmerge (a, b);
2316 Index: gcc/testsuite/gcc.target/sparc/align.c
2317 ===================================================================
2318 --- gcc/testsuite/gcc.target/sparc/align.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
2319 +++ gcc/testsuite/gcc.target/sparc/align.c      (.../branches/gcc-4_2-branch)   (revision 126002)
2320 @@ -1,10 +1,9 @@
2321  /* { dg-do compile } */
2322  /* { dg-options "-mcpu=ultrasparc -mvis" } */
2323 -
2324  typedef long long int64_t;
2325  typedef int vec32 __attribute__((vector_size(8)));
2326  typedef short vec16 __attribute__((vector_size(8)));
2327 -typedef char vec8 __attribute__((vector_size(8)));
2328 +typedef unsigned char vec8 __attribute__((vector_size(8)));
2329  
2330  vec16 foo1 (vec16 a, vec16 b) {
2331    return __builtin_vis_faligndatav4hi (a, b);
2332 Index: gcc/testsuite/gcc.target/sparc/fpack16.c
2333 ===================================================================
2334 --- gcc/testsuite/gcc.target/sparc/fpack16.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
2335 +++ gcc/testsuite/gcc.target/sparc/fpack16.c    (.../branches/gcc-4_2-branch)   (revision 126002)
2336 @@ -1,7 +1,7 @@
2337  /* { dg-do compile } */
2338  /* { dg-options "-mcpu=ultrasparc -mvis" } */
2339  typedef short vec16 __attribute__((vector_size(8)));
2340 -typedef char vec8 __attribute__((vector_size(4)));
2341 +typedef unsigned char vec8 __attribute__((vector_size(4)));
2342  
2343  vec8 foo (vec16 a) {
2344    return __builtin_vis_fpack16 (a);
2345 Index: gcc/testsuite/gcc.target/i386/sse2-vec-3.c
2346 ===================================================================
2347 --- gcc/testsuite/gcc.target/i386/sse2-vec-3.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2348 +++ gcc/testsuite/gcc.target/i386/sse2-vec-3.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2349 @@ -0,0 +1,37 @@
2350 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2351 +/* { dg-options "-O2 -msse2" } */
2352 +
2353 +#include "sse2-check.h"
2354 +
2355 +#include <emmintrin.h>
2356 +
2357 +static void
2358 +sse2_test (void)
2359 +{
2360 +  union
2361 +    {
2362 +      __m128i x;
2363 +      char c[16];
2364 +      short s[8];
2365 +      int i[4];
2366 +      long long ll[2];
2367 +    } val1;
2368 +  int res[4];
2369 +  int masks[4];
2370 +  int i;
2371 +
2372 +  for (i = 0; i < 16; i++)
2373 +    val1.c[i] = i;
2374 +
2375 +  res[0] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 0);
2376 +  res[1] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 1);
2377 +  res[2] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 2);
2378 +  res[3] = __builtin_ia32_vec_ext_v4si ((__v4si)val1.x, 3);
2379 +
2380 +  for (i = 0; i < 4; i++)
2381 +    masks[i] = i;
2382 +
2383 +  for (i = 0; i < 4; i++)
2384 +    if (res[i] != val1.i [masks[i]])
2385 +      abort ();
2386 +}
2387 Index: gcc/testsuite/gcc.target/i386/pr32389.c
2388 ===================================================================
2389 --- gcc/testsuite/gcc.target/i386/pr32389.c     (.../tags/gcc_4_2_0_release)    (revision 0)
2390 +++ gcc/testsuite/gcc.target/i386/pr32389.c     (.../branches/gcc-4_2-branch)   (revision 126002)
2391 @@ -0,0 +1,10 @@
2392 +/* Testcase by Mike Frysinger <vapier@gentoo.org>  */
2393 +
2394 +/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
2395 +/* { dg-options "-msse" } */
2396 +
2397 +double f1();
2398 +int f2() {
2399 +  __builtin_ia32_stmxcsr();
2400 +  return f1();
2401 +}
2402 Index: gcc/testsuite/gcc.target/i386/pr31167.c
2403 ===================================================================
2404 --- gcc/testsuite/gcc.target/i386/pr31167.c     (.../tags/gcc_4_2_0_release)    (revision 0)
2405 +++ gcc/testsuite/gcc.target/i386/pr31167.c     (.../branches/gcc-4_2-branch)   (revision 126002)
2406 @@ -0,0 +1,20 @@
2407 +/* { dg-do compile { target x86_64-*-* } } */
2408 +/* { dg-options "-O" } */
2409 +
2410 +typedef int int32_t;
2411 +
2412 +int32_t round32hi (const __int128_t arg)
2413 +{
2414 +  const int SHIFT = 96;
2415 +  const int mshift = 96;
2416 +  const __int128_t M = (~(__int128_t) 0) << mshift;
2417 +  const __int128_t L = (~M) + 1;
2418 +  const __int128_t L1 = ((__int128_t) L) >> 1;
2419 +  const __int128_t Mlo = ((__int128_t) (~M)) >> 1;
2420 +  __int128_t vv = arg & M;
2421 +
2422 +  if ((arg & (L1)) && ((arg & Mlo) || (arg & L)))
2423 +    vv += L;
2424 +
2425 +  return (int32_t) (vv >> SHIFT);
2426 +}
2427 Index: gcc/testsuite/gcc.target/i386/sse2-vec-4.c
2428 ===================================================================
2429 --- gcc/testsuite/gcc.target/i386/sse2-vec-4.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2430 +++ gcc/testsuite/gcc.target/i386/sse2-vec-4.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2431 @@ -0,0 +1,41 @@
2432 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2433 +/* { dg-options "-O2 -msse2" } */
2434 +
2435 +#include "sse2-check.h"
2436 +
2437 +#include <emmintrin.h>
2438 +
2439 +static void
2440 +sse2_test (void)
2441 +{
2442 +  union
2443 +    {
2444 +      __m128i x;
2445 +      char c[16];
2446 +      short s[8];
2447 +      int i[4];
2448 +      long long ll[2];
2449 +    } val1;
2450 +  short res[8];
2451 +  int masks[8];
2452 +  int i;
2453 +
2454 +  for (i = 0; i < 16; i++)
2455 +    val1.c[i] = i;
2456 +
2457 +  res[0] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 0);
2458 +  res[1] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 1);
2459 +  res[2] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 2);
2460 +  res[3] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 3);
2461 +  res[4] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 4);
2462 +  res[5] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 5);
2463 +  res[6] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 6);
2464 +  res[7] = __builtin_ia32_vec_ext_v8hi ((__v8hi)val1.x, 7);
2465 +
2466 +  for (i = 0; i < 8; i++)
2467 +    masks[i] = i;
2468 +
2469 +  for (i = 0; i < 8; i++)
2470 +    if (res[i] != val1.s [masks[i]])
2471 +      abort ();
2472 +}
2473 Index: gcc/testsuite/gcc.target/i386/sse2-check.h
2474 ===================================================================
2475 --- gcc/testsuite/gcc.target/i386/sse2-check.h  (.../tags/gcc_4_2_0_release)    (revision 0)
2476 +++ gcc/testsuite/gcc.target/i386/sse2-check.h  (.../branches/gcc-4_2-branch)   (revision 126002)
2477 @@ -0,0 +1,20 @@
2478 +#include <stdio.h>
2479 +#include <stdlib.h>
2480 +
2481 +#include "../../gcc.dg/i386-cpuid.h"
2482 +
2483 +static void sse2_test (void);
2484 +
2485 +int
2486 +main ()
2487 +{
2488 +  unsigned long cpu_facilities;
2489
2490 +  cpu_facilities = i386_cpuid_edx ();
2491 +
2492 +  /* Run SSE2 test only if host has SSE2 support.  */
2493 +  if ((cpu_facilities & bit_SSE2))
2494 +    sse2_test ();
2495 +
2496 +  exit (0);
2497 +}
2498 Index: gcc/testsuite/gcc.target/i386/sse2-vec-1.c
2499 ===================================================================
2500 --- gcc/testsuite/gcc.target/i386/sse2-vec-1.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2501 +++ gcc/testsuite/gcc.target/i386/sse2-vec-1.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2502 @@ -0,0 +1,35 @@
2503 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2504 +/* { dg-options "-O2 -msse2" } */
2505 +
2506 +#include "sse2-check.h"
2507 +
2508 +#include <emmintrin.h>
2509 +
2510 +#define msk0   0
2511 +#define msk1   1
2512 +
2513 +static void
2514 +sse2_test (void)
2515 +{
2516 +  union
2517 +    {
2518 +      __m128d x;
2519 +      double d[2];
2520 +    } val1;
2521 +  double res[2];
2522 +  int masks[2];
2523 +  int i;
2524 +
2525 +  val1.d[0] = 23.;
2526 +  val1.d[1] = 45;
2527 +
2528 +  res[0] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk0);
2529 +  res[1] = __builtin_ia32_vec_ext_v2df ((__v2df)val1.x, msk1);
2530 +
2531 +  masks[0] = msk0;
2532 +  masks[1] = msk1;
2533 +
2534 +  for (i = 0; i < 2; i++)
2535 +    if (res[i] != val1.d [masks[i]])
2536 +      abort ();
2537 +}
2538 Index: gcc/testsuite/gcc.target/i386/sse2-vec-5.c
2539 ===================================================================
2540 --- gcc/testsuite/gcc.target/i386/sse2-vec-5.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2541 +++ gcc/testsuite/gcc.target/i386/sse2-vec-5.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2542 @@ -0,0 +1,49 @@
2543 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2544 +/* { dg-options "-O2 -msse2" } */
2545 +
2546 +#include "sse2-check.h"
2547 +
2548 +#include <emmintrin.h>
2549 +
2550 +static void
2551 +sse2_test (void)
2552 +{
2553 +  union
2554 +    {
2555 +      __m128i x;
2556 +      char c[16];
2557 +      short s[8];
2558 +      int i[4];
2559 +      long long ll[2];
2560 +    } val1;
2561 +  char res[16];
2562 +  int masks[16];
2563 +  int i;
2564 +
2565 +  for (i = 0; i < 16; i++)
2566 +    val1.c[i] = i;
2567 +
2568 +  res[0] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 0);
2569 +  res[1] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 1);
2570 +  res[2] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 2);
2571 +  res[3] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 3);
2572 +  res[4] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 4);
2573 +  res[5] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 5);
2574 +  res[6] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 6);
2575 +  res[7] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 7);
2576 +  res[8] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 8);
2577 +  res[9] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 9);
2578 +  res[10] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 10);
2579 +  res[11] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 11);
2580 +  res[12] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 12);
2581 +  res[13] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 13);
2582 +  res[14] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 14);
2583 +  res[15] = __builtin_ia32_vec_ext_v16qi ((__v16qi)val1.x, 15);
2584 +
2585 +  for (i = 0; i < 16; i++)
2586 +    masks[i] = i;
2587 +
2588 +  for (i = 0; i < 16; i++)
2589 +    if (res[i] != val1.c [masks[i]])
2590 +      abort ();
2591 +}
2592 Index: gcc/testsuite/gcc.target/i386/sse2-vec-2.c
2593 ===================================================================
2594 --- gcc/testsuite/gcc.target/i386/sse2-vec-2.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2595 +++ gcc/testsuite/gcc.target/i386/sse2-vec-2.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2596 @@ -0,0 +1,35 @@
2597 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2598 +/* { dg-options "-O2 -msse2" } */
2599 +
2600 +#include "sse2-check.h"
2601 +
2602 +#include <emmintrin.h>
2603 +
2604 +static void
2605 +sse2_test (void)
2606 +{
2607 +  union
2608 +    {
2609 +      __m128i x;
2610 +      char c[16];
2611 +      short s[8];
2612 +      int i[4];
2613 +      long long ll[2];
2614 +    } val1;
2615 +  long long res[2];
2616 +  int masks[2];
2617 +  int i;
2618 +
2619 +  for (i = 0; i < 16; i++)
2620 +    val1.c[i] = i;
2621 +
2622 +  res[0] = __builtin_ia32_vec_ext_v2di ((__v2di)val1.x, 0);
2623 +  res[1] = __builtin_ia32_vec_ext_v2di ((__v2di)val1.x, 1);
2624 +
2625 +  for (i = 0; i < 2; i++)
2626 +    masks[i] = i;
2627 +
2628 +  for (i = 0; i < 2; i++)
2629 +    if (res[i] != val1.ll [masks[i]])
2630 +      abort ();
2631 +}
2632 Index: gcc/testsuite/gcc.target/i386/sse2-vec-6.c
2633 ===================================================================
2634 --- gcc/testsuite/gcc.target/i386/sse2-vec-6.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2635 +++ gcc/testsuite/gcc.target/i386/sse2-vec-6.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2636 @@ -0,0 +1,69 @@
2637 +/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2638 +/* { dg-options "-O2 -msse2" } */
2639 +
2640 +#include "sse2-check.h"
2641 +
2642 +#include <emmintrin.h>
2643 +#include <string.h>
2644 +
2645 +static void
2646 +sse2_test (void)
2647 +{
2648 +  union
2649 +    {
2650 +      __m128i x;
2651 +      char c[16];
2652 +      short s[8];
2653 +      int i[4];
2654 +      long long ll[2];
2655 +    } val1, res[16], tmp;
2656 +  short ins[8] = { 8, 5, 9, 4, 2, 6, 1, 20 };
2657 +  int masks[8];
2658 +  int i;
2659 +
2660 +  for (i = 0; i < 16; i++)
2661 +    val1.c[i] = i;
2662 +
2663 +  res[0].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2664 +                                                   ins[0], 0);
2665 +  res[1].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2666 +                                                   ins[0], 1);
2667 +  res[2].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2668 +                                                   ins[0], 2);
2669 +  res[3].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2670 +                                                   ins[0], 3);
2671 +  res[4].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2672 +                                                   ins[0], 4);
2673 +  res[5].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2674 +                                                   ins[0], 5);
2675 +  res[6].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2676 +                                                   ins[0], 6);
2677 +  res[7].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2678 +                                                   ins[0], 7);
2679 +
2680 +  for (i = 0; i < 8; i++)
2681 +    masks[i] = i;
2682 +
2683 +  for (i = 0; i < 8; i++)
2684 +    {
2685 +      tmp.x = val1.x;
2686 +      tmp.s[masks[i]] = ins[0];
2687 +      if (memcmp (&tmp, &res[i], sizeof (tmp)))
2688 +       abort ();
2689 +    }
2690 +
2691 +  for (i = 0; i < 8; i++)
2692 +    {
2693 +      res[i].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
2694 +                                                       ins[i], 0);
2695 +      masks[i] = 0;
2696 +    }
2697 +
2698 +  for (i = 0; i < 8; i++)
2699 +    {
2700 +      tmp.x = val1.x;
2701 +      tmp.s[masks[i]] = ins[i];
2702 +      if (memcmp (&tmp, &res[i], sizeof (tmp)))
2703 +       abort ();
2704 +    }
2705 +}
2706 Index: gcc/testsuite/gcc.dg/Wstrict-overflow-18.c
2707 ===================================================================
2708 --- gcc/testsuite/gcc.dg/Wstrict-overflow-18.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2709 +++ gcc/testsuite/gcc.dg/Wstrict-overflow-18.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2710 @@ -0,0 +1,22 @@
2711 +/* { dg-do compile } */
2712 +/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
2713 +
2714 +/* Don't warn about an overflow when folding i > 0.  The loop analysis
2715 +   should determine that i does not wrap.  */
2716 +
2717 +struct c { unsigned int a; unsigned int b; };
2718 +extern void bar (struct c *);
2719 +int
2720 +foo (struct c *p)
2721 +{
2722 +  int i;
2723 +  int sum = 0;
2724 +
2725 +  for (i = 0; i < p->a - p->b; ++i)
2726 +    {
2727 +      if (i > 0)
2728 +       sum += 2;
2729 +      bar (p);
2730 +    }
2731 +  return sum;
2732 +}
2733 Index: gcc/testsuite/gcc.dg/Wstrict-overflow-19.c
2734 ===================================================================
2735 --- gcc/testsuite/gcc.dg/Wstrict-overflow-19.c  (.../tags/gcc_4_2_0_release)    (revision 0)
2736 +++ gcc/testsuite/gcc.dg/Wstrict-overflow-19.c  (.../branches/gcc-4_2-branch)   (revision 126002)
2737 @@ -0,0 +1,15 @@
2738 +/* { dg-do compile } */
2739 +/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */
2740 +
2741 +/* Don't warn about an overflow when threading jumps.  We used to get
2742 +   a warning from comparing bounds generated by VRP.  */
2743 +
2744 +int
2745 +bar(int a, int b, int n)
2746 +{
2747 +  if (b > a)
2748 +    n = a - b;
2749 +  if (a >= b)
2750 +    n = 1;
2751 +  return n;
2752 +}
2753 Index: gcc/testsuite/ChangeLog
2754 ===================================================================
2755 --- gcc/testsuite/ChangeLog     (.../tags/gcc_4_2_0_release)    (revision 126002)
2756 +++ gcc/testsuite/ChangeLog     (.../branches/gcc-4_2-branch)   (revision 126002)
2757 @@ -1,3 +1,190 @@
2758 +2007-06-21  Uros Bizjak  <ubizjak@gmail.com>
2759 +
2760 +       PR target/32389
2761 +       * gcc.target/i386/pr32389.c New test.
2762 +
2763 +2007-06-20  Daniel Franke  <franke.daniel@gmail.com>
2764 +
2765 +       Backport from trunk:
2766 +       PR fortran/32002
2767 +       * gfortran.dg/compliant_elemental_intrinsics_2.f90: New test.
2768 +
2769 +2007-06-20  Jakub Jelinek  <jakub@redhat.com>
2770 +
2771 +       PR inline-asm/32109
2772 +       * g++.dg/ext/asm10.C: New test.
2773 +
2774 +       PR middle-end/32285
2775 +       * gcc.c-torture/execute/20070614-1.c: New test.
2776 +
2777 +2007-06-20  Paul Thomas  <pault@gcc.gnu.org>
2778 +
2779 +       PR fortran/32302
2780 +       * gfortran.dg/common_resize_1.f90: New test.
2781 +
2782 +2007-06-19  Richard Guenther  <rguenther@suse.de>
2783 +       Michael Matz  <matz@suse.de>
2784 +
2785 +       PR tree-optimization/30252
2786 +       * g++.dg/opt/pr30252.C: New testcase.
2787 +
2788 +2007-06-19  Jakub Jelinek  <jakub@redhat.com>
2789 +
2790 +       PR tree-optimization/32353
2791 +       * g++.dg/opt/nrv13.C: New test.
2792 +
2793 +2007-06-15  Mark Mitchell  <mark@codesourcery.com>
2794 +
2795 +       * g++.dg/lookup/anon6.C: New test.
2796 +
2797 +2007-06-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
2798 +
2799 +       * gcc.target/sparc/align.c: Use 'unsigned char' as element type.
2800 +       * gcc.target/sparc/combined-2.c: Likewise.
2801 +       * gcc.target/sparc/fexpand.c : Likewise.
2802 +       * gcc.target/sparc/fnot.c: Likewise.  Fix a couple of prototypes.
2803 +       * gcc.target/sparc/fpack16.c : Likewise.
2804 +       * gcc.target/sparc/fpmerge.c : Likewise.
2805 +       * gcc.target/sparc/fpmul.c : Likewise.
2806 +       * gcc.target/sparc/noresult.c : Likewise.
2807 +       * gcc.target/sparc/pdist.c: Likewise.
2808 +
2809 +2007-06-15  Diego Novillo  <dnovillo@google.com>
2810 +
2811 +       PR 32327
2812 +       * g++.dg/tree-ssa/pr32327-1.C: New test.
2813 +       * g++.dg/tree-ssa/pr32327.C: New test.
2814 +
2815 +2007-06-13  Eric Botcazou  <ebotcazou@libertysurf.fr>
2816 +
2817 +       * gcc.target/sparc/mfpu.c: New test.
2818 +
2819 +2007-06-09  Ian Lance Taylor  <iant@google.com>
2820 +
2821 +       PR tree-optimization/32169
2822 +       * gcc.c-torture/compile/pr32169.c: New test.
2823 +
2824 +2007-06-08  Dirk Mueller  <dmueller@suse.de>
2825 +
2826 +       PR c++/31809
2827 +       Backport from mainline:
2828 +       2007-05-30  Jakub Jelinek  <jakub@redhat.com>
2829 +
2830 +       * g++.dg/opt/static5.C: New test.
2831 +
2832 +2007-06-06  Ian Lance Taylor  <iant@google.com>
2833 +
2834 +       * g++.dg/conversion/enum1.C: New test.
2835 +
2836 +2007-06-05  Ian Lance Taylor  <iant@google.com>
2837 +
2838 +       * gcc.dg/Wstrict-overflow-19.c: New test.
2839 +
2840 +2007-06-04  Ian Lance Taylor  <iant@google.com>
2841 +
2842 +       * gcc.dg/Wstrict-overflow-18.c: New test.
2843 +
2844 +2007-05-31  H.J. Lu  <hongjiu.lu@intel.com>
2845 +
2846 +       Backport from mainline:
2847 +       2007-05-25  H.J. Lu  <hongjiu.lu@intel.com>
2848 +
2849 +       * gcc.target/i386/sse2-check.h: New.
2850 +       * gcc.target/i386/sse2-vec-1.c: Likewise.
2851 +       * gcc.target/i386/sse2-vec-2.c: Likewise.
2852 +       * gcc.target/i386/sse2-vec-3.c: Likewise.
2853 +       * gcc.target/i386/sse2-vec-4.c: Likewise.
2854 +       * gcc.target/i386/sse2-vec-5.c: Likewise.
2855 +       * gcc.target/i386/sse2-vec-6.c: Likewise.
2856 +
2857 +2007-05-31  Paul Thomas  <pault@gcc.gnu.org>
2858 +
2859 +       PR fortran/31483
2860 +       * gfortran.dg/altreturn_5.f90: New test.
2861 +
2862 +       PR fortran/31540
2863 +       * gfortran.dg/char_result_5.f90: New test.
2864 +
2865 +       PR fortran/31867
2866 +       * gfortran.dg/char_length_5.f90: New test.
2867 +
2868 +       PR fortran/31994
2869 +       * gfortran.dg/array_reference_1.f90: New test.
2870 +
2871 +2007-05-22  Tobias Burnus  <burnus@net-b.de>
2872 +
2873 +       PR fortran/31559
2874 +       Backport from mainline.
2875 +       * primary.c (match_variable): External functions
2876 +       are no variables.
2877 +
2878 +2007-05-30  Jakub Jelinek  <jakub@redhat.com>
2879 +
2880 +       PR tree-optimization/31769
2881 +       * g++.dg/gomp/pr31769.C: New test.
2882 +
2883 +2007-05-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>
2884 +
2885 +       PR tree-opt/32100
2886 +       * gcc.c-torture/execute/vrp-7.c: New test.
2887 +        
2888 +2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
2889 +
2890 +       PR libfortran/31964
2891 +       * gfortran.fortran-torture/execute/intrinsic_bitops.f90: Update.
2892 +
2893 +2007-05-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
2894 +
2895 +       PR libgfortran/31051
2896 +       * gfortran.dg/fmt_t_3.f90: New.
2897 +
2898 +2007-05-22  Dominique d'Humieres  <dominiq@lps.ens.fr>
2899 +
2900 +       * gfortran.dg/unf_io_convert_3.f90: Fix dg directive.
2901 +
2902 +2007-05-22  Tobias Burnus  <burnus@net-b.de>
2903 +
2904 +       PR fortran/31559
2905 +       Backport from mainline.
2906 +       * func_assign.f90: New test.
2907 +
2908 +2007-05-21  Uros Bizjak  <ubizjak@gmail.com>
2909 +
2910 +       PR target/31167
2911 +       Backport from mainline.
2912 +       * gcc.target/i386/pr31167.c: New test.
2913 +
2914 +2007-05-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
2915 +
2916 +       PR libgfortran/31395
2917 +       * gfortran.dg/fmt_colon.f90: New test.
2918 +
2919 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
2920 +
2921 +       PR fortran/31618
2922 +       Backport from trunk.
2923 +       * gfortran.dg/backspace_8.f:  New test case.
2924 +
2925 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
2926 +
2927 +       PR libfortran/31196
2928 +       Backport from trunk.
2929 +       * gfortran.dg/reshape_transpose_1.f90:  New test.
2930 +
2931 +2007-05-17  Ian Lance Taylor  <iant@google.com>
2932 +
2933 +       PR tree-optimization/31953
2934 +       * gcc.c-torture/compile/pr31953.c: New test.
2935 +
2936 +2007-05-17  Eric Botcazou  <ebotcazou@libertysurf.fr>
2937 +
2938 +       * gcc.c-torture/execute/20070517-1.c: New test.
2939 +
2940 +2007-05-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
2941 +
2942 +       PR fortran/31725
2943 +       * gfortran.dg/substr_4.f: New test.
2944 +
2945  2007-05-13  Release Manager
2946  
2947         * GCC 4.2.0 released.
2948 Index: gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90
2949 ===================================================================
2950 --- gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90 (.../tags/gcc_4_2_0_release)    (revision 126002)
2951 +++ gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_bitops.f90 (.../branches/gcc-4_2-branch)   (revision 126002)
2952 @@ -8,7 +8,8 @@
2953     i = 2
2954     j = 3
2955     k = 12
2956 -
2957 +   a = 5
2958 +   
2959     if (.not. btest (i, o+1)) call abort
2960     if (btest (i, o+2)) call abort
2961     if (iand (i, j) .ne. 2) call abort
2962 @@ -26,4 +27,6 @@
2963     if (ishftc (k, o-30) .ne. 48) call abort
2964     if (ishftc (k, o+1, o+3) .ne. 9) call abort
2965     if (not (i) .ne. -3) call abort
2966 +   if (ishftc (a, 1, bit_size(a)) .ne. 10) call abort
2967 +   if (ishftc (1, 1, 32) .ne. 2) call abort
2968  end program
2969 Index: gcc/testsuite/g++.dg/tree-ssa/pr32327-1.C
2970 ===================================================================
2971 --- gcc/testsuite/g++.dg/tree-ssa/pr32327-1.C   (.../tags/gcc_4_2_0_release)    (revision 0)
2972 +++ gcc/testsuite/g++.dg/tree-ssa/pr32327-1.C   (.../branches/gcc-4_2-branch)   (revision 126002)
2973 @@ -0,0 +1,70 @@
2974 +// { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
2975 +// { dg-options "-O2" }
2976 +
2977 +// Endian sensitive.  This is a little-endian redux.
2978 +
2979 +typedef long long int64;
2980 +typedef unsigned long long uint64;
2981 +typedef __SIZE_TYPE__ size_t;
2982 +
2983 +extern "C" {
2984 +extern void *memcpy (void *__restrict __dest,
2985 +      __const void *__restrict __src, size_t __n) /*throw ()*/;
2986 +extern void abort (void);
2987 +}
2988 +
2989 +inline uint64 Swap64(uint64 ull) {
2990 + uint64 b0 = (ull >>  0) & 0xff;
2991 + uint64 b1 = (ull >>  8) & 0xff;
2992 + uint64 b2 = (ull >> 16) & 0xff;
2993 + uint64 b3 = (ull >> 24) & 0xff;
2994 + uint64 b4 = (ull >> 32) & 0xff;
2995 + uint64 b5 = (ull >> 40) & 0xff;
2996 + uint64 b6 = (ull >> 48) & 0xff;
2997 + uint64 b7 = (ull >> 56) & 0xff;
2998 + return (b0 << 56) | (b1 << 48) | (b2 << 40) | (b3 << 32) |
2999 +        (b4 << 24) | (b5 << 16) | (b6 <<  8) | (b7 <<  0);
3000 +}
3001 +
3002 +inline void KeyFromUint64(uint64 ull, unsigned char* key) {
3003 + uint64 ull_swap = Swap64(ull);
3004 + memcpy(key, &ull_swap, sizeof(uint64));
3005 +}
3006 +
3007 +inline int64 int64_from_double(const double& source) {
3008 + int64 dest;
3009 + memcpy(&dest, &source, sizeof(dest));
3010 + return dest;
3011 +}
3012 +
3013 +void KeyFromDouble(double x, unsigned char* key) __attribute__ ((noinline));
3014 +void KeyFromDouble(double x, unsigned char* key) {
3015 + int64 n = int64_from_double(x);
3016 + if (n >= 0) {
3017 +   n += 1ull << 63;
3018 + } else {
3019 +   n = -n;
3020 + }
3021 + KeyFromUint64(n, key);
3022 +}
3023 +
3024 +
3025 +void TestKeyFromDouble(uint64 ull) {
3026 + double d;
3027 + memcpy(&d, &ull, sizeof(d));
3028 +
3029 + unsigned char key[sizeof(uint64)];
3030 + unsigned char expected_key[sizeof(uint64)] = { 0x81, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
3031 +
3032 + KeyFromDouble(d, key);
3033 +
3034 + for (size_t i = 0; i < sizeof(key); ++i) {
3035 +   if ((key[i] & 0xff) != expected_key[i])
3036 +     abort ();
3037 + }
3038 +}
3039 +
3040 +int main() {
3041 + TestKeyFromDouble(0x0123456789abcdefull);
3042 + return 0;
3043 +}
3044 Index: gcc/testsuite/g++.dg/tree-ssa/pr32327.C
3045 ===================================================================
3046 --- gcc/testsuite/g++.dg/tree-ssa/pr32327.C     (.../tags/gcc_4_2_0_release)    (revision 0)
3047 +++ gcc/testsuite/g++.dg/tree-ssa/pr32327.C     (.../branches/gcc-4_2-branch)   (revision 126002)
3048 @@ -0,0 +1,84 @@
3049 +// { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
3050 +// { dg-options "-O2" }
3051 +
3052 +typedef unsigned long long uint64;
3053 +typedef __SIZE_TYPE__ size_t;
3054 +
3055 +extern "C" {
3056 +extern void *memcpy (void *__restrict __dest,
3057 +      __const void *__restrict __src, size_t __n) /*throw ()*/;
3058 +extern void abort (void);
3059 +}
3060 +
3061 +extern void foo (void* p);
3062 +
3063 +inline uint64
3064 +ghtonll(uint64 x)
3065 +{
3066 + // __r is allocated the same stack slot as dest below
3067 + union { unsigned long long int __ll;
3068 +         unsigned long int __l[2]; } __w, __r;
3069 + __w.__ll = x;
3070 + __r.__l[0] = (
3071 +   {
3072 +     register unsigned int __v;
3073 +     __asm__ __volatile__ ("bswap %0" : "=r" (__v) :
3074 +                           "0" ((unsigned int) (__w.__l[1])));
3075 +     __v; });
3076 +
3077 + __r.__l[1] = (
3078 +   {
3079 +     register unsigned int __v;
3080 +     __asm__ __volatile__ ("bswap %0" : "=r" (__v) :
3081 +                           "0" ((unsigned int) (__w.__l[0])));
3082 +     __v; });
3083 +
3084 + return __r.__ll;
3085 +}
3086 +
3087 +inline uint64
3088 +double_2_uint64 (const double *source)
3089 +{
3090 + uint64 dest;  // allocated the same stack slot as __r above
3091 + memcpy(&dest, source, sizeof(dest));
3092 + return dest;
3093 +}
3094 +
3095 +inline void
3096 +KeyFromUint64(uint64 fp) {
3097 + uint64 norder;
3098 + norder = ghtonll (fp);
3099 + foo((char*)(&norder));
3100 +}
3101 +
3102 +void
3103 +KeyFromDouble(double x) {
3104 + uint64 n = double_2_uint64 (&x);
3105 + if (n >= 42) {
3106 +   n += 1;
3107 + }
3108 +
3109 + KeyFromUint64(n);
3110 +}
3111 +
3112 +#define NUM            0x0123456789abcdefll
3113 +#define EXPECTED       0xe0bc9a7856347243ll
3114 +
3115 +void foo (void *x)
3116 +{
3117 +  if (*((uint64 *)x) != (uint64) EXPECTED)
3118 +    abort ();
3119 +}
3120 +
3121 +int main ()
3122 +{
3123 +  if (sizeof (double) != sizeof (uint64))
3124 +    return 0;
3125 +
3126 +  if (sizeof (uint64) == sizeof (unsigned long int))
3127 +    return 0;
3128 +
3129 +  KeyFromDouble ((double)NUM);
3130 +
3131 +  return 0;
3132 +}
3133 Index: gcc/testsuite/g++.dg/conversion/enum1.C
3134 ===================================================================
3135 --- gcc/testsuite/g++.dg/conversion/enum1.C     (.../tags/gcc_4_2_0_release)    (revision 0)
3136 +++ gcc/testsuite/g++.dg/conversion/enum1.C     (.../branches/gcc-4_2-branch)   (revision 126002)
3137 @@ -0,0 +1,10 @@
3138 +// { dg-do run }
3139 +// { dg-options "-O2 -finline-functions" }
3140 +
3141 +enum E { V = 1 };
3142 +static const E E_MIN = V;
3143 +static const E E_MAX = V;
3144 +
3145 +bool valid(E v) { return v >= E_MIN && v <= E_MAX; }
3146 +
3147 +int main() { return valid(E(2)); }
3148 Index: gcc/testsuite/g++.dg/ext/asm10.C
3149 ===================================================================
3150 --- gcc/testsuite/g++.dg/ext/asm10.C    (.../tags/gcc_4_2_0_release)    (revision 0)
3151 +++ gcc/testsuite/g++.dg/ext/asm10.C    (.../branches/gcc-4_2-branch)   (revision 126002)
3152 @@ -0,0 +1,14 @@
3153 +// PR inline-asm/32109
3154 +// { dg-do compile }
3155 +// { dg-options "-O2" }
3156 +
3157 +struct A { int i[3]; ~A (); };
3158 +struct A a;
3159 +struct B { struct A c; int i; B (); } b;
3160 +
3161 +B::B ()
3162 +{
3163 +  __asm ("" : : "r" (a));      // { dg-error "impossible constraint|non-memory input" }
3164 +  __asm ("" : : "r" (b.c));    // { dg-error "impossible constraint|non-memory input" }
3165 +  __asm ("" : : "r" (c));      // { dg-error "impossible constraint|non-memory input" }
3166 +}
3167 Index: gcc/testsuite/g++.dg/gomp/pr31769.C
3168 ===================================================================
3169 --- gcc/testsuite/g++.dg/gomp/pr31769.C (.../tags/gcc_4_2_0_release)    (revision 0)
3170 +++ gcc/testsuite/g++.dg/gomp/pr31769.C (.../branches/gcc-4_2-branch)   (revision 126002)
3171 @@ -0,0 +1,61 @@
3172 +// PR tree-optimization/31769
3173 +// { dg-options "-O2 -fopenmp" }
3174 +// { dg-do compile }
3175 +
3176 +struct B
3177 +{
3178 +  B () {}
3179 +  virtual ~B () {}
3180 +};
3181 +struct C
3182 +{
3183 +  C (int x, int y) {}
3184 +};
3185 +template<typename T, int U>
3186 +struct D
3187 +{
3188 +  D () {}
3189 +  ~D () {}
3190 +};
3191 +struct E
3192 +{
3193 +  E () {}
3194 +  ~E () {}
3195 +  D<int, 1> e;
3196 +};
3197 +struct A
3198 +{
3199 +  B *b;
3200 +  A () { b = __null; }
3201 +  ~A () { if (b != __null) delete b; }
3202 +};
3203 +struct F : public A
3204 +{
3205 +  explicit F (int x) { foo (0); }
3206 +  F (const F &x) {}
3207 +  F (F &x, C y) {}
3208 +  F operator () (C x) const
3209 +  {
3210 +    return F (const_cast<F &>(*this), x);
3211 +  }
3212 +  template <typename U> F & operator+= (const U &);
3213 +  void foo (int);
3214 +  E f;
3215 +};
3216 +
3217 +int
3218 +main ()
3219 +{
3220 +  try
3221 +  {
3222 +    F f (10);
3223 +    F g (10);
3224 +    C h (0, 9);
3225 +#pragma omp parallel for
3226 +    for (int i = 0; i < 2; ++i)
3227 +      g += f (h);
3228 +  }
3229 +  catch (int &e)
3230 +  {
3231 +  }
3232 +}
3233 Index: gcc/testsuite/g++.dg/opt/pr30252.C
3234 ===================================================================
3235 --- gcc/testsuite/g++.dg/opt/pr30252.C  (.../tags/gcc_4_2_0_release)    (revision 0)
3236 +++ gcc/testsuite/g++.dg/opt/pr30252.C  (.../branches/gcc-4_2-branch)   (revision 126002)
3237 @@ -0,0 +1,226 @@
3238 +/* { dg-do run } */
3239 +/* { dg-options "-O -fstrict-aliasing" } */
3240 +
3241 +extern "C" void abort (void);
3242 +namespace sigc {
3243 +  template <class T_type>
3244 +  struct type_trait
3245 +  {
3246 +    typedef T_type& pass;
3247 +    typedef const T_type& take;
3248 +    typedef T_type* pointer;
3249 +  };
3250 +  template <class T_base, class T_derived>
3251 +  struct is_base_and_derived
3252 +  {
3253 +    struct big {
3254 +      char memory[64];
3255 +    };
3256 +    static big is_base_class_(...);
3257 +    static char is_base_class_(typename type_trait<T_base>::pointer);
3258 +    static const bool value =
3259 +    sizeof(is_base_class_(reinterpret_cast<typename type_trait<T_derived>::pointer>(0))) ==
3260 +    sizeof(char);
3261 +  };
3262 +  struct nil;
3263 +  struct functor_base {};
3264 +  template <class T_functor, bool I_derives_functor_base=is_base_and_derived<functor_base,T_functor>::value>
3265 +  struct functor_trait
3266 +  {
3267 +  };
3268 +  template <class T_functor>
3269 +  struct functor_trait<T_functor,true>
3270 +  {
3271 +    typedef typename T_functor::result_type result_type;
3272 +    typedef T_functor functor_type;
3273 +  };
3274 +  template <class T_arg1, class T_return>
3275 +  class pointer_functor1 : public functor_base
3276 +  {
3277 +    typedef T_return (*function_type)(T_arg1);
3278 +    function_type func_ptr_;
3279 +  public:
3280 +    typedef T_return result_type;
3281 +    explicit pointer_functor1(function_type _A_func): func_ptr_(_A_func) {}
3282 +    T_return operator()(typename type_trait<T_arg1>::take _A_a1) const
3283 +    { return func_ptr_(_A_a1); }
3284 +  };
3285 +  template <class T_arg1, class T_return>
3286 +  inline pointer_functor1<T_arg1, T_return>
3287 +  ptr_fun1(T_return (*_A_func)(T_arg1))
3288 +  { return pointer_functor1<T_arg1, T_return>(_A_func); }
3289 +  struct adaptor_base : public functor_base {};
3290 +  template <class T_functor,
3291 +    class T_arg1=void,
3292 +    bool I_derives_adaptor_base=is_base_and_derived<adaptor_base,T_functor>::value>
3293 +  struct deduce_result_type
3294 +  { typedef typename functor_trait<T_functor>::result_type type; };
3295 +  template <class T_functor>
3296 +  struct adaptor_functor : public adaptor_base
3297 +  {
3298 +    template <class T_arg1=void>
3299 +    struct deduce_result_type
3300 +    { typedef typename sigc::deduce_result_type<T_functor, T_arg1>::type type; };
3301 +    typedef typename functor_trait<T_functor>::result_type result_type;
3302 +    result_type
3303 +    operator()() const;
3304 +    template <class T_arg1>
3305 +    typename deduce_result_type<T_arg1>::type
3306 +    operator()(T_arg1 _A_arg1) const
3307 +    { return functor_(_A_arg1); }
3308 +    explicit adaptor_functor(const T_functor& _A_functor)
3309 +      : functor_(_A_functor)
3310 +    {}
3311 +    mutable T_functor functor_;
3312 +  };
3313 +  template <class T_functor>
3314 +  typename adaptor_functor<T_functor>::result_type
3315 +  adaptor_functor<T_functor>::operator()() const
3316 +  { return functor_(); }
3317 +  template <class T_functor, bool I_isadaptor = is_base_and_derived<adaptor_base, T_functor>::value> struct adaptor_trait;
3318 +  template <class T_functor>
3319 +  struct adaptor_trait<T_functor, true>
3320 +  {
3321 +    typedef T_functor adaptor_type;
3322 +  };
3323 +  template <class T_functor>
3324 +  struct adaptor_trait<T_functor, false>
3325 +  {
3326 +    typedef typename functor_trait<T_functor>::functor_type functor_type;
3327 +    typedef adaptor_functor<functor_type> adaptor_type;
3328 +  };
3329 +  template <class T_functor>
3330 +  struct adapts : public adaptor_base
3331 +  {
3332 +    typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
3333 +    explicit adapts(const T_functor& _A_functor)
3334 +      : functor_(_A_functor)
3335 +    {}
3336 +    mutable adaptor_type functor_;
3337 +  };
3338 +  template <class T_type>
3339 +  struct reference_wrapper
3340 +  {
3341 +  };
3342 +  template <class T_type>
3343 +  struct unwrap_reference
3344 +  {
3345 +    typedef T_type type;
3346 +  };
3347 +  template <class T_type>
3348 +  class bound_argument
3349 +  {
3350 +  public:
3351 +    bound_argument(const T_type& _A_argument)
3352 +      : visited_(_A_argument)
3353 +    {}
3354 +    inline T_type& invoke()
3355 +    { return visited_; }
3356 +    T_type visited_;
3357 +  };
3358 +  template <class T_wrapped>
3359 +  class bound_argument< reference_wrapper<T_wrapped> >
3360 +  {
3361 +  };
3362 +  template <int I_location, class T_functor, class T_type1=nil>
3363 +  struct bind_functor;
3364 +  template <class T_functor, class T_type1>
3365 +  struct bind_functor<-1, T_functor, T_type1> : public adapts<T_functor>
3366 +  {
3367 +    typedef typename adapts<T_functor>::adaptor_type adaptor_type;
3368 +    typedef typename adaptor_type::result_type result_type;
3369 +    result_type
3370 +    operator()()
3371 +    {
3372 +      return this->functor_.template operator()<typename type_trait<typename unwrap_reference<T_type1>::type>::pass> (bound1_.invoke());
3373 +    }
3374 +    bind_functor(typename type_trait<T_functor>::take _A_func, typename type_trait<T_type1>::take _A_bound1)
3375 +      : adapts<T_functor>(_A_func), bound1_(_A_bound1)
3376 +    {}
3377 +    bound_argument<T_type1> bound1_;
3378 +  };
3379 +  template <class T_type1, class T_functor>
3380 +  inline bind_functor<-1, T_functor,
3381 +                     T_type1>
3382 +  bind(const T_functor& _A_func, T_type1 _A_b1)
3383 +  { return bind_functor<-1, T_functor,
3384 +      T_type1>
3385 +      (_A_func, _A_b1);
3386 +  }
3387 +  namespace internal {
3388 +    struct slot_rep;
3389 +    typedef void* (*hook)(slot_rep *);
3390 +    struct slot_rep
3391 +    {
3392 +      hook call_;
3393 +    };
3394 +  }
3395 +  class slot_base : public functor_base
3396 +  {
3397 +  public:
3398 +    typedef internal::slot_rep rep_type;
3399 +    explicit slot_base(rep_type* rep)
3400 +      : rep_(rep)
3401 +    {
3402 +    }
3403 +    mutable rep_type *rep_;
3404 +  };
3405 +  namespace internal {
3406 +    template <class T_functor>
3407 +    struct typed_slot_rep : public slot_rep
3408 +    {
3409 +      typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type;
3410 +      adaptor_type functor_;
3411 +      inline typed_slot_rep(const T_functor& functor)
3412 +       : functor_(functor)
3413 +      {
3414 +      }
3415 +    };
3416 +    template<class T_functor>
3417 +    struct slot_call0
3418 +    {
3419 +      static void *call_it(slot_rep* rep)
3420 +      {
3421 +       typedef typed_slot_rep<T_functor> typed_slot;
3422 +       typed_slot *typed_rep = static_cast<typed_slot*>(rep);
3423 +       return (typed_rep->functor_)();
3424 +      }
3425 +      static hook address()
3426 +      {
3427 +       return &call_it;
3428 +      }
3429 +    };
3430 +  }
3431 +
3432 +  class slot0 : public slot_base
3433 +  {
3434 +  public:
3435 +    typedef void * (*call_type)(rep_type*);
3436 +    inline void *operator()() const
3437 +    {
3438 +      return slot_base::rep_->call_ (slot_base::rep_);
3439 +    }
3440 +    template <class T_functor>
3441 +    slot0(const T_functor& _A_func)
3442 +      : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
3443 +    {
3444 +      slot_base::rep_->call_ = internal::slot_call0<T_functor>::address();
3445 +    }
3446 +  };
3447 +}
3448 +struct A
3449 +{
3450 +  static void *foo (void *p) { return p; }
3451 +  typedef sigc::slot0 C;
3452 +  C bar();
3453 +};
3454 +A::C A::bar ()
3455 +{
3456 +  return sigc::bind (sigc::ptr_fun1 (&A::foo), (void*)0);
3457 +}
3458 +int main (void)
3459 +{
3460 +  A a;
3461 +  if (a.bar ()() != 0)
3462 +    abort ();
3463 +}
3464 Index: gcc/testsuite/g++.dg/opt/static5.C
3465 ===================================================================
3466 --- gcc/testsuite/g++.dg/opt/static5.C  (.../tags/gcc_4_2_0_release)    (revision 0)
3467 +++ gcc/testsuite/g++.dg/opt/static5.C  (.../branches/gcc-4_2-branch)   (revision 126002)
3468 @@ -0,0 +1,29 @@
3469 +// PR c++/31809
3470 +// { dg-do run }
3471 +// { dg-options "-O2" }
3472 +
3473 +struct S
3474 +{
3475 +  unsigned v;
3476 +  static inline S f (unsigned a);
3477 +};
3478 +
3479 +inline S
3480 +S::f (unsigned a)
3481 +{
3482 +  static S t = { a };
3483 +  return t;
3484 +}
3485 +
3486 +const static S s = S::f (26);
3487 +
3488 +extern "C" void abort (void);
3489 +
3490 +int
3491 +main ()
3492 +{
3493 +  S t = s;
3494 +  if (t.v != 26)
3495 +    abort ();
3496 +  return 0;
3497 +}
3498 Index: gcc/testsuite/g++.dg/opt/nrv13.C
3499 ===================================================================
3500 --- gcc/testsuite/g++.dg/opt/nrv13.C    (.../tags/gcc_4_2_0_release)    (revision 0)
3501 +++ gcc/testsuite/g++.dg/opt/nrv13.C    (.../branches/gcc-4_2-branch)   (revision 126002)
3502 @@ -0,0 +1,42 @@
3503 +// PR tree-optimization/32353
3504 +// { dg-do run }
3505 +// { dg-options "-O2" }
3506 +
3507 +extern "C" void abort ();
3508 +
3509 +struct A
3510 +{
3511 +  int f;
3512 +  A (int x) : f (x) {}
3513 +};
3514 +
3515 +A
3516 +foo (const A &x, const A &y)
3517 +{
3518 +  A r (0);
3519 +  r = x.f == -111 ? y : (y.f == -111 || x.f > y.f) ? x : y;
3520 +  A s (0);
3521 +  r = r.f == -111 ? s : (r.f > s.f) ? r : s;
3522 +  return r;
3523 +}
3524 +
3525 +int
3526 +main ()
3527 +{
3528 +  if (foo (A (0), A (1)).f != 1)
3529 +    abort ();
3530 +  if (foo (A (1), A (9)).f != 9)
3531 +    abort ();
3532 +  if (foo (A (9), A (1)).f != 9)
3533 +    abort ();
3534 +  if (foo (A (-4), A (-5)).f != 0)
3535 +    abort ();
3536 +  if (foo (A (-111), A (-111)).f != 0)
3537 +    abort ();
3538 +  if (foo (A (2), A (-111)).f != 2)
3539 +    abort ();
3540 +  if (foo (A (-111), A (6)).f != 6)
3541 +    abort ();
3542 +  if (foo (A (-111), A (-4)).f != 0)
3543 +    abort ();
3544 +}
3545 Index: gcc/testsuite/g++.dg/lookup/anon6.C
3546 ===================================================================
3547 --- gcc/testsuite/g++.dg/lookup/anon6.C (.../tags/gcc_4_2_0_release)    (revision 0)
3548 +++ gcc/testsuite/g++.dg/lookup/anon6.C (.../branches/gcc-4_2-branch)   (revision 126002)
3549 @@ -0,0 +1,11 @@
3550 +extern int v1; // { dg-error "declared" }
3551 +static union { int v1; }; // { dg-error "redeclaration" } 
3552 +
3553 +static union { int v2; }; // { dg-error "declared" }
3554 +extern int v2; // { dg-error "redeclaration" } 
3555 +
3556 +int v3; // { dg-error "declared" }
3557 +static union { int v3; }; // { dg-error "redeclaration" } 
3558 +
3559 +static union { int v4; }; // { dg-error "declared" }
3560 +static union { int v4; }; // { dg-error "redeclaration" } 
3561 Index: gcc/testsuite/gfortran.dg/char_length_5.f90
3562 ===================================================================
3563 --- gcc/testsuite/gfortran.dg/char_length_5.f90 (.../tags/gcc_4_2_0_release)    (revision 0)
3564 +++ gcc/testsuite/gfortran.dg/char_length_5.f90 (.../branches/gcc-4_2-branch)   (revision 126002)
3565 @@ -0,0 +1,61 @@
3566 +! { dg-do run }
3567 +! Tests the fix for PR31867, in which the interface evaluation
3568 +! of the character length of 'join' (ie. the length available in
3569 +! the caller) was wrong.
3570 +!
3571 +! Contributed by <beliavsky@aol.com> 
3572 +!
3573 +module util_mod
3574 +  implicit none
3575 +contains
3576 +  function join (words, sep) result(str)
3577 +    character (len=*), intent(in)        :: words(:),sep
3578 +    character (len = (size (words) - 1) * len_trim (sep) + & 
3579 +               sum (len_trim (words)))   :: str
3580 +    integer                              :: i,nw
3581 +    nw  = size (words)
3582 +    str = ""
3583 +    if (nw < 1) then
3584 +      return
3585 +    else
3586 +      str = words(1)
3587 +    end if
3588 +    do i=2,nw
3589 +      str = trim (str) // trim (sep) // words(i)
3590 +    end do
3591 +  end function join
3592 +end module util_mod
3593 +!
3594 +program xjoin
3595 +  use util_mod, only: join
3596 +  implicit none
3597 +  integer yy
3598 +  character (len=5) :: words(5:8) = (/"two  ","three","four ","five "/), sep = "^#^"
3599 +  character (len=5) :: words2(4) = (/"bat  ","ball ","goal ","stump"/), sep2 = "&"
3600 +
3601 +  if (join (words, sep) .ne. "two^#^three^#^four^#^five") call abort ()
3602 +  if (len (join (words, sep)) .ne. 25) call abort ()
3603 +
3604 +  if (join (words(5:6), sep) .ne. "two^#^three") call abort ()
3605 +  if (len (join (words(5:6), sep)) .ne. 11) call abort ()
3606 +
3607 +  if (join (words(7:8), sep) .ne. "four^#^five") call abort ()
3608 +  if (len (join (words(7:8), sep)) .ne. 11) call abort ()
3609 +
3610 +  if (join (words(5:7:2), sep) .ne. "two^#^four") call abort ()
3611 +  if (len (join (words(5:7:2), sep)) .ne. 10) call abort ()
3612 +
3613 +  if (join (words(6:8:2), sep) .ne. "three^#^five") call abort ()
3614 +  if (len (join (words(6:8:2), sep)) .ne. 12) call abort ()
3615 +
3616 +  if (join (words2, sep2) .ne. "bat&ball&goal&stump") call abort ()
3617 +  if (len (join (words2, sep2)) .ne. 19) call abort ()
3618 +
3619 +  if (join (words2(1:2), sep2) .ne. "bat&ball") call abort ()
3620 +  if (len (join (words2(1:2), sep2)) .ne. 8) call abort ()
3621 +
3622 +  if (join (words2(2:4:2), sep2) .ne. "ball&stump") call abort ()
3623 +  if (len (join (words2(2:4:2), sep2)) .ne. 10) call abort ()
3624 +
3625 +end program xjoin
3626 +! { dg-final { cleanup-modules "util_mod" } }
3627 Index: gcc/testsuite/gfortran.dg/array_reference_1.f90
3628 ===================================================================
3629 --- gcc/testsuite/gfortran.dg/array_reference_1.f90     (.../tags/gcc_4_2_0_release)    (revision 0)
3630 +++ gcc/testsuite/gfortran.dg/array_reference_1.f90     (.../branches/gcc-4_2-branch)   (revision 126002)
3631 @@ -0,0 +1,35 @@
3632 +! { dg-do run }
3633 +! Tests the fix for PR31994, aka 31867, in which the offset
3634 +! of 'a' in both subroutines was being evaluated incorrectly.
3635 +! The testcase for PR31867 is char_length_5.f90
3636 +!
3637 +! Contributed by Elizabeth Yip <elizabeth.l.yip@boeing.com>
3638 +!            and Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
3639 +!
3640 +program main
3641 +  call PR31994
3642 +  call PR31994_comment6
3643 +contains
3644 +  subroutine PR31994
3645 +    implicit none
3646 +    complex (kind=4), dimension(2,2) :: a, b, c
3647 +    a(1,1) = (1.,1.)
3648 +    a(2,1) = (2.,2.)
3649 +    a(1,2) = (3.,3.)
3650 +    a(2,2) = (4.,4.)
3651 +    b=conjg (transpose (a))
3652 +    c=transpose (a)
3653 +    c=conjg (c)
3654 +    if (any (b .ne. c)) call abort ()
3655 +  end subroutine PR31994
3656 +  subroutine PR31994_comment6
3657 +    implicit none
3658 +    real ,dimension(2,2)::a
3659 +    integer ,dimension(2,2) :: b, c
3660 +    a = reshape ((/1.,2.,3.,4./), (/2,2/))
3661 +    b=int (transpose(a))
3662 +    c = int (a)
3663 +    c = transpose (c)
3664 +    if (any (b .ne. c)) call abort ()
3665 +  end subroutine PR31994_comment6
3666 +END program main
3667 Index: gcc/testsuite/gfortran.dg/reshape_transpose_1.f90
3668 ===================================================================
3669 --- gcc/testsuite/gfortran.dg/reshape_transpose_1.f90   (.../tags/gcc_4_2_0_release)    (revision 0)
3670 +++ gcc/testsuite/gfortran.dg/reshape_transpose_1.f90   (.../branches/gcc-4_2-branch)   (revision 126002)
3671 @@ -0,0 +1,18 @@
3672 +! { dg-do run }
3673 +! PR 31196 - reshape of transposed derived types generated
3674 +!            wront results.
3675 +program main
3676 +  implicit none
3677 +  TYPE datatype
3678 +     INTEGER :: I
3679 +  END TYPE datatype
3680 +  character (len=20) line1, line2
3681 +  TYPE(datatype), dimension(2,2) :: data, result
3682 +  data(1,1)%i = 1
3683 +  data(2,1)%i = 2
3684 +  data(1,2)%i = 3
3685 +  data(2,2)%i = 4
3686 +  write (unit=line1, fmt="(4I4)") reshape(transpose(data),shape(data))
3687 +  write (unit=line2, fmt="(4I4)") (/ 1, 3, 2, 4 /)
3688 +  if (line1 /= line2) call abort
3689 +END program main
3690 Index: gcc/testsuite/gfortran.dg/common_resize_1.f
3691 ===================================================================
3692 --- gcc/testsuite/gfortran.dg/common_resize_1.f (.../tags/gcc_4_2_0_release)    (revision 0)
3693 +++ gcc/testsuite/gfortran.dg/common_resize_1.f (.../branches/gcc-4_2-branch)   (revision 126002)
3694 @@ -0,0 +1,176 @@
3695 +c { dg-do run }
3696 +c { dg-options "-std=legacy" }
3697 +c
3698 +c Tests the fix for PR32302, in which the resizing of 'aux32' would cause
3699 +c misalignment for double precision types and a wrong result would be obtained
3700 +c at any level of optimization except none.
3701 +c
3702 +c Contributed by Dale Ranta <dir@lanl.gov> 
3703 +c
3704 +      subroutine unpki(ixp,nwcon,nmel)
3705 +      parameter(lnv=32)
3706 +      implicit double precision (a-h,o-z)                                    dp
3707 +c
3708 +c     unpack connection data
3709 +c
3710 +      common/aux32/kka(lnv),kkb(lnv),kkc(lnv),
3711 +     1 kk1(lnv),kk2(lnv),kk3(lnv),dxy(lnv),
3712 +     2 dyx(lnv),dyz(lnv),dzy(lnv),dzx(lnv),
3713 +     3 dxz(lnv),vx17(lnv),vx28(lnv),vx35(lnv),
3714 +     4 vx46(lnv),vy17(lnv),vy28(lnv),
3715 +     5 vy35(lnv),vy46(lnv),vz17(lnv),vz28(lnv),vz35(lnv),vz46(lnv)
3716 +      common/aux33/ix1(lnv),ix2(lnv),ix3(lnv),ix4(lnv),ix5(lnv),
3717 +     1             ix6(lnv),ix7(lnv),ix8(lnv),mxt(lnv)
3718 +      dimension ixp(nwcon,*)
3719 +c
3720 +      return
3721 +      end
3722 +      subroutine prtal
3723 +      parameter(lnv=32)
3724 +      implicit double precision (a-h,o-z)                                    dp
3725 +      common/aux8/
3726 +     & x1(lnv),x2(lnv),x3(lnv),x4(lnv),
3727 +     & x5(lnv),x6(lnv),x7(lnv),x8(lnv),
3728 +     & y1(lnv),y2(lnv),y3(lnv),y4(lnv),
3729 +     & y5(lnv),y6(lnv),y7(lnv),y8(lnv),
3730 +     & z1(lnv),z2(lnv),z3(lnv),z4(lnv),
3731 +     & z5(lnv),z6(lnv),z7(lnv),z8(lnv)
3732 +      common/aux9/vlrho(lnv),det(lnv)
3733 +      common/aux10/
3734 +     1 px1(lnv),px2(lnv),px3(lnv),px4(lnv),
3735 +     & px5(lnv),px6(lnv),px7(lnv),px8(lnv),
3736 +     2 py1(lnv),py2(lnv),py3(lnv),py4(lnv),
3737 +     & py5(lnv),py6(lnv),py7(lnv),py8(lnv),
3738 +     3 pz1(lnv),pz2(lnv),pz3(lnv),pz4(lnv),
3739 +     & pz5(lnv),pz6(lnv),pz7(lnv),pz8(lnv),
3740 +     4 vx1(lnv),vx2(lnv),vx3(lnv),vx4(lnv),
3741 +     5 vx5(lnv),vx6(lnv),vx7(lnv),vx8(lnv),
3742 +     6 vy1(lnv),vy2(lnv),vy3(lnv),vy4(lnv),
3743 +     7 vy5(lnv),vy6(lnv),vy7(lnv),vy8(lnv),
3744 +     8 vz1(lnv),vz2(lnv),vz3(lnv),vz4(lnv),
3745 +     9 vz5(lnv),vz6(lnv),vz7(lnv),vz8(lnv)
3746 +      common/aux32/    ! { dg-warning "shall be of the same size" }
3747 +     a a17(lnv),a28(lnv),dett(lnv),
3748 +     1 aj1(lnv),aj2(lnv),aj3(lnv),aj4(lnv),
3749 +     2 aj5(lnv),aj6(lnv),aj7(lnv),aj8(lnv),
3750 +     3 aj9(lnv),x17(lnv),x28(lnv),x35(lnv),
3751 +     4 x46(lnv),y17(lnv),y28(lnv),y35(lnv),
3752 +     5 y46(lnv),z17(lnv),z28(lnv),z35(lnv),z46(lnv)
3753 +      common/aux33/    ! { dg-warning "shall be of the same size" }
3754 +     a ix1(lnv),ix2(lnv),ix3(lnv),ix4(lnv),ix5(lnv),
3755 +     1             ix6(lnv),ix7(lnv),ix8(lnv),mxt(lnv),nmel
3756 +      common/aux36/lft,llt
3757 +      common/failu/sieu(lnv),failu(lnv)
3758 +      common/sand1/ihf,ibemf,ishlf,itshf
3759 +      dimension aj5968(lnv),aj6749(lnv),aj4857(lnv),aji1(lnv),aji2(lnv),
3760 +     1          aji3(lnv),aji4(lnv),aji5(lnv),
3761 +     1          aji6(lnv),aji7(lnv),aji8(lnv),aji9(lnv),aj12(lnv),
3762 +     2          aj45(lnv),aj78(lnv),b17(lnv),b28(lnv),c17(lnv),c28(lnv)
3763 +c
3764 +      equivalence (x17,aj5968),(x28,aj6749),(x35,aj4857),(x46,aji1),
3765 +     1 (y17,aji2),(y28,aji3),(y35,aji4),(y46,aji5),(z17,aji6),
3766 +     2 (z28,aji7),(z35,aji8),(z46,aji9),(aj1,aj12),(aj2,aj45),
3767 +     3 (aj3,aj78),(px1,b17),(px2,b28),(px3,c17),(px4,c28)
3768 +      data o64th/0.0156250/
3769 +c
3770 +c     jacobian matrix
3771 +c
3772 +      do 10 i=lft,llt
3773 +      x17(i)=x7(i)-x1(i)
3774 +      x28(i)=x8(i)-x2(i)
3775 +      x35(i)=x5(i)-x3(i)
3776 +      x46(i)=x6(i)-x4(i)
3777 +      y17(i)=y7(i)-y1(i)
3778 +      y28(i)=y8(i)-y2(i)
3779 +      y35(i)=y5(i)-y3(i)
3780 +      y46(i)=y6(i)-y4(i)
3781 +      z17(i)=z7(i)-z1(i)
3782 +      z28(i)=z8(i)-z2(i)
3783 +      z35(i)=z5(i)-z3(i)
3784 +   10 z46(i)=z6(i)-z4(i)
3785 +      do 20 i=lft,llt
3786 +      aj1(i)=x17(i)+x28(i)-x35(i)-x46(i)
3787 +      aj2(i)=y17(i)+y28(i)-y35(i)-y46(i)
3788 +      aj3(i)=z17(i)+z28(i)-z35(i)-z46(i)
3789 +      a17(i)=x17(i)+x46(i)
3790 +      a28(i)=x28(i)+x35(i)
3791 +      b17(i)=y17(i)+y46(i)
3792 +      b28(i)=y28(i)+y35(i)
3793 +      c17(i)=z17(i)+z46(i)
3794 +   20 c28(i)=z28(i)+z35(i)
3795 +      do 30 i=lft,llt
3796 +      aj4(i)=a17(i)+a28(i)
3797 +      aj5(i)=b17(i)+b28(i)
3798 +      aj6(i)=c17(i)+c28(i)
3799 +      aj7(i)=a17(i)-a28(i)
3800 +      aj8(i)=b17(i)-b28(i)
3801 +   30 aj9(i)=c17(i)-c28(i)
3802 +c
3803 +c     jacobian
3804 +c
3805 +      do 40 i=lft,llt
3806 +      aj5968(i)=aj5(i)*aj9(i)-aj6(i)*aj8(i)
3807 +      aj6749(i)=aj6(i)*aj7(i)-aj4(i)*aj9(i)
3808 +   40 aj4857(i)=aj4(i)*aj8(i)-aj5(i)*aj7(i)
3809 +      if (ihf.ne.1) then
3810 +      do 50 i=lft,llt
3811 +   50 det(i)=o64th*(aj1(i)*aj5968(i)+aj2(i)*aj6749(i)+aj3(i)*aj4857(i))
3812 +      else
3813 +      do 55 i=lft,llt
3814 +      det(i)=o64th*(aj1(i)*aj5968(i)+aj2(i)*aj6749(i)+aj3(i)*aj4857(i))
3815 +     1       *failu(i) + (1. - failu(i))
3816 +   55 continue
3817 +      endif
3818 +      do 60 i=lft,llt
3819 +   60 dett(i)=o64th/det(i)
3820 +
3821 +      if (det(lft) .ne. 1d0) call abort ()
3822 +      if (det(llt) .ne. 1d0) call abort ()
3823 +
3824 +      return
3825 +c
3826 +      end
3827 +      program main
3828 +      parameter(lnv=32)
3829 +      implicit double precision (a-h,o-z)                                    dp
3830 +      common/aux8/
3831 +     & x1(lnv),x2(lnv),x3(lnv),x4(lnv),
3832 +     & x5(lnv),x6(lnv),x7(lnv),x8(lnv),
3833 +     & y1(lnv),y2(lnv),y3(lnv),y4(lnv),
3834 +     & y5(lnv),y6(lnv),y7(lnv),y8(lnv),
3835 +     & z1(lnv),z2(lnv),z3(lnv),z4(lnv),
3836 +     & z5(lnv),z6(lnv),z7(lnv),z8(lnv)
3837 +      common/aux36/lft,llt
3838 +      common/sand1/ihf,ibemf,ishlf,itshf
3839 +      lft=1
3840 +      llt=1
3841 +      x1(1)=0
3842 +      x2(1)=1
3843 +      x3(1)=1
3844 +      x4(1)=0
3845 +      x5(1)=0
3846 +      x6(1)=1
3847 +      x7(1)=1
3848 +      x8(1)=0
3849 +
3850 +      y1(1)=0
3851 +      y2(1)=0
3852 +      y3(1)=1
3853 +      y4(1)=1
3854 +      y5(1)=0
3855 +      y6(1)=0
3856 +      y7(1)=1
3857 +      y8(1)=1
3858 +
3859 +      z1(1)=0
3860 +      z2(1)=0
3861 +      z3(1)=0
3862 +      z4(1)=0
3863 +      z5(1)=1
3864 +      z6(1)=1
3865 +      z7(1)=1
3866 +      z8(1)=1
3867 +      call prtal
3868 +      stop
3869 +      end
3870 +
3871 Index: gcc/testsuite/gfortran.dg/fmt_colon.f90
3872 ===================================================================
3873 --- gcc/testsuite/gfortran.dg/fmt_colon.f90     (.../tags/gcc_4_2_0_release)    (revision 0)
3874 +++ gcc/testsuite/gfortran.dg/fmt_colon.f90     (.../branches/gcc-4_2-branch)   (revision 126002)
3875 @@ -0,0 +1,14 @@
3876 +! { dg-do run }
3877 +! PR31395 Colon edit descriptor is ignored.
3878 +! Test case derived from PR. Prepared by Jerry DeLisle
3879 +! <jvdelisle@gcc.gnu.org>
3880 +PROGRAM test
3881 +    INTEGER :: i = 1
3882 +    character(30) :: astring
3883 +    WRITE(astring, 10) i
3884 + 10 FORMAT('i =',I2:' this should not print')
3885 +    if (astring.ne."i = 1") call abort
3886 +    write(astring, 20) i, i
3887 + 20 format('i =',I2:' this should print',I2)
3888 +    if (astring.ne."i = 1 this should print 1") call abort
3889 +END PROGRAM test
3890 \ No newline at end of file
3891 Index: gcc/testsuite/gfortran.dg/char_result_13.f90
3892 ===================================================================
3893 --- gcc/testsuite/gfortran.dg/char_result_13.f90        (.../tags/gcc_4_2_0_release)    (revision 0)
3894 +++ gcc/testsuite/gfortran.dg/char_result_13.f90        (.../branches/gcc-4_2-branch)   (revision 126002)
3895 @@ -0,0 +1,13 @@
3896 +! { dg-do compile }
3897 +! tests the fix for PR31540, in which the character lengths in
3898 +! parentheses were not resolved.
3899 +!
3900 +! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
3901 +!
3902 +        subroutine pfb()
3903 +        implicit none
3904 +        external pfname1, pfname2
3905 +        character ((136)) pfname1
3906 +        character ((129+7)) pfname2
3907 +        return
3908 +        end
3909 Index: gcc/testsuite/gfortran.dg/compliant_elemental_intrinsics_2.f90
3910 ===================================================================
3911 --- gcc/testsuite/gfortran.dg/compliant_elemental_intrinsics_2.f90      (.../tags/gcc_4_2_0_release)    (revision 0)
3912 +++ gcc/testsuite/gfortran.dg/compliant_elemental_intrinsics_2.f90      (.../branches/gcc-4_2-branch)   (revision 126002)
3913 @@ -0,0 +1,44 @@
3914 +! { dg-compile }
3915 +!
3916 +! Testcases from PR32002.
3917 +!
3918 +PROGRAM test_pr32002
3919 +
3920 +  CALL test_1()                       ! scalar/vector
3921 +  CALL test_2()                       ! vector/vector
3922 +  CALL test_3()                       ! matrix/vector
3923 +  CALL test_4()                       ! matrix/matrix
3924 +
3925 +CONTAINS
3926 +  ELEMENTAL FUNCTION f(x)
3927 +    INTEGER, INTENT(in) :: x
3928 +    INTEGER :: f
3929 +    f = x
3930 +  END FUNCTION
3931 +
3932 +  SUBROUTINE test_1()
3933 +    INTEGER :: a = 0, b(2) = 0
3934 +    a = f(b)                          ! { dg-error "Incompatible ranks" }
3935 +    b = f(a)                          ! ok, set all array elements to f(a)
3936 +  END SUBROUTINE
3937 +
3938 +  SUBROUTINE test_2()
3939 +    INTEGER :: a(2) = 0, b(3) = 0
3940 +    a = f(b)                          ! { dg-error "different shape" }
3941 +    a = f(b(1:2))                     ! ok, slice, stride 1
3942 +    a = f(b(1:3:2))                   ! ok, slice, stride 2
3943 +  END SUBROUTINE
3944 +
3945 +  SUBROUTINE test_3()
3946 +    INTEGER :: a(4) = 0, b(2,2) = 0
3947 +    a = f(b)                          ! { dg-error "Incompatible ranks" }
3948 +    a = f(RESHAPE(b, (/ 4 /)))        ! ok, same shape
3949 +  END SUBROUTINE
3950 +
3951 +  SUBROUTINE test_4()
3952 +    INTEGER :: a(2,2) = 0, b(3,3) = 0
3953 +    a = f(b)                          ! { dg-error "different shape" }
3954 +    a = f(b(1:3, 1:2))                ! { dg-error "different shape" }
3955 +    a = f(b(1:3:2, 1:3:2))            ! ok, same shape
3956 +  END SUBROUTINE
3957 +END PROGRAM
3958 Index: gcc/testsuite/gfortran.dg/altreturn_5.f90
3959 ===================================================================
3960 --- gcc/testsuite/gfortran.dg/altreturn_5.f90   (.../tags/gcc_4_2_0_release)    (revision 0)
3961 +++ gcc/testsuite/gfortran.dg/altreturn_5.f90   (.../branches/gcc-4_2-branch)   (revision 126002)
3962 @@ -0,0 +1,30 @@
3963 +! { dg-do run }
3964 +! Tests the fix for PR31483, in which dummy argument procedures
3965 +! produced an ICE if they had an alternate return.
3966 +!
3967 +! Contributed by Mathias Fröhlich <M.Froehlich@science-computing.de>
3968 +
3969 +      SUBROUTINE R (i, *, *)
3970 +      INTEGER i
3971 +      RETURN i
3972 +      END
3973 +
3974 +      SUBROUTINE PHLOAD (READER, i, res)
3975 +      IMPLICIT NONE
3976 +      EXTERNAL         READER
3977 +      integer i
3978 +      character(3) res
3979 +      CALL READER (i, *1, *2)
3980 + 1    res = "one"
3981 +      return
3982 + 2    res = "two"
3983 +      return
3984 +      END
3985 +
3986 +      EXTERNAL R
3987 +      character(3) res
3988 +      call PHLOAD (R, 1, res)
3989 +      if (res .ne. "one") call abort ()
3990 +      CALL PHLOAD (R, 2, res)
3991 +      if (res .ne. "two") call abort ()
3992 +      END
3993 \ No newline at end of file
3994 Index: gcc/testsuite/gfortran.dg/substr_4.f
3995 ===================================================================
3996 --- gcc/testsuite/gfortran.dg/substr_4.f        (.../tags/gcc_4_2_0_release)    (revision 0)
3997 +++ gcc/testsuite/gfortran.dg/substr_4.f        (.../branches/gcc-4_2-branch)   (revision 126002)
3998 @@ -0,0 +1,69 @@
3999 +! { dg-do run }
4000 +      subroutine test_lower
4001 +      implicit none
4002 +      character(3), dimension(3) :: zsymel,zsymelr
4003 +      common /xx/ zsymel, zsymelr
4004 +      integer :: znsymelr
4005 +      zsymel = (/ 'X', 'Y', ' ' /)
4006 +      zsymelr= (/ 'X', 'Y', ' ' /)
4007 +      znsymelr=2
4008 +      call check_zsymel(zsymel,zsymelr,znsymelr)
4009 +
4010 +      contains
4011 +
4012 +      subroutine check_zsymel(zsymel,zsymelr,znsymelr)
4013 +        implicit none
4014 +        integer znsymelr, isym
4015 +        character(*) zsymel(*),zsymelr(*)
4016 +        character(len=80) buf
4017 +        zsymel(3)(lenstr(zsymel(3))+1:)='X'
4018 +        write (buf,10) (trim(zsymelr(isym)),isym=1,znsymelr)
4019 +10      format(3(a,:,','))
4020 +        if (trim(buf) /= 'X,Y') call abort
4021 +      end subroutine check_zsymel
4022 +
4023 +      function lenstr(s)
4024 +        character(len=*),intent(in) :: s
4025 +        integer :: lenstr
4026 +        if (len_trim(s) /= 0) call abort
4027 +        lenstr = len_trim(s)
4028 +      end function lenstr
4029 +
4030 +      end subroutine test_lower
4031 +
4032 +      subroutine test_upper
4033 +      implicit none
4034 +      character(3), dimension(3) :: zsymel,zsymelr
4035 +      common /xx/ zsymel, zsymelr
4036 +      integer :: znsymelr
4037 +      zsymel = (/ 'X', 'Y', ' ' /)
4038 +      zsymelr= (/ 'X', 'Y', ' ' /)
4039 +      znsymelr=2
4040 +      call check_zsymel(zsymel,zsymelr,znsymelr)
4041 +
4042 +      contains
4043 +
4044 +      subroutine check_zsymel(zsymel,zsymelr,znsymelr)
4045 +        implicit none
4046 +        integer znsymelr, isym
4047 +        character(*) zsymel(*),zsymelr(*)
4048 +        character(len=80) buf
4049 +        zsymel(3)(:lenstr(zsymel(3))+1)='X'
4050 +        write (buf,20) (trim(zsymelr(isym)),isym=1,znsymelr)
4051 +20      format(3(a,:,','))
4052 +        if (trim(buf) /= 'X,Y') call abort
4053 +      end subroutine check_zsymel
4054 +
4055 +      function lenstr(s)
4056 +        character(len=*),intent(in) :: s
4057 +        integer :: lenstr
4058 +        if (len_trim(s) /= 0) call abort
4059 +        lenstr = len_trim(s)
4060 +      end function lenstr
4061 +
4062 +      end subroutine test_upper
4063 +
4064 +      program test
4065 +        call test_lower
4066 +        call test_upper
4067 +      end program test
4068 Index: gcc/testsuite/gfortran.dg/fmt_t_3.f90
4069 ===================================================================
4070 --- gcc/testsuite/gfortran.dg/fmt_t_3.f90       (.../tags/gcc_4_2_0_release)    (revision 0)
4071 +++ gcc/testsuite/gfortran.dg/fmt_t_3.f90       (.../branches/gcc-4_2-branch)   (revision 126002)
4072 @@ -0,0 +1,15 @@
4073 +! { dg-do run }
4074 +! PR31051 bug with x and t format descriptors.
4075 +! Test case prepared by Jerry DeLisle  <jvdelisle@gcc.gnu.org> from PR.
4076 +program t
4077 +   integer, parameter :: n = 9
4078 +   character(len=40) :: fmt
4079 +   character(len=2), dimension(n) :: y
4080 +   open(unit=10, status="scratch")
4081 +   y = 'a '
4082 +   fmt = '(a,1x,(t7, 3a))'
4083 +   write(10, fmt) 'xxxx', (y(i), i = 1,n)
4084 +   rewind(10)
4085 +   read(10, '(a)') fmt
4086 +   if (fmt.ne."xxxx  a a a") call abort()
4087 +end program t
4088 Index: gcc/testsuite/gfortran.dg/backspace_8.f
4089 ===================================================================
4090 --- gcc/testsuite/gfortran.dg/backspace_8.f     (.../tags/gcc_4_2_0_release)    (revision 0)
4091 +++ gcc/testsuite/gfortran.dg/backspace_8.f     (.../branches/gcc-4_2-branch)   (revision 126002)
4092 @@ -0,0 +1,18 @@
4093 +C { dg-do run }
4094 +C PR libfortran/31618 - backspace after an error didn't work.
4095 +      program main
4096 +      character*78 msg
4097 +      open (21, file="backspace_7.dat", form="unformatted")
4098 +      write (21) 42, 43
4099 +      write (21) 4711, 4712
4100 +      write (21) -1, -4
4101 +      rewind (21)
4102 +      read (21) i,j
4103 +      read (21,err=100,end=100) i,j,k
4104 +      call abort
4105 + 100  continue
4106 +      backspace 21
4107 +      read (21) i,j
4108 +      if (i .ne. 4711 .or. j .ne. 4712) call abort
4109 +      close (21,status="delete")
4110 +      end
4111 Index: gcc/testsuite/gfortran.dg/func_assign.f90
4112 ===================================================================
4113 --- gcc/testsuite/gfortran.dg/func_assign.f90   (.../tags/gcc_4_2_0_release)    (revision 0)
4114 +++ gcc/testsuite/gfortran.dg/func_assign.f90   (.../branches/gcc-4_2-branch)   (revision 126002)
4115 @@ -0,0 +1,33 @@
4116 +! { dg-do compile }
4117 +!
4118 +! PR fortran/31559
4119 +! Do not allow assigning to external functions
4120 +!
4121 +! Contributed by Steve Kargl <sgk@troutmask.apl.washington.edu>
4122 +!
4123 +module mod
4124 +  implicit none
4125 +contains
4126 +  integer function bar()
4127 +    bar = 4
4128 +  end function bar
4129 +
4130 +  subroutine a() 
4131 +   implicit none
4132 +   real :: fun
4133 +   external fun
4134 +   interface
4135 +     function funget(a)
4136 +       integer :: a
4137 +     end function
4138 +     subroutine sub()
4139 +     end subroutine sub
4140 +   end interface
4141 +   sub = 'a'  ! { dg-error "Expected VARIABLE" }
4142 +   fun = 4.4  ! { dg-error "Expected VARIABLE" }
4143 +   funget = 4 ! { dg-error "is not a VALUE" }
4144 +   bar = 5    ! { dg-error "is not a VALUE" }
4145 +  end subroutine a
4146 +end module mod
4147 +
4148 +end
4149 Index: gcc/testsuite/gfortran.dg/unf_io_convert_3.f90
4150 ===================================================================
4151 --- gcc/testsuite/gfortran.dg/unf_io_convert_3.f90      (.../tags/gcc_4_2_0_release)    (revision 126002)
4152 +++ gcc/testsuite/gfortran.dg/unf_io_convert_3.f90      (.../branches/gcc-4_2-branch)   (revision 126002)
4153 @@ -1,4 +1,4 @@
4154 -! { dg-do run}
4155 +! { dg-do run }
4156  ! { dg-require-effective-target fortran_large_real }
4157  program main
4158    integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
4159 Index: gcc/cp/class.c
4160 ===================================================================
4161 --- gcc/cp/class.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
4162 +++ gcc/cp/class.c      (.../branches/gcc-4_2-branch)   (revision 126002)
4163 @@ -5350,22 +5350,34 @@
4164         }
4165        else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
4166         {
4167 +         /* We only need one hash table because it is always left empty.  */
4168 +         static htab_t ht;
4169 +         if (!ht)
4170 +           ht = htab_create (37, 
4171 +                             htab_hash_pointer,
4172 +                             htab_eq_pointer,
4173 +                             /*htab_del=*/NULL);
4174 +
4175           /* Reference variables should be references to objects.  */
4176           if (nonnull)
4177             *nonnull = 1;
4178  
4179 -         /* DECL_VAR_MARKED_P is used to prevent recursion; a
4180 +         /* Enter the INSTANCE in a table to prevent recursion; a
4181              variable's initializer may refer to the variable
4182              itself.  */
4183           if (TREE_CODE (instance) == VAR_DECL
4184               && DECL_INITIAL (instance)
4185 -             && !DECL_VAR_MARKED_P (instance))
4186 +             && !htab_find (ht, instance))
4187             {
4188               tree type;
4189 -             DECL_VAR_MARKED_P (instance) = 1;
4190 +             void **slot;
4191 +
4192 +             slot = htab_find_slot (ht, instance, INSERT);
4193 +             *slot = instance;
4194               type = fixed_type_or_null (DECL_INITIAL (instance),
4195                                          nonnull, cdtorp);
4196 -             DECL_VAR_MARKED_P (instance) = 0;
4197 +             htab_clear_slot (ht, slot);
4198 +
4199               return type;
4200             }
4201         }
4202 Index: gcc/cp/decl.c
4203 ===================================================================
4204 --- gcc/cp/decl.c       (.../tags/gcc_4_2_0_release)    (revision 126002)
4205 +++ gcc/cp/decl.c       (.../branches/gcc-4_2-branch)   (revision 126002)
4206 @@ -2161,8 +2161,24 @@
4207      }
4208    else if (toplevel_bindings_p () || DECL_NAMESPACE_SCOPE_P (newdecl))
4209      {
4210 -      /* Objects declared at top level:  */
4211 -      /* If at least one is a reference, it's ok.  */
4212 +      /* The objects have been declared at namespace scope.  If either
4213 +        is a member of an anonymous union, then this is an invalid
4214 +        redeclaration.  For example:
4215 +
4216 +          int i;
4217 +          union { int i; };
4218 +
4219 +          is invalid.  */
4220 +      if (DECL_ANON_UNION_VAR_P (newdecl)
4221 +         || DECL_ANON_UNION_VAR_P (olddecl))
4222 +       return "redeclaration of %q#D";
4223 +      /* If at least one declaration is a reference, there is no
4224 +        conflict.  For example:
4225 +
4226 +          int i = 3;
4227 +          extern int i;
4228 +
4229 +        is valid.  */
4230        if (DECL_EXTERNAL (newdecl) || DECL_EXTERNAL (olddecl))
4231         return NULL;
4232        /* Reject two definitions.  */
4233 @@ -5368,7 +5384,18 @@
4234              initializer.  It is not legal to redeclare a static data
4235              member, so this issue does not arise in that case.  */
4236           if (var_definition_p && TREE_STATIC (decl))
4237 -           expand_static_init (decl, init);
4238 +           {
4239 +              /* If a TREE_READONLY variable needs initialization
4240 +                at runtime, it is no longer readonly and we need to
4241 +                avoid MEM_READONLY_P being set on RTL created for it.  */
4242 +             if (init)
4243 +               {
4244 +                 if (TREE_READONLY (decl))
4245 +                   TREE_READONLY (decl) = 0;
4246 +                 was_readonly = 0;
4247 +               }
4248 +             expand_static_init (decl, init);
4249 +           }
4250         }
4251      }
4252  
4253 Index: gcc/cp/cp-tree.h
4254 ===================================================================
4255 --- gcc/cp/cp-tree.h    (.../tags/gcc_4_2_0_release)    (revision 126002)
4256 +++ gcc/cp/cp-tree.h    (.../branches/gcc-4_2-branch)   (revision 126002)
4257 @@ -107,7 +107,7 @@
4258        DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
4259     3: DECL_IN_AGGR_P.
4260     4: DECL_C_BIT_FIELD (in a FIELD_DECL)
4261 -      DECL_VAR_MARKED_P (in a VAR_DECL)
4262 +      DECL_ANON_UNION_VAR_P (in a VAR_DECL)
4263        DECL_SELF_REFERENCE_P (in a TYPE_DECL)
4264        DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL)
4265     5: DECL_INTERFACE_KNOWN.
4266 @@ -2111,10 +2111,10 @@
4267    (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \
4268     ->decl_flags.u.template_info)
4269  
4270 -/* For a VAR_DECL, indicates that the variable has been processed.
4271 -   This flag is set and unset throughout the code; it is always
4272 -   used for a temporary purpose.  */
4273 -#define DECL_VAR_MARKED_P(NODE) \
4274 +/* For a VAR_DECL, indicates that the variable is actually a
4275 +   non-static data member of anonymous union that has been promoted to
4276 +   variable status.  */
4277 +#define DECL_ANON_UNION_VAR_P(NODE) \
4278    (DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)))
4279  
4280  /* Template information for a RECORD_TYPE or UNION_TYPE.  */
4281 Index: gcc/cp/ChangeLog
4282 ===================================================================
4283 --- gcc/cp/ChangeLog    (.../tags/gcc_4_2_0_release)    (revision 126002)
4284 +++ gcc/cp/ChangeLog    (.../branches/gcc-4_2-branch)   (revision 126002)
4285 @@ -1,3 +1,29 @@
4286 +2007-06-15  Mark Mitchell  <mark@codesourcery.com>
4287 +
4288 +       * cp-tree.h (DECL_VAR_MARKED_P): Remove.
4289 +       (DECL_ANON_UNION_VAR_P): New macro.
4290 +       * class.c (fixed_type_or_null): Tidy.  Use a hash table, rather
4291 +       than DECL_VAR_MARKED_P, to keep track of which variables we have
4292 +       seen.
4293 +       * decl.c (redeclaration_error_message): Complain about redeclaring
4294 +       anonymous union members at namespace scope.
4295 +       * decl2.c (build_anon_union_vars): Set DECL_ANON_UNION_VAR_P.
4296 +
4297 +2007-06-08  Dirk Mueller  <dmueller@suse.de>
4298 +
4299 +       PR c++/31809
4300 +       PR c++/31806
4301 +       Backport from mainline:
4302 +       2007-05-31  Jakub Jelinek  <jakub@redhat.com>
4303 +
4304 +       * decl.c (cp_finish_decl): Also clear was_readonly if a static var
4305 +       needs runtime initialization.
4306 +
4307 +       2007-05-30  Jakub Jelinek  <jakub@redhat.com>
4308 +
4309 +       * decl.c (cp_finish_decl): Clear TREE_READONLY flag on TREE_STATIC
4310 +       variables that need runtime initialization.
4311 +
4312  2007-05-13  Release Manager
4313  
4314         * GCC 4.2.0 released.
4315 Index: gcc/cp/decl2.c
4316 ===================================================================
4317 --- gcc/cp/decl2.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
4318 +++ gcc/cp/decl2.c      (.../branches/gcc-4_2-branch)   (revision 126002)
4319 @@ -1056,6 +1056,7 @@
4320           tree base;
4321  
4322           decl = build_decl (VAR_DECL, DECL_NAME (field), TREE_TYPE (field));
4323 +         DECL_ANON_UNION_VAR_P (decl) = 1;
4324  
4325           base = get_base_address (object);
4326           TREE_PUBLIC (decl) = TREE_PUBLIC (base);
4327 Index: gcc/fortran/trans-expr.c
4328 ===================================================================
4329 --- gcc/fortran/trans-expr.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
4330 +++ gcc/fortran/trans-expr.c    (.../branches/gcc-4_2-branch)   (revision 126002)
4331 @@ -255,6 +255,10 @@
4332      gfc_conv_string_parameter (se);
4333    else
4334      {
4335 +      /* Avoid multiple evaluation of substring start.  */
4336 +      if (!CONSTANT_CLASS_P (start.expr) && !DECL_P (start.expr))
4337 +       start.expr = gfc_evaluate_now (start.expr, &se->pre);
4338 +
4339        /* Change the start of the string.  */
4340        if (TYPE_STRING_FLAG (TREE_TYPE (se->expr)))
4341         tmp = se->expr;
4342 @@ -273,6 +277,10 @@
4343        gfc_conv_expr_type (&end, ref->u.ss.end, gfc_charlen_type_node);
4344        gfc_add_block_to_block (&se->pre, &end.pre);
4345      }
4346 +
4347 +  if (!CONSTANT_CLASS_P (end.expr) && !DECL_P (end.expr))
4348 +    end.expr = gfc_evaluate_now (end.expr, &se->pre);
4349 +
4350    tmp = fold_build2 (MINUS_EXPR, gfc_charlen_type_node,
4351                      build_int_cst (gfc_charlen_type_node, 1),
4352                      start.expr);
4353 @@ -2340,17 +2348,23 @@
4354  
4355    /* Generate the actual call.  */
4356    gfc_conv_function_val (se, sym);
4357 +
4358    /* If there are alternate return labels, function type should be
4359       integer.  Can't modify the type in place though, since it can be shared
4360 -     with other functions.  */
4361 +     with other functions.  For dummy arguments, the typing is done to
4362 +     to this result, even if it has to be repeated for each call.  */
4363    if (has_alternate_specifier
4364        && TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) != integer_type_node)
4365      {
4366 -      gcc_assert (! sym->attr.dummy);
4367 -      TREE_TYPE (sym->backend_decl)
4368 -        = build_function_type (integer_type_node,
4369 -                               TYPE_ARG_TYPES (TREE_TYPE (sym->backend_decl)));
4370 -      se->expr = build_fold_addr_expr (sym->backend_decl);
4371 +      if (!sym->attr.dummy)
4372 +       {
4373 +         TREE_TYPE (sym->backend_decl)
4374 +               = build_function_type (integer_type_node,
4375 +                     TYPE_ARG_TYPES (TREE_TYPE (sym->backend_decl)));
4376 +         se->expr = build_fold_addr_expr (sym->backend_decl);
4377 +       }
4378 +      else
4379 +       TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) = integer_type_node;
4380      }
4381  
4382    fntype = TREE_TYPE (TREE_TYPE (se->expr));
4383 Index: gcc/fortran/trans-array.c
4384 ===================================================================
4385 --- gcc/fortran/trans-array.c   (.../tags/gcc_4_2_0_release)    (revision 126002)
4386 +++ gcc/fortran/trans-array.c   (.../branches/gcc-4_2-branch)   (revision 126002)
4387 @@ -4422,6 +4422,8 @@
4388  
4389        if (se->direct_byref)
4390         base = gfc_index_zero_node;
4391 +      else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
4392 +       base = gfc_evaluate_now (gfc_conv_array_offset (desc), &loop.pre);
4393        else
4394         base = NULL_TREE;
4395  
4396 @@ -4489,8 +4491,20 @@
4397                                 stride, info->stride[dim]);
4398  
4399           if (se->direct_byref)
4400 -           base = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
4401 -                               base, stride);
4402 +           {
4403 +             base = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
4404 +                                 base, stride);
4405 +           }
4406 +         else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
4407 +           {
4408 +             tmp = gfc_conv_array_lbound (desc, n);
4409 +             tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
4410 +                                tmp, loop.from[dim]);
4411 +             tmp = fold_build2 (MULT_EXPR, TREE_TYPE (base),
4412 +                                tmp, gfc_conv_array_stride (desc, n));
4413 +             base = fold_build2 (PLUS_EXPR, TREE_TYPE (base),
4414 +                                 tmp, base);
4415 +           }
4416  
4417           /* Store the new stride.  */
4418           tmp = gfc_conv_descriptor_stride (parm, gfc_rank_cst[dim]);
4419 @@ -4511,7 +4525,8 @@
4420           gfc_conv_descriptor_data_set (&loop.pre, parm, offset);
4421         }
4422  
4423 -      if (se->direct_byref && !se->data_not_needed)
4424 +      if ((se->direct_byref || GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
4425 +            && !se->data_not_needed)
4426         {
4427           /* Set the offset.  */
4428           tmp = gfc_conv_descriptor_offset (parm);
4429 Index: gcc/fortran/gfortran.texi
4430 ===================================================================
4431 --- gcc/fortran/gfortran.texi   (.../tags/gcc_4_2_0_release)    (revision 126002)
4432 +++ gcc/fortran/gfortran.texi   (.../branches/gcc-4_2-branch)   (revision 126002)
4433 @@ -611,7 +611,7 @@
4434  to change the representation of data for unformatted files.
4435  The syntax for the @env{GFORTRAN_CONVERT_UNIT} variable is:
4436  @smallexample
4437 -GFORTRAN_CONVERT_UNIT: mode | mode ';' exception ;
4438 +GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ;
4439  mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
4440  exception: mode ':' unit_list | unit_list ;
4441  unit_list: unit_spec | unit_list unit_spec ;
4442 @@ -668,7 +668,12 @@
4443  setting a default data representation for the whole program.  The
4444  @code{CONVERT} specifier overrides the @option{-fconvert} compile options.
4445  
4446 +@emph{Note that the values specified via the GFORTRAN_CONVERT_UNIT
4447 +environment variable will override the CONVERT specifier in the
4448 +open statement}.  This is to give control over data formats to
4449 +users who do not have the source code of their program available.
4450  
4451 +
4452  @c =====================================================================
4453  @c PART II: LANGUAGE REFERENCE
4454  @c =====================================================================
4455 Index: gcc/fortran/trans-common.c
4456 ===================================================================
4457 --- gcc/fortran/trans-common.c  (.../tags/gcc_4_2_0_release)    (revision 126002)
4458 +++ gcc/fortran/trans-common.c  (.../branches/gcc-4_2-branch)   (revision 126002)
4459 @@ -359,14 +359,15 @@
4460        tree size = TYPE_SIZE_UNIT (union_type);
4461        if (tree_int_cst_lt (DECL_SIZE_UNIT (decl), size))
4462          {
4463 -          /* Named common blocks of the same name shall be of the same size
4464 -             in all scoping units of a program in which they appear, but
4465 -             blank common blocks may be of different sizes.  */
4466 -          if (strcmp (com->name, BLANK_COMMON_NAME))
4467 +         /* Named common blocks of the same name shall be of the same size
4468 +            in all scoping units of a program in which they appear, but
4469 +            blank common blocks may be of different sizes.  */
4470 +         if (strcmp (com->name, BLANK_COMMON_NAME))
4471             gfc_warning ("Named COMMON block '%s' at %L shall be of the "
4472                          "same size", com->name, &com->where);
4473 -          DECL_SIZE_UNIT (decl) = size;
4474 -        }
4475 +         DECL_SIZE_UNIT (decl) = size;
4476 +         TREE_TYPE (decl) = union_type;
4477 +       }
4478       }
4479  
4480    /* If this common block has been declared in a previous program unit,
4481 Index: gcc/fortran/ChangeLog
4482 ===================================================================
4483 --- gcc/fortran/ChangeLog       (.../tags/gcc_4_2_0_release)    (revision 126002)
4484 +++ gcc/fortran/ChangeLog       (.../branches/gcc-4_2-branch)   (revision 126002)
4485 @@ -1,3 +1,43 @@
4486 +2007-07-20  Daniel Franke  <franke.daniel@gmail.com>
4487 +
4488 +       Backport from trunk:
4489 +       PR fortran/32002
4490 +       * resolve.c (resolve_actual_arglist): Resolve actual argument after
4491 +       being identified as variable.
4492 +
4493 +2007-06-20  Paul Thomas  <pault@gcc.gnu.org>
4494 +
4495 +       PR fortran/32302
4496 +       * trans-common.c (build_common_decl): If resizing of common
4497 +       decl is needed, update the TREE_TYPE.
4498 +
4499 +2007-05-31  Paul Thomas  <pault@gcc.gnu.org>
4500 +
4501 +       PR fortran/31483
4502 +       * trans-expr.c (gfc_conv_function_call): Give a dummy
4503 +       procedure the correct type if it has alternate returns.
4504 +       
4505 +
4506 +       PR fortran/31540
4507 +       * resolve.c (resolve_fl_procedure): Resolve constant character
4508 +       lengths.
4509 +
4510 +       PR fortran/31867
4511 +       PR fortran/31994
4512 +       * trans-array.c (gfc_conv_expr_descriptor): Obtain the stored
4513 +       offset for non-descriptor, source arrays and correct for stride
4514 +       not equal to one before writing to field of output descriptor.
4515 +
4516 +2007-05-17  Tobias Burnus  <burnus@net-b.de>
4517 +
4518 +       * gfortran.texi (GFORTRAN_CONVERT_UNIT): Improve documentation.
4519 +
4520 +2007-05-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
4521 +
4522 +       PR fortran/31725
4523 +       * trans-expr.c (gfc_conv_substring): Evaluate substring bounds
4524 +       only once.
4525 +
4526  2007-05-13  Release Manager
4527  
4528         * GCC 4.2.0 released.
4529 Index: gcc/fortran/resolve.c
4530 ===================================================================
4531 --- gcc/fortran/resolve.c       (.../tags/gcc_4_2_0_release)    (revision 126002)
4532 +++ gcc/fortran/resolve.c       (.../branches/gcc-4_2-branch)   (revision 126002)
4533 @@ -1006,6 +1006,13 @@
4534           e->ref->u.ar.as = sym->as;
4535         }
4536  
4537 +      /* Expressions are assigned a default ts.type of BT_PROCEDURE in
4538 +        primary.c (match_actual_arg). If above code determines that it
4539 +        is a  variable instead, it needs to be resolved as it was not
4540 +        done at the beginning of this function.  */
4541 +      if (gfc_resolve_expr (e) != SUCCESS)
4542 +       return FAILURE;
4543 +
4544      argument_list:
4545        /* Check argument list functions %VAL, %LOC and %REF.  There is
4546          nothing to do for %REF.  */
4547 @@ -5742,6 +5749,11 @@
4548    if (sym->ts.type == BT_CHARACTER)
4549      {
4550        gfc_charlen *cl = sym->ts.cl;
4551 +
4552 +      if (cl && cl->length && gfc_is_constant_expr (cl->length)
4553 +            && resolve_charlen (cl) == FAILURE)
4554 +       return FAILURE;
4555 +
4556        if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT)
4557         {
4558           if (sym->attr.proc == PROC_ST_FUNCTION)
4559 Index: gcc/fortran/primary.c
4560 ===================================================================
4561 --- gcc/fortran/primary.c       (.../tags/gcc_4_2_0_release)    (revision 126002)
4562 +++ gcc/fortran/primary.c       (.../branches/gcc-4_2-branch)   (revision 126002)
4563 @@ -2415,7 +2415,8 @@
4564  
4565      case FL_PROCEDURE:
4566        /* Check for a nonrecursive function result */
4567 -      if (sym->attr.function && (sym->result == sym || sym->attr.entry))
4568 +      if (sym->attr.function && (sym->result == sym || sym->attr.entry)
4569 +         && !sym->attr.external)
4570         {
4571           /* If a function result is a derived type, then the derived
4572              type may still have to be resolved.  */
4573 Index: gcc/BASE-VER
4574 ===================================================================
4575 --- gcc/BASE-VER        (.../tags/gcc_4_2_0_release)    (revision 126002)
4576 +++ gcc/BASE-VER        (.../branches/gcc-4_2-branch)   (revision 126002)
4577 @@ -1 +1 @@
4578 -4.2.0
4579 +4.2.1
4580 Index: gcc/gimplify.c
4581 ===================================================================
4582 --- gcc/gimplify.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
4583 +++ gcc/gimplify.c      (.../branches/gcc-4_2-branch)   (revision 126002)
4584 @@ -4053,6 +4053,19 @@
4585        parse_input_constraint (&constraint, 0, 0, noutputs, 0,
4586                               oconstraints, &allows_mem, &allows_reg);
4587  
4588 +      /* If we can't make copies, we can only accept memory.  */
4589 +      if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (link))))
4590 +       {
4591 +         if (allows_mem)
4592 +           allows_reg = 0;
4593 +         else
4594 +           {
4595 +             error ("impossible constraint in %<asm%>");
4596 +             error ("non-memory input %d must stay in memory", i);
4597 +             return GS_ERROR;
4598 +           }
4599 +       }
4600 +
4601        /* If the operand is a memory input, it should be an lvalue.  */
4602        if (!allows_reg && allows_mem)
4603         {
4604 @@ -4802,7 +4815,20 @@
4605    else if (flags & GOVD_SHARED)
4606      {
4607        if (is_global_var (decl))
4608 -       return 0;
4609 +       {
4610 +         struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp->outer_context;
4611 +         while (ctx != NULL)
4612 +           {
4613 +             splay_tree_node on
4614 +               = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
4615 +             if (on && (on->value & (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE
4616 +                                     | GOVD_PRIVATE | GOVD_REDUCTION)) != 0)
4617 +               break;
4618 +             ctx = ctx->outer_context;
4619 +           }
4620 +         if (ctx == NULL)
4621 +           return 0;
4622 +       }
4623        code = OMP_CLAUSE_SHARED;
4624      }
4625    else if (flags & GOVD_PRIVATE)
4626 Index: gcc/calls.c
4627 ===================================================================
4628 --- gcc/calls.c (.../tags/gcc_4_2_0_release)    (revision 126002)
4629 +++ gcc/calls.c (.../branches/gcc-4_2-branch)   (revision 126002)
4630 @@ -1238,13 +1238,25 @@
4631  
4632    /* If this is a libcall, then precompute all arguments so that we do not
4633       get extraneous instructions emitted as part of the libcall sequence.  */
4634 -  if ((flags & ECF_LIBCALL_BLOCK) == 0)
4635 +
4636 +  /* If we preallocated the stack space, and some arguments must be passed
4637 +     on the stack, then we must precompute any parameter which contains a
4638 +     function call which will store arguments on the stack.
4639 +     Otherwise, evaluating the parameter may clobber previous parameters
4640 +     which have already been stored into the stack.  (we have code to avoid
4641 +     such case by saving the outgoing stack arguments, but it results in
4642 +     worse code)  */
4643 +  if ((flags & ECF_LIBCALL_BLOCK) == 0 && !ACCUMULATE_OUTGOING_ARGS)
4644      return;
4645  
4646    for (i = 0; i < num_actuals; i++)
4647      {
4648        enum machine_mode mode;
4649  
4650 +      if ((flags & ECF_LIBCALL_BLOCK) == 0
4651 +         && TREE_CODE (args[i].tree_value) != CALL_EXPR)
4652 +       continue;
4653 +
4654        /* If this is an addressable type, we cannot pre-evaluate it.  */
4655        gcc_assert (!TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)));
4656  
4657 Index: gcc/except.c
4658 ===================================================================
4659 --- gcc/except.c        (.../tags/gcc_4_2_0_release)    (revision 126002)
4660 +++ gcc/except.c        (.../branches/gcc-4_2-branch)   (revision 126002)
4661 @@ -1005,7 +1005,11 @@
4662      for (prev_try = VEC_index (eh_region, cfun->eh->region_array, outer_region);
4663           prev_try && prev_try->type != ERT_TRY;
4664          prev_try = prev_try->outer)
4665 -      ;
4666 +      if (prev_try->type == ERT_MUST_NOT_THROW)
4667 +       {
4668 +         prev_try = NULL;
4669 +         break;
4670 +       }
4671  
4672    /* Remap all of the internal catch and cleanup linkages.  Since we 
4673       duplicate entire subtrees, all of the referenced regions will have
4674 Index: gcc/combine.c
4675 ===================================================================
4676 --- gcc/combine.c       (.../tags/gcc_4_2_0_release)    (revision 126002)
4677 +++ gcc/combine.c       (.../branches/gcc-4_2-branch)   (revision 126002)
4678 @@ -5341,14 +5341,14 @@
4679         }
4680        else if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
4681         {
4682 -         SUBST(SET_SRC (x), op0);
4683 +         SUBST (SET_SRC (x), op0);
4684           src = SET_SRC (x);
4685         }
4686 -      else
4687 +      /* Otherwise, update the COMPARE if needed.  */
4688 +      else if (XEXP (src, 0) != op0 || XEXP (src, 1) != op1)
4689         {
4690 -         /* Otherwise, update the COMPARE if needed.  */
4691 -         SUBST (XEXP (src, 0), op0);
4692 -         SUBST (XEXP (src, 1), op1);
4693 +         SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
4694 +         src = SET_SRC (x);
4695         }
4696      }
4697    else
4698 Index: gcc/Makefile.in
4699 ===================================================================
4700 --- gcc/Makefile.in     (.../tags/gcc_4_2_0_release)    (revision 126002)
4701 +++ gcc/Makefile.in     (.../branches/gcc-4_2-branch)   (revision 126002)
4702 @@ -1839,7 +1839,7 @@
4703  tree-ssa-structalias.o: tree-ssa-structalias.c tree-ssa-structalias.h \
4704     $(SYSTEM_H) $(CONFIG_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \
4705     $(TM_H) coretypes.h $(CGRAPH_H) tree-pass.h $(TIMEVAR_H) \
4706 -   gt-tree-ssa-structalias.h $(PARAMS_H)
4707 +   gt-tree-ssa-structalias.h $(PARAMS_H) pointer-set.h
4708  tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
4709     $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
4710     toplev.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
4711 Index: gcc/tree-ssa-structalias.c
4712 ===================================================================
4713 --- gcc/tree-ssa-structalias.c  (.../tags/gcc_4_2_0_release)    (revision 126002)
4714 +++ gcc/tree-ssa-structalias.c  (.../branches/gcc-4_2-branch)   (revision 126002)
4715 @@ -51,10 +51,11 @@
4716  #include "params.h"
4717  #include "tree-ssa-structalias.h"
4718  #include "cgraph.h"
4719 +#include "pointer-set.h"
4720  
4721  /* The idea behind this analyzer is to generate set constraints from the
4722     program, then solve the resulting constraints in order to generate the
4723 -   points-to sets. 
4724 +   points-to sets.
4725  
4726     Set constraints are a way of modeling program analysis problems that
4727     involve sets.  They consist of an inclusion constraint language,
4728 @@ -70,33 +71,33 @@
4729  
4730     Also see "Ultra-fast Aliasing Analysis using CLA: A Million Lines
4731     of C Code in a Second" by ""Nevin Heintze and Olivier Tardieu" at
4732 -   http://citeseer.ist.psu.edu/heintze01ultrafast.html 
4733 +   http://citeseer.ist.psu.edu/heintze01ultrafast.html
4734  
4735 -   There are three types of constraint expressions, DEREF, ADDRESSOF, and
4736 -   SCALAR.  Each constraint expression consists of a constraint type,
4737 -   a variable, and an offset.  
4738 -   
4739 +   There are three types of real constraint expressions, DEREF,
4740 +   ADDRESSOF, and SCALAR.  Each constraint expression consists
4741 +   of a constraint type, a variable, and an offset.
4742 +
4743     SCALAR is a constraint expression type used to represent x, whether
4744     it appears on the LHS or the RHS of a statement.
4745     DEREF is a constraint expression type used to represent *x, whether
4746 -   it appears on the LHS or the RHS of a statement. 
4747 +   it appears on the LHS or the RHS of a statement.
4748     ADDRESSOF is a constraint expression used to represent &x, whether
4749     it appears on the LHS or the RHS of a statement.
4750 -   
4751 +
4752     Each pointer variable in the program is assigned an integer id, and
4753     each field of a structure variable is assigned an integer id as well.
4754 -   
4755 +
4756     Structure variables are linked to their list of fields through a "next
4757     field" in each variable that points to the next field in offset
4758 -   order.  
4759 -   Each variable for a structure field has 
4760 +   order.
4761 +   Each variable for a structure field has
4762  
4763     1. "size", that tells the size in bits of that field.
4764     2. "fullsize, that tells the size in bits of the entire structure.
4765     3. "offset", that tells the offset in bits from the beginning of the
4766     structure to this field.
4767  
4768 -   Thus, 
4769 +   Thus,
4770     struct f
4771     {
4772       int a;
4773 @@ -110,50 +111,51 @@
4774     foo.b -> id 2, size 32, offset 32, fullsize 64, next NULL
4775     bar -> id 3, size 32, offset 0, fullsize 32, next NULL
4776  
4777 -   
4778 +
4779    In order to solve the system of set constraints, the following is
4780    done:
4781  
4782    1. Each constraint variable x has a solution set associated with it,
4783    Sol(x).
4784 -  
4785 +
4786    2. Constraints are separated into direct, copy, and complex.
4787    Direct constraints are ADDRESSOF constraints that require no extra
4788    processing, such as P = &Q
4789    Copy constraints are those of the form P = Q.
4790 -  Complex constraints are all the constraints involving dereferences.
4791 -  
4792 +  Complex constraints are all the constraints involving dereferences
4793 +  and offsets (including offsetted copies).
4794 +
4795    3. All direct constraints of the form P = &Q are processed, such
4796 -  that Q is added to Sol(P) 
4797 +  that Q is added to Sol(P)
4798  
4799    4. All complex constraints for a given constraint variable are stored in a
4800 -  linked list attached to that variable's node.  
4801 +  linked list attached to that variable's node.
4802  
4803    5. A directed graph is built out of the copy constraints. Each
4804 -  constraint variable is a node in the graph, and an edge from 
4805 +  constraint variable is a node in the graph, and an edge from
4806    Q to P is added for each copy constraint of the form P = Q
4807 -  
4808 +
4809    6. The graph is then walked, and solution sets are
4810    propagated along the copy edges, such that an edge from Q to P
4811    causes Sol(P) <- Sol(P) union Sol(Q).
4812 -  
4813 +
4814    7.  As we visit each node, all complex constraints associated with
4815    that node are processed by adding appropriate copy edges to the graph, or the
4816 -  appropriate variables to the solution set.  
4817 +  appropriate variables to the solution set.
4818  
4819    8. The process of walking the graph is iterated until no solution
4820    sets change.
4821  
4822    Prior to walking the graph in steps 6 and 7, We perform static
4823 -  cycle elimination on the constraint graph, as well 
4824 +  cycle elimination on the constraint graph, as well
4825    as off-line variable substitution.
4826 -  
4827 +
4828    TODO: Adding offsets to pointer-to-structures can be handled (IE not punted
4829    on and turned into anything), but isn't.  You can just see what offset
4830    inside the pointed-to struct it's going to access.
4831 -  
4832 +
4833    TODO: Constant bounded arrays can be handled as if they were structs of the
4834 -  same number of elements. 
4835 +  same number of elements.
4836  
4837    TODO: Modeling heap and incoming pointers becomes much better if we
4838    add fields to them as we discover them, which we could do.
4839 @@ -161,20 +163,29 @@
4840    TODO: We could handle unions, but to be honest, it's probably not
4841    worth the pain or slowdown.  */
4842  
4843 -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) 
4844 -htab_t heapvar_for_stmt;
4845 +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) htab_t heapvar_for_stmt;
4846  
4847  /* One variable to represent all non-local accesses.  */
4848  tree nonlocal_all;
4849  
4850  static bool use_field_sensitive = true;
4851  static int in_ipa_mode = 0;
4852 +
4853 +/* Used for predecessor bitmaps. */
4854  static bitmap_obstack predbitmap_obstack;
4855 -static bitmap_obstack ptabitmap_obstack;
4856 +
4857 +/* Used for points-to sets.  */
4858 +static bitmap_obstack pta_obstack;
4859 +
4860 +/* Used for oldsolution members of variables. */
4861 +static bitmap_obstack oldpta_obstack;
4862 +
4863 +/* Used for per-solver-iteration bitmaps.  */
4864  static bitmap_obstack iteration_obstack;
4865  
4866  static unsigned int create_variable_info_for (tree, const char *);
4867 -static void build_constraint_graph (void);
4868 +typedef struct constraint_graph *constraint_graph_t;
4869 +static void unify_nodes (constraint_graph_t, unsigned int, unsigned int, bool);
4870  
4871  DEF_VEC_P(constraint_t);
4872  DEF_VEC_ALLOC_P(constraint_t,heap);
4873 @@ -186,11 +197,13 @@
4874  static struct constraint_stats
4875  {
4876    unsigned int total_vars;
4877 -  unsigned int collapsed_vars;
4878 +  unsigned int nonpointer_vars;
4879    unsigned int unified_vars_static;
4880    unsigned int unified_vars_dynamic;
4881    unsigned int iterations;
4882    unsigned int num_edges;
4883 +  unsigned int num_implicit_edges;
4884 +  unsigned int points_to_sets_created;
4885  } stats;
4886  
4887  struct variable_info
4888 @@ -205,7 +218,7 @@
4889    tree decl;
4890  
4891    /* Offset of this variable, in bits, from the base variable  */
4892 -  unsigned HOST_WIDE_INT offset;  
4893 +  unsigned HOST_WIDE_INT offset;
4894  
4895    /* Size of the variable, in bits.  */
4896    unsigned HOST_WIDE_INT size;
4897 @@ -216,34 +229,21 @@
4898    /* A link to the variable for the next field in this structure.  */
4899    struct variable_info *next;
4900  
4901 -  /* Node in the graph that represents the constraints and points-to
4902 -     solution for the variable.  */
4903 -  unsigned int node;
4904 -
4905 -  /* True if the address of this variable is taken.  Needed for
4906 -     variable substitution.  */
4907 -  unsigned int address_taken:1;
4908 -
4909 -  /* True if this variable is the target of a dereference.  Needed for
4910 -     variable substitution.  */
4911 -  unsigned int indirect_target:1;
4912 -  
4913    /* True if the variable is directly the target of a dereference.
4914       This is used to track which variables are *actually* dereferenced
4915 -     so we can prune their points to listed. This is equivalent to the
4916 -     indirect_target flag when no merging of variables happens.  */
4917 +     so we can prune their points to listed. */
4918    unsigned int directly_dereferenced:1;
4919  
4920    /* True if this is a variable created by the constraint analysis, such as
4921       heap variables and constraints we had to break up.  */
4922    unsigned int is_artificial_var:1;
4923 -  
4924 +
4925    /* True if this is a special variable whose solution set should not be
4926       changed.  */
4927    unsigned int is_special_var:1;
4928  
4929    /* True for variables whose size is not known or variable.  */
4930 -  unsigned int is_unknown_size_var:1;  
4931 +  unsigned int is_unknown_size_var:1;
4932  
4933    /* True for variables that have unions somewhere in them.  */
4934    unsigned int has_union:1;
4935 @@ -254,16 +254,15 @@
4936    /* Points-to set for this variable.  */
4937    bitmap solution;
4938  
4939 +  /* Old points-to set for this variable.  */
4940 +  bitmap oldsolution;
4941 +
4942    /* Variable ids represented by this node.  */
4943    bitmap variables;
4944  
4945 -  /* Vector of complex constraints for this node.  Complex
4946 -     constraints are those involving dereferences.  */
4947 -  VEC(constraint_t,heap) *complex;
4948 -  
4949 -  /* Variable id this was collapsed to due to type unsafety.
4950 -     This should be unused completely after build_constraint_graph, or
4951 -     something is broken.  */
4952 +  /* Variable id this was collapsed to due to type unsafety.  This
4953 +     should be unused completely after build_succ_graph, or something
4954 +     is broken.  */
4955    struct variable_info *collapsed_to;
4956  };
4957  typedef struct variable_info *varinfo_t;
4958 @@ -277,8 +276,8 @@
4959  
4960  DEF_VEC_ALLOC_P(varinfo_t, heap);
4961  
4962 -/* Table of variable info structures for constraint variables.  Indexed directly
4963 -   by variable info id.  */
4964 +/* Table of variable info structures for constraint variables.
4965 +   Indexed directly by variable info id.  */
4966  static VEC(varinfo_t,heap) *varmap;
4967  
4968  /* Return the varmap element N */
4969 @@ -286,7 +285,7 @@
4970  static inline varinfo_t
4971  get_varinfo (unsigned int n)
4972  {
4973 -  return VEC_index(varinfo_t, varmap, n);
4974 +  return VEC_index (varinfo_t, varmap, n);
4975  }
4976  
4977  /* Return the varmap element N, following the collapsed_to link.  */
4978 @@ -294,7 +293,7 @@
4979  static inline varinfo_t
4980  get_varinfo_fc (unsigned int n)
4981  {
4982 -  varinfo_t v = VEC_index(varinfo_t, varmap, n);
4983 +  varinfo_t v = VEC_index (varinfo_t, varmap, n);
4984  
4985    if (v->collapsed_to)
4986      return v->collapsed_to;
4987 @@ -331,10 +330,9 @@
4988  /* Variable that represents non-local variables before we expand it to
4989     one for each type.  */
4990  static unsigned int nonlocal_vars_id;
4991 -
4992  /* Lookup a heap var for FROM, and return it if we find one.  */
4993  
4994 -static tree 
4995 +static tree
4996  heapvar_lookup (tree from)
4997  {
4998    struct tree_map *h, in;
4999 @@ -367,25 +365,21 @@
5000     named NAME, and using constraint graph node NODE.  */
5001  
5002  static varinfo_t
5003 -new_var_info (tree t, unsigned int id, const char *name, unsigned int node)
5004 +new_var_info (tree t, unsigned int id, const char *name)
5005  {
5006    varinfo_t ret = pool_alloc (variable_info_pool);
5007  
5008    ret->id = id;
5009    ret->name = name;
5010    ret->decl = t;
5011 -  ret->node = node;
5012 -  ret->address_taken = false;
5013 -  ret->indirect_target = false;
5014    ret->directly_dereferenced = false;
5015    ret->is_artificial_var = false;
5016    ret->is_heap_var = false;
5017    ret->is_special_var = false;
5018    ret->is_unknown_size_var = false;
5019    ret->has_union = false;
5020 -  ret->solution = BITMAP_ALLOC (&ptabitmap_obstack);
5021 -  ret->variables = BITMAP_ALLOC (&ptabitmap_obstack);
5022 -  ret->complex = NULL;
5023 +  ret->solution = BITMAP_ALLOC (&pta_obstack);
5024 +  ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
5025    ret->next = NULL;
5026    ret->collapsed_to = NULL;
5027    return ret;
5028 @@ -395,7 +389,7 @@
5029  
5030  /* An expression that appears in a constraint.  */
5031  
5032 -struct constraint_expr 
5033 +struct constraint_expr
5034  {
5035    /* Constraint type.  */
5036    constraint_expr_type type;
5037 @@ -418,7 +412,7 @@
5038  static void do_deref (VEC (ce_s, heap) **);
5039  
5040  /* Our set constraints are made up of two constraint expressions, one
5041 -   LHS, and one RHS.  
5042 +   LHS, and one RHS.
5043  
5044     As described in the introduction, our set constraints each represent an
5045     operation between set valued variables.
5046 @@ -434,63 +428,98 @@
5047  static VEC(constraint_t,heap) *constraints;
5048  static alloc_pool constraint_pool;
5049  
5050 -/* An edge in the weighted constraint graph.   The edges are weighted,
5051 -   with a bit set in weights meaning their is an edge with that
5052 -   weight. 
5053 -   We don't keep the src in the edge, because we always know what it
5054 -   is. */
5055  
5056 -struct constraint_edge
5057 +DEF_VEC_I(int);
5058 +DEF_VEC_ALLOC_I(int, heap);
5059 +
5060 +/* The constraint graph is represented as an array of bitmaps
5061 +   containing successor nodes.  */
5062 +
5063 +struct constraint_graph
5064  {
5065 -  unsigned int dest;
5066 -  bitmap weights;
5067 -};
5068 +  /* Size of this graph, which may be different than the number of
5069 +     nodes in the variable map.  */
5070 +  unsigned int size;
5071  
5072 -typedef struct constraint_edge *constraint_edge_t;
5073 -static alloc_pool constraint_edge_pool;
5074 +  /* Explicit successors of each node. */
5075 +  bitmap *succs;
5076  
5077 -/* Return a new constraint edge from SRC to DEST.  */
5078 +  /* Implicit predecessors of each node (Used for variable
5079 +     substitution). */
5080 +  bitmap *implicit_preds;
5081  
5082 -static constraint_edge_t
5083 -new_constraint_edge (unsigned int dest)
5084 -{
5085 -  constraint_edge_t ret = pool_alloc (constraint_edge_pool);
5086 -  ret->dest = dest;
5087 -  ret->weights = NULL;
5088 -  return ret;
5089 -}
5090 +  /* Explicit predecessors of each node (Used for variable substitution).  */
5091 +  bitmap *preds;
5092  
5093 -DEF_VEC_P(constraint_edge_t);
5094 -DEF_VEC_ALLOC_P(constraint_edge_t,heap);
5095 +  /* Indirect cycle representatives, or -1 if the node has no indirect
5096 +     cycles.  */
5097 +  int *indirect_cycles;
5098  
5099 +  /* Representative node for a node.  rep[a] == a unless the node has
5100 +     been unified. */
5101 +  unsigned int *rep;
5102  
5103 -/* The constraint graph is represented internally in two different
5104 -   ways.  The overwhelming majority of edges in the constraint graph
5105 -   are zero weigh edges, and thus, using a vector of contrainst_edge_t
5106 -   is a waste of time and memory, since they have no weights.  We
5107 -   simply use a bitmap to store the preds and succs for each node.
5108 -   The weighted edges are stored as a set of adjacency vectors, one
5109 -   per variable. succs[x] is the vector of successors for variable x,
5110 -   and preds[x] is the vector of predecessors for variable x.  IOW,
5111 -   all edges are "forward" edges, which is not like our CFG.  So
5112 -   remember that preds[x]->src == x, and succs[x]->src == x.  */
5113 +  /* Equivalence class representative for a node.  This is used for
5114 +     variable substitution.  */
5115 +  int *eq_rep;
5116  
5117 -struct constraint_graph
5118 -{
5119 -  bitmap *zero_weight_succs;
5120 -  bitmap *zero_weight_preds;
5121 -  VEC(constraint_edge_t,heap) **succs;
5122 -  VEC(constraint_edge_t,heap) **preds;
5123 +  /* Label for each node, used during variable substitution.  */
5124 +  unsigned int *label;
5125 +
5126 +  /* Bitmap of nodes where the bit is set if the node is a direct
5127 +     node.  Used for variable substitution.  */
5128 +  sbitmap direct_nodes;
5129 +
5130 +  /* Vector of complex constraints for each graph node.  Complex
5131 +     constraints are those involving dereferences or offsets that are
5132 +     not 0.  */
5133 +  VEC(constraint_t,heap) **complex;
5134  };
5135  
5136 -typedef struct constraint_graph *constraint_graph_t;
5137 -
5138  static constraint_graph_t graph;
5139 -static int graph_size;
5140  
5141 +/* During variable substitution and the offline version of indirect
5142 +   cycle finding, we create nodes to represent dereferences and
5143 +   address taken constraints.  These represent where these start and
5144 +   end.  */
5145 +#define FIRST_REF_NODE (VEC_length (varinfo_t, varmap))
5146 +#define LAST_REF_NODE (FIRST_REF_NODE + (FIRST_REF_NODE - 1))
5147 +#define FIRST_ADDR_NODE (LAST_REF_NODE + 1)
5148 +
5149 +/* Return the representative node for NODE, if NODE has been unioned
5150 +   with another NODE.
5151 +   This function performs path compression along the way to finding
5152 +   the representative.  */
5153 +
5154 +static unsigned int
5155 +find (unsigned int node)
5156 +{
5157 +  gcc_assert (node < graph->size);
5158 +  if (graph->rep[node] != node)
5159 +    return graph->rep[node] = find (graph->rep[node]);
5160 +  return node;
5161 +}
5162 +
5163 +/* Union the TO and FROM nodes to the TO nodes.
5164 +   Note that at some point in the future, we may want to do
5165 +   union-by-rank, in which case we are going to have to return the
5166 +   node we unified to.  */
5167 +
5168 +static bool
5169 +unite (unsigned int to, unsigned int from)
5170 +{
5171 +  gcc_assert (to < graph->size && from < graph->size);
5172 +  if (to != from && graph->rep[from] != to)
5173 +    {
5174 +      graph->rep[from] = to;
5175 +      return true;
5176 +    }
5177 +  return false;
5178 +}
5179 +
5180  /* Create a new constraint consisting of LHS and RHS expressions.  */
5181  
5182 -static constraint_t 
5183 +static constraint_t
5184  new_constraint (const struct constraint_expr lhs,
5185                 const struct constraint_expr rhs)
5186  {
5187 @@ -508,7 +537,7 @@
5188    if (c->lhs.type == ADDRESSOF)
5189      fprintf (file, "&");
5190    else if (c->lhs.type == DEREF)
5191 -    fprintf (file, "*");  
5192 +    fprintf (file, "*");
5193    fprintf (file, "%s", get_varinfo_fc (c->lhs.var)->name);
5194    if (c->lhs.offset != 0)
5195      fprintf (file, " + " HOST_WIDE_INT_PRINT_DEC, c->lhs.offset);
5196 @@ -550,23 +579,24 @@
5197    dump_constraints (stderr);
5198  }
5199  
5200 -/* SOLVER FUNCTIONS 
5201 +/* SOLVER FUNCTIONS
5202  
5203     The solver is a simple worklist solver, that works on the following
5204     algorithm:
5205 -   
5206 -   sbitmap changed_nodes = all ones;
5207 -   changed_count = number of nodes;
5208 -   For each node that was already collapsed:
5209 -       changed_count--;
5210  
5211 +   sbitmap changed_nodes = all zeroes;
5212 +   changed_count = 0;
5213 +   For each node that is not already collapsed:
5214 +       changed_count++;
5215 +       set bit in changed nodes
5216 +
5217     while (changed_count > 0)
5218     {
5219       compute topological ordering for constraint graph
5220 -  
5221 +
5222       find and collapse cycles in the constraint graph (updating
5223       changed if necessary)
5224 -     
5225 +
5226       for each node (n) in the graph in topological order:
5227         changed_count--;
5228  
5229 @@ -619,11 +649,11 @@
5230  }
5231  
5232  /* Return true if two constraints A and B are equal.  */
5233 -  
5234 +
5235  static bool
5236  constraint_equal (struct constraint a, struct constraint b)
5237  {
5238 -  return constraint_expr_equal (a.lhs, b.lhs) 
5239 +  return constraint_expr_equal (a.lhs, b.lhs)
5240      && constraint_expr_equal (a.rhs, b.rhs);
5241  }
5242  
5243 @@ -634,7 +664,7 @@
5244  constraint_vec_find (VEC(constraint_t,heap) *vec,
5245                      struct constraint lookfor)
5246  {
5247 -  unsigned int place;  
5248 +  unsigned int place;
5249    constraint_t found;
5250  
5251    if (vec == NULL)
5252 @@ -678,30 +708,47 @@
5253    bitmap result = BITMAP_ALLOC (&iteration_obstack);
5254    unsigned int i;
5255    bitmap_iterator bi;
5256 +  unsigned HOST_WIDE_INT min = -1, max = 0;
5257  
5258 +  /* Compute set of vars we can reach from set + offset.  */
5259 +
5260    EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
5261      {
5262 +      if (get_varinfo (i)->is_artificial_var
5263 +         || get_varinfo (i)->has_union
5264 +         || get_varinfo (i)->is_unknown_size_var)
5265 +       continue;
5266 +
5267 +      if (get_varinfo (i)->offset + offset < min)
5268 +       min = get_varinfo (i)->offset + offset;
5269 +      if (get_varinfo (i)->offset + get_varinfo (i)->size + offset > max)
5270 +       {
5271 +         max = get_varinfo (i)->offset + get_varinfo (i)->size + offset;
5272 +         if (max > get_varinfo (i)->fullsize)
5273 +           max = get_varinfo (i)->fullsize;
5274 +       }
5275 +    }
5276 +
5277 +  EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
5278 +    {
5279        /* If this is a properly sized variable, only add offset if it's
5280          less than end.  Otherwise, it is globbed to a single
5281          variable.  */
5282 -      
5283 -      if ((get_varinfo (i)->offset + offset) < get_varinfo (i)->fullsize)
5284 +
5285 +      if (get_varinfo (i)->offset + get_varinfo (i)->size - 1 >= min
5286 +         && get_varinfo (i)->offset < max)
5287         {
5288 -         unsigned HOST_WIDE_INT fieldoffset = get_varinfo (i)->offset + offset;
5289 -         varinfo_t v = first_vi_for_offset (get_varinfo (i), fieldoffset);
5290 -         if (!v)
5291 -           continue;
5292 -         bitmap_set_bit (result, v->id);
5293 +         bitmap_set_bit (result, i);
5294         }
5295 -      else if (get_varinfo (i)->is_artificial_var 
5296 +      else if (get_varinfo (i)->is_artificial_var
5297                || get_varinfo (i)->has_union
5298                || get_varinfo (i)->is_unknown_size_var)
5299         {
5300           bitmap_set_bit (result, i);
5301         }
5302      }
5303 -  
5304 -  bitmap_copy (set, result);  
5305 +
5306 +  bitmap_copy (set, result);
5307    BITMAP_FREE (result);
5308  }
5309  
5310 @@ -727,397 +774,149 @@
5311      }
5312  }
5313  
5314 -/* Insert constraint C into the list of complex constraints for VAR.  */
5315 +/* Insert constraint C into the list of complex constraints for graph
5316 +   node VAR.  */
5317  
5318  static void
5319 -insert_into_complex (unsigned int var, constraint_t c)
5320 +insert_into_complex (constraint_graph_t graph,
5321 +                    unsigned int var, constraint_t c)
5322  {
5323 -  varinfo_t vi = get_varinfo (var);
5324 -  unsigned int place = VEC_lower_bound (constraint_t, vi->complex, c,
5325 +  VEC (constraint_t, heap) *complex = graph->complex[var];
5326 +  unsigned int place = VEC_lower_bound (constraint_t, complex, c,
5327                                         constraint_less);
5328 -  VEC_safe_insert (constraint_t, heap, vi->complex, place, c);
5329 -}
5330  
5331 -
5332 -/* Compare two constraint edges A and B, return true if they are equal.  */
5333 -
5334 -static bool
5335 -constraint_edge_equal (struct constraint_edge a, struct constraint_edge b)
5336 -{
5337 -  return a.dest == b.dest;
5338 +  /* Only insert constraints that do not already exist.  */
5339 +  if (place >= VEC_length (constraint_t, complex)
5340 +      || !constraint_equal (*c, *VEC_index (constraint_t, complex, place)))
5341 +    VEC_safe_insert (constraint_t, heap, graph->complex[var], place, c);
5342  }
5343  
5344 -/* Compare two constraint edges, return true if A is less than B */
5345  
5346 -static bool
5347 -constraint_edge_less (const constraint_edge_t a, const constraint_edge_t b)
5348 -{
5349 -  if (a->dest < b->dest)
5350 -    return true;
5351 -  return false;
5352 -}
5353 -
5354 -/* Find the constraint edge that matches LOOKFOR, in VEC.
5355 -   Return the edge, if found, NULL otherwise.  */
5356 -
5357 -static constraint_edge_t 
5358 -constraint_edge_vec_find (VEC(constraint_edge_t,heap) *vec, 
5359 -                         struct constraint_edge lookfor)
5360 -{
5361 -  unsigned int place;  
5362 -  constraint_edge_t edge = NULL;
5363 -
5364 -  place = VEC_lower_bound (constraint_edge_t, vec, &lookfor, 
5365 -                          constraint_edge_less);
5366 -  if (place >= VEC_length (constraint_edge_t, vec))
5367 -    return NULL;
5368 -  edge = VEC_index (constraint_edge_t, vec, place);
5369 -  if (!constraint_edge_equal (*edge, lookfor))
5370 -    return NULL;
5371 -  return edge;
5372 -}
5373 -
5374  /* Condense two variable nodes into a single variable node, by moving
5375     all associated info from SRC to TO.  */
5376  
5377 -static void 
5378 -condense_varmap_nodes (unsigned int to, unsigned int src)
5379 +static void
5380 +merge_node_constraints (constraint_graph_t graph, unsigned int to,
5381 +                       unsigned int from)
5382  {
5383 -  varinfo_t tovi = get_varinfo (to);
5384 -  varinfo_t srcvi = get_varinfo (src);
5385    unsigned int i;
5386    constraint_t c;
5387 -  bitmap_iterator bi;
5388 -  
5389 -  /* the src node, and all its variables, are now the to node.  */
5390 -  srcvi->node = to;
5391 -  EXECUTE_IF_SET_IN_BITMAP (srcvi->variables, 0, i, bi)
5392 -    get_varinfo (i)->node = to;
5393 -  
5394 -  /* Merge the src node variables and the to node variables.  */
5395 -  bitmap_set_bit (tovi->variables, src);
5396 -  bitmap_ior_into (tovi->variables, srcvi->variables);
5397 -  bitmap_clear (srcvi->variables);
5398 -  
5399 +
5400 +  gcc_assert (find (from) == to);
5401 +
5402    /* Move all complex constraints from src node into to node  */
5403 -  for (i = 0; VEC_iterate (constraint_t, srcvi->complex, i, c); i++)
5404 +  for (i = 0; VEC_iterate (constraint_t, graph->complex[from], i, c); i++)
5405      {
5406        /* In complex constraints for node src, we may have either
5407 -        a = *src, and *src = a.  */
5408 -      
5409 +        a = *src, and *src = a, or an offseted constraint which are
5410 +        always added to the rhs node's constraints.  */
5411 +
5412        if (c->rhs.type == DEREF)
5413         c->rhs.var = to;
5414 +      else if (c->lhs.type == DEREF)
5415 +       c->lhs.var = to;
5416        else
5417 -       c->lhs.var = to;
5418 +       c->rhs.var = to;
5419      }
5420 -  constraint_set_union (&tovi->complex, &srcvi->complex);
5421 -  VEC_free (constraint_t, heap, srcvi->complex);
5422 -  srcvi->complex = NULL;
5423 +  constraint_set_union (&graph->complex[to], &graph->complex[from]);
5424 +  VEC_free (constraint_t, heap, graph->complex[from]);
5425 +  graph->complex[from] = NULL;
5426  }
5427  
5428 -/* Erase an edge from SRC to SRC from GRAPH.  This routine only
5429 -   handles self-edges (e.g. an edge from a to a).  */
5430  
5431 -static void
5432 -erase_graph_self_edge (constraint_graph_t graph, unsigned int src)
5433 -{
5434 -  VEC(constraint_edge_t,heap) *predvec = graph->preds[src];
5435 -  VEC(constraint_edge_t,heap) *succvec = graph->succs[src];
5436 -  struct constraint_edge edge;
5437 -  unsigned int place;
5438 -
5439 -  edge.dest = src;
5440 -
5441 -  /* Remove from the successors.  */
5442 -  place = VEC_lower_bound (constraint_edge_t, succvec, &edge, 
5443 -                          constraint_edge_less);
5444 -  
5445 -  /* Make sure we found the edge.  */
5446 -#ifdef ENABLE_CHECKING
5447 -  {
5448 -    constraint_edge_t tmp = VEC_index (constraint_edge_t, succvec, place);
5449 -    gcc_assert (constraint_edge_equal (*tmp, edge));
5450 -  }
5451 -#endif
5452 -  VEC_ordered_remove (constraint_edge_t, succvec, place);
5453 -
5454 -  /* Remove from the predecessors.  */
5455 -  place = VEC_lower_bound (constraint_edge_t, predvec, &edge,
5456 -                          constraint_edge_less);
5457 -
5458 -  /* Make sure we found the edge.  */
5459 -#ifdef ENABLE_CHECKING
5460 -  {
5461 -    constraint_edge_t tmp = VEC_index (constraint_edge_t, predvec, place);
5462 -    gcc_assert (constraint_edge_equal (*tmp, edge));
5463 -  }
5464 -#endif
5465 -  VEC_ordered_remove (constraint_edge_t, predvec, place);
5466 -}
5467 -
5468  /* Remove edges involving NODE from GRAPH.  */
5469  
5470  static void
5471  clear_edges_for_node (constraint_graph_t graph, unsigned int node)
5472  {
5473 -  VEC(constraint_edge_t,heap) *succvec = graph->succs[node];
5474 -  VEC(constraint_edge_t,heap) *predvec = graph->preds[node];
5475 -  bitmap_iterator bi;
5476 -  unsigned int j;
5477 -  constraint_edge_t c = NULL;
5478 -  int i;
5479 -
5480 -  /* Walk the successors, erase the associated preds.  */
5481 -  
5482 -  EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[node], 0, j, bi)
5483 -    if (j != node)
5484 -      bitmap_clear_bit (graph->zero_weight_preds[j], node);
5485 -  
5486 -  for (i = 0; VEC_iterate (constraint_edge_t, succvec, i, c); i++)
5487 -    if (c->dest != node)
5488 -      {
5489 -       unsigned int place;
5490 -       struct constraint_edge lookfor;
5491 -       constraint_edge_t result;
5492 -
5493 -       lookfor.dest = node;
5494 -       place = VEC_lower_bound (constraint_edge_t, graph->preds[c->dest], 
5495 -                                &lookfor, constraint_edge_less);
5496 -       result = VEC_ordered_remove (constraint_edge_t, 
5497 -                                    graph->preds[c->dest], place);
5498 -       pool_free (constraint_edge_pool, result);
5499 -      }
5500 -
5501 -  /* Walk the preds, erase the associated succs.  */
5502 -
5503 -  EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_preds[node], 0, j, bi)
5504 -    if (j != node)
5505 -      bitmap_clear_bit (graph->zero_weight_succs[j], node);
5506 -  
5507 -  for (i =0; VEC_iterate (constraint_edge_t, predvec, i, c); i++)
5508 -    if (c->dest != node)
5509 -      {
5510 -       unsigned int place;
5511 -       struct constraint_edge lookfor;
5512 -       constraint_edge_t result;
5513 -
5514 -       lookfor.dest = node;
5515 -       place = VEC_lower_bound (constraint_edge_t, graph->succs[c->dest],
5516 -                                &lookfor, constraint_edge_less);
5517 -       result = VEC_ordered_remove (constraint_edge_t, 
5518 -                                    graph->succs[c->dest], place);
5519 -       pool_free (constraint_edge_pool, result);
5520 -
5521 -      }    
5522 -
5523 -  if (graph->zero_weight_preds[node])
5524 -    {
5525 -      BITMAP_FREE (graph->zero_weight_preds[node]);
5526 -      graph->zero_weight_preds[node] = NULL;
5527 -    } 
5528 -
5529 -  if (graph->zero_weight_succs[node])
5530 -    {
5531 -      BITMAP_FREE (graph->zero_weight_succs[node]);
5532 -      graph->zero_weight_succs[node] = NULL;
5533 -    } 
5534 -
5535 -  VEC_free (constraint_edge_t, heap, graph->preds[node]);
5536 -  VEC_free (constraint_edge_t, heap, graph->succs[node]);
5537 -  graph->preds[node] = NULL;
5538 -  graph->succs[node] = NULL;
5539 +  if (graph->succs[node])
5540 +    BITMAP_FREE (graph->succs[node]);
5541  }
5542  
5543 -static bool edge_added = false;
5544 -  
5545 -/* Add edge (src, dest) to the graph.  */
5546 -
5547 -static bool
5548 -add_graph_edge (constraint_graph_t graph, unsigned int src, unsigned int dest)
5549 -{
5550 -  unsigned int place;
5551 -  VEC(constraint_edge_t,heap) *vec;
5552 -  struct constraint_edge newe;
5553 -  newe.dest = dest;
5554 -
5555 -  vec = graph->preds[src];
5556 -  place = VEC_lower_bound (constraint_edge_t, vec, &newe, 
5557 -                          constraint_edge_less);
5558 -  if (place == VEC_length (constraint_edge_t, vec)
5559 -      || VEC_index (constraint_edge_t, vec, place)->dest != dest)
5560 -    {
5561 -      constraint_edge_t edge = new_constraint_edge (dest);
5562 -
5563 -      VEC_safe_insert (constraint_edge_t, heap, graph->preds[src], 
5564 -                      place, edge);
5565 -      edge = new_constraint_edge (src);
5566 -
5567 -      place = VEC_lower_bound (constraint_edge_t, graph->succs[dest],
5568 -                              edge, constraint_edge_less);
5569 -      VEC_safe_insert (constraint_edge_t, heap, graph->succs[dest], 
5570 -                      place, edge);
5571 -      edge_added = true;
5572 -      stats.num_edges++;
5573 -      return true;
5574 -    }
5575 -  else
5576 -    return false;
5577 -}
5578 -
5579 -
5580 -/* Return the bitmap representing the weights of edge (SRC, DEST).  */
5581 -
5582 -static bitmap *
5583 -get_graph_weights (constraint_graph_t graph, unsigned int src,
5584 -                  unsigned int dest)
5585 -{
5586 -  constraint_edge_t edge;
5587 -  VEC(constraint_edge_t,heap) *vec;
5588 -  struct constraint_edge lookfor;
5589 -
5590 -  lookfor.dest = dest;
5591 -
5592 -  vec = graph->preds[src];
5593 -  edge = constraint_edge_vec_find (vec, lookfor);
5594 -  gcc_assert (edge != NULL);
5595 -  return &edge->weights;
5596 -}
5597 -
5598 -/* Allocate graph weight bitmap for the edges associated with SRC and
5599 -   DEST in GRAPH.  Both the pred and the succ edges share a single
5600 -   bitmap, so we need to set both edges to that bitmap.  */
5601 -
5602 -static bitmap
5603 -allocate_graph_weights (constraint_graph_t graph, unsigned int src, 
5604 -                       unsigned int dest)
5605 -{
5606 -  bitmap result;
5607 -  constraint_edge_t edge;
5608 -  VEC(constraint_edge_t,heap) *vec;
5609 -  struct constraint_edge lookfor;
5610 -  
5611 -  result = BITMAP_ALLOC (&ptabitmap_obstack);
5612 -
5613 -  /* Set the pred weight.  */
5614 -  lookfor.dest = dest;
5615 -  vec = graph->preds[src];
5616 -  edge = constraint_edge_vec_find (vec, lookfor);
5617 -  gcc_assert (edge != NULL);
5618 -  edge->weights = result;
5619 -
5620 -  /* Set the succ weight.  */  
5621 -  lookfor.dest = src;
5622 -  vec = graph->succs[dest];
5623 -  edge = constraint_edge_vec_find (vec, lookfor);
5624 -  gcc_assert (edge != NULL);
5625 -  edge->weights = result;
5626 -  
5627 -  return result;  
5628 -}
5629 -
5630 -
5631  /* Merge GRAPH nodes FROM and TO into node TO.  */
5632  
5633  static void
5634 -merge_graph_nodes (constraint_graph_t graph, unsigned int to, 
5635 +merge_graph_nodes (constraint_graph_t graph, unsigned int to,
5636                    unsigned int from)
5637  {
5638 -  VEC(constraint_edge_t,heap) *succvec = graph->succs[from];
5639 -  VEC(constraint_edge_t,heap) *predvec = graph->preds[from];
5640 -  int i;
5641 -  constraint_edge_t c;
5642 -  unsigned int j;
5643 -  bitmap_iterator bi;
5644 -
5645 -  /* Merge all the zero weighted predecessor edges.  */
5646 -  if (graph->zero_weight_preds[from])
5647 +  if (graph->indirect_cycles[from] != -1)
5648      {
5649 -      if (!graph->zero_weight_preds[to])
5650 -       graph->zero_weight_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
5651 -      
5652 -      EXECUTE_IF_SET_IN_BITMAP (graph->zero_weight_preds[from], 0, j, bi)
5653 +      /* If we have indirect cycles with the from node, and we have
5654 +        none on the to node, the to node has indirect cycles from the
5655 +        from node now that they are unified.
5656 +        If indirect cycles exist on both, unify the nodes that they
5657 +        are in a cycle with, since we know they are in a cycle with
5658 +        each other.  */
5659 +      if (graph->indirect_cycles[to] == -1)
5660         {
5661 -         if (j != to)
5662 -           {
5663 -             bitmap_clear_bit (graph->zero_weight_succs[j], from);
5664 -             bitmap_set_bit (graph->zero_weight_succs[j], to);
5665 -           }
5666 +         graph->indirect_cycles[to] = graph->indirect_cycles[from];
5667         }
5668 -      bitmap_ior_into (graph->zero_weight_preds[to], 
5669 -                      graph->zero_weight_preds[from]);
5670 -    }
5671 +      else
5672 +       {
5673 +         unsigned int tonode = find (graph->indirect_cycles[to]);
5674 +         unsigned int fromnode = find (graph->indirect_cycles[from]);
5675  
5676 -  /* Merge all the zero weighted successor edges.  */
5677 -  if (graph->zero_weight_succs[from])
5678 -    {
5679 -      if (!graph->zero_weight_succs[to])
5680 -       graph->zero_weight_succs[to] = BITMAP_ALLOC (&ptabitmap_obstack);
5681 -      EXECUTE_IF_SET_IN_BITMAP (graph->zero_weight_succs[from], 0, j, bi)
5682 -       {
5683 -         bitmap_clear_bit (graph->zero_weight_preds[j], from);
5684 -         bitmap_set_bit (graph->zero_weight_preds[j], to);
5685 +         if (unite (tonode, fromnode))
5686 +           unify_nodes (graph, tonode, fromnode, true);
5687         }
5688 -      bitmap_ior_into (graph->zero_weight_succs[to], 
5689 -                      graph->zero_weight_succs[from]);
5690      }
5691  
5692 -  /* Merge all the nonzero weighted predecessor edges.  */
5693 -  for (i = 0; VEC_iterate (constraint_edge_t, predvec, i, c); i++)
5694 +  /* Merge all the successor edges.  */
5695 +  if (graph->succs[from])
5696      {
5697 -      unsigned int d = c->dest;
5698 -      bitmap temp;
5699 -      bitmap *weights;
5700 +      if (!graph->succs[to])
5701 +       graph->succs[to] = BITMAP_ALLOC (&pta_obstack);
5702 +      bitmap_ior_into (graph->succs[to],
5703 +                      graph->succs[from]);
5704 +    }
5705  
5706 -      if (c->dest == from)
5707 -       d = to;
5708 +  clear_edges_for_node (graph, from);
5709 +}
5710  
5711 -      add_graph_edge (graph, to, d);
5712  
5713 -      temp = *(get_graph_weights (graph, from, c->dest));      
5714 -      if (temp)
5715 -       {
5716 -         weights = get_graph_weights (graph, to, d);
5717 -         if (!*weights)
5718 -           *weights = allocate_graph_weights (graph, to, d);
5719 -         
5720 -         bitmap_ior_into (*weights, temp);
5721 -       }
5722 -      
5723 -    }
5724 -  
5725 -  /* Merge all the nonzero weighted successor edges.  */
5726 -  for (i = 0; VEC_iterate (constraint_edge_t, succvec, i, c); i++)
5727 -    {
5728 -      unsigned int d = c->dest;
5729 -      bitmap temp;
5730 -      bitmap *weights;
5731 +/* Add an indirect graph edge to GRAPH, going from TO to FROM if
5732 +   it doesn't exist in the graph already.  */
5733  
5734 -      if (c->dest == from)
5735 -       d = to;
5736 +static void
5737 +add_implicit_graph_edge (constraint_graph_t graph, unsigned int to,
5738 +                        unsigned int from)
5739 +{
5740 +  if (to == from)
5741 +    return;
5742  
5743 -      add_graph_edge (graph, d, to);
5744 +  if (!graph->implicit_preds[to])
5745 +    graph->implicit_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
5746  
5747 -      temp = *(get_graph_weights (graph, c->dest, from));
5748 -      if (temp)
5749 -       {
5750 -         weights = get_graph_weights (graph, d, to);
5751 -         if (!*weights)
5752 -           *weights = allocate_graph_weights (graph, d, to);
5753 -         bitmap_ior_into (*weights, temp);
5754 -       }
5755 +  if (!bitmap_bit_p (graph->implicit_preds[to], from))
5756 +    {
5757 +      stats.num_implicit_edges++;
5758 +      bitmap_set_bit (graph->implicit_preds[to], from);
5759      }
5760 -  clear_edges_for_node (graph, from);
5761  }
5762  
5763 -/* Add a graph edge to GRAPH, going from TO to FROM, with WEIGHT, if
5764 +/* Add a predecessor graph edge to GRAPH, going from TO to FROM if
5765     it doesn't exist in the graph already.
5766     Return false if the edge already existed, true otherwise.  */
5767  
5768 +static void
5769 +add_pred_graph_edge (constraint_graph_t graph, unsigned int to,
5770 +                    unsigned int from)
5771 +{
5772 +  if (!graph->preds[to])
5773 +    graph->preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
5774 +  if (!bitmap_bit_p (graph->preds[to], from))
5775 +    bitmap_set_bit (graph->preds[to], from);
5776 +}
5777 +
5778 +/* Add a graph edge to GRAPH, going from FROM to TO if
5779 +   it doesn't exist in the graph already.
5780 +   Return false if the edge already existed, true otherwise.  */
5781 +
5782  static bool
5783 -int_add_graph_edge (constraint_graph_t graph, unsigned int to, 
5784 -                   unsigned int from, unsigned HOST_WIDE_INT weight)
5785 +add_graph_edge (constraint_graph_t graph, unsigned int to,
5786 +               unsigned int from)
5787  {
5788 -  if (to == from && weight == 0)
5789 +  if (to == from)
5790      {
5791        return false;
5792      }
5793 @@ -1125,41 +924,15 @@
5794      {
5795        bool r = false;
5796  
5797 -      if (weight == 0)
5798 +      if (!graph->succs[from])
5799 +       graph->succs[from] = BITMAP_ALLOC (&pta_obstack);
5800 +      if (!bitmap_bit_p (graph->succs[from], to))
5801         {
5802 -          if (!graph->zero_weight_preds[to])
5803 -           graph->zero_weight_preds[to] = BITMAP_ALLOC (&predbitmap_obstack);
5804 -          if (!graph->zero_weight_succs[from])
5805 -           graph->zero_weight_succs[from] = BITMAP_ALLOC (&ptabitmap_obstack);
5806 -         if (!bitmap_bit_p (graph->zero_weight_succs[from], to))
5807 -           {
5808 -             edge_added = true;
5809 -             r = true;
5810 -             stats.num_edges++;
5811 -             bitmap_set_bit (graph->zero_weight_preds[to], from);
5812 -             bitmap_set_bit (graph->zero_weight_succs[from], to);
5813 -           }
5814 +         r = true;
5815 +         if (to < FIRST_REF_NODE && from < FIRST_REF_NODE)
5816 +           stats.num_edges++;
5817 +         bitmap_set_bit (graph->succs[from], to);
5818         }
5819 -      else
5820 -       {
5821 -         bitmap *weights;
5822 -
5823 -         r = add_graph_edge (graph, to, from);
5824 -         weights = get_graph_weights (graph, to, from);
5825 -
5826 -         if (!*weights)
5827 -           {
5828 -             r = true;
5829 -             *weights = allocate_graph_weights (graph, to, from);
5830 -             bitmap_set_bit (*weights, weight);
5831 -           }
5832 -         else
5833 -           {
5834 -             r |= !bitmap_bit_p (*weights, weight);
5835 -             bitmap_set_bit (*weights, weight);
5836 -           }
5837 -       }
5838 -      
5839        return r;
5840      }
5841  }
5842 @@ -1168,46 +941,51 @@
5843  /* Return true if {DEST.SRC} is an existing graph edge in GRAPH.  */
5844  
5845  static bool
5846 -valid_graph_edge (constraint_graph_t graph, unsigned int src, 
5847 +valid_graph_edge (constraint_graph_t graph, unsigned int src,
5848                   unsigned int dest)
5849  {
5850 -  struct constraint_edge lookfor;
5851 -  lookfor.dest = src;
5852 -  
5853 -  return (graph->zero_weight_succs[dest] 
5854 -      && bitmap_bit_p (graph->zero_weight_succs[dest], src)) 
5855 -    || constraint_edge_vec_find (graph->succs[dest], lookfor) != NULL;
5856 +  return (graph->succs[dest]
5857 +         && bitmap_bit_p (graph->succs[dest], src));
5858  }
5859  
5860 -/* Return true if {DEST, SRC} is an existing weighted graph edge (IE has
5861 -   a weight other than 0) in GRAPH.  */
5862 -static bool
5863 -valid_weighted_graph_edge (constraint_graph_t graph, unsigned int src, 
5864 -                          unsigned int dest)
5865 -{
5866 -  struct constraint_edge lookfor;
5867 -  lookfor.dest = src;
5868 -  
5869 -  return graph->preds[src] 
5870 -    && constraint_edge_vec_find (graph->succs[dest], lookfor) != NULL;
5871 -}
5872 +/* Build the constraint graph, adding only predecessor edges right now.  */
5873  
5874 -
5875 -/* Build the constraint graph.  */
5876 -
5877  static void
5878 -build_constraint_graph (void)
5879 +build_pred_graph (void)
5880  {
5881 -  int i = 0;
5882 +  int i;
5883    constraint_t c;
5884 +  unsigned int j;
5885  
5886    graph = XNEW (struct constraint_graph);
5887 -  graph_size = VEC_length (varinfo_t, varmap) + 1;
5888 -  graph->succs = XCNEWVEC (VEC(constraint_edge_t,heap) *, graph_size);
5889 -  graph->preds = XCNEWVEC (VEC(constraint_edge_t,heap) *, graph_size);
5890 -  graph->zero_weight_succs = XCNEWVEC (bitmap, graph_size);
5891 -  graph->zero_weight_preds = XCNEWVEC (bitmap, graph_size);
5892 +  graph->size = (VEC_length (varinfo_t, varmap)) * 3;
5893 +  graph->succs = XCNEWVEC (bitmap, graph->size);
5894 +  graph->implicit_preds = XCNEWVEC (bitmap, graph->size);
5895 +  graph->preds = XCNEWVEC (bitmap, graph->size);
5896 +  graph->indirect_cycles = XNEWVEC (int, VEC_length (varinfo_t, varmap));
5897 +  graph->label = XCNEWVEC (unsigned int, graph->size);
5898 +  graph->rep = XNEWVEC (unsigned int, graph->size);
5899 +  graph->eq_rep = XNEWVEC (int, graph->size);
5900 +  graph->complex = XCNEWVEC (VEC(constraint_t, heap) *,
5901 +                            VEC_length (varinfo_t, varmap));
5902 +  graph->direct_nodes = sbitmap_alloc (graph->size);
5903 +  sbitmap_zero (graph->direct_nodes);
5904  
5905 +  for (j = 0; j < FIRST_REF_NODE; j++)
5906 +    {
5907 +      if (!get_varinfo (j)->is_special_var)
5908 +       SET_BIT (graph->direct_nodes, j);
5909 +    }
5910 +
5911 +  for (j = 0; j < graph->size; j++)
5912 +    {
5913 +      graph->rep[j] = j;
5914 +      graph->eq_rep[j] = -1;
5915 +    }
5916 +
5917 +  for (j = 0; j < VEC_length (varinfo_t, varmap); j++)
5918 +    graph->indirect_cycles[j] = -1;
5919 +
5920    for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
5921      {
5922        struct constraint_expr lhs = c->lhs;
5923 @@ -1217,31 +995,92 @@
5924  
5925        if (lhs.type == DEREF)
5926         {
5927 -         /* *x = y or *x = &y (complex) */
5928 -         if (rhs.type == ADDRESSOF || rhsvar > anything_id)
5929 -           insert_into_complex (lhsvar, c);
5930 +         /* *x = y.  */
5931 +         if (rhs.offset == 0 && lhs.offset == 0 && rhs.type == SCALAR)
5932 +           add_pred_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
5933 +         if (rhs.type == ADDRESSOF)
5934 +           RESET_BIT (graph->direct_nodes, rhsvar);
5935         }
5936        else if (rhs.type == DEREF)
5937         {
5938 -         /* !special var= *y */
5939 -         if (!(get_varinfo (lhsvar)->is_special_var))
5940 -           insert_into_complex (rhsvar, c);
5941 +         /* x = *y */
5942 +         if (rhs.offset == 0 && lhs.offset == 0 && lhs.type == SCALAR)
5943 +           add_pred_graph_edge (graph, lhsvar, FIRST_REF_NODE + rhsvar);
5944 +         else
5945 +           RESET_BIT (graph->direct_nodes, lhsvar);
5946         }
5947        else if (rhs.type == ADDRESSOF)
5948         {
5949           /* x = &y */
5950 +         add_pred_graph_edge (graph, lhsvar, FIRST_ADDR_NODE + rhsvar);
5951 +         /* Implicitly, *x = y */
5952 +         add_implicit_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
5953 +
5954 +         RESET_BIT (graph->direct_nodes, rhsvar);
5955 +       }
5956 +      else if (lhsvar > anything_id
5957 +              && lhsvar != rhsvar && lhs.offset == 0 && rhs.offset == 0)
5958 +       {
5959 +         /* x = y */
5960 +         add_pred_graph_edge (graph, lhsvar, rhsvar);
5961 +         /* Implicitly, *x = *y */
5962 +         add_implicit_graph_edge (graph, FIRST_REF_NODE + lhsvar,
5963 +                                  FIRST_REF_NODE + rhsvar);
5964 +       }
5965 +      else if (lhs.offset != 0 || rhs.offset != 0)
5966 +       {
5967 +         if (rhs.offset != 0)
5968 +           RESET_BIT (graph->direct_nodes, lhs.var);
5969 +         if (lhs.offset != 0)
5970 +           RESET_BIT (graph->direct_nodes, rhs.var);
5971 +       }
5972 +    }
5973 +}
5974 +
5975 +/* Build the constraint graph, adding successor edges.  */
5976 +
5977 +static void
5978 +build_succ_graph (void)
5979 +{
5980 +  int i;
5981 +  constraint_t c;
5982 +
5983 +  for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
5984 +    {
5985 +      struct constraint_expr lhs;
5986 +      struct constraint_expr rhs;
5987 +      unsigned int lhsvar;
5988 +      unsigned int rhsvar;
5989 +
5990 +      if (!c)
5991 +       continue;
5992 +
5993 +      lhs = c->lhs;
5994 +      rhs = c->rhs;
5995 +      lhsvar = find (get_varinfo_fc (lhs.var)->id);
5996 +      rhsvar = find (get_varinfo_fc (rhs.var)->id);
5997 +
5998 +      if (lhs.type == DEREF)
5999 +       {
6000 +         if (rhs.offset == 0 && lhs.offset == 0 && rhs.type == SCALAR)
6001 +           add_graph_edge (graph, FIRST_REF_NODE + lhsvar, rhsvar);
6002 +       }
6003 +      else if (rhs.type == DEREF)
6004 +       {
6005 +         if (rhs.offset == 0 && lhs.offset == 0 && lhs.type == SCALAR)
6006 +           add_graph_edge (graph, lhsvar, FIRST_REF_NODE + rhsvar);
6007 +       }
6008 +      else if (rhs.type == ADDRESSOF)
6009 +       {
6010 +         /* x = &y */
6011 +         gcc_assert (find (get_varinfo_fc (rhs.var)->id)
6012 +                     == get_varinfo_fc (rhs.var)->id);
6013           bitmap_set_bit (get_varinfo (lhsvar)->solution, rhsvar);
6014         }
6015 -      else if (lhsvar > anything_id)
6016 +      else if (lhsvar > anything_id
6017 +              && lhsvar != rhsvar && lhs.offset == 0 && rhs.offset == 0)
6018         {
6019 -         /* Ignore 0 weighted self edges, as they can't possibly contribute
6020 -            anything */
6021 -         if (lhsvar != rhsvar || rhs.offset != 0 || lhs.offset != 0)
6022 -           {
6023 -             /* x = y (simple) */
6024 -             int_add_graph_edge (graph, lhs.var, rhs.var, rhs.offset);
6025 -           }
6026 -         
6027 +         add_graph_edge (graph, lhsvar, rhsvar);
6028         }
6029      }
6030  }
6031 @@ -1260,20 +1099,20 @@
6032  struct scc_info
6033  {
6034    sbitmap visited;
6035 -  sbitmap in_component;
6036 +  sbitmap roots;
6037 +  unsigned int *dfs;
6038 +  unsigned int *node_mapping;
6039    int current_index;
6040 -  unsigned int *visited_index;
6041    VEC(unsigned,heap) *scc_stack;
6042 -  VEC(unsigned,heap) *unification_queue;
6043  };
6044  
6045  
6046  /* Recursive routine to find strongly connected components in GRAPH.
6047     SI is the SCC info to store the information in, and N is the id of current
6048     graph node we are processing.
6049 -   
6050 +
6051     This is Tarjan's strongly connected component finding algorithm, as
6052 -   modified by Nuutila to keep only non-root nodes on the stack.  
6053 +   modified by Nuutila to keep only non-root nodes on the stack.
6054     The algorithm can be found in "On finding the strongly connected
6055     connected components in a directed graph" by Esko Nuutila and Eljas
6056     Soisalon-Soininen, in Information Processing Letters volume 49,
6057 @@ -1284,188 +1123,144 @@
6058  {
6059    unsigned int i;
6060    bitmap_iterator bi;
6061 +  unsigned int my_dfs;
6062  
6063 -  gcc_assert (get_varinfo (n)->node == n);
6064    SET_BIT (si->visited, n);
6065 -  RESET_BIT (si->in_component, n);
6066 -  si->visited_index[n] = si->current_index ++;
6067 -  
6068 +  si->dfs[n] = si->current_index ++;
6069 +  my_dfs = si->dfs[n];
6070 +
6071    /* Visit all the successors.  */
6072 -  EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[n], 0, i, bi)
6073 +  EXECUTE_IF_IN_NONNULL_BITMAP (graph->succs[n], 0, i, bi)
6074      {
6075 -      unsigned int w = i;
6076 +      unsigned int w;
6077 +
6078 +      if (i > LAST_REF_NODE)
6079 +       break;
6080 +
6081 +      w = find (i);
6082 +      if (TEST_BIT (si->roots, w))
6083 +       continue;
6084 +
6085        if (!TEST_BIT (si->visited, w))
6086         scc_visit (graph, si, w);
6087 -      if (!TEST_BIT (si->in_component, w))
6088 -       {
6089 -         unsigned int t = get_varinfo (w)->node;
6090 -         unsigned int nnode = get_varinfo (n)->node;
6091 -         if (si->visited_index[t] < si->visited_index[nnode])
6092 -           get_varinfo (n)->node = t;
6093 -       }
6094 +      {
6095 +       unsigned int t = find (w);
6096 +       unsigned int nnode = find (n);
6097 +       gcc_assert (nnode == n);
6098 +
6099 +       if (si->dfs[t] < si->dfs[nnode])
6100 +         si->dfs[n] = si->dfs[t];
6101 +      }
6102      }
6103 -  
6104 +
6105    /* See if any components have been identified.  */
6106 -  if (get_varinfo (n)->node == n)
6107 +  if (si->dfs[n] == my_dfs)
6108      {
6109 -      unsigned int t = si->visited_index[n];
6110 -      SET_BIT (si->in_component, n);
6111 -      while (VEC_length (unsigned, si->scc_stack) != 0 
6112 -            && t < si->visited_index[VEC_last (unsigned, si->scc_stack)])
6113 +      if (VEC_length (unsigned, si->scc_stack) > 0
6114 +         && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
6115         {
6116 -         unsigned int w = VEC_pop (unsigned, si->scc_stack);
6117 -         get_varinfo (w)->node = n;
6118 -         SET_BIT (si->in_component, w);
6119 -         /* Mark this node for collapsing.  */
6120 -         VEC_safe_push (unsigned, heap, si->unification_queue, w);
6121 -       } 
6122 -    }
6123 -  else
6124 -    VEC_safe_push (unsigned, heap, si->scc_stack, n);
6125 -}
6126 +         bitmap scc = BITMAP_ALLOC (NULL);
6127 +         bool have_ref_node = n >= FIRST_REF_NODE;
6128 +         unsigned int lowest_node;
6129 +         bitmap_iterator bi;
6130  
6131 +         bitmap_set_bit (scc, n);
6132  
6133 -/* Collapse two variables into one variable.  */
6134 +         while (VEC_length (unsigned, si->scc_stack) != 0
6135 +                && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
6136 +           {
6137 +             unsigned int w = VEC_pop (unsigned, si->scc_stack);
6138  
6139 -static void
6140 -collapse_nodes (constraint_graph_t graph, unsigned int to, unsigned int from)
6141 -{
6142 -  bitmap tosol, fromsol;
6143 +             bitmap_set_bit (scc, w);
6144 +             if (w >= FIRST_REF_NODE)
6145 +               have_ref_node = true;
6146 +           }
6147  
6148 -  condense_varmap_nodes (to, from);
6149 -  tosol = get_varinfo (to)->solution;
6150 -  fromsol = get_varinfo (from)->solution;
6151 -  bitmap_ior_into (tosol, fromsol);
6152 -  merge_graph_nodes (graph, to, from);
6153 -
6154 -  if (valid_graph_edge (graph, to, to))
6155 -    {
6156 -      if (graph->zero_weight_preds[to])
6157 -       {
6158 -         bitmap_clear_bit (graph->zero_weight_preds[to], to);
6159 -         bitmap_clear_bit (graph->zero_weight_succs[to], to);
6160 +         lowest_node = bitmap_first_set_bit (scc);
6161 +         gcc_assert (lowest_node < FIRST_REF_NODE);
6162 +         EXECUTE_IF_SET_IN_BITMAP (scc, 0, i, bi)
6163 +           {
6164 +             if (i < FIRST_REF_NODE)
6165 +               {
6166 +                 /* Mark this node for collapsing.  */
6167 +                 if (unite (lowest_node, i))
6168 +                   unify_nodes (graph, lowest_node, i, false);
6169 +               }
6170 +             else
6171 +               {
6172 +                 unite (lowest_node, i);
6173 +                 graph->indirect_cycles[i - FIRST_REF_NODE] = lowest_node;
6174 +               }
6175 +           }
6176         }
6177 -      if (valid_weighted_graph_edge (graph, to, to))
6178 -       {
6179 -         bitmap weights = *(get_graph_weights (graph, to, to));
6180 -         if (!weights || bitmap_empty_p (weights))
6181 -           erase_graph_self_edge (graph, to);
6182 -       }
6183 +      SET_BIT (si->roots, n);
6184      }
6185 -  BITMAP_FREE (fromsol);
6186 -  get_varinfo (to)->address_taken |= get_varinfo (from)->address_taken;
6187 -  get_varinfo (to)->indirect_target |= get_varinfo (from)->indirect_target;
6188 +  else
6189 +    VEC_safe_push (unsigned, heap, si->scc_stack, n);
6190  }
6191  
6192 +/* Unify node FROM into node TO, updating the changed count if
6193 +   necessary when UPDATE_CHANGED is true.  */
6194  
6195 -/* Unify nodes in GRAPH that we have found to be part of a cycle.
6196 -   SI is the Strongly Connected Components information structure that tells us
6197 -   what components to unify.
6198 -   UPDATE_CHANGED should be set to true if the changed sbitmap and changed
6199 -   count should be updated to reflect the unification.  */
6200 -
6201  static void
6202 -process_unification_queue (constraint_graph_t graph, struct scc_info *si,
6203 -                          bool update_changed)
6204 +unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from,
6205 +            bool update_changed)
6206  {
6207 -  size_t i = 0;
6208 -  bitmap tmp = BITMAP_ALLOC (update_changed ? &iteration_obstack : NULL);
6209 -  bitmap_clear (tmp);
6210  
6211 -  /* We proceed as follows:
6212 +  gcc_assert (to != from && find (to) == to);
6213 +  if (dump_file && (dump_flags & TDF_DETAILS))
6214 +    fprintf (dump_file, "Unifying %s to %s\n",
6215 +            get_varinfo (from)->name,
6216 +            get_varinfo (to)->name);
6217  
6218 -     For each component in the queue (components are delineated by
6219 -     when current_queue_element->node != next_queue_element->node):
6220 +  if (update_changed)
6221 +    stats.unified_vars_dynamic++;
6222 +  else
6223 +    stats.unified_vars_static++;
6224  
6225 -        rep = representative node for component
6226 +  merge_graph_nodes (graph, to, from);
6227 +  merge_node_constraints (graph, to, from);
6228  
6229 -        For each node (tounify) to be unified in the component,
6230 -           merge the solution for tounify into tmp bitmap
6231 -
6232 -           clear solution for tounify
6233 -
6234 -           merge edges from tounify into rep
6235 -
6236 -          merge complex constraints from tounify into rep
6237 -
6238 -          update changed count to note that tounify will never change
6239 -          again
6240 -
6241 -       Merge tmp into solution for rep, marking rep changed if this
6242 -       changed rep's solution.
6243 -       
6244 -       Delete any 0 weighted self-edges we now have for rep.  */
6245 -  while (i != VEC_length (unsigned, si->unification_queue))
6246 +  if (update_changed && TEST_BIT (changed, from))
6247      {
6248 -      unsigned int tounify = VEC_index (unsigned, si->unification_queue, i);
6249 -      unsigned int n = get_varinfo (tounify)->node;
6250 -
6251 -      if (dump_file && (dump_flags & TDF_DETAILS))
6252 -       fprintf (dump_file, "Unifying %s to %s\n", 
6253 -                get_varinfo (tounify)->name,
6254 -                get_varinfo (n)->name);
6255 -      if (update_changed)
6256 -       stats.unified_vars_dynamic++;
6257 +      RESET_BIT (changed, from);
6258 +      if (!TEST_BIT (changed, to))
6259 +       SET_BIT (changed, to);
6260        else
6261 -       stats.unified_vars_static++;
6262 -      bitmap_ior_into (tmp, get_varinfo (tounify)->solution);
6263 -      merge_graph_nodes (graph, n, tounify);
6264 -      condense_varmap_nodes (n, tounify);
6265 -      
6266 -      if (update_changed && TEST_BIT (changed, tounify))
6267         {
6268 -         RESET_BIT (changed, tounify);
6269 -         if (!TEST_BIT (changed, n))
6270 -           SET_BIT (changed, n);
6271 -         else
6272 -           {
6273 -             gcc_assert (changed_count > 0);
6274 -             changed_count--;
6275 -           }
6276 +         gcc_assert (changed_count > 0);
6277 +         changed_count--;
6278         }
6279 +    }
6280  
6281 -      bitmap_clear (get_varinfo (tounify)->solution);
6282 -      ++i;
6283 -
6284 -      /* If we've either finished processing the entire queue, or
6285 -        finished processing all nodes for component n, update the solution for
6286 -        n.  */
6287 -      if (i == VEC_length (unsigned, si->unification_queue)
6288 -         || get_varinfo (VEC_index (unsigned, si->unification_queue, i))->node != n)
6289 +  /* If the solution changes because of the merging, we need to mark
6290 +     the variable as changed.  */
6291 +  if (bitmap_ior_into (get_varinfo (to)->solution,
6292 +                      get_varinfo (from)->solution))
6293 +    {
6294 +      if (update_changed && !TEST_BIT (changed, to))
6295         {
6296 -         /* If the solution changes because of the merging, we need to mark
6297 -            the variable as changed.  */
6298 -         if (bitmap_ior_into (get_varinfo (n)->solution, tmp))
6299 -           {
6300 -             if (update_changed && !TEST_BIT (changed, n))
6301 -               {
6302 -                 SET_BIT (changed, n);
6303 -                 changed_count++;
6304 -               }
6305 -           }
6306 -         bitmap_clear (tmp);
6307 -
6308 -         if (valid_graph_edge (graph, n, n))
6309 -           {
6310 -             if (graph->zero_weight_succs[n])
6311 -               {
6312 -                 if (graph->zero_weight_preds[n])
6313 -                   bitmap_clear_bit (graph->zero_weight_preds[n], n);
6314 -                 bitmap_clear_bit (graph->zero_weight_succs[n], n);
6315 -               }
6316 -             if (valid_weighted_graph_edge (graph, n, n))
6317 -               {
6318 -                 bitmap weights = *(get_graph_weights (graph, n, n));
6319 -                 if (!weights || bitmap_empty_p (weights))
6320 -                   erase_graph_self_edge (graph, n);
6321 -               }
6322 -           }
6323 +         SET_BIT (changed, to);
6324 +         changed_count++;
6325         }
6326      }
6327 -  BITMAP_FREE (tmp);
6328 +
6329 +  BITMAP_FREE (get_varinfo (from)->solution);
6330 +  BITMAP_FREE (get_varinfo (from)->oldsolution);
6331 +
6332 +  if (stats.iterations > 0)
6333 +    {
6334 +      BITMAP_FREE (get_varinfo (to)->oldsolution);
6335 +      get_varinfo (to)->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
6336 +    }
6337 +
6338 +  if (valid_graph_edge (graph, to, to))
6339 +    {
6340 +      if (graph->succs[to])
6341 +       bitmap_clear_bit (graph->succs[to], to);
6342 +    }
6343  }
6344  
6345 -
6346  /* Information needed to compute the topological ordering of a graph.  */
6347  
6348  struct topo_info
6349 @@ -1509,37 +1304,24 @@
6350  topo_visit (constraint_graph_t graph, struct topo_info *ti,
6351             unsigned int n)
6352  {
6353 -  VEC(constraint_edge_t,heap) *succs = graph->succs[n];
6354 -  bitmap temp;
6355    bitmap_iterator bi;
6356 -  constraint_edge_t c;
6357 -  int i;
6358    unsigned int j;
6359  
6360    SET_BIT (ti->visited, n);
6361 -  if (VEC_length (constraint_edge_t, succs) != 0)
6362 -    {
6363 -      temp = BITMAP_ALLOC (&iteration_obstack);
6364 -      if (graph->zero_weight_succs[n])
6365 -       bitmap_ior_into (temp, graph->zero_weight_succs[n]);
6366 -      for (i = 0; VEC_iterate (constraint_edge_t, succs, i, c); i++)
6367 -       bitmap_set_bit (temp, c->dest);
6368 -    }
6369 -  else 
6370 -    temp = graph->zero_weight_succs[n];
6371  
6372 -  if (temp) 
6373 -    EXECUTE_IF_SET_IN_BITMAP (temp, 0, j, bi)
6374 +  if (graph->succs[n])
6375 +    EXECUTE_IF_SET_IN_BITMAP (graph->succs[n], 0, j, bi)
6376        {
6377         if (!TEST_BIT (ti->visited, j))
6378           topo_visit (graph, ti, j);
6379        }
6380 +
6381    VEC_safe_push (unsigned, heap, ti->topo_order, n);
6382  }
6383  
6384  /* Return true if variable N + OFFSET is a legal field of N.  */
6385  
6386 -static bool 
6387 +static bool
6388  type_safe (unsigned int n, unsigned HOST_WIDE_INT *offset)
6389  {
6390    varinfo_t ninfo = get_varinfo (n);
6391 @@ -1582,10 +1364,10 @@
6392           v = first_vi_for_offset (get_varinfo (j), fieldoffset);
6393           if (!v)
6394             continue;
6395 -         t = v->node;
6396 +         t = find (v->id);
6397           sol = get_varinfo (t)->solution;
6398           if (!bitmap_bit_p (sol, rhs))
6399 -           {             
6400 +           {
6401               bitmap_set_bit (sol, rhs);
6402               if (!TEST_BIT (changed, t))
6403                 {
6404 @@ -1596,7 +1378,7 @@
6405         }
6406        else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
6407         fprintf (dump_file, "Untypesafe usage in do_da_constraint.\n");
6408 -      
6409 +
6410      }
6411  }
6412  
6413 @@ -1607,7 +1389,7 @@
6414  do_sd_constraint (constraint_graph_t graph, constraint_t c,
6415                   bitmap delta)
6416  {
6417 -  unsigned int lhs = get_varinfo (c->lhs.var)->node;
6418 +  unsigned int lhs = find (c->lhs.var);
6419    bool flag = false;
6420    bitmap sol = get_varinfo (lhs)->solution;
6421    unsigned int j;
6422 @@ -1620,7 +1402,7 @@
6423         bitmap_set_bit (sol, anything_id);
6424       goto done;
6425     }
6426 -  /* For each variable j in delta (Sol(y)), add    
6427 +  /* For each variable j in delta (Sol(y)), add
6428       an edge in the graph from j to x, and union Sol(j) into Sol(x).  */
6429    EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi)
6430      {
6431 @@ -1634,18 +1416,18 @@
6432           v = first_vi_for_offset (get_varinfo (j), fieldoffset);
6433           if (!v)
6434             continue;
6435 -         t = v->node;
6436 +         t = find (v->id);
6437  
6438           /* Adding edges from the special vars is pointless.
6439              They don't have sets that can change.  */
6440           if (get_varinfo (t) ->is_special_var)
6441             flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
6442 -         else if (int_add_graph_edge (graph, lhs, t, 0))
6443 +         else if (add_graph_edge (graph, lhs, t))
6444             flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
6445         }
6446        else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
6447         fprintf (dump_file, "Untypesafe usage in do_sd_constraint\n");
6448 -      
6449 +
6450      }
6451  
6452  done:
6453 @@ -1658,15 +1440,15 @@
6454           SET_BIT (changed, lhs);
6455           changed_count++;
6456         }
6457 -    }    
6458 +    }
6459  }
6460  
6461  /* Process a constraint C that represents *x = y.  */
6462  
6463  static void
6464 -do_ds_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
6465 +do_ds_constraint (constraint_t c, bitmap delta)
6466  {
6467 -  unsigned int rhs = get_varinfo (c->rhs.var)->node;
6468 +  unsigned int rhs = find (c->rhs.var);
6469    unsigned HOST_WIDE_INT roff = c->rhs.offset;
6470    bitmap sol = get_varinfo (rhs)->solution;
6471    unsigned int j;
6472 @@ -1685,8 +1467,8 @@
6473          v = first_vi_for_offset (get_varinfo (j), fieldoffset);
6474          if (!v)
6475            continue;
6476 -        t = v->node;
6477 -        
6478 +        t = find (v->id);
6479 +
6480          if (!bitmap_bit_p (get_varinfo (t)->solution, anything_id))
6481            {
6482              bitmap_set_bit (get_varinfo (t)->solution, anything_id);
6483 @@ -1705,40 +1487,39 @@
6484    EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi)
6485      {
6486        unsigned HOST_WIDE_INT loff = c->lhs.offset;
6487 -      if (type_safe (j, &loff) && !(get_varinfo(j)->is_special_var))
6488 +      if (type_safe (j, &loff) && !(get_varinfo (j)->is_special_var))
6489         {
6490           varinfo_t v;
6491           unsigned int t;
6492           unsigned HOST_WIDE_INT fieldoffset = get_varinfo (j)->offset + loff;
6493 +         bitmap tmp;
6494  
6495           v = first_vi_for_offset (get_varinfo (j), fieldoffset);
6496           if (!v)
6497             continue;
6498 -         t = v->node;
6499 -         if (int_add_graph_edge (graph, t, rhs, roff))
6500 +         t = find (v->id);
6501 +         tmp = get_varinfo (t)->solution;
6502 +
6503 +         if (set_union_with_increment (tmp, sol, roff))
6504             {
6505 -             bitmap tmp = get_varinfo (t)->solution;
6506 -             if (set_union_with_increment (tmp, sol, roff))
6507 +             get_varinfo (t)->solution = tmp;
6508 +             if (t == rhs)
6509 +               sol = get_varinfo (rhs)->solution;
6510 +             if (!TEST_BIT (changed, t))
6511                 {
6512 -                 get_varinfo (t)->solution = tmp;
6513 -                 if (t == rhs)
6514 -                   sol = get_varinfo (rhs)->solution;
6515 -                 if (!TEST_BIT (changed, t))
6516 -                   {
6517 -                     SET_BIT (changed, t);
6518 -                     changed_count++;
6519 -                   }
6520 +                 SET_BIT (changed, t);
6521 +                 changed_count++;
6522                 }
6523             }
6524 -       }    
6525 +       }
6526        else if (0 && dump_file && !(get_varinfo (j)->is_special_var))
6527         fprintf (dump_file, "Untypesafe usage in do_ds_constraint\n");
6528      }
6529  }
6530  
6531 -/* Handle a non-simple (simple meaning requires no iteration), non-copy
6532 -   constraint (IE *x = &y, x = *y, and *x = y).  */
6533 -   
6534 +/* Handle a non-simple (simple meaning requires no iteration),
6535 +   constraint (IE *x = &y, x = *y, *x = y, and x = y with offsets involved).  */
6536 +
6537  static void
6538  do_complex_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
6539  {
6540 @@ -1752,33 +1533,62 @@
6541        else
6542         {
6543           /* *x = y */
6544 -         do_ds_constraint (graph, c, delta);
6545 +         do_ds_constraint (c, delta);
6546         }
6547      }
6548 -  else
6549 +  else if (c->rhs.type == DEREF)
6550      {
6551        /* x = *y */
6552        if (!(get_varinfo (c->lhs.var)->is_special_var))
6553         do_sd_constraint (graph, c, delta);
6554      }
6555 +  else
6556 +    {
6557 +      bitmap tmp;
6558 +      bitmap solution;
6559 +      bool flag = false;
6560 +      unsigned int t;
6561 +
6562 +      gcc_assert (c->rhs.type == SCALAR && c->lhs.type == SCALAR);
6563 +      t = find (c->rhs.var);
6564 +      solution = get_varinfo (t)->solution;
6565 +      t = find (c->lhs.var);
6566 +      tmp = get_varinfo (t)->solution;
6567 +
6568 +      flag = set_union_with_increment (tmp, solution, c->rhs.offset);
6569 +
6570 +      if (flag)
6571 +       {
6572 +         get_varinfo (t)->solution = tmp;
6573 +         if (!TEST_BIT (changed, t))
6574 +           {
6575 +             SET_BIT (changed, t);
6576 +             changed_count++;
6577 +           }
6578 +       }
6579 +    }
6580  }
6581  
6582  /* Initialize and return a new SCC info structure.  */
6583  
6584  static struct scc_info *
6585 -init_scc_info (void)
6586 +init_scc_info (size_t size)
6587  {
6588    struct scc_info *si = XNEW (struct scc_info);
6589 -  size_t size = VEC_length (varinfo_t, varmap);
6590 +  size_t i;
6591  
6592    si->current_index = 0;
6593    si->visited = sbitmap_alloc (size);
6594    sbitmap_zero (si->visited);
6595 -  si->in_component = sbitmap_alloc (size);
6596 -  sbitmap_ones (si->in_component);
6597 -  si->visited_index = XCNEWVEC (unsigned int, size + 1);
6598 +  si->roots = sbitmap_alloc (size);
6599 +  sbitmap_zero (si->roots);
6600 +  si->node_mapping = XNEWVEC (unsigned int, size);
6601 +  si->dfs = XCNEWVEC (unsigned int, size);
6602 +
6603 +  for (i = 0; i < size; i++)
6604 +    si->node_mapping[i] = i;
6605 +
6606    si->scc_stack = VEC_alloc (unsigned, heap, 1);
6607 -  si->unification_queue = VEC_alloc (unsigned, heap, 1);
6608    return si;
6609  }
6610  
6611 @@ -1786,209 +1596,430 @@
6612  
6613  static void
6614  free_scc_info (struct scc_info *si)
6615 -{  
6616 +{
6617    sbitmap_free (si->visited);
6618 -  sbitmap_free (si->in_component);
6619 -  free (si->visited_index);
6620 +  sbitmap_free (si->roots);
6621 +  free (si->node_mapping);
6622 +  free (si->dfs);
6623    VEC_free (unsigned, heap, si->scc_stack);
6624 -  VEC_free (unsigned, heap, si->unification_queue);
6625 -  free(si); 
6626 +  free (si);
6627  }
6628  
6629  
6630 -/* Find cycles in GRAPH that occur, using strongly connected components, and
6631 -   collapse the cycles into a single representative node.  if UPDATE_CHANGED
6632 -   is true, then update the changed sbitmap to note those nodes whose
6633 -   solutions have changed as a result of collapsing.  */
6634 +/* Find indirect cycles in GRAPH that occur, using strongly connected
6635 +   components, and note them in the indirect cycles map.
6636  
6637 +   This technique comes from Ben Hardekopf and Calvin Lin,
6638 +   "It Pays to be Lazy: Fast and Accurate Pointer Analysis for Millions of
6639 +   Lines of Code", submitted to PLDI 2007.  */
6640 +
6641  static void
6642 -find_and_collapse_graph_cycles (constraint_graph_t graph, bool update_changed)
6643 +find_indirect_cycles (constraint_graph_t graph)
6644  {
6645    unsigned int i;
6646 -  unsigned int size = VEC_length (varinfo_t, varmap);
6647 -  struct scc_info *si = init_scc_info ();
6648 +  unsigned int size = graph->size;
6649 +  struct scc_info *si = init_scc_info (size);
6650  
6651 -  for (i = 0; i != size; ++i)
6652 -    if (!TEST_BIT (si->visited, i) && get_varinfo (i)->node == i)
6653 +  for (i = 0; i < MIN (LAST_REF_NODE, size); i ++ )
6654 +    if (!TEST_BIT (si->visited, i) && find (i) == i)
6655        scc_visit (graph, si, i);
6656 -  
6657 -  process_unification_queue (graph, si, update_changed);
6658 +
6659    free_scc_info (si);
6660  }
6661  
6662  /* Compute a topological ordering for GRAPH, and store the result in the
6663     topo_info structure TI.  */
6664  
6665 -static void 
6666 +static void
6667  compute_topo_order (constraint_graph_t graph,
6668                     struct topo_info *ti)
6669  {
6670    unsigned int i;
6671    unsigned int size = VEC_length (varinfo_t, varmap);
6672 -  
6673 +
6674    for (i = 0; i != size; ++i)
6675 -    if (!TEST_BIT (ti->visited, i) && get_varinfo (i)->node == i)
6676 +    if (!TEST_BIT (ti->visited, i) && find (i) == i)
6677        topo_visit (graph, ti, i);
6678  }
6679  
6680 -/* Return true if bitmap B is empty, or a bitmap other than bit 0 is set. */
6681 +/* Perform offline variable substitution.
6682  
6683 -static bool
6684 -bitmap_other_than_zero_bit_set (bitmap b)
6685 -{
6686 -  unsigned int i;
6687 -  bitmap_iterator bi;
6688 -
6689 -  if (bitmap_empty_p (b))
6690 -    return false;
6691 -  EXECUTE_IF_SET_IN_BITMAP (b, 1, i, bi)
6692 -    return true;
6693 -  return false;
6694 -}
6695 -
6696 -/* Perform offline variable substitution.
6697 -   
6698     This is a linear time way of identifying variables that must have
6699     equivalent points-to sets, including those caused by static cycles,
6700     and single entry subgraphs, in the constraint graph.
6701  
6702     The technique is described in "Off-line variable substitution for
6703     scaling points-to analysis" by Atanas Rountev and Satish Chandra,
6704 -   in "ACM SIGPLAN Notices" volume 35, number 5, pages 47-56.  */
6705 +   in "ACM SIGPLAN Notices" volume 35, number 5, pages 47-56.
6706  
6707 +   There is an optimal way to do this involving hash based value
6708 +   numbering, once the technique is published i will implement it
6709 +   here.  
6710 +
6711 +   The general method of finding equivalence classes is as follows:
6712 +   Add fake nodes (REF nodes) and edges for *a = b and a = *b constraints.
6713 +   Add fake nodes (ADDRESS nodes) and edges for a = &b constraints.
6714 +   Initialize all non-REF/ADDRESS nodes to be direct nodes
6715 +   For each SCC in the predecessor graph:
6716 +      for each member (x) of the SCC
6717 +         if x is not a direct node:
6718 +          set rootnode(SCC) to be not a direct node
6719 +        collapse node x into rootnode(SCC).
6720 +      if rootnode(SCC) is not a direct node:
6721 +        label rootnode(SCC) with a new equivalence class
6722 +      else:
6723 +        if all labeled predecessors of rootnode(SCC) have the same
6724 +       label:
6725 +         label rootnode(SCC) with this label
6726 +       else:
6727 +         label rootnode(SCC) with a new equivalence class
6728 +
6729 +   All direct nodes with the same equivalence class can be replaced
6730 +   with a single representative node.
6731 +   All unlabeled nodes (label == 0) are not pointers and all edges
6732 +   involving them can be eliminated.
6733 +   We perform these optimizations during move_complex_constraints.
6734 +*/
6735 +
6736 +static int equivalence_class;
6737 +
6738 +/* Recursive routine to find strongly connected components in GRAPH,
6739 +   and label it's nodes with equivalence classes.
6740 +   This is used during variable substitution to find cycles involving
6741 +   the regular or implicit predecessors, and label them as equivalent.
6742 +   The SCC finding algorithm used is the same as that for scc_visit.  */
6743 +
6744  static void
6745 -perform_var_substitution (constraint_graph_t graph)
6746 +label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n)
6747  {
6748 -  struct topo_info *ti = init_topo_info ();
6749
6750 -  bitmap_obstack_initialize (&iteration_obstack);
6751 -  /* Compute the topological ordering of the graph, then visit each
6752 -     node in topological order.  */
6753 -  compute_topo_order (graph, ti);
6754
6755 -  while (VEC_length (unsigned, ti->topo_order) != 0)
6756 +  unsigned int i;
6757 +  bitmap_iterator bi;
6758 +  unsigned int my_dfs;
6759 +
6760 +  gcc_assert (si->node_mapping[n] == n);
6761 +  SET_BIT (si->visited, n);
6762 +  si->dfs[n] = si->current_index ++;
6763 +  my_dfs = si->dfs[n];
6764 +
6765 +  /* Visit all the successors.  */
6766 +  EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi)
6767      {
6768 -      unsigned int i = VEC_pop (unsigned, ti->topo_order);
6769 -      unsigned int pred;
6770 -      varinfo_t vi = get_varinfo (i);
6771 -      bool okay_to_elim = false;
6772 -      unsigned int root = VEC_length (varinfo_t, varmap);
6773 -      VEC(constraint_edge_t,heap) *predvec = graph->preds[i];
6774 -      constraint_edge_t ce = NULL;
6775 -      bitmap tmp;
6776 -      unsigned int k;
6777 -      bitmap_iterator bi;
6778 +      unsigned int w = si->node_mapping[i];
6779  
6780 -      /* We can't eliminate things whose address is taken, or which is
6781 -        the target of a dereference.  */
6782 -      if (vi->address_taken || vi->indirect_target)
6783 +      if (TEST_BIT (si->roots, w))
6784         continue;
6785  
6786 -      /* See if all predecessors of I are ripe for elimination */
6787 -      EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_preds[i], 0, k, bi)
6788 -         {
6789 -           unsigned int w;
6790 -           w = get_varinfo (k)->node;
6791 +      if (!TEST_BIT (si->visited, w))
6792 +       label_visit (graph, si, w);
6793 +      {
6794 +       unsigned int t = si->node_mapping[w];
6795 +       unsigned int nnode = si->node_mapping[n];
6796 +       gcc_assert (nnode == n);
6797  
6798 -           /* We can't eliminate the node if one of the predecessors is
6799 -              part of a different strongly connected component.  */
6800 -           if (!okay_to_elim)
6801 -             {
6802 -               root = w;
6803 -               okay_to_elim = true;
6804 -             }
6805 -           else if (w != root)
6806 -             {
6807 -               okay_to_elim = false;
6808 -               break;
6809 -             }
6810 +       if (si->dfs[t] < si->dfs[nnode])
6811 +         si->dfs[n] = si->dfs[t];
6812 +      }
6813 +    }
6814  
6815 -           /* Theorem 4 in Rountev and Chandra: If i is a direct node,
6816 -              then Solution(i) is a subset of Solution (w), where w is a
6817 -              predecessor in the graph.  
6818 -              Corollary: If all predecessors of i have the same
6819 -              points-to set, then i has that same points-to set as
6820 -              those predecessors.  */
6821 -           tmp = BITMAP_ALLOC (NULL);
6822 -           bitmap_and_compl (tmp, get_varinfo (i)->solution,
6823 -                             get_varinfo (w)->solution);
6824 -           if (!bitmap_empty_p (tmp))
6825 -             {
6826 -               okay_to_elim = false;
6827 -               BITMAP_FREE (tmp);
6828 -               break;
6829 -             }
6830 -           BITMAP_FREE (tmp);
6831 -         }
6832 +  /* Visit all the implicit predecessors.  */
6833 +  EXECUTE_IF_IN_NONNULL_BITMAP (graph->implicit_preds[n], 0, i, bi)
6834 +    {
6835 +      unsigned int w = si->node_mapping[i];
6836  
6837 -      if (okay_to_elim)
6838 -       for (pred = 0; 
6839 -            VEC_iterate (constraint_edge_t, predvec, pred, ce); 
6840 -            pred++)
6841 -         {
6842 -           bitmap weight;
6843 -           unsigned int w;
6844 -           weight = *(get_graph_weights (graph, i, ce->dest));
6845 +      if (TEST_BIT (si->roots, w))
6846 +       continue;
6847  
6848 -           /* We can't eliminate variables that have nonzero weighted
6849 -              edges between them.  */
6850 -           if (weight && bitmap_other_than_zero_bit_set (weight))
6851 -             {
6852 -               okay_to_elim = false;
6853 -               break;
6854 -             }
6855 -           w = get_varinfo (ce->dest)->node;
6856 +      if (!TEST_BIT (si->visited, w))
6857 +       label_visit (graph, si, w);
6858 +      {
6859 +       unsigned int t = si->node_mapping[w];
6860 +       unsigned int nnode = si->node_mapping[n];
6861 +       gcc_assert (nnode == n);
6862  
6863 -           /* We can't eliminate the node if one of the predecessors is
6864 -              part of a different strongly connected component.  */
6865 -           if (!okay_to_elim)
6866 -             {
6867 -               root = w;
6868 -               okay_to_elim = true;
6869 -             }
6870 -           else if (w != root)
6871 -             {
6872 -               okay_to_elim = false;
6873 -               break;
6874 -             }
6875 +       if (si->dfs[t] < si->dfs[nnode])
6876 +         si->dfs[n] = si->dfs[t];
6877 +      }
6878 +    }
6879  
6880 -           /* Theorem 4 in Rountev and Chandra: If i is a direct node,
6881 -              then Solution(i) is a subset of Solution (w), where w is a
6882 -              predecessor in the graph.  
6883 -              Corollary: If all predecessors of i have the same
6884 -              points-to set, then i has that same points-to set as
6885 -              those predecessors.  */
6886 -           tmp = BITMAP_ALLOC (NULL);
6887 -           bitmap_and_compl (tmp, get_varinfo (i)->solution,
6888 -                             get_varinfo (w)->solution);
6889 -           if (!bitmap_empty_p (tmp))
6890 -             {
6891 -               okay_to_elim = false;
6892 -               BITMAP_FREE (tmp);
6893 -               break;
6894 -             }
6895 -           BITMAP_FREE (tmp);
6896 -         }
6897 +  /* See if any components have been identified.  */
6898 +  if (si->dfs[n] == my_dfs)
6899 +    {
6900 +      while (VEC_length (unsigned, si->scc_stack) != 0
6901 +            && si->dfs[VEC_last (unsigned, si->scc_stack)] >= my_dfs)
6902 +       {
6903 +         unsigned int w = VEC_pop (unsigned, si->scc_stack);
6904 +         si->node_mapping[w] = n;
6905  
6906 -      /* See if the root is different than the original node. 
6907 -        If so, we've found an equivalence.  */
6908 -      if (root != get_varinfo (i)->node && okay_to_elim)
6909 +         if (!TEST_BIT (graph->direct_nodes, w))
6910 +           RESET_BIT (graph->direct_nodes, n);
6911 +       }
6912 +      SET_BIT (si->roots, n);
6913 +
6914 +      if (!TEST_BIT (graph->direct_nodes, n))
6915         {
6916 -         /* Found an equivalence */
6917 -         get_varinfo (i)->node = root;
6918 -         collapse_nodes (graph, root, i);
6919 +         graph->label[n] = equivalence_class++;
6920 +       }
6921 +      else
6922 +       {
6923 +         unsigned int size = 0;
6924 +         unsigned int firstlabel = ~0;
6925 +
6926 +         EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi)
6927 +           {
6928 +             unsigned int j = si->node_mapping[i];
6929 +
6930 +             if (j == n || graph->label[j] == 0)
6931 +               continue;
6932 +
6933 +             if (firstlabel == (unsigned int)~0)
6934 +               {
6935 +                 firstlabel = graph->label[j];
6936 +                 size++;
6937 +               }
6938 +             else if (graph->label[j] != firstlabel)
6939 +               size++;
6940 +           }
6941 +
6942 +         if (size == 0)
6943 +           graph->label[n] = 0;
6944 +         else if (size == 1)
6945 +           graph->label[n] = firstlabel;
6946 +         else
6947 +           graph->label[n] = equivalence_class++;
6948 +       }
6949 +    }
6950 +  else
6951 +    VEC_safe_push (unsigned, heap, si->scc_stack, n);
6952 +}
6953 +
6954 +/* Perform offline variable substitution, discovering equivalence
6955 +   classes, and eliminating non-pointer variables.  */
6956 +
6957 +static struct scc_info *
6958 +perform_var_substitution (constraint_graph_t graph)
6959 +{
6960 +  unsigned int i;
6961 +  unsigned int size = graph->size;
6962 +  struct scc_info *si = init_scc_info (size);
6963 +
6964 +  bitmap_obstack_initialize (&iteration_obstack);
6965 +  equivalence_class = 0;
6966 +
6967 +  /* We only need to visit the non-address nodes for labeling
6968 +     purposes, as the address nodes will never have any predecessors,
6969 +     because &x never appears on the LHS of a constraint.  */
6970 +  for (i = 0; i < LAST_REF_NODE; i++)
6971 +    if (!TEST_BIT (si->visited, si->node_mapping[i]))
6972 +      label_visit (graph, si, si->node_mapping[i]);
6973 +
6974 +  if (dump_file && (dump_flags & TDF_DETAILS))
6975 +    for (i = 0; i < FIRST_REF_NODE; i++)
6976 +      {
6977 +       bool direct_node = TEST_BIT (graph->direct_nodes, i);
6978 +       fprintf (dump_file,
6979 +                "Equivalence class for %s node id %d:%s is %d\n",
6980 +                direct_node ? "Direct node" : "Indirect node", i,
6981 +                get_varinfo (i)->name,
6982 +                graph->label[si->node_mapping[i]]);
6983 +      }
6984 +
6985 +  /* Quickly eliminate our non-pointer variables.  */
6986 +
6987 +  for (i = 0; i < FIRST_REF_NODE; i++)
6988 +    {
6989 +      unsigned int node = si->node_mapping[i];
6990 +
6991 +      if (graph->label[node] == 0 && TEST_BIT (graph->direct_nodes, node))
6992 +       {
6993           if (dump_file && (dump_flags & TDF_DETAILS))
6994 -           fprintf (dump_file, "Collapsing %s into %s\n",
6995 -                    get_varinfo (i)->name,
6996 -                    get_varinfo (root)->name);
6997 -         stats.collapsed_vars++;
6998 +           fprintf (dump_file,
6999 +                    "%s is a non-pointer variable, eliminating edges.\n",
7000 +                    get_varinfo (node)->name);
7001 +         stats.nonpointer_vars++;
7002 +         clear_edges_for_node (graph, node);
7003         }
7004      }
7005 +  return si;
7006 +}
7007  
7008 +/* Free information that was only necessary for variable
7009 +   substitution.  */
7010 +
7011 +static void
7012 +free_var_substitution_info (struct scc_info *si)
7013 +{
7014 +  free_scc_info (si);
7015 +  free (graph->label);
7016 +  free (graph->eq_rep);
7017 +  sbitmap_free (graph->direct_nodes);
7018    bitmap_obstack_release (&iteration_obstack);
7019 -  free_topo_info (ti);
7020  }
7021  
7022 +/* Return an existing node that is equivalent to NODE, which has
7023 +   equivalence class LABEL, if one exists.  Return NODE otherwise.  */
7024 +
7025 +static unsigned int
7026 +find_equivalent_node (constraint_graph_t graph,
7027 +                     unsigned int node, unsigned int label)
7028 +{
7029 +  /* If the address version of this variable is unused, we can
7030 +     substitute it for anything else with the same label.
7031 +     Otherwise, we know the pointers are equivalent, but not the
7032 +     locations.  */
7033 +
7034 +  if (graph->label[FIRST_ADDR_NODE + node] == 0)
7035 +    {
7036 +      gcc_assert (label < graph->size);
7037 +
7038 +      if (graph->eq_rep[label] != -1)
7039 +       {
7040 +         /* Unify the two variables since we know they are equivalent.  */
7041 +         if (unite (graph->eq_rep[label], node))
7042 +           unify_nodes (graph, graph->eq_rep[label], node, false);
7043 +         return graph->eq_rep[label];
7044 +       }
7045 +      else
7046 +       {
7047 +         graph->eq_rep[label] = node;
7048 +       }
7049 +    }
7050 +  return node;
7051 +}
7052 +
7053 +/* Move complex constraints to the appropriate nodes, and collapse
7054 +   variables we've discovered are equivalent during variable
7055 +   substitution.  SI is the SCC_INFO that is the result of
7056 +   perform_variable_substitution.  */
7057 +
7058 +static void
7059 +move_complex_constraints (constraint_graph_t graph,
7060 +                         struct scc_info *si)
7061 +{
7062 +  int i;
7063 +  unsigned int j;
7064 +  constraint_t c;
7065 +
7066 +  for (j = 0; j < graph->size; j++)
7067 +    gcc_assert (find (j) == j);
7068 +
7069 +  for (i = 0; VEC_iterate (constraint_t, constraints, i, c); i++)
7070 +    {
7071 +      struct constraint_expr lhs = c->lhs;
7072 +      struct constraint_expr rhs = c->rhs;
7073 +      unsigned int lhsvar = find (get_varinfo_fc (lhs.var)->id);
7074 +      unsigned int rhsvar = find (get_varinfo_fc (rhs.var)->id);
7075 +      unsigned int lhsnode, rhsnode;
7076 +      unsigned int lhslabel, rhslabel;
7077 +
7078 +      lhsnode = si->node_mapping[lhsvar];
7079 +      rhsnode = si->node_mapping[rhsvar];
7080 +      lhslabel = graph->label[lhsnode];
7081 +      rhslabel = graph->label[rhsnode];
7082 +
7083 +      /* See if it is really a non-pointer variable, and if so, ignore
7084 +        the constraint.  */
7085 +      if (lhslabel == 0)
7086 +       {
7087 +         if (!TEST_BIT (graph->direct_nodes, lhsnode))
7088 +           lhslabel = graph->label[lhsnode] = equivalence_class++;
7089 +         else
7090 +           {
7091 +             if (dump_file && (dump_flags & TDF_DETAILS))
7092 +               {
7093 +
7094 +                 fprintf (dump_file, "%s is a non-pointer variable,"
7095 +                          "ignoring constraint:",
7096 +                          get_varinfo (lhs.var)->name);
7097 +                 dump_constraint (dump_file, c);
7098 +               }
7099 +             VEC_replace (constraint_t, constraints, i, NULL);
7100 +             continue;
7101 +           }
7102 +       }
7103 +
7104 +      if (rhslabel == 0)
7105 +       {
7106 +         if (!TEST_BIT (graph->direct_nodes, rhsnode))
7107 +           rhslabel = graph->label[rhsnode] = equivalence_class++;
7108 +         else
7109 +           {
7110 +             if (dump_file && (dump_flags & TDF_DETAILS))
7111 +               {
7112 +
7113 +                 fprintf (dump_file, "%s is a non-pointer variable,"
7114 +                          "ignoring constraint:",
7115 +                          get_varinfo (rhs.var)->name);
7116 +                 dump_constraint (dump_file, c);
7117 +               }
7118 +             VEC_replace (constraint_t, constraints, i, NULL);
7119 +             continue;
7120 +           }
7121 +       }
7122 +
7123 +      lhsvar = find_equivalent_node (graph, lhsvar, lhslabel);
7124 +      rhsvar = find_equivalent_node (graph, rhsvar, rhslabel);
7125 +      c->lhs.var = lhsvar;
7126 +      c->rhs.var = rhsvar;
7127 +
7128 +      if (lhs.type == DEREF)
7129 +       {
7130 +         if (rhs.type == ADDRESSOF || rhsvar > anything_id)
7131 +           insert_into_complex (graph, lhsvar, c);
7132 +       }
7133 +      else if (rhs.type == DEREF)
7134 +       {
7135 +         if (!(get_varinfo (lhsvar)->is_special_var))
7136 +           insert_into_complex (graph, rhsvar, c);
7137 +       }
7138 +      else if (rhs.type != ADDRESSOF && lhsvar > anything_id
7139 +              && (lhs.offset != 0 || rhs.offset != 0))
7140 +       {
7141 +         insert_into_complex (graph, rhsvar, c);
7142 +       }
7143 +
7144 +    }
7145 +}
7146 +
7147 +/* Eliminate indirect cycles involving NODE.  Return true if NODE was
7148 +   part of an SCC, false otherwise.  */
7149 +
7150 +static bool
7151 +eliminate_indirect_cycles (unsigned int node)
7152 +{
7153 +  if (graph->indirect_cycles[node] != -1
7154 +      && !bitmap_empty_p (get_varinfo (node)->solution))
7155 +    {
7156 +      unsigned int i;
7157 +      VEC(unsigned,heap) *queue = NULL;
7158 +      int queuepos;
7159 +      unsigned int to = find (graph->indirect_cycles[node]);
7160 +      bitmap_iterator bi;
7161 +
7162 +      /* We can't touch the solution set and call unify_nodes
7163 +        at the same time, because unify_nodes is going to do
7164 +        bitmap unions into it. */
7165 +
7166 +      EXECUTE_IF_SET_IN_BITMAP (get_varinfo (node)->solution, 0, i, bi)
7167 +       {
7168 +         if (find (i) == i && i != to)
7169 +           {
7170 +             if (unite (to, i))
7171 +               VEC_safe_push (unsigned, heap, queue, i);
7172 +           }
7173 +       }
7174 +
7175 +      for (queuepos = 0;
7176 +          VEC_iterate (unsigned, queue, queuepos, i);
7177 +          queuepos++)
7178 +       {
7179 +         unify_nodes (graph, to, i, true);
7180 +       }
7181 +      VEC_free (unsigned, heap, queue);
7182 +      return true;
7183 +    }
7184 +  return false;
7185 +}
7186 +
7187  /* Solve the constraint graph GRAPH using our worklist solver.
7188     This is based on the PW* family of solvers from the "Efficient Field
7189     Sensitive Pointer Analysis for C" paper.
7190 @@ -2001,17 +2032,28 @@
7191  {
7192    unsigned int size = VEC_length (varinfo_t, varmap);
7193    unsigned int i;
7194 +  bitmap pts;
7195  
7196 -  changed_count = size;
7197 +  changed_count = 0;
7198    changed = sbitmap_alloc (size);
7199 -  sbitmap_ones (changed);
7200 -  
7201 -  /* The already collapsed/unreachable nodes will never change, so we
7202 -     need to  account for them in changed_count.  */
7203 +  sbitmap_zero (changed);
7204 +
7205 +  /* Mark all initial non-collapsed nodes as changed.  */
7206    for (i = 0; i < size; i++)
7207 -    if (get_varinfo (i)->node != i)
7208 -      changed_count--;
7209 -  
7210 +    {
7211 +      varinfo_t ivi = get_varinfo (i);
7212 +      if (find (i) == i && !bitmap_empty_p (ivi->solution)
7213 +         && ((graph->succs[i] && !bitmap_empty_p (graph->succs[i]))
7214 +             || VEC_length (constraint_t, graph->complex[i]) > 0))
7215 +       {
7216 +         SET_BIT (changed, i);
7217 +         changed_count++;
7218 +       }
7219 +    }
7220 +
7221 +  /* Allocate a bitmap to be used to store the changed bits.  */
7222 +  pts = BITMAP_ALLOC (&pta_obstack);
7223 +
7224    while (changed_count > 0)
7225      {
7226        unsigned int i;
7227 @@ -2019,41 +2061,45 @@
7228        stats.iterations++;
7229  
7230        bitmap_obstack_initialize (&iteration_obstack);
7231 -      
7232 -      if (edge_added)
7233 -       {
7234 -         /* We already did cycle elimination once, when we did
7235 -            variable substitution, so we don't need it again for the
7236 -            first iteration.  */
7237 -         if (stats.iterations > 1)
7238 -           find_and_collapse_graph_cycles (graph, true);
7239  
7240 -         edge_added = false;
7241 -       }
7242 -
7243        compute_topo_order (graph, ti);
7244  
7245        while (VEC_length (unsigned, ti->topo_order) != 0)
7246         {
7247 +
7248           i = VEC_pop (unsigned, ti->topo_order);
7249 -         gcc_assert (get_varinfo (i)->node == i);
7250  
7251 +         /* If this variable is not a representative, skip it.  */
7252 +         if (find (i) != i)
7253 +           continue;
7254 +
7255 +         /* In certain indirect cycle cases, we may merge this
7256 +            variable to another.  */
7257 +         if (eliminate_indirect_cycles (i) && find (i) != i)
7258 +           continue;
7259 +
7260           /* If the node has changed, we need to process the
7261              complex constraints and outgoing edges again.  */
7262           if (TEST_BIT (changed, i))
7263             {
7264               unsigned int j;
7265               constraint_t c;
7266 -             constraint_edge_t e = NULL;
7267               bitmap solution;
7268 -             bitmap_iterator bi;
7269 -             VEC(constraint_t,heap) *complex = get_varinfo (i)->complex;
7270 -             VEC(constraint_edge_t,heap) *succs;
7271 +             VEC(constraint_t,heap) *complex = graph->complex[i];
7272               bool solution_empty;
7273  
7274               RESET_BIT (changed, i);
7275               changed_count--;
7276  
7277 +             /* Compute the changed set of solution bits.  */
7278 +             bitmap_and_compl (pts, get_varinfo (i)->solution,
7279 +                               get_varinfo (i)->oldsolution);
7280 +
7281 +             if (bitmap_empty_p (pts))
7282 +               continue;
7283 +
7284 +             bitmap_ior_into (get_varinfo (i)->oldsolution, pts);
7285 +
7286               solution = get_varinfo (i)->solution;
7287               solution_empty = bitmap_empty_p (solution);
7288  
7289 @@ -2065,52 +2111,38 @@
7290                      is a constraint where the lhs side is receiving
7291                      some set from elsewhere.  */
7292                   if (!solution_empty || c->lhs.type != DEREF)
7293 -                   do_complex_constraint (graph, c, solution);
7294 +                   do_complex_constraint (graph, c, pts);
7295                 }
7296  
7297               solution_empty = bitmap_empty_p (solution);
7298  
7299               if (!solution_empty)
7300                 {
7301 +                 bitmap_iterator bi;
7302 +
7303                   /* Propagate solution to all successors.  */
7304 -                 succs = graph->succs[i];
7305 -                 
7306 -                 EXECUTE_IF_IN_NONNULL_BITMAP (graph->zero_weight_succs[i], 
7307 +                 EXECUTE_IF_IN_NONNULL_BITMAP (graph->succs[i],
7308                                                 0, j, bi)
7309                     {
7310 -                     bitmap tmp = get_varinfo (j)->solution;
7311 -                     bool flag = false;
7312 -                 
7313 -                     flag = set_union_with_increment (tmp, solution, 0);
7314 -                 
7315 -                     if (flag)
7316 -                       {
7317 -                         get_varinfo (j)->solution = tmp;
7318 -                         if (!TEST_BIT (changed, j))
7319 -                           {
7320 -                             SET_BIT (changed, j);
7321 -                             changed_count++;
7322 -                           }
7323 -                       }
7324 -                   }
7325 -                 for (j = 0; VEC_iterate (constraint_edge_t, succs, j, e); j++)
7326 -                   {
7327 -                     bitmap tmp = get_varinfo (e->dest)->solution;
7328 -                     bool flag = false;
7329 -                     unsigned int k;
7330 -                     bitmap weights = e->weights;
7331 -                     bitmap_iterator bi;
7332 +                     bitmap tmp;
7333 +                     bool flag;
7334  
7335 -                     gcc_assert (weights && !bitmap_empty_p (weights));
7336 -                     EXECUTE_IF_SET_IN_BITMAP (weights, 0, k, bi)
7337 -                       flag |= set_union_with_increment (tmp, solution, k);
7338 +                     unsigned int to = find (j);
7339 +                     tmp = get_varinfo (to)->solution;
7340 +                     flag = false;
7341  
7342 +                     /* Don't try to propagate to ourselves.  */
7343 +                     if (to == i)
7344 +                       continue;
7345 +
7346 +                     flag = set_union_with_increment (tmp, pts, 0);
7347 +
7348                       if (flag)
7349                         {
7350 -                         get_varinfo (e->dest)->solution = tmp;
7351 -                         if (!TEST_BIT (changed, e->dest))
7352 +                         get_varinfo (to)->solution = tmp;
7353 +                         if (!TEST_BIT (changed, to))
7354                             {
7355 -                             SET_BIT (changed, e->dest);
7356 +                             SET_BIT (changed, to);
7357                               changed_count++;
7358                             }
7359                         }
7360 @@ -2122,74 +2154,37 @@
7361        bitmap_obstack_release (&iteration_obstack);
7362      }
7363  
7364 +  BITMAP_FREE (pts);
7365    sbitmap_free (changed);
7366 +  bitmap_obstack_release (&oldpta_obstack);
7367  }
7368  
7369 +/* Map from trees to variable infos.  */
7370 +static struct pointer_map_t *vi_for_tree;
7371  
7372 -/* CONSTRAINT AND VARIABLE GENERATION FUNCTIONS */
7373  
7374 -/* Map from trees to variable ids.  */    
7375 -static htab_t id_for_tree;
7376 +/* Insert ID as the variable id for tree T in the vi_for_tree map.  */
7377  
7378 -typedef struct tree_id
7379 +static void
7380 +insert_vi_for_tree (tree t, varinfo_t vi)
7381  {
7382 -  tree t;
7383 -  unsigned int id;
7384 -} *tree_id_t;
7385 -
7386 -/* Hash a tree id structure.  */
7387 -
7388 -static hashval_t 
7389 -tree_id_hash (const void *p)
7390 -{
7391 -  const tree_id_t ta = (tree_id_t) p;
7392 -  return htab_hash_pointer (ta->t);
7393 -}
7394 -
7395 -/* Return true if the tree in P1 and the tree in P2 are the same.  */
7396 -
7397 -static int
7398 -tree_id_eq (const void *p1, const void *p2)
7399 -{
7400 -  const tree_id_t ta1 = (tree_id_t) p1;
7401 -  const tree_id_t ta2 = (tree_id_t) p2;
7402 -  return ta1->t == ta2->t;
7403 -}
7404 -
7405 -/* Insert ID as the variable id for tree T in the hashtable.  */
7406 -
7407 -static void 
7408 -insert_id_for_tree (tree t, int id)
7409 -{
7410 -  void **slot;
7411 -  struct tree_id finder;
7412 -  tree_id_t new_pair;
7413 -  
7414 -  finder.t = t;
7415 -  slot = htab_find_slot (id_for_tree, &finder, INSERT);
7416 +  void **slot = pointer_map_insert (vi_for_tree, t);
7417 +  gcc_assert (vi);
7418    gcc_assert (*slot == NULL);
7419 -  new_pair = XNEW (struct tree_id);
7420 -  new_pair->t = t;
7421 -  new_pair->id = id;
7422 -  *slot = (void *)new_pair;
7423 +  *slot = vi;
7424  }
7425  
7426 -/* Find the variable id for tree T in ID_FOR_TREE.  If T does not
7427 -   exist in the hash table, return false, otherwise, return true and
7428 -   set *ID to the id we found.  */
7429 +/* Find the variable info for tree T in VI_FOR_TREE.  If T does not
7430 +   exist in the map, return NULL, otherwise, return the varinfo we found.  */
7431  
7432 -static bool
7433 -lookup_id_for_tree (tree t, unsigned int *id)
7434 +static varinfo_t
7435 +lookup_vi_for_tree (tree t)
7436  {
7437 -  tree_id_t pair;
7438 -  struct tree_id finder;
7439 +  void **slot = pointer_map_contains (vi_for_tree, t);
7440 +  if (slot == NULL)
7441 +    return NULL;
7442  
7443 -  finder.t = t;
7444 -  pair = htab_find (id_for_tree,  &finder);
7445 -  if (pair == NULL)
7446 -    return false;
7447 -  *id = pair->id;
7448 -  return true;
7449 +  return (varinfo_t) *slot;
7450  }
7451  
7452  /* Return a printable name for DECL  */
7453 @@ -2210,7 +2205,7 @@
7454  
7455    if (TREE_CODE (decl) == SSA_NAME)
7456      {
7457 -      num_printed = asprintf (&temp, "%s_%u", 
7458 +      num_printed = asprintf (&temp, "%s_%u",
7459                               alias_get_name (SSA_NAME_VAR (decl)),
7460                               SSA_NAME_VERSION (decl));
7461      }
7462 @@ -2226,21 +2221,17 @@
7463    return res;
7464  }
7465  
7466 -/* Find the variable id for tree T in the hashtable.
7467 -   If T doesn't exist in the hash table, create an entry for it.  */
7468 +/* Find the variable id for tree T in the map.
7469 +   If T doesn't exist in the map, create an entry for it and return it.  */
7470  
7471 -static unsigned int
7472 -get_id_for_tree (tree t)
7473 +static varinfo_t
7474 +get_vi_for_tree (tree t)
7475  {
7476 -  tree_id_t pair;
7477 -  struct tree_id finder;
7478 +  void **slot = pointer_map_contains (vi_for_tree, t);
7479 +  if (slot == NULL)
7480 +    return get_varinfo (create_variable_info_for (t, alias_get_name (t)));
7481  
7482 -  finder.t = t;
7483 -  pair = htab_find (id_for_tree,  &finder);
7484 -  if (pair == NULL)
7485 -    return create_variable_info_for (t, alias_get_name (t));
7486 -  
7487 -  return pair->id;
7488 +  return (varinfo_t) *slot;
7489  }
7490  
7491  /* Get a constraint expression from an SSA_VAR_P node.  */
7492 @@ -2254,14 +2245,14 @@
7493  
7494    /* For parameters, get at the points-to set for the actual parm
7495       decl.  */
7496 -  if (TREE_CODE (t) == SSA_NAME 
7497 -      && TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL 
7498 +  if (TREE_CODE (t) == SSA_NAME
7499 +      && TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL
7500        && default_def (SSA_NAME_VAR (t)) == t)
7501      return get_constraint_exp_from_ssa_var (SSA_NAME_VAR (t));
7502  
7503    cexpr.type = SCALAR;
7504 -  
7505 -  cexpr.var = get_id_for_tree (t);
7506 +
7507 +  cexpr.var = get_vi_for_tree (t)->id;
7508    /* If we determine the result is "anything", and we know this is readonly,
7509       say it points to readonly memory instead.  */
7510    if (cexpr.var == anything_id && TREE_READONLY (t))
7511 @@ -2269,7 +2260,7 @@
7512        cexpr.type = ADDRESSOF;
7513        cexpr.var = readonly_id;
7514      }
7515 -    
7516 +
7517    cexpr.offset = 0;
7518    return cexpr;
7519  }
7520 @@ -2290,7 +2281,13 @@
7521      get_varinfo (lhs.var)->directly_dereferenced = true;
7522    if (rhs.type == DEREF)
7523      get_varinfo (rhs.var)->directly_dereferenced = true;
7524 -  
7525 +
7526 +  if (!use_field_sensitive)
7527 +    {
7528 +      t->rhs.offset = 0;
7529 +      t->lhs.offset = 0;
7530 +    }
7531 +
7532    /* ANYTHING == ANYTHING is pointless.  */
7533    if (lhs.var == anything_id && rhs.var == anything_id)
7534      return;
7535 @@ -2302,7 +2299,7 @@
7536        t->lhs = t->rhs;
7537        t->rhs = rhs;
7538        process_constraint (t);
7539 -    }   
7540 +    }
7541    /* This can happen in our IR with things like n->a = *p */
7542    else if (rhs.type == DEREF && lhs.type == DEREF && rhs.var != anything_id)
7543      {
7544 @@ -2312,33 +2309,19 @@
7545        tree pointedtotype = TREE_TYPE (pointertype);
7546        tree tmpvar = create_tmp_var_raw (pointedtotype, "doubledereftmp");
7547        struct constraint_expr tmplhs = get_constraint_exp_from_ssa_var (tmpvar);
7548 -      
7549 +
7550        /* If this is an aggregate of known size, we should have passed
7551          this off to do_structure_copy, and it should have broken it
7552          up.  */
7553 -      gcc_assert (!AGGREGATE_TYPE_P (pointedtotype) 
7554 +      gcc_assert (!AGGREGATE_TYPE_P (pointedtotype)
7555                   || get_varinfo (rhs.var)->is_unknown_size_var);
7556 -      
7557 +
7558        process_constraint (new_constraint (tmplhs, rhs));
7559        process_constraint (new_constraint (lhs, tmplhs));
7560      }
7561 -  else if (rhs.type == ADDRESSOF)
7562 -    {
7563 -      varinfo_t vi;
7564 -      gcc_assert (rhs.offset == 0);
7565 -      
7566 -      /* No need to mark address taken simply because of escaped vars
7567 -        constraints.  */
7568 -      if (lhs.var != escaped_vars_id)
7569 -       for (vi = get_varinfo (rhs.var); vi != NULL; vi = vi->next)
7570 -         vi->address_taken = true;
7571 -
7572 -      VEC_safe_push (constraint_t, heap, constraints, t);
7573 -    }
7574    else
7575      {
7576 -      if (lhs.type != DEREF && rhs.type == DEREF)
7577 -       get_varinfo (lhs.var)->indirect_target = true;
7578 +      gcc_assert (rhs.type != ADDRESSOF || rhs.offset == 0);
7579        VEC_safe_push (constraint_t, heap, constraints, t);
7580      }
7581  }
7582 @@ -2350,10 +2333,12 @@
7583  could_have_pointers (tree t)
7584  {
7585    tree type = TREE_TYPE (t);
7586 -  
7587 -  if (POINTER_TYPE_P (type) || AGGREGATE_TYPE_P (type)
7588 +
7589 +  if (POINTER_TYPE_P (type)
7590 +      || AGGREGATE_TYPE_P (type)
7591        || TREE_CODE (type) == COMPLEX_TYPE)
7592      return true;
7593 +
7594    return false;
7595  }
7596  
7597 @@ -2367,9 +2352,9 @@
7598    if (TREE_CODE (DECL_FIELD_OFFSET (fdecl)) != INTEGER_CST
7599        || TREE_CODE (DECL_FIELD_BIT_OFFSET (fdecl)) != INTEGER_CST)
7600      return -1;
7601 -  
7602 -  return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * 8) 
7603 -         + tree_low_cst (DECL_FIELD_BIT_OFFSET (fdecl), 1);
7604 +
7605 +  return (tree_low_cst (DECL_FIELD_OFFSET (fdecl), 1) * 8)
7606 +        + tree_low_cst (DECL_FIELD_BIT_OFFSET (fdecl), 1);
7607  }
7608  
7609  
7610 @@ -2388,7 +2373,7 @@
7611      return true;
7612    if (accesspos < fieldpos && (accesspos + accesssize > fieldpos))
7613      return true;
7614 -  
7615 +
7616    return false;
7617  }
7618  
7619 @@ -2411,20 +2396,20 @@
7620    while (!SSA_VAR_P (forzero) && !CONSTANT_CLASS_P (forzero))
7621      forzero = TREE_OPERAND (forzero, 0);
7622  
7623 -  if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero)) 
7624 +  if (CONSTANT_CLASS_P (forzero) && integer_zerop (forzero))
7625      {
7626        struct constraint_expr temp;
7627 -      
7628 +
7629        temp.offset = 0;
7630        temp.var = integer_id;
7631        temp.type = SCALAR;
7632        VEC_safe_push (ce_s, heap, *results, &temp);
7633        return;
7634      }
7635
7636 +
7637    t = get_ref_base_and_extent (t, &bitpos, &bitsize, &bitmaxsize);
7638  
7639 -  /* String constants's are readonly, so there is nothing to really do
7640 +  /* String constants are readonly, so there is nothing to really do
7641       here.  */
7642    if (TREE_CODE (t) == STRING_CST)
7643      return;
7644 @@ -2438,21 +2423,21 @@
7645    /* This can also happen due to weird offsetof type macros.  */
7646    if (TREE_CODE (t) != ADDR_EXPR && result->type == ADDRESSOF)
7647      result->type = SCALAR;
7648
7649 +
7650    if (result->type == SCALAR)
7651      {
7652        /* In languages like C, you can access one past the end of an
7653          array.  You aren't allowed to dereference it, so we can
7654          ignore this constraint. When we handle pointer subtraction,
7655          we may have to do something cute here.  */
7656 -      
7657 +
7658        if (result->offset < get_varinfo (result->var)->fullsize
7659           && bitmaxsize != 0)
7660         {
7661           /* It's also not true that the constraint will actually start at the
7662              right offset, it may start in some padding.  We only care about
7663              setting the constraint to the first actual field it touches, so
7664 -            walk to find it.  */ 
7665 +            walk to find it.  */
7666           varinfo_t curr;
7667           for (curr = get_varinfo (result->var); curr; curr = curr->next)
7668             {
7669 @@ -2495,6 +2480,7 @@
7670  {
7671    struct constraint_expr *c;
7672    unsigned int i = 0;
7673 +
7674    for (i = 0; VEC_iterate (ce_s, *constraints, i, c); i++)
7675      {
7676        if (c->type == SCALAR)
7677 @@ -2576,6 +2562,7 @@
7678               tree pttype = TREE_TYPE (TREE_TYPE (t));
7679  
7680               get_constraint_for (exp, results);
7681 +
7682               /* Make sure we capture constraints to all elements
7683                  of an array.  */
7684               if ((handled_component_p (exp)
7685 @@ -2588,7 +2575,7 @@
7686  
7687                   if (VEC_length (ce_s, *results) == 0)
7688                     return;
7689 -                 
7690 +
7691                   gcc_assert (VEC_length (ce_s, *results) == 1);
7692                   origrhs = VEC_last (ce_s, *results);
7693                   tmp = *origrhs;
7694 @@ -2619,12 +2606,12 @@
7695                       VEC_safe_push (ce_s, heap, *results, &tmp);
7696                     }
7697                 }
7698 -             
7699 +
7700               for (i = 0; VEC_iterate (ce_s, *results, i, c); i++)
7701                 {
7702                   if (c->type == DEREF)
7703                     c->type = SCALAR;
7704 -                 else 
7705 +                 else
7706                     c->type = ADDRESSOF;
7707                 }
7708               return;
7709 @@ -2638,9 +2625,9 @@
7710               {
7711                 varinfo_t vi;
7712                 tree heapvar = heapvar_lookup (t);
7713 -               
7714 +
7715                 if (heapvar == NULL)
7716 -                 {                 
7717 +                 {
7718                     heapvar = create_tmp_var_raw (ptr_type_node, "HEAP");
7719                     DECL_EXTERNAL (heapvar) = 1;
7720                     if (referenced_vars)
7721 @@ -2650,7 +2637,7 @@
7722  
7723                 temp.var = create_variable_info_for (heapvar,
7724                                                      alias_get_name (heapvar));
7725 -               
7726 +
7727                 vi = get_varinfo (temp.var);
7728                 vi->is_artificial_var = 1;
7729                 vi->is_heap_var = 1;
7730 @@ -2712,7 +2699,7 @@
7731           case NON_LVALUE_EXPR:
7732             {
7733               tree op = TREE_OPERAND (t, 0);
7734 -             
7735 +
7736               /* Cast from non-pointer to pointers are bad news for us.
7737                  Anything else, we see through */
7738               if (!(POINTER_TYPE_P (TREE_TYPE (t))
7739 @@ -2738,7 +2725,7 @@
7740        {
7741         switch (TREE_CODE (t))
7742           {
7743 -         case PHI_NODE:           
7744 +         case PHI_NODE:
7745             {
7746               get_constraint_for (PHI_RESULT (t), results);
7747               return;
7748 @@ -2782,8 +2769,8 @@
7749  
7750  
7751  /* Handle the structure copy case where we have a simple structure copy
7752 -   between LHS and RHS that is of SIZE (in bits) 
7753 -  
7754 +   between LHS and RHS that is of SIZE (in bits)
7755 +
7756     For each field of the lhs variable (lhsfield)
7757       For each field of the rhs variable at lhsfield.offset (rhsfield)
7758         add the constraint lhsfield = rhsfield
7759 @@ -2808,7 +2795,7 @@
7760        struct constraint_expr temprhs = rhs;
7761        unsigned HOST_WIDE_INT fieldoffset;
7762  
7763 -      templhs.var = p->id;            
7764 +      templhs.var = p->id;
7765        q = get_varinfo (temprhs.var);
7766        fieldoffset = p->offset - pstart;
7767        q = first_vi_for_offset (q, q->offset + fieldoffset);
7768 @@ -2823,8 +2810,8 @@
7769  
7770  /* Handle the structure copy case where we have a  structure copy between a
7771     aggregate on the LHS and a dereference of a pointer on the RHS
7772 -   that is of SIZE (in bits) 
7773 -  
7774 +   that is of SIZE (in bits)
7775 +
7776     For each field of the lhs variable (lhsfield)
7777         rhs.offset = lhsfield->offset
7778         add the constraint lhsfield = rhs
7779 @@ -2849,12 +2836,12 @@
7780  
7781  
7782        if (templhs.type == SCALAR)
7783 -       templhs.var = p->id;      
7784 +       templhs.var = p->id;
7785        else
7786         templhs.offset = p->offset;
7787 -      
7788 +
7789        q = get_varinfo (temprhs.var);
7790 -      fieldoffset = p->offset - pstart;      
7791 +      fieldoffset = p->offset - pstart;
7792        temprhs.offset += fieldoffset;
7793        process_constraint (new_constraint (templhs, temprhs));
7794      }
7795 @@ -2862,7 +2849,7 @@
7796  
7797  /* Handle the structure copy case where we have a structure copy
7798     between a aggregate on the RHS and a dereference of a pointer on
7799 -   the LHS that is of SIZE (in bits) 
7800 +   the LHS that is of SIZE (in bits)
7801  
7802     For each field of the rhs variable (rhsfield)
7803         lhs.offset = rhsfield->offset
7804 @@ -2888,12 +2875,12 @@
7805  
7806  
7807        if (temprhs.type == SCALAR)
7808 -       temprhs.var = p->id;      
7809 +       temprhs.var = p->id;
7810        else
7811         temprhs.offset = p->offset;
7812 -      
7813 +
7814        q = get_varinfo (templhs.var);
7815 -      fieldoffset = p->offset - pstart;      
7816 +      fieldoffset = p->offset - pstart;
7817        templhs.offset += fieldoffset;
7818        process_constraint (new_constraint (templhs, temprhs));
7819      }
7820 @@ -2901,7 +2888,7 @@
7821  
7822  /* Sometimes, frontends like to give us bad type information.  This
7823     function will collapse all the fields from VAR to the end of VAR,
7824 -   into VAR, so that we treat those fields as a single variable. 
7825 +   into VAR, so that we treat those fields as a single variable.
7826     We return the variable they were collapsed into.  */
7827  
7828  static unsigned int
7829 @@ -2913,16 +2900,16 @@
7830    for (field = currvar->next; field; field = field->next)
7831      {
7832        if (dump_file)
7833 -       fprintf (dump_file, "Type safety: Collapsing var %s into %s\n", 
7834 +       fprintf (dump_file, "Type safety: Collapsing var %s into %s\n",
7835                  field->name, currvar->name);
7836 -      
7837 +
7838        gcc_assert (!field->collapsed_to);
7839        field->collapsed_to = currvar;
7840      }
7841  
7842    currvar->next = NULL;
7843    currvar->size = currvar->fullsize - currvar->offset;
7844 -  
7845 +
7846    return currvar->id;
7847  }
7848  
7849 @@ -2944,7 +2931,7 @@
7850    gcc_assert (VEC_length (ce_s, rhsc) == 1);
7851    lhs = *(VEC_last (ce_s, lhsc));
7852    rhs = *(VEC_last (ce_s, rhsc));
7853 -  
7854 +
7855    VEC_free (ce_s, heap, lhsc);
7856    VEC_free (ce_s, heap, rhsc);
7857  
7858 @@ -2955,7 +2942,7 @@
7859        lhs = rhs;
7860        rhs = tmp;
7861      }
7862 -  
7863 +
7864    /*  This is fairly conservative for the RHS == ADDRESSOF case, in that it's
7865        possible it's something we could handle.  However, most cases falling
7866        into this are dealing with transparent unions, which are slightly
7867 @@ -3021,11 +3008,11 @@
7868        else
7869         lhssize = TREE_INT_CST_LOW (lhstypesize);
7870  
7871 -  
7872 -      if (rhs.type == SCALAR && lhs.type == SCALAR)  
7873 +
7874 +      if (rhs.type == SCALAR && lhs.type == SCALAR)
7875         {
7876           if (!do_simple_structure_copy (lhs, rhs, MIN (lhssize, rhssize)))
7877 -           {         
7878 +           {
7879               lhs.var = collapse_rest_of_var (lhs.var);
7880               rhs.var = collapse_rest_of_var (rhs.var);
7881               lhs.offset = 0;
7882 @@ -3042,7 +3029,7 @@
7883        else
7884         {
7885           tree pointedtotype = lhstype;
7886 -         tree tmpvar;  
7887 +         tree tmpvar;
7888  
7889           gcc_assert (rhs.type == DEREF && lhs.type == DEREF);
7890           tmpvar = create_tmp_var_raw (pointedtotype, "structcopydereftmp");
7891 @@ -3052,6 +3039,7 @@
7892      }
7893  }
7894  
7895 +
7896  /* Update related alias information kept in AI.  This is used when
7897     building name tags, alias sets and deciding grouping heuristics.
7898     STMT is the statement to process.  This function also updates
7899 @@ -3261,7 +3249,6 @@
7900      }
7901  }
7902  
7903 -
7904  /* Handle pointer arithmetic EXPR when creating aliasing constraints.
7905     Expressions of the type PTR + CST can be handled in two ways:
7906  
7907 @@ -3288,7 +3275,7 @@
7908    unsigned int i = 0;
7909    unsigned int j = 0;
7910    VEC (ce_s, heap) *temp = NULL;
7911 -  unsigned int rhsoffset = 0;
7912 +  unsigned HOST_WIDE_INT rhsoffset = 0;
7913  
7914    if (TREE_CODE (expr) != PLUS_EXPR
7915        && TREE_CODE (expr) != MINUS_EXPR)
7916 @@ -3299,14 +3286,18 @@
7917  
7918    get_constraint_for (op0, &temp);
7919    if (POINTER_TYPE_P (TREE_TYPE (op0))
7920 -      && TREE_CODE (op1) == INTEGER_CST
7921 +      && host_integerp (op1, 1)
7922        && TREE_CODE (expr) == PLUS_EXPR)
7923      {
7924 +      if ((TREE_INT_CST_LOW (op1) * BITS_PER_UNIT) / BITS_PER_UNIT
7925 +         != TREE_INT_CST_LOW (op1))
7926 +       return false;
7927        rhsoffset = TREE_INT_CST_LOW (op1) * BITS_PER_UNIT;
7928      }
7929    else
7930      return false;
7931  
7932 +
7933    for (i = 0; VEC_iterate (ce_s, lhsc, i, c); i++)
7934      for (j = 0; VEC_iterate (ce_s, temp, j, c2); j++)
7935        {
7936 @@ -3360,12 +3351,12 @@
7937         {
7938           int i;
7939           unsigned int j;
7940 -         
7941 +
7942           /* For a phi node, assign all the arguments to
7943              the result.  */
7944           get_constraint_for (PHI_RESULT (t), &lhsc);
7945           for (i = 0; i < PHI_NUM_ARGS (t); i++)
7946 -           { 
7947 +           {
7948               tree rhstype;
7949               tree strippedrhs = PHI_ARG_DEF (t, i);
7950  
7951 @@ -3401,7 +3392,6 @@
7952      {
7953        tree lhsop;
7954        tree rhsop;
7955 -      unsigned int varid;
7956        tree arglist;
7957        varinfo_t fi;
7958        int i = 1;
7959 @@ -3423,17 +3413,16 @@
7960          we should still be able to handle.  */
7961        if (decl)
7962         {
7963 -         varid = get_id_for_tree (decl);
7964 +         fi = get_vi_for_tree (decl);
7965         }
7966        else
7967         {
7968           decl = TREE_OPERAND (rhsop, 0);
7969 -         varid = get_id_for_tree (decl);
7970 +         fi = get_vi_for_tree (decl);
7971         }
7972  
7973        /* Assign all the passed arguments to the appropriate incoming
7974          parameters of the function.  */
7975 -      fi = get_varinfo (varid);
7976        arglist = TREE_OPERAND (rhsop, 1);
7977         
7978        for (;arglist; arglist = TREE_CHAIN (arglist))
7979 @@ -3463,13 +3452,14 @@
7980             }
7981           i++;
7982         }
7983 +
7984        /* If we are returning a value, assign it to the result.  */
7985        if (lhsop)
7986         {
7987           struct constraint_expr rhs;
7988           struct constraint_expr *lhsp;
7989           unsigned int j = 0;
7990 -         
7991 +
7992           get_constraint_for (lhsop, &lhsc);
7993           if (TREE_CODE (decl) != FUNCTION_DECL)
7994             {
7995 @@ -3485,7 +3475,7 @@
7996             }
7997           for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
7998             process_constraint (new_constraint (*lhsp, rhs));
7999 -       }      
8000 +       }
8001      }
8002    /* Otherwise, just a regular assignment statement.  */
8003    else if (TREE_CODE (t) == MODIFY_EXPR)
8004 @@ -3494,7 +3484,7 @@
8005        tree rhsop = TREE_OPERAND (t, 1);
8006        int i;
8007  
8008 -      if ((AGGREGATE_TYPE_P (TREE_TYPE (lhsop)) 
8009 +      if ((AGGREGATE_TYPE_P (TREE_TYPE (lhsop))
8010            || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE)
8011           && (AGGREGATE_TYPE_P (TREE_TYPE (rhsop))
8012               || TREE_CODE (TREE_TYPE (lhsop)) == COMPLEX_TYPE))
8013 @@ -3513,7 +3503,7 @@
8014                 {
8015                   /* RHS that consist of unary operations,
8016                      exceptional types, or bare decls/constants, get
8017 -                    handled directly by get_constraint_for.  */ 
8018 +                    handled directly by get_constraint_for.  */
8019                   case tcc_reference:
8020                   case tcc_declaration:
8021                   case tcc_constant:
8022 @@ -3528,7 +3518,7 @@
8023                           {
8024                             struct constraint_expr *c2;
8025                             unsigned int k;
8026 -                           
8027 +
8028                             for (k = 0; VEC_iterate (ce_s, rhsc, k, c2); k++)
8029                               process_constraint (new_constraint (*c, *c2));
8030                           }
8031 @@ -3570,7 +3560,7 @@
8032                               }
8033                           }
8034                       }
8035 -               }      
8036 +               }
8037             }
8038         }
8039      }
8040 @@ -3578,7 +3568,7 @@
8041    /* After promoting variables and computing aliasing we will
8042       need to re-scan most statements.  FIXME: Try to minimize the
8043       number of statements re-scanned.  It's not really necessary to
8044 -     re-scan *all* statements.  */  
8045 +     re-scan *all* statements.  */
8046    mark_stmt_modified (origt);
8047    VEC_free (ce_s, heap, rhsc);
8048    VEC_free (ce_s, heap, lhsc);
8049 @@ -3591,7 +3581,7 @@
8050     first field that overlaps with OFFSET.
8051     Return NULL if we can't find one.  */
8052  
8053 -static varinfo_t 
8054 +static varinfo_t
8055  first_vi_for_offset (varinfo_t start, unsigned HOST_WIDE_INT offset)
8056  {
8057    varinfo_t curr = start;
8058 @@ -3617,7 +3607,7 @@
8059  {
8060    varinfo_t prev = base;
8061    varinfo_t curr = base->next;
8062 -  
8063 +
8064    field->next = curr;
8065    prev->next = field;
8066  }
8067 @@ -3630,7 +3620,7 @@
8068  {
8069    varinfo_t prev = base;
8070    varinfo_t curr = base->next;
8071 -  
8072 +
8073    if (curr == NULL)
8074      {
8075        prev->next = field;
8076 @@ -3652,13 +3642,13 @@
8077  
8078  /* qsort comparison function for two fieldoff's PA and PB */
8079  
8080 -static int 
8081 +static int
8082  fieldoff_compare (const void *pa, const void *pb)
8083  {
8084    const fieldoff_s *foa = (const fieldoff_s *)pa;
8085    const fieldoff_s *fob = (const fieldoff_s *)pb;
8086    HOST_WIDE_INT foasize, fobsize;
8087 -  
8088 +
8089    if (foa->offset != fob->offset)
8090      return foa->offset - fob->offset;
8091  
8092 @@ -3671,8 +3661,8 @@
8093  void
8094  sort_fieldstack (VEC(fieldoff_s,heap) *fieldstack)
8095  {
8096 -  qsort (VEC_address (fieldoff_s, fieldstack), 
8097 -        VEC_length (fieldoff_s, fieldstack), 
8098 +  qsort (VEC_address (fieldoff_s, fieldstack),
8099 +        VEC_length (fieldoff_s, fieldstack),
8100          sizeof (fieldoff_s),
8101          fieldoff_compare);
8102  }
8103 @@ -3686,12 +3676,13 @@
8104     TYPE.  */
8105  
8106  int
8107 -push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack, 
8108 +push_fields_onto_fieldstack (tree type, VEC(fieldoff_s,heap) **fieldstack,
8109                              HOST_WIDE_INT offset, bool *has_union)
8110  {
8111    tree field;
8112    int count = 0;
8113 -  
8114 +  unsigned HOST_WIDE_INT minoffset = -1;
8115 +
8116    if (TREE_CODE (type) == COMPLEX_TYPE)
8117      {
8118        fieldoff_s *real_part, *img_part;
8119 @@ -3700,13 +3691,13 @@
8120        real_part->size = TYPE_SIZE (TREE_TYPE (type));
8121        real_part->offset = offset;
8122        real_part->decl = NULL_TREE;
8123 -      
8124 +
8125        img_part = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL);
8126        img_part->type = TREE_TYPE (type);
8127        img_part->size = TYPE_SIZE (TREE_TYPE (type));
8128        img_part->offset = offset + TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (type)));
8129        img_part->decl = NULL_TREE;
8130 -      
8131 +
8132        return 2;
8133      }
8134  
8135 @@ -3733,12 +3724,12 @@
8136         {
8137           bool push = false;
8138           int pushed = 0;
8139 -       
8140 -         if (has_union 
8141 +
8142 +         if (has_union
8143               && (TREE_CODE (TREE_TYPE (type)) == QUAL_UNION_TYPE
8144                   || TREE_CODE (TREE_TYPE (type)) == UNION_TYPE))
8145             *has_union = true;
8146 -       
8147 +
8148           if (!AGGREGATE_TYPE_P (TREE_TYPE (type))) /* var_can_have_subvars */
8149             push = true;
8150           else if (!(pushed = push_fields_onto_fieldstack
8151 @@ -3772,12 +3763,12 @@
8152        {
8153         bool push = false;
8154         int pushed = 0;
8155 -       
8156 -       if (has_union 
8157 +
8158 +       if (has_union
8159             && (TREE_CODE (TREE_TYPE (field)) == QUAL_UNION_TYPE
8160                 || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE))
8161           *has_union = true;
8162 -       
8163 +
8164         if (!var_can_have_subvars (field))
8165           push = true;
8166         else if (!(pushed = push_fields_onto_fieldstack
8167 @@ -3789,7 +3780,7 @@
8168              see if we didn't push any subfields and the size is
8169              nonzero, push the field onto the stack */
8170           push = true;
8171 -       
8172 +
8173         if (push)
8174           {
8175             fieldoff_s *pair;
8176 @@ -3803,8 +3794,25 @@
8177           }
8178         else
8179           count += pushed;
8180 +
8181 +       if (bitpos_of_field (field) < minoffset)
8182 +         minoffset = bitpos_of_field (field);
8183        }
8184  
8185 +  /* We need to create a fake subvar for empty bases.  But _only_ for non-empty
8186 +     classes.  */
8187 +  if (minoffset != 0 && count != 0)
8188 +    {
8189 +      fieldoff_s *pair;
8190 +
8191 +      pair = VEC_safe_push (fieldoff_s, heap, *fieldstack, NULL);
8192 +      pair->type = void_type_node;
8193 +      pair->size = build_int_cst (size_type_node, minoffset);
8194 +      pair->decl = NULL;
8195 +      pair->offset = offset;
8196 +      count++;
8197 +    }
8198 +
8199    return count;
8200  }
8201  
8202 @@ -3848,15 +3856,15 @@
8203    unsigned int i = 0;
8204    tree t;
8205  
8206 -  for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); 
8207 +  for (t = TYPE_ARG_TYPES (TREE_TYPE (decl));
8208         t;
8209         t = TREE_CHAIN (t))
8210 -    {  
8211 +    {
8212        if (TREE_VALUE (t) == void_type_node)
8213         break;
8214        i++;
8215      }
8216 -  
8217 +
8218    if (!t)
8219      *is_varargs = true;
8220    return i;
8221 @@ -3870,19 +3878,19 @@
8222  {
8223    unsigned int index = VEC_length (varinfo_t, varmap);
8224    varinfo_t vi;
8225 -  tree arg; 
8226 +  tree arg;
8227    unsigned int i;
8228    bool is_varargs = false;
8229  
8230    /* Create the variable info.  */
8231  
8232 -  vi = new_var_info (decl, index, name, index);
8233 +  vi = new_var_info (decl, index, name);
8234    vi->decl = decl;
8235    vi->offset = 0;
8236    vi->has_union = 0;
8237    vi->size = 1;
8238    vi->fullsize = count_num_arguments (decl, &is_varargs) + 1;
8239 -  insert_id_for_tree (vi->decl, index);  
8240 +  insert_vi_for_tree (vi->decl, vi);
8241    VEC_safe_push (varinfo_t, heap, varmap, vi);
8242  
8243    stats.total_vars++;
8244 @@ -3898,12 +3906,12 @@
8245        return index;
8246      }
8247  
8248 -  
8249 +
8250    arg = DECL_ARGUMENTS (decl);
8251  
8252    /* Set up variables for each argument.  */
8253    for (i = 1; i < vi->fullsize; i++)
8254 -    {      
8255 +    {
8256        varinfo_t argvi;
8257        const char *newname;
8258        char *tempname;
8259 @@ -3912,13 +3920,13 @@
8260  
8261        if (arg)
8262         argdecl = arg;
8263 -      
8264 +
8265        newindex = VEC_length (varinfo_t, varmap);
8266        asprintf (&tempname, "%s.arg%d", name, i-1);
8267        newname = ggc_strdup (tempname);
8268        free (tempname);
8269  
8270 -      argvi = new_var_info (argdecl, newindex,newname, newindex);
8271 +      argvi = new_var_info (argdecl, newindex, newname);
8272        argvi->decl = argdecl;
8273        VEC_safe_push (varinfo_t, heap, varmap, argvi);
8274        argvi->offset = i;
8275 @@ -3929,7 +3937,7 @@
8276        stats.total_vars ++;
8277        if (arg)
8278         {
8279 -         insert_id_for_tree (arg, newindex);
8280 +         insert_vi_for_tree (arg, argvi);
8281           arg = TREE_CHAIN (arg);
8282         }
8283      }
8284 @@ -3948,13 +3956,13 @@
8285  
8286        if (DECL_RESULT (decl))
8287         resultdecl = DECL_RESULT (decl);
8288 -      
8289 +
8290        newindex = VEC_length (varinfo_t, varmap);
8291        asprintf (&tempname, "%s.result", name);
8292        newname = ggc_strdup (tempname);
8293        free (tempname);
8294  
8295 -      resultvi = new_var_info (resultdecl, newindex, newname, newindex);
8296 +      resultvi = new_var_info (resultdecl, newindex, newname);
8297        resultvi->decl = resultdecl;
8298        VEC_safe_push (varinfo_t, heap, varmap, resultvi);
8299        resultvi->offset = i;
8300 @@ -3964,13 +3972,13 @@
8301        insert_into_field_list_sorted (vi, resultvi);
8302        stats.total_vars ++;
8303        if (DECL_RESULT (decl))
8304 -       insert_id_for_tree (DECL_RESULT (decl), newindex);
8305 +       insert_vi_for_tree (DECL_RESULT (decl), resultvi);
8306      }
8307    return index;
8308 -}  
8309 +}
8310  
8311  
8312 -/* Return true if FIELDSTACK contains fields that overlap. 
8313 +/* Return true if FIELDSTACK contains fields that overlap.
8314     FIELDSTACK is assumed to be sorted by offset.  */
8315  
8316  static bool
8317 @@ -4057,12 +4065,12 @@
8318    bool hasunion;
8319    bool is_global = DECL_P (decl) ? is_global_var (decl) : false;
8320    VEC (fieldoff_s,heap) *fieldstack = NULL;
8321 -  
8322 +
8323    if (TREE_CODE (decl) == FUNCTION_DECL && in_ipa_mode)
8324      return create_function_info_for (decl, name);
8325  
8326    hasunion = TREE_CODE (decltype) == UNION_TYPE
8327 -             || TREE_CODE (decltype) == QUAL_UNION_TYPE;
8328 +            || TREE_CODE (decltype) == QUAL_UNION_TYPE;
8329    if (var_can_have_subvars (decl) && use_field_sensitive && !hasunion)
8330      {
8331        push_fields_onto_fieldstack (decltype, &fieldstack, 0, &hasunion);
8332 @@ -4072,12 +4080,12 @@
8333           notokay = true;
8334         }
8335      }
8336 -  
8337  
8338 +
8339    /* If the variable doesn't have subvars, we may end up needing to
8340       sort the field list and create fake variables for all the
8341       fields.  */
8342 -  vi = new_var_info (decl, index, name, index);
8343 +  vi = new_var_info (decl, index, name);
8344    vi->decl = decl;
8345    vi->offset = 0;
8346    vi->has_union = hasunion;
8347 @@ -4095,8 +4103,8 @@
8348        vi->fullsize = TREE_INT_CST_LOW (declsize);
8349        vi->size = vi->fullsize;
8350      }
8351 -  
8352 -  insert_id_for_tree (vi->decl, index);  
8353 +
8354 +  insert_vi_for_tree (vi->decl, vi);
8355    VEC_safe_push (varinfo_t, heap, varmap, vi);
8356    if (is_global && (!flag_whole_program || !in_ipa_mode))
8357      {
8358 @@ -4122,9 +4130,9 @@
8359      }
8360  
8361    stats.total_vars++;
8362 -  if (use_field_sensitive 
8363 -      && !notokay 
8364 -      && !vi->is_unknown_size_var 
8365 +  if (use_field_sensitive
8366 +      && !notokay
8367 +      && !vi->is_unknown_size_var
8368        && var_can_have_subvars (decl)
8369        && VEC_length (fieldoff_s, fieldstack) <= MAX_FIELDS_FOR_FIELD_SENSITIVE)
8370      {
8371 @@ -4148,7 +4156,7 @@
8372          without creating varinfos for the fields anyway, so sorting them is a
8373          waste to boot.  */
8374        if (!notokay)
8375 -       {       
8376 +       {
8377           sort_fieldstack (fieldstack);
8378           /* Due to some C++ FE issues, like PR 22488, we might end up
8379              what appear to be overlapping fields even though they,
8380 @@ -4156,8 +4164,8 @@
8381              we will simply disable field-sensitivity for these cases.  */
8382           notokay = check_for_overlaps (fieldstack);
8383         }
8384 -      
8385 -      
8386 +
8387 +
8388        if (VEC_length (fieldoff_s, fieldstack) != 0)
8389         fo = VEC_index (fieldoff_s, fieldstack, 0);
8390  
8391 @@ -4169,11 +4177,11 @@
8392           VEC_free (fieldoff_s, heap, fieldstack);
8393           return index;
8394         }
8395 -      
8396 +
8397        vi->size = TREE_INT_CST_LOW (fo->size);
8398        vi->offset = fo->offset;
8399 -      for (i = VEC_length (fieldoff_s, fieldstack) - 1; 
8400 -          i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo); 
8401 +      for (i = VEC_length (fieldoff_s, fieldstack) - 1;
8402 +          i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo);
8403            i--)
8404         {
8405           varinfo_t newvi;
8406 @@ -4184,15 +4192,15 @@
8407           if (dump_file)
8408             {
8409               if (fo->decl)
8410 -               asprintf (&tempname, "%s.%s",
8411 +               asprintf (&tempname, "%s.%s",
8412                           vi->name, alias_get_name (fo->decl));
8413               else
8414 -               asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC,
8415 +               asprintf (&tempname, "%s." HOST_WIDE_INT_PRINT_DEC,
8416                           vi->name, fo->offset);
8417               newname = ggc_strdup (tempname);
8418               free (tempname);
8419             }
8420 -         newvi = new_var_info (decl, newindex, newname, newindex);
8421 +         newvi = new_var_info (decl, newindex, newname);
8422           newvi->offset = fo->offset;
8423           newvi->size = TREE_INT_CST_LOW (fo->size);
8424           newvi->fullsize = vi->fullsize;
8425 @@ -4228,14 +4236,22 @@
8426  {
8427    varinfo_t vi = get_varinfo (var);
8428    unsigned int i;
8429 -  bitmap_iterator bi; 
8430 -  
8431 -  fprintf (file, "%s = { ", vi->name);
8432 -  EXECUTE_IF_SET_IN_BITMAP (get_varinfo (vi->node)->solution, 0, i, bi)
8433 +  bitmap_iterator bi;
8434 +
8435 +  if (find (var) != var)
8436      {
8437 -      fprintf (file, "%s ", get_varinfo (i)->name);
8438 +      varinfo_t vipt = get_varinfo (find (var));
8439 +      fprintf (file, "%s = same as %s\n", vi->name, vipt->name);
8440      }
8441 -  fprintf (file, "}\n");
8442 +  else
8443 +    {
8444 +      fprintf (file, "%s = { ", vi->name);
8445 +      EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi)
8446 +       {
8447 +         fprintf (file, "%s ", get_varinfo (i)->name);
8448 +       }
8449 +      fprintf (file, "}\n");
8450 +    }
8451  }
8452  
8453  /* Print the points-to solution for VAR to stdout.  */
8454 @@ -4266,7 +4282,7 @@
8455        if (!could_have_pointers (t))
8456         continue;
8457        
8458 -      arg_id = get_id_for_tree (t);
8459 +      arg_id = get_vi_for_tree (t)->id;
8460  
8461        /* With flag_argument_noalias greater than two means that the incoming
8462           argument cannot alias anything except for itself so create a HEAP
8463 @@ -4276,11 +4292,10 @@
8464         {
8465           varinfo_t vi;
8466           tree heapvar = heapvar_lookup (t);
8467 -         unsigned int id;
8468           
8469           lhs.offset = 0;
8470           lhs.type = SCALAR;
8471 -         lhs.var  = get_id_for_tree (t);
8472 +         lhs.var  = get_vi_for_tree (t)->id;
8473           
8474           if (heapvar == NULL_TREE)
8475             {
8476 @@ -4291,11 +4306,11 @@
8477                 add_referenced_var (heapvar);
8478               heapvar_insert (t, heapvar);
8479             }
8480 -         id = get_id_for_tree (heapvar);
8481 -         vi = get_varinfo (id);
8482 +
8483 +         vi = get_vi_for_tree (heapvar);
8484           vi->is_artificial_var = 1;
8485           vi->is_heap_var = 1;
8486 -         rhs.var = id;
8487 +         rhs.var = vi->id;
8488           rhs.type = ADDRESSOF;
8489           rhs.offset = 0;
8490            for (p = get_varinfo (lhs.var); p; p = p->next)
8491 @@ -4366,7 +4381,8 @@
8492             bitmap_set_bit (into, DECL_UID (sv->var));
8493         }
8494        else if (TREE_CODE (vi->decl) == VAR_DECL 
8495 -              || TREE_CODE (vi->decl) == PARM_DECL)
8496 +              || TREE_CODE (vi->decl) == PARM_DECL
8497 +              || TREE_CODE (vi->decl) == RESULT_DECL)
8498         {
8499           if (var_can_have_subvars (vi->decl)
8500               && get_subvars_for_var (vi->decl))
8501 @@ -4409,8 +4425,8 @@
8502  bool
8503  find_what_p_points_to (tree p)
8504  {
8505 -  unsigned int id = 0;
8506    tree lookup_p = p;
8507 +  varinfo_t vi;
8508  
8509    if (!have_alias_info)
8510      return false;
8511 @@ -4422,10 +4438,10 @@
8512        && default_def (SSA_NAME_VAR (p)) == p)
8513      lookup_p = SSA_NAME_VAR (p);
8514  
8515 -  if (lookup_id_for_tree (lookup_p, &id))
8516 +  vi = lookup_vi_for_tree (lookup_p);
8517 +  if (vi)
8518      {
8519 -      varinfo_t vi = get_varinfo (id);
8520 -
8521 +      
8522        if (vi->is_artificial_var)
8523         return false;
8524  
8525 @@ -4447,7 +4463,7 @@
8526  
8527           /* This variable may have been collapsed, let's get the real
8528              variable.  */
8529 -         vi = get_varinfo (vi->node);
8530 +         vi = get_varinfo (find (vi->id));
8531           
8532           /* Translate artificial variables into SSA_NAME_PTR_INFO
8533              attributes.  */
8534 @@ -4506,13 +4522,16 @@
8535      {
8536        fprintf (outfile, "Stats:\n");
8537        fprintf (outfile, "Total vars:               %d\n", stats.total_vars);
8538 +      fprintf (outfile, "Non-pointer vars:          %d\n",
8539 +              stats.nonpointer_vars);
8540        fprintf (outfile, "Statically unified vars:  %d\n",
8541                stats.unified_vars_static);
8542 -      fprintf (outfile, "Collapsed vars:           %d\n", stats.collapsed_vars);
8543        fprintf (outfile, "Dynamically unified vars: %d\n",
8544                stats.unified_vars_dynamic);
8545        fprintf (outfile, "Iterations:               %d\n", stats.iterations);
8546        fprintf (outfile, "Number of edges:          %d\n", stats.num_edges);
8547 +      fprintf (outfile, "Number of implicit edges: %d\n",
8548 +              stats.num_implicit_edges);
8549      }
8550  
8551    for (i = 0; i < VEC_length (varinfo_t, varmap); i++)
8552 @@ -4540,8 +4559,8 @@
8553    /* Create the NULL variable, used to represent that a variable points
8554       to NULL.  */
8555    nothing_tree = create_tmp_var_raw (void_type_node, "NULL");
8556 -  var_nothing = new_var_info (nothing_tree, 0, "NULL", 0);
8557 -  insert_id_for_tree (nothing_tree, 0);
8558 +  var_nothing = new_var_info (nothing_tree, 0, "NULL");
8559 +  insert_vi_for_tree (nothing_tree, var_nothing);
8560    var_nothing->is_artificial_var = 1;
8561    var_nothing->offset = 0;
8562    var_nothing->size = ~0;
8563 @@ -4553,8 +4572,8 @@
8564    /* Create the ANYTHING variable, used to represent that a variable
8565       points to some unknown piece of memory.  */
8566    anything_tree = create_tmp_var_raw (void_type_node, "ANYTHING");
8567 -  var_anything = new_var_info (anything_tree, 1, "ANYTHING", 1); 
8568 -  insert_id_for_tree (anything_tree, 1);
8569 +  var_anything = new_var_info (anything_tree, 1, "ANYTHING"); 
8570 +  insert_vi_for_tree (anything_tree, var_anything);
8571    var_anything->is_artificial_var = 1;
8572    var_anything->size = ~0;
8573    var_anything->offset = 0;
8574 @@ -4573,7 +4592,6 @@
8575    rhs.type = ADDRESSOF;
8576    rhs.var = anything_id;
8577    rhs.offset = 0;
8578 -  var_anything->address_taken = true;
8579  
8580    /* This specifically does not use process_constraint because
8581       process_constraint ignores all anything = anything constraints, since all
8582 @@ -4583,14 +4601,14 @@
8583    /* Create the READONLY variable, used to represent that a variable
8584       points to readonly memory.  */
8585    readonly_tree = create_tmp_var_raw (void_type_node, "READONLY");
8586 -  var_readonly = new_var_info (readonly_tree, 2, "READONLY", 2);
8587 +  var_readonly = new_var_info (readonly_tree, 2, "READONLY");
8588    var_readonly->is_artificial_var = 1;
8589    var_readonly->offset = 0;
8590    var_readonly->size = ~0;
8591    var_readonly->fullsize = ~0;
8592    var_readonly->next = NULL;
8593    var_readonly->is_special_var = 1;
8594 -  insert_id_for_tree (readonly_tree, 2);
8595 +  insert_vi_for_tree (readonly_tree, var_readonly);
8596    readonly_id = 2;
8597    VEC_safe_push (varinfo_t, heap, varmap, var_readonly);
8598  
8599 @@ -4610,8 +4628,8 @@
8600    /* Create the INTEGER variable, used to represent that a variable points
8601       to an INTEGER.  */
8602    integer_tree = create_tmp_var_raw (void_type_node, "INTEGER");
8603 -  var_integer = new_var_info (integer_tree, 3, "INTEGER", 3);
8604 -  insert_id_for_tree (integer_tree, 3);
8605 +  var_integer = new_var_info (integer_tree, 3, "INTEGER");
8606 +  insert_vi_for_tree (integer_tree, var_integer);
8607    var_integer->is_artificial_var = 1;
8608    var_integer->size = ~0;
8609    var_integer->fullsize = ~0;
8610 @@ -4634,8 +4652,8 @@
8611    /* Create the ESCAPED_VARS variable used to represent variables that
8612       escape this function.  */
8613    escaped_vars_tree = create_tmp_var_raw (void_type_node, "ESCAPED_VARS");
8614 -  var_escaped_vars = new_var_info (escaped_vars_tree, 4, "ESCAPED_VARS", 4);
8615 -  insert_id_for_tree (escaped_vars_tree, 4);
8616 +  var_escaped_vars = new_var_info (escaped_vars_tree, 4, "ESCAPED_VARS");
8617 +  insert_vi_for_tree (escaped_vars_tree, var_escaped_vars);
8618    var_escaped_vars->is_artificial_var = 1;
8619    var_escaped_vars->size = ~0;
8620    var_escaped_vars->fullsize = ~0;
8621 @@ -4660,21 +4678,19 @@
8622  static void
8623  init_alias_vars (void)
8624  {
8625 -  bitmap_obstack_initialize (&ptabitmap_obstack);
8626 +  bitmap_obstack_initialize (&pta_obstack);
8627 +  bitmap_obstack_initialize (&oldpta_obstack);
8628    bitmap_obstack_initialize (&predbitmap_obstack);
8629  
8630 -  constraint_pool = create_alloc_pool ("Constraint pool", 
8631 +  constraint_pool = create_alloc_pool ("Constraint pool",
8632                                        sizeof (struct constraint), 30);
8633    variable_info_pool = create_alloc_pool ("Variable info pool",
8634                                           sizeof (struct variable_info), 30);
8635 -  constraint_edge_pool = create_alloc_pool ("Constraint edges",
8636 -                                           sizeof (struct constraint_edge), 30);
8637 -  
8638    constraints = VEC_alloc (constraint_t, heap, 8);
8639    varmap = VEC_alloc (varinfo_t, heap, 8);
8640 -  id_for_tree = htab_create (10, tree_id_hash, tree_id_eq, free);
8641 +  vi_for_tree = pointer_map_create ();
8642 +
8643    memset (&stats, 0, sizeof (stats));
8644 -
8645    init_base_vars ();
8646  }
8647  
8648 @@ -4777,6 +4793,43 @@
8649    VEC_free (ce_s, heap, rhsc);
8650  }
8651  
8652 +
8653 +/* Remove the REF and ADDRESS edges from GRAPH, as well as all the
8654 +   predecessor edges.  */
8655 +
8656 +static void
8657 +remove_preds_and_fake_succs (constraint_graph_t graph)
8658 +{
8659 +  unsigned int i;
8660 +
8661 +  /* Clear the implicit ref and address nodes from the successor
8662 +     lists.  */
8663 +  for (i = 0; i < FIRST_REF_NODE; i++)
8664 +    {
8665 +      if (graph->succs[i])
8666 +       bitmap_clear_range (graph->succs[i], FIRST_REF_NODE,
8667 +                           FIRST_REF_NODE * 2);
8668 +    }
8669 +
8670 +  /* Free the successor list for the non-ref nodes.  */
8671 +  for (i = FIRST_REF_NODE; i < graph->size; i++)
8672 +    {
8673 +      if (graph->succs[i])
8674 +       BITMAP_FREE (graph->succs[i]);
8675 +    }
8676 +
8677 +  /* Now reallocate the size of the successor list as, and blow away
8678 +     the predecessor bitmaps.  */
8679 +  graph->size = VEC_length (varinfo_t, varmap);
8680 +  graph->succs = xrealloc (graph->succs, graph->size * sizeof (bitmap));
8681 +
8682 +  free (graph->implicit_preds);
8683 +  graph->implicit_preds = NULL;
8684 +  free (graph->preds);
8685 +  graph->preds = NULL;
8686 +  bitmap_obstack_release (&predbitmap_obstack);
8687 +}
8688 +
8689  /* Create points-to sets for the current function.  See the comments
8690     at the start of the file for an algorithmic overview.  */
8691  
8692 @@ -4784,11 +4837,13 @@
8693  compute_points_to_sets (struct alias_info *ai)
8694  {
8695    basic_block bb;
8696 +  struct scc_info *si;
8697  
8698    timevar_push (TV_TREE_PTA);
8699  
8700    init_alias_vars ();
8701 -
8702 +  init_alias_heapvars ();
8703 +  
8704    intra_create_variable_infos ();
8705  
8706    /* Now walk all statements and derive aliases.  */
8707 @@ -4824,36 +4879,42 @@
8708         }
8709      }
8710  
8711 -  build_constraint_graph ();
8712  
8713    if (dump_file)
8714      {
8715        fprintf (dump_file, "Points-to analysis\n\nConstraints:\n\n");
8716        dump_constraints (dump_file);
8717      }
8718 -  
8719 +
8720    if (dump_file)
8721      fprintf (dump_file,
8722              "\nCollapsing static cycles and doing variable "
8723              "substitution:\n");
8724 -      
8725 -  find_and_collapse_graph_cycles (graph, false);
8726 -  perform_var_substitution (graph);
8727 -      
8728 +
8729 +  build_pred_graph ();
8730 +  si = perform_var_substitution (graph);
8731 +  move_complex_constraints (graph, si);
8732 +  free_var_substitution_info (si);
8733 +  
8734 +  build_succ_graph ();
8735 +  find_indirect_cycles (graph);
8736 +
8737 +  /* Implicit nodes and predecessors are no longer necessary at this
8738 +     point. */
8739 +  remove_preds_and_fake_succs (graph);
8740 +
8741    if (dump_file)
8742      fprintf (dump_file, "\nSolving graph:\n");
8743 -      
8744 +
8745    solve_graph (graph);
8746 -  
8747 +
8748    if (dump_file)
8749      dump_sa_points_to_info (dump_file);
8750 -  
8751    have_alias_info = true;
8752  
8753    timevar_pop (TV_TREE_PTA);
8754  }
8755  
8756 -
8757  /* Delete created points-to sets.  */
8758  
8759  void
8760 @@ -4861,33 +4922,27 @@
8761  {
8762    varinfo_t v;
8763    int i;
8764 -  
8765 -  htab_delete (id_for_tree);
8766 -  bitmap_obstack_release (&ptabitmap_obstack);
8767 -  bitmap_obstack_release (&predbitmap_obstack);
8768 +
8769 +  if (dump_file && (dump_flags & TDF_STATS))
8770 +    fprintf (dump_file, "Points to sets created:%d\n",
8771 +            stats.points_to_sets_created);
8772 +
8773 +  pointer_map_destroy (vi_for_tree);
8774 +  bitmap_obstack_release (&pta_obstack);
8775    VEC_free (constraint_t, heap, constraints);
8776 -  
8777 +
8778    for (i = 0; VEC_iterate (varinfo_t, varmap, i, v); i++)
8779 -    {
8780 -      /* Nonlocal vars may add more varinfos.  */
8781 -      if (i >= graph_size)
8782 -       break;
8783 +    VEC_free (constraint_t, heap, graph->complex[i]);
8784 +  free (graph->complex);
8785  
8786 -      VEC_free (constraint_edge_t, heap, graph->succs[i]);
8787 -      VEC_free (constraint_edge_t, heap, graph->preds[i]);
8788 -      VEC_free (constraint_t, heap, v->complex);
8789 -    }
8790 -  free (graph->zero_weight_preds);
8791 -  free (graph->zero_weight_succs);
8792 +  free (graph->rep);
8793    free (graph->succs);
8794 -  free (graph->preds);
8795 +  free (graph->indirect_cycles);
8796    free (graph);
8797  
8798    VEC_free (varinfo_t, heap, varmap);
8799    free_alloc_pool (variable_info_pool);
8800 -  free_alloc_pool (constraint_pool); 
8801 -  free_alloc_pool (constraint_edge_pool);
8802 -
8803 +  free_alloc_pool (constraint_pool);
8804    have_alias_info = false;
8805  }
8806  
8807 @@ -4905,6 +4960,7 @@
8808  static unsigned int
8809  ipa_pta_execute (void)
8810  {
8811 +#if 0
8812    struct cgraph_node *node;
8813    in_ipa_mode = 1;
8814    init_alias_heapvars ();
8815 @@ -4994,6 +5050,7 @@
8816    in_ipa_mode = 0;
8817    delete_alias_heapvars ();
8818    delete_points_to_sets ();
8819 +#endif
8820    return 0;
8821  }
8822    
8823 @@ -5018,8 +5075,9 @@
8824  void
8825  init_alias_heapvars (void)
8826  {
8827 -  heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
8828 -                                     NULL);
8829 +  if (!heapvar_for_stmt)
8830 +    heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
8831 +                                       NULL);
8832    nonlocal_all = NULL_TREE;
8833  }
8834  
8835 @@ -5028,7 +5086,7 @@
8836  {
8837    nonlocal_all = NULL_TREE;
8838    htab_delete (heapvar_for_stmt);
8839 +  heapvar_for_stmt = NULL;
8840  }
8841 -
8842    
8843  #include "gt-tree-ssa-structalias.h"
8844 Index: gcc/config/sparc/sparc.c
8845 ===================================================================
8846 --- gcc/config/sparc/sparc.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
8847 +++ gcc/config/sparc/sparc.c    (.../branches/gcc-4_2-branch)   (revision 126002)
8848 @@ -703,7 +703,7 @@
8849         error ("-mcmodel= is not supported on 32 bit systems");
8850      }
8851  
8852 -  fpu = TARGET_FPU; /* save current -mfpu status */
8853 +  fpu = target_flags & MASK_FPU; /* save current -mfpu status */
8854  
8855    /* Set the default CPU.  */
8856    for (def = &cpu_default[0]; def->name; ++def)
8857 @@ -7968,8 +7968,10 @@
8858     Expand builtin functions for sparc intrinsics.  */
8859  
8860  static rtx
8861 -sparc_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
8862 -                     enum machine_mode tmode, int ignore ATTRIBUTE_UNUSED)
8863 +sparc_expand_builtin (tree exp, rtx target,
8864 +                     rtx subtarget ATTRIBUTE_UNUSED,
8865 +                     enum machine_mode tmode ATTRIBUTE_UNUSED,
8866 +                     int ignore ATTRIBUTE_UNUSED)
8867  {
8868    tree arglist;
8869    tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
8870 @@ -7978,14 +7980,13 @@
8871    enum machine_mode mode[4];
8872    int arg_count = 0;
8873  
8874 -  mode[arg_count] = tmode;
8875 -
8876 -  if (target == 0
8877 -      || GET_MODE (target) != tmode
8878 -      || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
8879 -    op[arg_count] = gen_reg_rtx (tmode);
8880 +  mode[0] = insn_data[icode].operand[0].mode;
8881 +  if (!target
8882 +      || GET_MODE (target) != mode[0]
8883 +      || ! (*insn_data[icode].operand[0].predicate) (target, mode[0]))
8884 +    op[0] = gen_reg_rtx (mode[0]);
8885    else
8886 -    op[arg_count] = target;
8887 +    op[0] = target;
8888  
8889    for (arglist = TREE_OPERAND (exp, 1); arglist;
8890         arglist = TREE_CHAIN (arglist))
8891 @@ -8101,11 +8102,11 @@
8892  {
8893    tree arg0, arg1, arg2;
8894    tree rtype = TREE_TYPE (TREE_TYPE (fndecl));
8895 -  
8896  
8897 -  if (ignore && DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrsi_vis
8898 +  if (ignore
8899 +      && DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrsi_vis
8900        && DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrdi_vis)
8901 -    return build_int_cst (rtype, 0);
8902 +    return fold_convert (rtype, integer_zero_node);
8903  
8904    switch (DECL_FUNCTION_CODE (fndecl))
8905      {
8906 @@ -8219,6 +8220,7 @@
8907      default:
8908        break;
8909      }
8910 +
8911    return NULL_TREE;
8912  }
8913  \f
8914 Index: gcc/config/i386/i386.h
8915 ===================================================================
8916 --- gcc/config/i386/i386.h      (.../tags/gcc_4_2_0_release)    (revision 126002)
8917 +++ gcc/config/i386/i386.h      (.../branches/gcc-4_2-branch)   (revision 126002)
8918 @@ -2164,7 +2164,8 @@
8919  
8920  enum ix86_stack_slot
8921  {
8922 -  SLOT_TEMP = 0,
8923 +  SLOT_VIRTUAL = 0,
8924 +  SLOT_TEMP,
8925    SLOT_CW_STORED,
8926    SLOT_CW_TRUNC,
8927    SLOT_CW_FLOOR,
8928 Index: gcc/config/i386/i386.md
8929 ===================================================================
8930 --- gcc/config/i386/i386.md     (.../tags/gcc_4_2_0_release)    (revision 126002)
8931 +++ gcc/config/i386/i386.md     (.../branches/gcc-4_2-branch)   (revision 126002)
8932 @@ -3716,7 +3716,7 @@
8933      ;
8934    else
8935      {
8936 -      rtx temp = assign_386_stack_local (SFmode, SLOT_TEMP);
8937 +      rtx temp = assign_386_stack_local (SFmode, SLOT_VIRTUAL);
8938        emit_insn (gen_truncdfsf2_with_temp (operands[0], operands[1], temp));
8939        DONE;
8940      }
8941 @@ -3868,7 +3868,7 @@
8942        DONE;
8943      }
8944    else
8945 -    operands[2] = assign_386_stack_local (SFmode, SLOT_TEMP);
8946 +    operands[2] = assign_386_stack_local (SFmode, SLOT_VIRTUAL);
8947  })
8948  
8949  (define_insn "*truncxfsf2_mixed"
8950 @@ -3966,7 +3966,7 @@
8951        DONE;
8952      }
8953    else
8954 -    operands[2] = assign_386_stack_local (DFmode, SLOT_TEMP);
8955 +    operands[2] = assign_386_stack_local (DFmode, SLOT_VIRTUAL);
8956  })
8957  
8958  (define_insn "*truncxfdf2_mixed"
8959 @@ -4749,7 +4749,7 @@
8960  (define_insn "*addti3_1"
8961    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
8962         (plus:TI (match_operand:TI 1 "nonimmediate_operand" "%0,0")
8963 -                (match_operand:TI 2 "general_operand" "roiF,riF")))
8964 +                (match_operand:TI 2 "x86_64_general_operand" "roe,re")))
8965     (clobber (reg:CC FLAGS_REG))]
8966    "TARGET_64BIT && ix86_binary_operator_ok (PLUS, TImode, operands)"
8967    "#")
8968 @@ -4757,7 +4757,7 @@
8969  (define_split
8970    [(set (match_operand:TI 0 "nonimmediate_operand" "")
8971         (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
8972 -                (match_operand:TI 2 "general_operand" "")))
8973 +                (match_operand:TI 2 "x86_64_general_operand" "")))
8974     (clobber (reg:CC FLAGS_REG))]
8975    "TARGET_64BIT && reload_completed"
8976    [(parallel [(set (reg:CC FLAGS_REG) (unspec:CC [(match_dup 1) (match_dup 2)]
8977 @@ -6483,7 +6483,7 @@
8978  (define_insn "*subti3_1"
8979    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
8980         (minus:TI (match_operand:TI 1 "nonimmediate_operand" "0,0")
8981 -                 (match_operand:TI 2 "general_operand" "roiF,riF")))
8982 +                 (match_operand:TI 2 "x86_64_general_operand" "roe,re")))
8983     (clobber (reg:CC FLAGS_REG))]
8984    "TARGET_64BIT && ix86_binary_operator_ok (MINUS, TImode, operands)"
8985    "#")
8986 @@ -6491,7 +6491,7 @@
8987  (define_split
8988    [(set (match_operand:TI 0 "nonimmediate_operand" "")
8989         (minus:TI (match_operand:TI 1 "nonimmediate_operand" "")
8990 -                 (match_operand:TI 2 "general_operand" "")))
8991 +                 (match_operand:TI 2 "x86_64_general_operand" "")))
8992     (clobber (reg:CC FLAGS_REG))]
8993    "TARGET_64BIT && reload_completed"
8994    [(parallel [(set (reg:CC FLAGS_REG) (compare:CC (match_dup 1) (match_dup 2)))
8995 @@ -9326,7 +9326,7 @@
8996  
8997  (define_insn "*negti2_1"
8998    [(set (match_operand:TI 0 "nonimmediate_operand" "=ro")
8999 -       (neg:TI (match_operand:TI 1 "general_operand" "0")))
9000 +       (neg:TI (match_operand:TI 1 "nonimmediate_operand" "0")))
9001     (clobber (reg:CC FLAGS_REG))]
9002    "TARGET_64BIT
9003     && ix86_unary_operator_ok (NEG, TImode, operands)"
9004 @@ -9334,7 +9334,7 @@
9005  
9006  (define_split
9007    [(set (match_operand:TI 0 "nonimmediate_operand" "")
9008 -       (neg:TI (match_operand:TI 1 "general_operand" "")))
9009 +       (neg:TI (match_operand:TI 1 "nonimmediate_operand" "")))
9010     (clobber (reg:CC FLAGS_REG))]
9011    "TARGET_64BIT && reload_completed"
9012    [(parallel
9013 Index: gcc/config/i386/sse.md
9014 ===================================================================
9015 --- gcc/config/i386/sse.md      (.../tags/gcc_4_2_0_release)    (revision 126002)
9016 +++ gcc/config/i386/sse.md      (.../branches/gcc-4_2-branch)   (revision 126002)
9017 @@ -2055,11 +2055,11 @@
9018             (match_dup 1))
9019           (parallel [(const_int 0)
9020                      (const_int 2)])))]
9021 -  "TARGET_SSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9022 +  "TARGET_SSE3 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9023    "@
9024     movddup\t{%1, %0|%0, %1}
9025     #"
9026 -  [(set_attr "type" "sselog,ssemov")
9027 +  [(set_attr "type" "sselog1,ssemov")
9028     (set_attr "mode" "V2DF")])
9029  
9030  (define_split
9031 @@ -3494,9 +3494,10 @@
9032    "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9033    "@
9034     movhps\t{%1, %0|%0, %1}
9035 -   psrldq\t{$4, %0|%0, 4}
9036 +   psrldq\t{$8, %0|%0, 8}
9037     movq\t{%H1, %0|%0, %H1}"
9038    [(set_attr "type" "ssemov,sseishft,ssemov")
9039 +   (set_attr "memory" "*,none,*")
9040     (set_attr "mode" "V2SF,TI,TI")])
9041  
9042  ;; Not sure this is ever used, but it doesn't hurt to have it. -aoliva
9043 Index: gcc/config/i386/i386.c
9044 ===================================================================
9045 --- gcc/config/i386/i386.c      (.../tags/gcc_4_2_0_release)    (revision 126002)
9046 +++ gcc/config/i386/i386.c      (.../branches/gcc-4_2-branch)   (revision 126002)
9047 @@ -13478,6 +13478,9 @@
9048  
9049    gcc_assert (n < MAX_386_STACK_LOCALS);
9050  
9051 +  /* Virtual slot is valid only before vregs are instantiated.  */
9052 +  gcc_assert ((n == SLOT_VIRTUAL) == !virtuals_instantiated);
9053 +
9054    for (s = ix86_stack_locals; s; s = s->next)
9055      if (s->mode == mode && s->n == n)
9056        return s->rtl;
9057 @@ -14567,6 +14570,7 @@
9058    IX86_BUILTIN_VEC_EXT_V4SF,
9059    IX86_BUILTIN_VEC_EXT_V4SI,
9060    IX86_BUILTIN_VEC_EXT_V8HI,
9061 +  IX86_BUILTIN_VEC_EXT_V16QI,
9062    IX86_BUILTIN_VEC_EXT_V2SI,
9063    IX86_BUILTIN_VEC_EXT_V4HI,
9064    IX86_BUILTIN_VEC_SET_V8HI,
9065 @@ -15539,13 +15543,13 @@
9066    /* Access to the vec_extract patterns.  */
9067    ftype = build_function_type_list (double_type_node, V2DF_type_node,
9068                                     integer_type_node, NULL_TREE);
9069 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v2df",
9070 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v2df",
9071                ftype, IX86_BUILTIN_VEC_EXT_V2DF);
9072  
9073    ftype = build_function_type_list (long_long_integer_type_node,
9074                                     V2DI_type_node, integer_type_node,
9075                                     NULL_TREE);
9076 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v2di",
9077 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v2di",
9078                ftype, IX86_BUILTIN_VEC_EXT_V2DI);
9079  
9080    ftype = build_function_type_list (float_type_node, V4SF_type_node,
9081 @@ -15555,12 +15559,12 @@
9082  
9083    ftype = build_function_type_list (intSI_type_node, V4SI_type_node,
9084                                     integer_type_node, NULL_TREE);
9085 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v4si",
9086 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v4si",
9087                ftype, IX86_BUILTIN_VEC_EXT_V4SI);
9088  
9089    ftype = build_function_type_list (intHI_type_node, V8HI_type_node,
9090                                     integer_type_node, NULL_TREE);
9091 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_ext_v8hi",
9092 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v8hi",
9093                ftype, IX86_BUILTIN_VEC_EXT_V8HI);
9094  
9095    ftype = build_function_type_list (intHI_type_node, V4HI_type_node,
9096 @@ -15573,11 +15577,15 @@
9097    def_builtin (MASK_MMX, "__builtin_ia32_vec_ext_v2si",
9098                ftype, IX86_BUILTIN_VEC_EXT_V2SI);
9099  
9100 +  ftype = build_function_type_list (intQI_type_node, V16QI_type_node,
9101 +                                   integer_type_node, NULL_TREE);
9102 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_ext_v16qi", ftype, IX86_BUILTIN_VEC_EXT_V16QI);
9103 +
9104    /* Access to the vec_set patterns.  */
9105    ftype = build_function_type_list (V8HI_type_node, V8HI_type_node,
9106                                     intHI_type_node,
9107                                     integer_type_node, NULL_TREE);
9108 -  def_builtin (MASK_SSE, "__builtin_ia32_vec_set_v8hi",
9109 +  def_builtin (MASK_SSE2, "__builtin_ia32_vec_set_v8hi",
9110                ftype, IX86_BUILTIN_VEC_SET_V8HI);
9111  
9112    ftype = build_function_type_list (V4HI_type_node, V4HI_type_node,
9113 @@ -16121,13 +16129,13 @@
9114  
9115      case IX86_BUILTIN_LDMXCSR:
9116        op0 = expand_normal (TREE_VALUE (arglist));
9117 -      target = assign_386_stack_local (SImode, SLOT_TEMP);
9118 +      target = assign_386_stack_local (SImode, SLOT_VIRTUAL);
9119        emit_move_insn (target, op0);
9120        emit_insn (gen_sse_ldmxcsr (target));
9121        return 0;
9122  
9123      case IX86_BUILTIN_STMXCSR:
9124 -      target = assign_386_stack_local (SImode, SLOT_TEMP);
9125 +      target = assign_386_stack_local (SImode, SLOT_VIRTUAL);
9126        emit_insn (gen_sse_stmxcsr (target));
9127        return copy_to_mode_reg (SImode, target);
9128  
9129 @@ -16489,6 +16497,7 @@
9130      case IX86_BUILTIN_VEC_EXT_V4SF:
9131      case IX86_BUILTIN_VEC_EXT_V4SI:
9132      case IX86_BUILTIN_VEC_EXT_V8HI:
9133 +    case IX86_BUILTIN_VEC_EXT_V16QI:
9134      case IX86_BUILTIN_VEC_EXT_V2SI:
9135      case IX86_BUILTIN_VEC_EXT_V4HI:
9136        return ix86_expand_vec_ext_builtin (arglist, target);
9137 Index: gcc/config/sh/sh.c
9138 ===================================================================
9139 --- gcc/config/sh/sh.c  (.../tags/gcc_4_2_0_release)    (revision 126002)
9140 +++ gcc/config/sh/sh.c  (.../branches/gcc-4_2-branch)   (revision 126002)
9141 @@ -5295,7 +5295,13 @@
9142               temp = scavenge_reg (&temps);
9143             }
9144           if (temp < 0 && live_regs_mask)
9145 -           temp = scavenge_reg (live_regs_mask);
9146 +           {
9147 +             HARD_REG_SET temps;
9148 +
9149 +             COPY_HARD_REG_SET (temps, *live_regs_mask);
9150 +             CLEAR_HARD_REG_BIT (temps, REGNO (reg));
9151 +             temp = scavenge_reg (&temps);
9152 +           }
9153           if (temp < 0)
9154             {
9155               rtx adj_reg, tmp_reg, mem;
9156 @@ -5344,6 +5350,9 @@
9157               emit_move_insn (adj_reg, mem);
9158               mem = gen_tmp_stack_mem (Pmode, gen_rtx_POST_INC (Pmode, reg));
9159               emit_move_insn (tmp_reg, mem);
9160 +             /* Tell flow the insns that pop r4/r5 aren't dead.  */
9161 +             emit_insn (gen_rtx_USE (VOIDmode, tmp_reg));
9162 +             emit_insn (gen_rtx_USE (VOIDmode, adj_reg));
9163               return;
9164             }
9165           const_reg = gen_rtx_REG (GET_MODE (reg), temp);
9166 @@ -8618,7 +8627,7 @@
9167        else if (TARGET_SH4
9168                && get_attr_type (insn) == TYPE_DYN_SHIFT
9169                && get_attr_any_int_load (dep_insn) == ANY_INT_LOAD_YES
9170 -              && reg_overlap_mentioned_p (SET_DEST (PATTERN (dep_insn)),
9171 +              && reg_overlap_mentioned_p (SET_DEST (single_set (dep_insn)),
9172                                            XEXP (SET_SRC (single_set (insn)),
9173                                                  1)))
9174         cost++;
9175 Index: gcc/config/sh/sh.md
9176 ===================================================================
9177 --- gcc/config/sh/sh.md (.../tags/gcc_4_2_0_release)    (revision 126002)
9178 +++ gcc/config/sh/sh.md (.../branches/gcc-4_2-branch)   (revision 126002)
9179 @@ -413,10 +413,12 @@
9180          (eq_attr "type" "jump")
9181          (cond [(eq_attr "med_branch_p" "yes")
9182                 (const_int 2)
9183 -               (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")
9184 -                         (symbol_ref "INSN"))
9185 -                     (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")
9186 -                         (symbol_ref "code_for_indirect_jump_scratch")))
9187 +               (and (ne (symbol_ref "prev_nonnote_insn (insn)")
9188 +                        (const_int 0))
9189 +                    (and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))")
9190 +                             (symbol_ref "INSN"))
9191 +                         (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))")
9192 +                             (symbol_ref "code_for_indirect_jump_scratch"))))
9193                  (cond [(eq_attr "braf_branch_p" "yes")
9194                         (const_int 6)
9195                         (eq (symbol_ref "flag_pic") (const_int 0))
9196 @@ -750,54 +752,6 @@
9197     (set_attr "type" "arith3")])
9198  
9199  (define_insn "cmpeqsi_media"
9200 -  [(set (match_operand:DI 0 "register_operand" "=r")
9201 -       (eq:DI (match_operand:SI 1 "logical_operand" "%r")
9202 -              (match_operand:SI 2 "cmp_operand" "Nr")))]
9203 -  "TARGET_SHMEDIA"
9204 -  "cmpeq       %1, %N2, %0"
9205 -  [(set_attr "type" "cmp_media")])
9206 -
9207 -(define_insn "cmpeqdi_media"
9208 -  [(set (match_operand:DI 0 "register_operand" "=r")
9209 -       (eq:DI (match_operand:DI 1 "register_operand" "%r")
9210 -              (match_operand:DI 2 "cmp_operand" "Nr")))]
9211 -  "TARGET_SHMEDIA"
9212 -  "cmpeq       %1, %N2, %0"
9213 -  [(set_attr "type" "cmp_media")])
9214 -
9215 -(define_insn "cmpgtsi_media"
9216 -  [(set (match_operand:DI 0 "register_operand" "=r")
9217 -       (gt:DI (match_operand:SI 1 "cmp_operand" "Nr")
9218 -              (match_operand:SI 2 "cmp_operand" "rN")))]
9219 -  "TARGET_SHMEDIA"
9220 -  "cmpgt       %N1, %N2, %0"
9221 -  [(set_attr "type" "cmp_media")])
9222 -
9223 -(define_insn "cmpgtdi_media"
9224 -  [(set (match_operand:DI 0 "register_operand" "=r")
9225 -       (gt:DI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
9226 -              (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
9227 -  "TARGET_SHMEDIA"
9228 -  "cmpgt       %N1, %N2, %0"
9229 -  [(set_attr "type" "cmp_media")])
9230 -
9231 -(define_insn "cmpgtusi_media"
9232 -  [(set (match_operand:DI 0 "register_operand" "=r")
9233 -       (gtu:DI (match_operand:SI 1 "cmp_operand" "Nr")
9234 -               (match_operand:SI 2 "cmp_operand" "rN")))]
9235 -  "TARGET_SHMEDIA"
9236 -  "cmpgtu      %N1, %N2, %0"
9237 -  [(set_attr "type" "cmp_media")])
9238 -
9239 -(define_insn "cmpgtudi_media"
9240 -  [(set (match_operand:DI 0 "register_operand" "=r")
9241 -       (gtu:DI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
9242 -               (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
9243 -  "TARGET_SHMEDIA"
9244 -  "cmpgtu      %N1, %N2, %0"
9245 -  [(set_attr "type" "cmp_media")])
9246 -
9247 -(define_insn "cmpsieqsi_media"
9248    [(set (match_operand:SI 0 "register_operand" "=r")
9249         (eq:SI (match_operand:SI 1 "logical_operand" "%r")
9250                (match_operand:SI 2 "cmp_operand" "Nr")))]
9251 @@ -805,7 +759,7 @@
9252    "cmpeq       %1, %N2, %0"
9253    [(set_attr "type" "cmp_media")])
9254  
9255 -(define_insn "cmpsieqdi_media"
9256 +(define_insn "cmpeqdi_media"
9257    [(set (match_operand:SI 0 "register_operand" "=r")
9258         (eq:SI (match_operand:DI 1 "register_operand" "%r")
9259                (match_operand:DI 2 "cmp_operand" "Nr")))]
9260 @@ -813,7 +767,7 @@
9261    "cmpeq       %1, %N2, %0"
9262    [(set_attr "type" "cmp_media")])
9263  
9264 -(define_insn "cmpsigtsi_media"
9265 +(define_insn "cmpgtsi_media"
9266    [(set (match_operand:SI 0 "register_operand" "=r")
9267         (gt:SI (match_operand:SI 1 "cmp_operand" "Nr")
9268                (match_operand:SI 2 "cmp_operand" "rN")))]
9269 @@ -821,7 +775,7 @@
9270    "cmpgt       %N1, %N2, %0"
9271    [(set_attr "type" "cmp_media")])
9272  
9273 -(define_insn "cmpsigtdi_media"
9274 +(define_insn "cmpgtdi_media"
9275    [(set (match_operand:SI 0 "register_operand" "=r")
9276         (gt:SI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
9277                (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
9278 @@ -829,7 +783,7 @@
9279    "cmpgt       %N1, %N2, %0"
9280    [(set_attr "type" "cmp_media")])
9281  
9282 -(define_insn "cmpsigtusi_media"
9283 +(define_insn "cmpgtusi_media"
9284    [(set (match_operand:SI 0 "register_operand" "=r")
9285         (gtu:SI (match_operand:SI 1 "cmp_operand" "Nr")
9286                 (match_operand:SI 2 "cmp_operand" "rN")))]
9287 @@ -837,7 +791,7 @@
9288    "cmpgtu      %N1, %N2, %0"
9289    [(set_attr "type" "cmp_media")])
9290  
9291 -(define_insn "cmpsigtudi_media"
9292 +(define_insn "cmpgtudi_media"
9293    [(set (match_operand:SI 0 "register_operand" "=r")
9294         (gtu:SI (match_operand:DI 1 "arith_reg_or_0_operand" "Nr")
9295                 (match_operand:DI 2 "arith_reg_or_0_operand" "rN")))]
9296 @@ -846,13 +800,6 @@
9297    [(set_attr "type" "cmp_media")])
9298  
9299  ; These two patterns are for combine.
9300 -(define_insn "*cmpne0si_media"
9301 -  [(set (match_operand:DI 0 "register_operand" "=r")
9302 -       (ne:DI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 0)))]
9303 -  "TARGET_SHMEDIA"
9304 -  "cmpgtu      %1,r63,%0"
9305 -  [(set_attr "type" "cmp_media")])
9306 -
9307  (define_insn "*cmpne0sisi_media"
9308    [(set (match_operand:SI 0 "register_operand" "=r")
9309         (ne:SI (match_operand:SI 1 "arith_reg_operand" "r") (const_int 0)))]
9310 @@ -1177,7 +1124,7 @@
9311  {
9312    emit_insn (gen_movsicc_false (operands[0], operands[1], operands[2],
9313                                 operands[3]));
9314 -  emit_insn (gen_cmpsigtusi_media (operands[5], operands[4], operands[0]));
9315 +  emit_insn (gen_cmpgtusi_media (operands[5], operands[4], operands[0]));
9316    emit_insn (gen_movsicc_false (operands[0], operands[5], operands[4],
9317                                 operands[0]));
9318    DONE;
9319 @@ -7200,7 +7147,7 @@
9320  }")
9321  
9322  (define_expand "bunordered"
9323 -  [(set (match_dup 1) (unordered:DI (match_dup 2) (match_dup 3)))
9324 +  [(set (match_dup 1) (unordered:SI (match_dup 2) (match_dup 3)))
9325     (set (pc)
9326         (if_then_else (ne (match_dup 1) (const_int 0))
9327                       (match_operand 0 "" "")
9328 @@ -7209,7 +7156,7 @@
9329    "
9330  {
9331    operands[0] = gen_rtx_LABEL_REF (Pmode, operands[0]);
9332 -  operands[1] = gen_reg_rtx (DImode);
9333 +  operands[1] = gen_reg_rtx (SImode);
9334    operands[2] = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9335    operands[3] = force_reg (GET_MODE (sh_compare_op1), sh_compare_op1);
9336  }")
9337 @@ -8397,6 +8344,20 @@
9338                                              operands[2],
9339                                              gen_rtx_REG (Pmode, PIC_REG)));
9340  
9341 +  /* When stack protector inserts codes after the result is set to
9342 +     R0, @(rX, r12) will cause a spill failure for R0.  Don't schedule
9343 +     insns to avoid combining (set A (plus rX r12)) and (set op0 (mem A))
9344 +     when rX is a GOT address for the guard symbol.  Ugly but doesn't
9345 +     matter because this is a rare situation.  */
9346 +  if (!TARGET_SHMEDIA
9347 +      && flag_stack_protect
9348 +      && GET_CODE (operands[1]) == CONST
9349 +      && GET_CODE (XEXP (operands[1], 0)) == UNSPEC
9350 +      && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF
9351 +      && strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0),
9352 +                \"__stack_chk_guard\") == 0)
9353 +    emit_insn (gen_blockage ());
9354 +
9355    /* N.B. This is not constant for a GOTPLT relocation.  */
9356    mem = gen_rtx_MEM (Pmode, operands[3]);
9357    MEM_NOTRAP_P (mem) = 1;
9358 @@ -9112,6 +9073,8 @@
9359  {
9360    if (TARGET_SHMEDIA)
9361      {
9362 +      rtx reg;
9363 +
9364        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9365        if (sh_compare_op1 != const0_rtx)
9366         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9367 @@ -9126,26 +9089,26 @@
9368           switch (GET_MODE (sh_compare_op0))
9369             {
9370             case SImode:
9371 -             emit_insn (gen_cmpsieqsi_media (operands[0],
9372 +             emit_insn (gen_cmpeqsi_media (operands[0],
9373                                               sh_compare_op0, sh_compare_op1));
9374               break;
9375  
9376             case DImode:
9377 -             emit_insn (gen_cmpsieqdi_media (operands[0],
9378 +             emit_insn (gen_cmpeqdi_media (operands[0],
9379                                               sh_compare_op0, sh_compare_op1));
9380               break;
9381  
9382             case SFmode:
9383               if (! TARGET_SHMEDIA_FPU)
9384                 FAIL;
9385 -             emit_insn (gen_cmpsieqsf_media (operands[0],
9386 +             emit_insn (gen_cmpeqsf_media (operands[0],
9387                                               sh_compare_op0, sh_compare_op1));
9388               break;
9389  
9390             case DFmode:
9391               if (! TARGET_SHMEDIA_FPU)
9392                 FAIL;
9393 -             emit_insn (gen_cmpsieqdf_media (operands[0],
9394 +             emit_insn (gen_cmpeqdf_media (operands[0],
9395                                               sh_compare_op0, sh_compare_op1));
9396               break;
9397  
9398 @@ -9155,38 +9118,44 @@
9399           DONE;
9400         }
9401  
9402 -      if (GET_MODE (operands[0]) != DImode)
9403 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9404 +      reg = operands[0];
9405 +      if (GET_MODE (operands[0]) != SImode)
9406 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9407 +                            : gen_reg_rtx (SImode);
9408  
9409        switch (GET_MODE (sh_compare_op0))
9410         {
9411         case SImode:
9412 -         emit_insn (gen_cmpeqsi_media (operands[0],
9413 +         emit_insn (gen_cmpeqsi_media (reg,
9414                                         sh_compare_op0, sh_compare_op1));
9415           break;
9416  
9417         case DImode:
9418 -         emit_insn (gen_cmpeqdi_media (operands[0],
9419 +         emit_insn (gen_cmpeqdi_media (reg,
9420                                         sh_compare_op0, sh_compare_op1));
9421           break;
9422  
9423         case SFmode:
9424           if (! TARGET_SHMEDIA_FPU)
9425             FAIL;
9426 -         emit_insn (gen_cmpeqsf_media (operands[0],
9427 +         emit_insn (gen_cmpeqsf_media (reg,
9428                                         sh_compare_op0, sh_compare_op1));
9429           break;
9430  
9431         case DFmode:
9432           if (! TARGET_SHMEDIA_FPU)
9433             FAIL;
9434 -         emit_insn (gen_cmpeqdf_media (operands[0],
9435 +         emit_insn (gen_cmpeqdf_media (reg,
9436                                         sh_compare_op0, sh_compare_op1));
9437           break;
9438  
9439         default:
9440           FAIL;
9441         }
9442 +
9443 +      if (GET_MODE (operands[0]) == DImode)
9444 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9445 +
9446        DONE;
9447      }
9448    if (sh_expand_t_scc (EQ, operands[0]))
9449 @@ -9204,8 +9173,8 @@
9450  {
9451    if (TARGET_SHMEDIA)
9452      {
9453 -      if (GET_MODE (operands[0]) != DImode)
9454 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9455 +      rtx reg;
9456 +
9457        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9458        if (sh_compare_op1 != const0_rtx)
9459         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9460 @@ -9213,35 +9182,44 @@
9461                                     : GET_MODE (sh_compare_op1),
9462                                     sh_compare_op1);
9463  
9464 +      reg = operands[0];
9465 +      if (GET_MODE (operands[0]) != SImode)
9466 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9467 +                            : gen_reg_rtx (SImode);
9468 +
9469        switch (GET_MODE (sh_compare_op0))
9470         {
9471         case SImode:
9472 -         emit_insn (gen_cmpgtsi_media (operands[0],
9473 +         emit_insn (gen_cmpgtsi_media (reg,
9474                                         sh_compare_op1, sh_compare_op0));
9475           break;
9476  
9477         case DImode:
9478 -         emit_insn (gen_cmpgtdi_media (operands[0],
9479 +         emit_insn (gen_cmpgtdi_media (reg,
9480                                         sh_compare_op1, sh_compare_op0));
9481           break;
9482  
9483         case SFmode:
9484           if (! TARGET_SHMEDIA_FPU)
9485             FAIL;
9486 -         emit_insn (gen_cmpgtsf_media (operands[0],
9487 +         emit_insn (gen_cmpgtsf_media (reg,
9488                                         sh_compare_op1, sh_compare_op0));
9489           break;
9490  
9491         case DFmode:
9492           if (! TARGET_SHMEDIA_FPU)
9493             FAIL;
9494 -         emit_insn (gen_cmpgtdf_media (operands[0],
9495 +         emit_insn (gen_cmpgtdf_media (reg,
9496                                         sh_compare_op1, sh_compare_op0));
9497           break;
9498  
9499         default:
9500           FAIL;
9501         }
9502 +
9503 +      if (GET_MODE (operands[0]) == DImode)
9504 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9505 +
9506        DONE;
9507      }
9508    if (! currently_expanding_to_rtl)
9509 @@ -9258,8 +9236,8 @@
9510  
9511    if (TARGET_SHMEDIA)
9512      {
9513 -      if (GET_MODE (operands[0]) != DImode)
9514 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9515 +      rtx reg;
9516 +
9517        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9518        if (sh_compare_op1 != const0_rtx)
9519         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9520 @@ -9267,45 +9245,54 @@
9521                                     : GET_MODE (sh_compare_op1),
9522                                     sh_compare_op1);
9523  
9524 +      reg = operands[0];
9525 +      if (GET_MODE (operands[0]) != SImode)
9526 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9527 +                            : gen_reg_rtx (SImode);
9528 +
9529        switch (GET_MODE (sh_compare_op0))
9530         {
9531         case SImode:
9532           {
9533 -           tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
9534 +           tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
9535  
9536             emit_insn (gen_cmpgtsi_media (tmp,
9537                                           sh_compare_op0, sh_compare_op1));
9538 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
9539 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
9540             break;
9541           }
9542  
9543         case DImode:
9544           {
9545 -           tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
9546 +           tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
9547  
9548             emit_insn (gen_cmpgtdi_media (tmp,
9549                                           sh_compare_op0, sh_compare_op1));
9550 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
9551 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
9552             break;
9553           }
9554  
9555         case SFmode:
9556           if (! TARGET_SHMEDIA_FPU)
9557             FAIL;
9558 -         emit_insn (gen_cmpgesf_media (operands[0],
9559 +         emit_insn (gen_cmpgesf_media (reg,
9560                                         sh_compare_op1, sh_compare_op0));
9561           break;
9562  
9563         case DFmode:
9564           if (! TARGET_SHMEDIA_FPU)
9565             FAIL;
9566 -         emit_insn (gen_cmpgedf_media (operands[0],
9567 +         emit_insn (gen_cmpgedf_media (reg,
9568                                         sh_compare_op1, sh_compare_op0));
9569           break;
9570  
9571         default:
9572           FAIL;
9573         }
9574 +
9575 +      if (GET_MODE (operands[0]) == DImode)
9576 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9577 +
9578        DONE;
9579      }
9580  
9581 @@ -9323,8 +9310,12 @@
9582  {
9583    if (TARGET_SHMEDIA)
9584      {
9585 -      if (GET_MODE (operands[0]) != DImode)
9586 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9587 +      rtx reg;
9588 +
9589 +      reg = operands[0];
9590 +      if (GET_MODE (operands[0]) != SImode)
9591 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9592 +                            : gen_reg_rtx (SImode);
9593        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9594        if (sh_compare_op1 != const0_rtx)
9595         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9596 @@ -9335,32 +9326,36 @@
9597        switch (GET_MODE (sh_compare_op0))
9598         {
9599         case SImode:
9600 -         emit_insn (gen_cmpgtsi_media (operands[0],
9601 +         emit_insn (gen_cmpgtsi_media (reg,
9602                                         sh_compare_op0, sh_compare_op1));
9603           break;
9604  
9605         case DImode:
9606 -         emit_insn (gen_cmpgtdi_media (operands[0],
9607 +         emit_insn (gen_cmpgtdi_media (reg,
9608                                         sh_compare_op0, sh_compare_op1));
9609           break;
9610  
9611         case SFmode:
9612           if (! TARGET_SHMEDIA_FPU)
9613             FAIL;
9614 -         emit_insn (gen_cmpgtsf_media (operands[0],
9615 +         emit_insn (gen_cmpgtsf_media (reg,
9616                                         sh_compare_op0, sh_compare_op1));
9617           break;
9618  
9619         case DFmode:
9620           if (! TARGET_SHMEDIA_FPU)
9621             FAIL;
9622 -         emit_insn (gen_cmpgtdf_media (operands[0],
9623 +         emit_insn (gen_cmpgtdf_media (reg,
9624                                         sh_compare_op0, sh_compare_op1));
9625           break;
9626  
9627         default:
9628           FAIL;
9629         }
9630 +
9631 +      if (GET_MODE (operands[0]) == DImode)
9632 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9633 +
9634        DONE;
9635      }
9636    if (! currently_expanding_to_rtl)
9637 @@ -9376,12 +9371,15 @@
9638  {
9639    if (TARGET_SHMEDIA)
9640      {
9641 +      rtx reg;
9642        enum machine_mode mode = GET_MODE (sh_compare_op0);
9643  
9644        if ((mode) == VOIDmode)
9645         mode = GET_MODE (sh_compare_op1);
9646 -      if (GET_MODE (operands[0]) != DImode)
9647 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9648 +      reg = operands[0];
9649 +      if (GET_MODE (operands[0]) != SImode)
9650 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9651 +                            : gen_reg_rtx (SImode);
9652        sh_compare_op0 = force_reg (mode, sh_compare_op0);
9653        if (sh_compare_op1 != const0_rtx)
9654         sh_compare_op1 = force_reg (mode, sh_compare_op1);
9655 @@ -9390,41 +9388,45 @@
9656         {
9657         case SImode:
9658           {
9659 -           rtx tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
9660 +           rtx tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
9661  
9662             emit_insn (gen_cmpgtsi_media (tmp,
9663                                           sh_compare_op1, sh_compare_op0));
9664 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
9665 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
9666             break;
9667           }
9668  
9669         case DImode:
9670           {
9671 -           rtx tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
9672 +           rtx tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
9673  
9674             emit_insn (gen_cmpgtdi_media (tmp,
9675                                           sh_compare_op1, sh_compare_op0));
9676 -           emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
9677 +           emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
9678             break;
9679           }
9680  
9681         case SFmode:
9682           if (! TARGET_SHMEDIA_FPU)
9683             FAIL;
9684 -         emit_insn (gen_cmpgesf_media (operands[0],
9685 +         emit_insn (gen_cmpgesf_media (reg,
9686                                         sh_compare_op0, sh_compare_op1));
9687           break;
9688  
9689         case DFmode:
9690           if (! TARGET_SHMEDIA_FPU)
9691             FAIL;
9692 -         emit_insn (gen_cmpgedf_media (operands[0],
9693 +         emit_insn (gen_cmpgedf_media (reg,
9694                                         sh_compare_op0, sh_compare_op1));
9695           break;
9696  
9697         default:
9698           FAIL;
9699         }
9700 +
9701 +      if (GET_MODE (operands[0]) == DImode)
9702 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9703 +
9704        DONE;
9705      }
9706  
9707 @@ -9456,8 +9458,12 @@
9708  {
9709    if (TARGET_SHMEDIA)
9710      {
9711 -      if (GET_MODE (operands[0]) != DImode)
9712 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9713 +      rtx reg;
9714 +
9715 +      reg = operands[0];
9716 +      if (GET_MODE (operands[0]) == DImode)
9717 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9718 +                            : gen_reg_rtx (SImode);
9719        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9720        if (sh_compare_op1 != const0_rtx)
9721         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9722 @@ -9465,8 +9471,11 @@
9723                                     : GET_MODE (sh_compare_op1),
9724                                     sh_compare_op1);
9725  
9726 -      emit_insn (gen_cmpgtudi_media (operands[0],
9727 +      emit_insn (gen_cmpgtudi_media (reg,
9728                                      sh_compare_op0, sh_compare_op1));
9729 +      if (GET_MODE (operands[0]) == DImode)
9730 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9731 +
9732        DONE;
9733      }
9734    if (! currently_expanding_to_rtl)
9735 @@ -9482,8 +9491,12 @@
9736  {
9737    if (TARGET_SHMEDIA)
9738      {
9739 -      if (GET_MODE (operands[0]) != DImode)
9740 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9741 +      rtx reg;
9742 +
9743 +      reg = operands[0];
9744 +      if (GET_MODE (operands[0]) == DImode)
9745 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9746 +                            : gen_reg_rtx (SImode);
9747        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9748        if (sh_compare_op1 != const0_rtx)
9749         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9750 @@ -9491,8 +9504,11 @@
9751                                     : GET_MODE (sh_compare_op1),
9752                                     sh_compare_op1);
9753  
9754 -      emit_insn (gen_cmpgtudi_media (operands[0],
9755 +      emit_insn (gen_cmpgtudi_media (reg,
9756                                      sh_compare_op1, sh_compare_op0));
9757 +      if (GET_MODE (operands[0]) == DImode)
9758 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9759 +
9760        DONE;
9761      }
9762    if (! currently_expanding_to_rtl)
9763 @@ -9508,10 +9524,12 @@
9764  {
9765    if (TARGET_SHMEDIA)
9766      {
9767 -      rtx tmp;
9768 +      rtx tmp, reg;
9769  
9770 -      if (GET_MODE (operands[0]) != DImode)
9771 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9772 +      reg = operands[0];
9773 +      if (GET_MODE (operands[0]) != SImode)
9774 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9775 +                            : gen_reg_rtx (SImode);
9776        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9777        if (sh_compare_op1 != const0_rtx)
9778         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9779 @@ -9519,10 +9537,12 @@
9780                                     : GET_MODE (sh_compare_op1),
9781                                     sh_compare_op1);
9782  
9783 -      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
9784 +      tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
9785  
9786        emit_insn (gen_cmpgtudi_media (tmp, sh_compare_op0, sh_compare_op1));
9787 -      emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
9788 +      emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
9789 +      if (GET_MODE (operands[0]) == DImode)
9790 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9791  
9792        DONE;
9793      }
9794 @@ -9539,10 +9559,12 @@
9795  {
9796    if (TARGET_SHMEDIA)
9797      {
9798 -      rtx tmp;
9799 +      rtx tmp, reg;
9800  
9801 -      if (GET_MODE (operands[0]) != DImode)
9802 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9803 +      reg = operands[0];
9804 +      if (GET_MODE (operands[0]) != SImode)
9805 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9806 +                            : gen_reg_rtx (SImode);
9807        sh_compare_op0 = force_reg (GET_MODE (sh_compare_op0), sh_compare_op0);
9808        if (sh_compare_op1 != const0_rtx)
9809         sh_compare_op1 = force_reg (GET_MODE (sh_compare_op1) == VOIDmode
9810 @@ -9550,10 +9572,12 @@
9811                                     : GET_MODE (sh_compare_op1),
9812                                     sh_compare_op1);
9813  
9814 -      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
9815 +      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (SImode);
9816  
9817        emit_insn (gen_cmpgtudi_media (tmp, sh_compare_op1, sh_compare_op0));
9818 -      emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
9819 +      emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
9820 +      if (GET_MODE (operands[0]) == DImode)
9821 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9822  
9823        DONE;
9824      }
9825 @@ -9584,11 +9608,12 @@
9826  {
9827    if (TARGET_SHMEDIA)
9828      {
9829 -      rtx tmp;
9830 +      rtx tmp, reg;
9831  
9832 -      if (GET_MODE (operands[0]) != DImode)
9833 -       operands[0] = gen_rtx_SUBREG (DImode, operands[0], 0);
9834 -
9835 +      reg = operands[0];
9836 +      if (GET_MODE (operands[0]) != SImode)
9837 +       reg = no_new_pseudos ? gen_rtx_SUBREG (SImode, operands[0], 0)
9838 +                            : gen_reg_rtx (SImode);
9839        if (! TARGET_SHMEDIA_FPU
9840           && GET_MODE (sh_compare_op0) != DImode
9841           && GET_MODE (sh_compare_op0) != SImode)
9842 @@ -9601,10 +9626,12 @@
9843                                     : GET_MODE (sh_compare_op1),
9844                                     sh_compare_op1);
9845  
9846 -      tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
9847 +      tmp = no_new_pseudos ? reg : gen_reg_rtx (SImode);
9848  
9849        emit_insn (gen_seq (tmp));
9850 -      emit_insn (gen_cmpeqdi_media (operands[0], tmp, const0_rtx));
9851 +      emit_insn (gen_cmpeqdi_media (reg, tmp, const0_rtx));
9852 +      if (GET_MODE (operands[0]) == DImode)
9853 +       emit_insn (gen_extendsidi2 (operands[0], reg));
9854  
9855        DONE;
9856      }
9857 @@ -9618,8 +9645,8 @@
9858  }")
9859  
9860  (define_expand "sunordered"
9861 -  [(set (match_operand:DI 0 "arith_reg_operand" "")
9862 -       (unordered:DI (match_dup 1) (match_dup 2)))]
9863 +  [(set (match_operand:SI 0 "arith_reg_operand" "")
9864 +       (unordered:SI (match_dup 1) (match_dup 2)))]
9865    "TARGET_SHMEDIA_FPU"
9866    "
9867  {
9868 @@ -10378,14 +10405,6 @@
9869     (set_attr "fp_mode" "single")])
9870  
9871  (define_insn "cmpeqsf_media"
9872 -  [(set (match_operand:DI 0 "register_operand" "=r")
9873 -       (eq:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9874 -              (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
9875 -  "TARGET_SHMEDIA_FPU"
9876 -  "fcmpeq.s    %1, %2, %0"
9877 -  [(set_attr "type" "fcmp_media")])
9878 -
9879 -(define_insn "cmpsieqsf_media"
9880    [(set (match_operand:SI 0 "register_operand" "=r")
9881         (eq:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9882                (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
9883 @@ -10394,24 +10413,24 @@
9884    [(set_attr "type" "fcmp_media")])
9885  
9886  (define_insn "cmpgtsf_media"
9887 -  [(set (match_operand:DI 0 "register_operand" "=r")
9888 -       (gt:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9889 +  [(set (match_operand:SI 0 "register_operand" "=r")
9890 +       (gt:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9891                (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
9892    "TARGET_SHMEDIA_FPU"
9893    "fcmpgt.s    %1, %2, %0"
9894    [(set_attr "type" "fcmp_media")])
9895  
9896  (define_insn "cmpgesf_media"
9897 -  [(set (match_operand:DI 0 "register_operand" "=r")
9898 -       (ge:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9899 +  [(set (match_operand:SI 0 "register_operand" "=r")
9900 +       (ge:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9901                (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
9902    "TARGET_SHMEDIA_FPU"
9903    "fcmpge.s    %1, %2, %0"
9904    [(set_attr "type" "fcmp_media")])
9905  
9906  (define_insn "cmpunsf_media"
9907 -  [(set (match_operand:DI 0 "register_operand" "=r")
9908 -       (unordered:DI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9909 +  [(set (match_operand:SI 0 "register_operand" "=r")
9910 +       (unordered:SI (match_operand:SF 1 "fp_arith_reg_operand" "f")
9911                       (match_operand:SF 2 "fp_arith_reg_operand" "f")))]
9912    "TARGET_SHMEDIA_FPU"
9913    "fcmpun.s    %1, %2, %0"
9914 @@ -10884,14 +10903,6 @@
9915     (set_attr "fp_mode" "double")])
9916  
9917  (define_insn "cmpeqdf_media"
9918 -  [(set (match_operand:DI 0 "register_operand" "=r")
9919 -       (eq:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9920 -              (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
9921 -  "TARGET_SHMEDIA_FPU"
9922 -  "fcmpeq.d    %1,%2,%0"
9923 -  [(set_attr "type" "fcmp_media")])
9924 -
9925 -(define_insn "cmpsieqdf_media"
9926    [(set (match_operand:SI 0 "register_operand" "=r")
9927         (eq:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9928                (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
9929 @@ -10900,24 +10911,24 @@
9930    [(set_attr "type" "fcmp_media")])
9931  
9932  (define_insn "cmpgtdf_media"
9933 -  [(set (match_operand:DI 0 "register_operand" "=r")
9934 -       (gt:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9935 +  [(set (match_operand:SI 0 "register_operand" "=r")
9936 +       (gt:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9937                (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
9938    "TARGET_SHMEDIA_FPU"
9939    "fcmpgt.d    %1,%2,%0"
9940    [(set_attr "type" "fcmp_media")])
9941  
9942  (define_insn "cmpgedf_media"
9943 -  [(set (match_operand:DI 0 "register_operand" "=r")
9944 -       (ge:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9945 +  [(set (match_operand:SI 0 "register_operand" "=r")
9946 +       (ge:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9947                (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
9948    "TARGET_SHMEDIA_FPU"
9949    "fcmpge.d    %1,%2,%0"
9950    [(set_attr "type" "fcmp_media")])
9951  
9952  (define_insn "cmpundf_media"
9953 -  [(set (match_operand:DI 0 "register_operand" "=r")
9954 -       (unordered:DI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9955 +  [(set (match_operand:SI 0 "register_operand" "=r")
9956 +       (unordered:SI (match_operand:DF 1 "fp_arith_reg_operand" "f")
9957                       (match_operand:DF 2 "fp_arith_reg_operand" "f")))]
9958    "TARGET_SHMEDIA_FPU"
9959    "fcmpun.d    %1,%2,%0"
9960 Index: gcc/config/score/predicates.md
9961 ===================================================================
9962 --- gcc/config/score/predicates.md      (.../tags/gcc_4_2_0_release)    (revision 126002)
9963 +++ gcc/config/score/predicates.md      (.../branches/gcc-4_2-branch)   (revision 126002)
9964 @@ -75,14 +75,3 @@
9965    return IMM_IN_RANGE (INTVAL (op), 15, 1);
9966  })
9967  
9968 -(define_predicate "const_pow2"
9969 -  (match_code "const_int")
9970 -{
9971 -  return IMM_IS_POW_OF_2 ((unsigned HOST_WIDE_INT) INTVAL (op), 0, 31);
9972 -})
9973 -
9974 -(define_predicate "const_npow2"
9975 -  (match_code "const_int")
9976 -{
9977 -  return IMM_IS_POW_OF_2 (~(unsigned HOST_WIDE_INT) INTVAL (op), 0, 31);
9978 -})
9979 Index: gcc/config/score/misc.md
9980 ===================================================================
9981 --- gcc/config/score/misc.md    (.../tags/gcc_4_2_0_release)    (revision 126002)
9982 +++ gcc/config/score/misc.md    (.../branches/gcc-4_2-branch)   (revision 126002)
9983 @@ -380,38 +380,3 @@
9984    [(set_attr "type" "arith")
9985     (set_attr "mode" "SI")])
9986  
9987 -(define_insn "bitclr_c"
9988 -  [(set (match_operand:SI 0 "register_operand" "=e,d")
9989 -        (and:SI (match_operand:SI 1 "register_operand" "0,d")
9990 -                (match_operand:SI 2 "const_npow2")))
9991 -   (clobber (reg:CC CC_REGNUM))]
9992 -  ""
9993 -  "@
9994 -   bitclr!    %0, %F2
9995 -   bitclr.c   %0, %1, %F2"
9996 -  [(set_attr "type" "arith")
9997 -   (set_attr "mode" "SI")])
9998 -
9999 -(define_insn "bitset_c"
10000 -  [(set (match_operand:SI 0 "register_operand" "=e,d")
10001 -        (ior:SI (match_operand:SI 1 "register_operand" "0,d")
10002 -                (match_operand:SI 2 "const_pow2")))
10003 -   (clobber (reg:CC CC_REGNUM))]
10004 -  ""
10005 -  "@
10006 -   bitset!    %0, %E2
10007 -   bitset.c   %0, %1, %E2"
10008 -  [(set_attr "type" "arith")
10009 -   (set_attr "mode" "SI")])
10010 -
10011 -(define_insn "bittgl_c"
10012 -  [(set (match_operand:SI 0 "register_operand" "=e,d")
10013 -        (xor:SI (match_operand:SI 1 "register_operand" "0,d")
10014 -                (match_operand:SI 2 "const_pow2")))
10015 -   (clobber (reg:CC CC_REGNUM))]
10016 -  ""
10017 -  "@
10018 -   bittgl!    %0, %E2
10019 -   bittgl.c   %0, %1, %E2"
10020 -  [(set_attr "type" "arith")
10021 -   (set_attr "mode" "SI")])
10022 Index: gcc/config/score/score.c
10023 ===================================================================
10024 --- gcc/config/score/score.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
10025 +++ gcc/config/score/score.c    (.../branches/gcc-4_2-branch)   (revision 126002)
10026 @@ -1168,7 +1168,7 @@
10027      {
10028        gcc_assert (code == CONST_INT);
10029        fprintf (file, HOST_WIDE_INT_PRINT_HEX,
10030 -               (unsigned HOST_WIDE_INT) INTVAL (op) >> 16);
10031 +               (INTVAL (op) >> 16) & 0xffff);
10032      }
10033    else if (c == 'D')
10034      {
10035 @@ -1176,7 +1176,7 @@
10036          {
10037            rtx temp = gen_lowpart (SImode, op);
10038            gcc_assert (GET_MODE (op) == SFmode);
10039 -          fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp));
10040 +          fprintf (file, HOST_WIDE_INT_PRINT_HEX, INTVAL (temp) & 0xffffffff);
10041          }
10042        else
10043          output_addr_const (file, op);
10044 Index: gcc/config/score/score.h
10045 ===================================================================
10046 --- gcc/config/score/score.h    (.../tags/gcc_4_2_0_release)    (revision 126002)
10047 +++ gcc/config/score/score.h    (.../branches/gcc-4_2-branch)   (revision 126002)
10048 @@ -785,6 +785,7 @@
10049     output anything and let undefined symbol become external. However
10050     the assembler uses length information on externals to allocate in
10051     data/sdata bss/sbss, thereby saving exec time.  */
10052 +#undef ASM_OUTPUT_EXTERNAL
10053  #define ASM_OUTPUT_EXTERNAL(STREAM, DECL, NAME) \
10054    score_output_external (STREAM, DECL, NAME)
10055  
10056 Index: gcc/config/pa/pa.md
10057 ===================================================================
10058 --- gcc/config/pa/pa.md (.../tags/gcc_4_2_0_release)    (revision 126002)
10059 +++ gcc/config/pa/pa.md (.../branches/gcc-4_2-branch)   (revision 126002)
10060 @@ -39,6 +39,9 @@
10061     (UNSPEC_TLSLDBASE   7)
10062     (UNSPEC_TLSIE       8)
10063     (UNSPEC_TLSLE       9)
10064 +   (UNSPEC_TLSGD_PIC   10)
10065 +   (UNSPEC_TLSLDM_PIC  11)
10066 +   (UNSPEC_TLSIE_PIC   12)
10067    ])
10068  
10069  ;; UNSPEC_VOLATILE:
10070 @@ -9890,33 +9893,55 @@
10071  (define_insn "tgd_load"
10072   [(set (match_operand:SI 0 "register_operand" "=r")
10073         (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD))
10074 -  (clobber (reg:SI 1))]
10075 +  (clobber (reg:SI 1))
10076 +  (use (reg:SI 27))]
10077    ""
10078    "*
10079  {
10080 -  if (flag_pic)
10081 -    return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
10082 -  else
10083 -    return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
10084 +  return \"addil LR'%1-$tls_gdidx$,%%r27\;ldo RR'%1-$tls_gdidx$(%%r1),%0\";
10085  }"
10086    [(set_attr "type" "multi")
10087     (set_attr "length" "8")])
10088  
10089 +(define_insn "tgd_load_pic"
10090 + [(set (match_operand:SI 0 "register_operand" "=r")
10091 +       (unspec:SI [(match_operand 1 "tgd_symbolic_operand" "")] UNSPEC_TLSGD_PIC))
10092 +  (clobber (reg:SI 1))
10093 +  (use (reg:SI 19))]
10094 +  ""
10095 +  "*
10096 +{
10097 +  return \"addil LT'%1-$tls_gdidx$,%%r19\;ldo RT'%1-$tls_gdidx$(%%r1),%0\";
10098 +}"
10099 +  [(set_attr "type" "multi")
10100 +   (set_attr "length" "8")])
10101 +
10102  (define_insn "tld_load"
10103   [(set (match_operand:SI 0 "register_operand" "=r")
10104         (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM))
10105 -  (clobber (reg:SI 1))]
10106 +  (clobber (reg:SI 1))
10107 +  (use (reg:SI 27))]
10108    ""
10109    "*
10110  {
10111 -  if (flag_pic)
10112 -    return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
10113 -  else
10114 -    return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
10115 +  return \"addil LR'%1-$tls_ldidx$,%%r27\;ldo RR'%1-$tls_ldidx$(%%r1),%0\";
10116  }"
10117    [(set_attr "type" "multi")
10118     (set_attr "length" "8")])
10119  
10120 +(define_insn "tld_load_pic"
10121 + [(set (match_operand:SI 0 "register_operand" "=r")
10122 +       (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] UNSPEC_TLSLDM_PIC))
10123 +  (clobber (reg:SI 1))
10124 +  (use (reg:SI 19))]
10125 +  ""
10126 +  "*
10127 +{
10128 +  return \"addil LT'%1-$tls_ldidx$,%%r19\;ldo RT'%1-$tls_ldidx$(%%r1),%0\";
10129 +}"
10130 +  [(set_attr "type" "multi")
10131 +   (set_attr "length" "8")])
10132 +
10133  (define_insn "tld_offset_load"
10134    [(set (match_operand:SI 0 "register_operand" "=r")
10135          (plus:SI (unspec:SI [(match_operand 1 "tld_symbolic_operand" "")] 
10136 @@ -9942,18 +9967,29 @@
10137  (define_insn "tie_load"
10138    [(set (match_operand:SI 0 "register_operand" "=r")
10139          (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE))
10140 -   (clobber (reg:SI 1))]
10141 +   (clobber (reg:SI 1))
10142 +   (use (reg:SI 27))]
10143    ""
10144    "*
10145  {
10146 -  if (flag_pic)
10147 -    return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
10148 -  else
10149 -    return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
10150 +  return \"addil LR'%1-$tls_ieoff$,%%r27\;ldw RR'%1-$tls_ieoff$(%%r1),%0\";
10151  }"
10152    [(set_attr "type" "multi")
10153     (set_attr "length" "8")])
10154  
10155 +(define_insn "tie_load_pic"
10156 +  [(set (match_operand:SI 0 "register_operand" "=r")
10157 +        (unspec:SI [(match_operand 1 "tie_symbolic_operand" "")] UNSPEC_TLSIE_PIC))
10158 +   (clobber (reg:SI 1))
10159 +   (use (reg:SI 19))]
10160 +  ""
10161 +  "*
10162 +{
10163 +  return \"addil LT'%1-$tls_ieoff$,%%r19\;ldw RT'%1-$tls_ieoff$(%%r1),%0\";
10164 +}"
10165 +  [(set_attr "type" "multi")
10166 +   (set_attr "length" "8")])
10167 +
10168  (define_insn "tle_load"
10169    [(set (match_operand:SI 0 "register_operand" "=r")
10170          (plus:SI (unspec:SI [(match_operand 1 "tle_symbolic_operand" "")] 
10171 Index: gcc/config/pa/pa.c
10172 ===================================================================
10173 --- gcc/config/pa/pa.c  (.../tags/gcc_4_2_0_release)    (revision 126002)
10174 +++ gcc/config/pa/pa.c  (.../branches/gcc-4_2-branch)   (revision 126002)
10175 @@ -726,7 +726,10 @@
10176      {
10177        case TLS_MODEL_GLOBAL_DYNAMIC:
10178         tmp = gen_reg_rtx (Pmode);
10179 -       emit_insn (gen_tgd_load (tmp, addr));
10180 +       if (flag_pic)
10181 +         emit_insn (gen_tgd_load_pic (tmp, addr));
10182 +       else
10183 +         emit_insn (gen_tgd_load (tmp, addr));
10184         ret = hppa_tls_call (tmp);
10185         break;
10186  
10187 @@ -734,7 +737,10 @@
10188         ret = gen_reg_rtx (Pmode);
10189         tmp = gen_reg_rtx (Pmode);
10190         start_sequence ();
10191 -       emit_insn (gen_tld_load (tmp, addr));
10192 +       if (flag_pic)
10193 +         emit_insn (gen_tld_load_pic (tmp, addr));
10194 +       else
10195 +         emit_insn (gen_tld_load (tmp, addr));
10196         t1 = hppa_tls_call (tmp);
10197         insn = get_insns ();
10198         end_sequence ();
10199 @@ -750,7 +756,10 @@
10200         tmp = gen_reg_rtx (Pmode);
10201         ret = gen_reg_rtx (Pmode);
10202         emit_insn (gen_tp_load (tp));
10203 -       emit_insn (gen_tie_load (tmp, addr));
10204 +       if (flag_pic)
10205 +         emit_insn (gen_tie_load_pic (tmp, addr));
10206 +       else
10207 +         emit_insn (gen_tie_load (tmp, addr));
10208         emit_move_insn (ret, gen_rtx_PLUS (Pmode, tp, tmp));
10209         break;
10210  
10211 Index: gcc/config/soft-fp/quad.h
10212 ===================================================================
10213 --- gcc/config/soft-fp/quad.h   (.../tags/gcc_4_2_0_release)    (revision 126002)
10214 +++ gcc/config/soft-fp/quad.h   (.../branches/gcc-4_2-branch)   (revision 126002)
10215 @@ -1,6 +1,6 @@
10216  /* Software floating-point emulation.
10217     Definitions for IEEE Quad Precision.
10218 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
10219 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
10220     This file is part of the GNU C Library.
10221     Contributed by Richard Henderson (rth@cygnus.com),
10222                   Jakub Jelinek (jj@ultra.linux.cz),
10223 @@ -176,15 +176,15 @@
10224    } longs;
10225    struct {
10226  #if __BYTE_ORDER == __BIG_ENDIAN
10227 -    unsigned sign  : 1;
10228 -    unsigned exp   : _FP_EXPBITS_Q;
10229 -    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
10230 -    unsigned long frac0 : _FP_W_TYPE_SIZE;
10231 +    unsigned sign    : 1;
10232 +    unsigned exp     : _FP_EXPBITS_Q;
10233 +    _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
10234 +    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
10235  #else
10236 -    unsigned long frac0 : _FP_W_TYPE_SIZE;
10237 -    unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
10238 -    unsigned exp   : _FP_EXPBITS_Q;
10239 -    unsigned sign  : 1;
10240 +    _FP_W_TYPE frac0 : _FP_W_TYPE_SIZE;
10241 +    _FP_W_TYPE frac1 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0) - _FP_W_TYPE_SIZE;
10242 +    unsigned exp     : _FP_EXPBITS_Q;
10243 +    unsigned sign    : 1;
10244  #endif
10245    } bits;
10246  };
10247 Index: gcc/config/soft-fp/floatunsidf.c
10248 ===================================================================
10249 --- gcc/config/soft-fp/floatunsidf.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
10250 +++ gcc/config/soft-fp/floatunsidf.c    (.../branches/gcc-4_2-branch)   (revision 126002)
10251 @@ -1,6 +1,6 @@
10252  /* Software floating-point emulation.
10253     Convert a 32bit unsigned integer to IEEE double
10254 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
10255 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
10256     This file is part of the GNU C Library.
10257     Contributed by Richard Henderson (rth@cygnus.com) and
10258                   Jakub Jelinek (jj@ultra.linux.cz).
10259 @@ -32,8 +32,7 @@
10260  #include "soft-fp.h"
10261  #include "double.h"
10262  
10263 -double
10264 -__floatunsidf(USItype i)
10265 +DFtype __floatunsidf(USItype i)
10266  {
10267    FP_DECL_EX;
10268    FP_DECL_D(A);
10269 Index: gcc/config/soft-fp/floatundidf.c
10270 ===================================================================
10271 --- gcc/config/soft-fp/floatundidf.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
10272 +++ gcc/config/soft-fp/floatundidf.c    (.../branches/gcc-4_2-branch)   (revision 126002)
10273 @@ -1,6 +1,6 @@
10274  /* Software floating-point emulation.
10275     Convert a 64bit unsigned integer to IEEE double
10276 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
10277 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
10278     This file is part of the GNU C Library.
10279     Contributed by Richard Henderson (rth@cygnus.com) and
10280                   Jakub Jelinek (jj@ultra.linux.cz).
10281 @@ -32,8 +32,7 @@
10282  #include "soft-fp.h"
10283  #include "double.h"
10284  
10285 -double
10286 -__floatundidf(UDItype i)
10287 +DFtype __floatundidf(UDItype i)
10288  {
10289    FP_DECL_EX;
10290    FP_DECL_D(A);
10291 Index: gcc/config/soft-fp/extended.h
10292 ===================================================================
10293 --- gcc/config/soft-fp/extended.h       (.../tags/gcc_4_2_0_release)    (revision 126002)
10294 +++ gcc/config/soft-fp/extended.h       (.../branches/gcc-4_2-branch)   (revision 126002)
10295 @@ -1,6 +1,6 @@
10296  /* Software floating-point emulation.
10297     Definitions for IEEE Extended Precision.
10298 -   Copyright (C) 1999,2006 Free Software Foundation, Inc.
10299 +   Copyright (C) 1999,2006,2007 Free Software Foundation, Inc.
10300     This file is part of the GNU C Library.
10301     Contributed by Jakub Jelinek (jj@ultra.linux.cz).
10302  
10303 @@ -94,12 +94,6 @@
10304      X##_f[1] = _flo.bits.frac1;                                \
10305      X##_e  = _flo.bits.exp;                            \
10306      X##_s  = _flo.bits.sign;                           \
10307 -    if (!X##_e && (X##_f[1] || X##_f[0])               \
10308 -        && !(X##_f[1] & _FP_IMPLBIT_E))                        \
10309 -      {                                                        \
10310 -        X##_e++;                                       \
10311 -        FP_SET_EXCEPTION(FP_EX_DENORM);                        \
10312 -      }                                                        \
10313    } while (0)
10314  
10315  #define FP_UNPACK_RAW_EP(X, val)                       \
10316 @@ -112,12 +106,6 @@
10317      X##_f[1] = _flo->bits.frac1;                       \
10318      X##_e  = _flo->bits.exp;                           \
10319      X##_s  = _flo->bits.sign;                          \
10320 -    if (!X##_e && (X##_f[1] || X##_f[0])               \
10321 -        && !(X##_f[1] & _FP_IMPLBIT_E))                        \
10322 -      {                                                        \
10323 -        X##_e++;                                       \
10324 -        FP_SET_EXCEPTION(FP_EX_DENORM);                        \
10325 -      }                                                        \
10326    } while (0)
10327  
10328  #define FP_PACK_RAW_E(val, X)                          \
10329 @@ -164,13 +152,13 @@
10330  
10331  #define FP_UNPACK_SEMIRAW_E(X,val)     \
10332    do {                                 \
10333 -    _FP_UNPACK_RAW_E(X,val);           \
10334 +    FP_UNPACK_RAW_E(X,val);            \
10335      _FP_UNPACK_SEMIRAW(E,4,X);         \
10336    } while (0)
10337  
10338  #define FP_UNPACK_SEMIRAW_EP(X,val)    \
10339    do {                                 \
10340 -    _FP_UNPACK_RAW_EP(X,val);          \
10341 +    FP_UNPACK_RAW_EP(X,val);           \
10342      _FP_UNPACK_SEMIRAW(E,4,X);         \
10343    } while (0)
10344  
10345 @@ -189,13 +177,13 @@
10346  #define FP_PACK_SEMIRAW_E(val,X)       \
10347    do {                                 \
10348      _FP_PACK_SEMIRAW(E,4,X);           \
10349 -    _FP_PACK_RAW_E(val,X);             \
10350 +    FP_PACK_RAW_E(val,X);              \
10351    } while (0)
10352  
10353  #define FP_PACK_SEMIRAW_EP(val,X)      \
10354    do {                                 \
10355      _FP_PACK_SEMIRAW(E,4,X);           \
10356 -    _FP_PACK_RAW_EP(val,X);            \
10357 +    FP_PACK_RAW_EP(val,X);             \
10358    } while (0)
10359  
10360  #define FP_ISSIGNAN_E(X)       _FP_ISSIGNAN(E,4,X)
10361 @@ -277,14 +265,14 @@
10362    XFtype flt;
10363    struct {
10364  #if __BYTE_ORDER == __BIG_ENDIAN
10365 -    unsigned long pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
10366 -    unsigned sign  : 1;
10367 -    unsigned exp   : _FP_EXPBITS_E;
10368 -    unsigned long frac : _FP_W_TYPE_SIZE;
10369 +    _FP_W_TYPE pad  : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
10370 +    unsigned sign   : 1;
10371 +    unsigned exp    : _FP_EXPBITS_E;
10372 +    _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
10373  #else
10374 -    unsigned long frac : _FP_W_TYPE_SIZE;
10375 -    unsigned exp   : _FP_EXPBITS_E;
10376 -    unsigned sign  : 1;
10377 +    _FP_W_TYPE frac : _FP_W_TYPE_SIZE;
10378 +    unsigned exp    : _FP_EXPBITS_E;
10379 +    unsigned sign   : 1;
10380  #endif
10381    } bits;
10382  };
10383 @@ -299,11 +287,6 @@
10384      X##_f1 = 0;                                                        \
10385      X##_e = _flo.bits.exp;                                     \
10386      X##_s = _flo.bits.sign;                                    \
10387 -    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))         \
10388 -      {                                                                \
10389 -        X##_e++;                                               \
10390 -        FP_SET_EXCEPTION(FP_EX_DENORM);                                \
10391 -      }                                                                \
10392    } while (0)
10393  
10394  #define FP_UNPACK_RAW_EP(X, val)                               \
10395 @@ -315,11 +298,6 @@
10396      X##_f1 = 0;                                                        \
10397      X##_e = _flo->bits.exp;                                    \
10398      X##_s = _flo->bits.sign;                                   \
10399 -    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))         \
10400 -      {                                                                \
10401 -        X##_e++;                                               \
10402 -        FP_SET_EXCEPTION(FP_EX_DENORM);                                \
10403 -      }                                                                \
10404    } while (0)
10405  
10406  #define FP_PACK_RAW_E(val, X)                                  \
10407 @@ -365,13 +343,13 @@
10408  
10409  #define FP_UNPACK_SEMIRAW_E(X,val)     \
10410    do {                                 \
10411 -    _FP_UNPACK_RAW_E(X,val);           \
10412 +    FP_UNPACK_RAW_E(X,val);            \
10413      _FP_UNPACK_SEMIRAW(E,2,X);         \
10414    } while (0)
10415  
10416  #define FP_UNPACK_SEMIRAW_EP(X,val)    \
10417    do {                                 \
10418 -    _FP_UNPACK_RAW_EP(X,val);          \
10419 +    FP_UNPACK_RAW_EP(X,val);           \
10420      _FP_UNPACK_SEMIRAW(E,2,X);         \
10421    } while (0)
10422  
10423 @@ -390,13 +368,13 @@
10424  #define FP_PACK_SEMIRAW_E(val,X)       \
10425    do {                                 \
10426      _FP_PACK_SEMIRAW(E,2,X);           \
10427 -    _FP_PACK_RAW_E(val,X);             \
10428 +    FP_PACK_RAW_E(val,X);              \
10429    } while (0)
10430  
10431  #define FP_PACK_SEMIRAW_EP(val,X)      \
10432    do {                                 \
10433      _FP_PACK_SEMIRAW(E,2,X);           \
10434 -    _FP_PACK_RAW_EP(val,X);            \
10435 +    FP_PACK_RAW_EP(val,X);             \
10436    } while (0)
10437  
10438  #define FP_ISSIGNAN_E(X)       _FP_ISSIGNAN(E,2,X)
10439 Index: gcc/config/soft-fp/floatunsisf.c
10440 ===================================================================
10441 --- gcc/config/soft-fp/floatunsisf.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
10442 +++ gcc/config/soft-fp/floatunsisf.c    (.../branches/gcc-4_2-branch)   (revision 126002)
10443 @@ -1,6 +1,6 @@
10444  /* Software floating-point emulation.
10445     Convert a 32bit unsigned integer to IEEE single
10446 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
10447 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
10448     This file is part of the GNU C Library.
10449     Contributed by Richard Henderson (rth@cygnus.com) and
10450                   Jakub Jelinek (jj@ultra.linux.cz).
10451 @@ -32,8 +32,7 @@
10452  #include "soft-fp.h"
10453  #include "single.h"
10454  
10455 -float
10456 -__floatunsisf(USItype i)
10457 +SFtype __floatunsisf(USItype i)
10458  {
10459    FP_DECL_EX;
10460    FP_DECL_S(A);
10461 Index: gcc/config/soft-fp/op-common.h
10462 ===================================================================
10463 --- gcc/config/soft-fp/op-common.h      (.../tags/gcc_4_2_0_release)    (revision 126002)
10464 +++ gcc/config/soft-fp/op-common.h      (.../branches/gcc-4_2-branch)   (revision 126002)
10465 @@ -1153,7 +1153,8 @@
10466    if (_FP_FRACBITS_##dfs < _FP_FRACBITS_##sfs                           \
10467        || (_FP_EXPMAX_##dfs - _FP_EXPBIAS_##dfs                          \
10468           < _FP_EXPMAX_##sfs - _FP_EXPBIAS_##sfs)                        \
10469 -      || _FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
10470 +      || (_FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1 \
10471 +         && _FP_EXPBIAS_##dfs != _FP_EXPBIAS_##sfs))                    \
10472      abort();                                                            \
10473    D##_s = S##_s;                                                        \
10474    _FP_FRAC_COPY_##dwc##_##swc(D, S);                                    \
10475 @@ -1168,6 +1169,14 @@
10476         {                                                                \
10477           if (_FP_FRAC_ZEROP_##swc(S))                                   \
10478             D##_e = 0;                                                   \
10479 +         else if (_FP_EXPBIAS_##dfs                                     \
10480 +                  < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1)         \
10481 +           {                                                            \
10482 +             FP_SET_EXCEPTION(FP_EX_DENORM);                            \
10483 +             _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs                  \
10484 +                                    - _FP_FRACBITS_##sfs));             \
10485 +             D##_e = 0;                                                 \
10486 +           }                                                            \
10487           else                                                           \
10488             {                                                            \
10489               int _lz;                                                   \
10490 @@ -1199,7 +1208,8 @@
10491  #define FP_TRUNC(dfs,sfs,dwc,swc,D,S)                                       \
10492  do {                                                                        \
10493    if (_FP_FRACBITS_##sfs < _FP_FRACBITS_##dfs                               \
10494 -      || _FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)     \
10495 +      || (_FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1     \
10496 +         && _FP_EXPBIAS_##sfs != _FP_EXPBIAS_##dfs))                        \
10497      abort();                                                                \
10498    D##_s = S##_s;                                                            \
10499    if (_FP_EXP_NORMAL(sfs, swc, S))                                          \
10500 @@ -1211,8 +1221,11 @@
10501         {                                                                    \
10502           if (D##_e <= 0)                                                    \
10503             {                                                                \
10504 -             if (D##_e <= 1 - _FP_FRACBITS_##dfs)                           \
10505 -               _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc);                   \
10506 +             if (D##_e < 1 - _FP_FRACBITS_##dfs)                            \
10507 +               {                                                            \
10508 +                 _FP_FRAC_SET_##swc(S, _FP_ZEROFRAC_##swc);                 \
10509 +                 _FP_FRAC_LOW_##swc(S) |= 1;                                \
10510 +               }                                                            \
10511               else                                                           \
10512                 {                                                            \
10513                   _FP_FRAC_HIGH_##sfs(S) |= _FP_IMPLBIT_SH_##sfs;            \
10514 @@ -1234,11 +1247,24 @@
10515        if (S##_e == 0)                                                       \
10516         {                                                                    \
10517           D##_e = 0;                                                         \
10518 -         _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);                         \
10519 -         if (!_FP_FRAC_ZEROP_##swc(S))                                      \
10520 +         if (_FP_FRAC_ZEROP_##swc(S))                                       \
10521 +           _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);                       \
10522 +         else                                                               \
10523             {                                                                \
10524               FP_SET_EXCEPTION(FP_EX_DENORM);                                \
10525 -             FP_SET_EXCEPTION(FP_EX_INEXACT);                               \
10526 +             if (_FP_EXPBIAS_##sfs                                          \
10527 +                 < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)              \
10528 +               {                                                            \
10529 +                 _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs                 \
10530 +                                        - _FP_WFRACBITS_##dfs),             \
10531 +                                    _FP_WFRACBITS_##sfs);                   \
10532 +                 _FP_FRAC_COPY_##dwc##_##swc(D, S);                         \
10533 +               }                                                            \
10534 +             else                                                           \
10535 +               {                                                            \
10536 +                 _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);                 \
10537 +                 _FP_FRAC_LOW_##dwc(D) |= 1;                                \
10538 +               }                                                            \
10539             }                                                                \
10540         }                                                                    \
10541        else                                                                  \
10542 Index: gcc/config/soft-fp/floatundisf.c
10543 ===================================================================
10544 --- gcc/config/soft-fp/floatundisf.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
10545 +++ gcc/config/soft-fp/floatundisf.c    (.../branches/gcc-4_2-branch)   (revision 126002)
10546 @@ -1,6 +1,6 @@
10547  /* Software floating-point emulation.
10548     Convert a 64bit unsigned integer to IEEE single
10549 -   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
10550 +   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
10551     This file is part of the GNU C Library.
10552     Contributed by Richard Henderson (rth@cygnus.com) and
10553                   Jakub Jelinek (jj@ultra.linux.cz).
10554 @@ -32,8 +32,7 @@
10555  #include "soft-fp.h"
10556  #include "single.h"
10557  
10558 -float
10559 -__floatundisf(UDItype i)
10560 +SFtype __floatundisf(UDItype i)
10561  {
10562    FP_DECL_EX;
10563    FP_DECL_S(A);
10564 Index: gcc/config/soft-fp/op-2.h
10565 ===================================================================
10566 --- gcc/config/soft-fp/op-2.h   (.../tags/gcc_4_2_0_release)    (revision 126002)
10567 +++ gcc/config/soft-fp/op-2.h   (.../branches/gcc-4_2-branch)   (revision 126002)
10568 @@ -1,6 +1,6 @@
10569  /* Software floating-point emulation.
10570     Basic two-word fraction declaration and manipulation.
10571 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
10572 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
10573     This file is part of the GNU C Library.
10574     Contributed by Richard Henderson (rth@cygnus.com),
10575                   Jakub Jelinek (jj@ultra.linux.cz),
10576 @@ -613,3 +613,5 @@
10577  #define _FP_FRAC_COPY_1_2(D, S)                (D##_f = S##_f0)
10578  
10579  #define _FP_FRAC_COPY_2_1(D, S)                ((D##_f0 = S##_f), (D##_f1 = 0))
10580 +
10581 +#define _FP_FRAC_COPY_2_2(D,S)         _FP_FRAC_COPY_2(D,S)
10582 Index: gcc/config/soft-fp/op-4.h
10583 ===================================================================
10584 --- gcc/config/soft-fp/op-4.h   (.../tags/gcc_4_2_0_release)    (revision 126002)
10585 +++ gcc/config/soft-fp/op-4.h   (.../branches/gcc-4_2-branch)   (revision 126002)
10586 @@ -1,6 +1,6 @@
10587  /* Software floating-point emulation.
10588     Basic four-word fraction declaration and manipulation.
10589 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
10590 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
10591     This file is part of the GNU C Library.
10592     Contributed by Richard Henderson (rth@cygnus.com),
10593                   Jakub Jelinek (jj@ultra.linux.cz),
10594 @@ -684,3 +684,5 @@
10595    D##_f[1] = S##_f1;                           \
10596    D##_f[2] = D##_f[3] = 0;                     \
10597  } while (0)
10598 +
10599 +#define _FP_FRAC_COPY_4_4(D,S) _FP_FRAC_COPY_4(D,S)
10600 Index: gcc/config/soft-fp/double.h
10601 ===================================================================
10602 --- gcc/config/soft-fp/double.h (.../tags/gcc_4_2_0_release)    (revision 126002)
10603 +++ gcc/config/soft-fp/double.h (.../branches/gcc-4_2-branch)   (revision 126002)
10604 @@ -1,6 +1,6 @@
10605  /* Software floating-point emulation.
10606     Definitions for IEEE Double Precision
10607 -   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
10608 +   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
10609     This file is part of the GNU C Library.
10610     Contributed by Richard Henderson (rth@cygnus.com),
10611                   Jakub Jelinek (jj@ultra.linux.cz),
10612 @@ -168,13 +168,13 @@
10613    DFtype flt;
10614    struct {
10615  #if __BYTE_ORDER == __BIG_ENDIAN
10616 -    unsigned sign : 1;
10617 -    unsigned exp  : _FP_EXPBITS_D;
10618 -    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
10619 +    unsigned sign   : 1;
10620 +    unsigned exp    : _FP_EXPBITS_D;
10621 +    _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
10622  #else
10623 -    unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
10624 -    unsigned exp  : _FP_EXPBITS_D;
10625 -    unsigned sign : 1;
10626 +    _FP_W_TYPE frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
10627 +    unsigned exp    : _FP_EXPBITS_D;
10628 +    unsigned sign   : 1;
10629  #endif
10630    } bits __attribute__((packed));
10631  };
10632 Index: gcc/tree-ssa-operands.c
10633 ===================================================================
10634 --- gcc/tree-ssa-operands.c     (.../tags/gcc_4_2_0_release)    (revision 126002)
10635 +++ gcc/tree-ssa-operands.c     (.../branches/gcc-4_2-branch)   (revision 126002)
10636 @@ -2162,9 +2162,14 @@
10637  {
10638    stmt_ann_t ann = get_stmt_ann (stmt);
10639    
10640 -  /* Initially assume that the statement has no volatile operands.  */
10641 +  /* Initially assume that the statement has no volatile operands and
10642 +     does not take the address of any symbols.  */
10643    if (ann)
10644 -    ann->has_volatile_ops = false;
10645 +    {
10646 +      ann->has_volatile_ops = false;
10647 +      if (ann->addresses_taken)
10648 +       ann->addresses_taken = NULL;
10649 +    }
10650  
10651    start_ssa_stmt_operands ();
10652  
10653 Index: libstdc++-v3/configure
10654 ===================================================================
10655 --- libstdc++-v3/configure      (.../tags/gcc_4_2_0_release)    (revision 126002)
10656 +++ libstdc++-v3/configure      (.../branches/gcc-4_2-branch)   (revision 126002)
10657 @@ -5764,8 +5764,6 @@
10658  
10659  
10660  
10661 -  echo "$as_me:$LINENO: checking for C locale to use" >&5
10662 -echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
10663     # Check whether --enable-clocale or --disable-clocale was given.
10664  if test "${enable_clocale+set}" = set; then
10665    enableval="$enable_clocale"
10666 @@ -5782,32 +5780,53 @@
10667  fi;
10668  
10669  
10670 -  # If they didn't use this option switch, or if they specified --enable
10671 -  # with no specific model, we'll have to look for one.  If they
10672 -  # specified --disable (???), do likewise.
10673 +  # Deal with gettext issues.  Default to not using it (=no) until we detect
10674 +  # support for it later.  Let the user turn it off via --e/d, but let that
10675 +  # default to on for easier handling.
10676 +  USE_NLS=no
10677 +  # Check whether --enable-nls or --disable-nls was given.
10678 +if test "${enable_nls+set}" = set; then
10679 +  enableval="$enable_nls"
10680 +
10681 +else
10682 +  enable_nls=yes
10683 +fi;
10684 +
10685 +  # Either a known packaage, or "auto"
10686    if test $enable_clocale = no || test $enable_clocale = yes; then
10687       enable_clocale=auto
10688    fi
10689 -
10690 -  # Either a known package, or "auto"
10691    enable_clocale_flag=$enable_clocale
10692  
10693 -  # Probe for locale support if no specific model is specified.
10694 +  # Probe for locale model to use if none specified.
10695    # Default to "generic".
10696    if test $enable_clocale_flag = auto; then
10697      case ${target_os} in
10698        linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
10699 -        cat >conftest.$ac_ext <<_ACEOF
10700 +        enable_clocale_flag=gnu
10701 +        ;;
10702 +      darwin* | freebsd*)
10703 +        enable_clocale_flag=darwin
10704 +       ;;
10705 +      *)
10706 +        enable_clocale_flag=generic
10707 +        ;;
10708 +    esac
10709 +  fi
10710 +
10711 +  # Sanity check model, and test for special functionality.
10712 +  if test $enable_clocale_flag = gnu; then
10713 +    cat >conftest.$ac_ext <<_ACEOF
10714  /* confdefs.h.  */
10715  _ACEOF
10716  cat confdefs.h >>conftest.$ac_ext
10717  cat >>conftest.$ac_ext <<_ACEOF
10718  /* end confdefs.h.  */
10719  
10720 -        #include <features.h>
10721 -        #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
10722 -          _GLIBCXX_ok
10723 -        #endif
10724 +    #include <features.h>
10725 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
10726 +      _GLIBCXX_ok
10727 +    #endif
10728  
10729  _ACEOF
10730  if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
10731 @@ -5819,9 +5838,8 @@
10732  rm -f conftest*
10733  
10734  
10735 -        # Test for bugs early in glibc-2.2.x series
10736 -          if test $enable_clocale_flag = gnu; then
10737 -          if test "$cross_compiling" = yes; then
10738 +    # Test for bugs early in glibc-2.2.x series
10739 +    if test "$cross_compiling" = yes; then
10740    enable_clocale_flag=generic
10741  else
10742    cat >conftest.$ac_ext <<_ACEOF
10743 @@ -5831,28 +5849,28 @@
10744  cat >>conftest.$ac_ext <<_ACEOF
10745  /* end confdefs.h.  */
10746  
10747 -          #define _GNU_SOURCE 1
10748 -          #include <locale.h>
10749 -          #include <string.h>
10750 -          #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
10751 -          extern __typeof(newlocale) __newlocale;
10752 -          extern __typeof(duplocale) __duplocale;
10753 -          extern __typeof(strcoll_l) __strcoll_l;
10754 -          #endif
10755 -          int main()
10756 -          {
10757 -              const char __one[] = "Äuglein Augmen";
10758 -              const char __two[] = "Äuglein";
10759 -              int i;
10760 -              int j;
10761 -              __locale_t        loc;
10762 -               __locale_t        loc_dup;
10763 -              loc = __newlocale(1 << LC_ALL, "de_DE", 0);
10764 -              loc_dup = __duplocale(loc);
10765 -              i = __strcoll_l(__one, __two, loc);
10766 -              j = __strcoll_l(__one, __two, loc_dup);
10767 -              return 0;
10768 -          }
10769 +    #define _GNU_SOURCE 1
10770 +    #include <locale.h>
10771 +    #include <string.h>
10772 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
10773 +    extern __typeof(newlocale) __newlocale;
10774 +    extern __typeof(duplocale) __duplocale;
10775 +    extern __typeof(strcoll_l) __strcoll_l;
10776 +    #endif
10777 +    int main()
10778 +    {
10779 +        const char __one[] = "Äuglein Augmen";
10780 +        const char __two[] = "Äuglein";
10781 +        int i;
10782 +        int j;
10783 +        __locale_t        loc;
10784 +        __locale_t        loc_dup;
10785 +        loc = __newlocale(1 << LC_ALL, "de_DE", 0);
10786 +        loc_dup = __duplocale(loc);
10787 +        i = __strcoll_l(__one, __two, loc);
10788 +        j = __strcoll_l(__one, __two, loc_dup);
10789 +        return 0;
10790 +    }
10791  
10792  _ACEOF
10793  rm -f conftest$ac_exeext
10794 @@ -5877,32 +5895,176 @@
10795  fi
10796  rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
10797  fi
10798 -          fi
10799  
10800 -        # ... at some point put __strxfrm_l tests in as well.
10801 -        ;;
10802 -      darwin* | freebsd*)
10803 -        enable_clocale_flag=darwin
10804 -       ;;
10805 -      *)
10806 -        enable_clocale_flag=generic
10807 -        ;;
10808 -    esac
10809 +    # Set it to scream when it hurts.
10810 +    ac_save_CFLAGS="$CFLAGS"
10811 +    CFLAGS="-Wimplicit-function-declaration -Werror"
10812 +
10813 +    # Use strxfrm_l if available.
10814 +    cat >conftest.$ac_ext <<_ACEOF
10815 +/* confdefs.h.  */
10816 +_ACEOF
10817 +cat confdefs.h >>conftest.$ac_ext
10818 +cat >>conftest.$ac_ext <<_ACEOF
10819 +/* end confdefs.h.  */
10820 +#define _GNU_SOURCE 1
10821 +                   #include <string.h>
10822 +                   #include <locale.h>
10823 +int
10824 +main ()
10825 +{
10826 +char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);
10827 +  ;
10828 +  return 0;
10829 +}
10830 +_ACEOF
10831 +rm -f conftest.$ac_objext
10832 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10833 +  (eval $ac_compile) 2>conftest.er1
10834 +  ac_status=$?
10835 +  grep -v '^ *+' conftest.er1 >conftest.err
10836 +  rm -f conftest.er1
10837 +  cat conftest.err >&5
10838 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10839 +  (exit $ac_status); } &&
10840 +        { ac_try='test -z "$ac_c_werror_flag"
10841 +                        || test ! -s conftest.err'
10842 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10843 +  (eval $ac_try) 2>&5
10844 +  ac_status=$?
10845 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10846 +  (exit $ac_status); }; } &&
10847 +        { ac_try='test -s conftest.$ac_objext'
10848 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10849 +  (eval $ac_try) 2>&5
10850 +  ac_status=$?
10851 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10852 +  (exit $ac_status); }; }; then
10853 +
10854 +cat >>confdefs.h <<\_ACEOF
10855 +#define HAVE_STRXFRM_L 1
10856 +_ACEOF
10857 +
10858 +else
10859 +  echo "$as_me: failed program was:" >&5
10860 +sed 's/^/| /' conftest.$ac_ext >&5
10861 +
10862 +fi
10863 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10864 +
10865 +    # Use strerror_l if available.
10866 +    cat >conftest.$ac_ext <<_ACEOF
10867 +/* confdefs.h.  */
10868 +_ACEOF
10869 +cat confdefs.h >>conftest.$ac_ext
10870 +cat >>conftest.$ac_ext <<_ACEOF
10871 +/* end confdefs.h.  */
10872 +#define _GNU_SOURCE 1
10873 +                   #include <string.h>
10874 +                   #include <locale.h>
10875 +int
10876 +main ()
10877 +{
10878 +__locale_t loc; strerror_l(5, loc);
10879 +  ;
10880 +  return 0;
10881 +}
10882 +_ACEOF
10883 +rm -f conftest.$ac_objext
10884 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10885 +  (eval $ac_compile) 2>conftest.er1
10886 +  ac_status=$?
10887 +  grep -v '^ *+' conftest.er1 >conftest.err
10888 +  rm -f conftest.er1
10889 +  cat conftest.err >&5
10890 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10891 +  (exit $ac_status); } &&
10892 +        { ac_try='test -z "$ac_c_werror_flag"
10893 +                        || test ! -s conftest.err'
10894 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10895 +  (eval $ac_try) 2>&5
10896 +  ac_status=$?
10897 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10898 +  (exit $ac_status); }; } &&
10899 +        { ac_try='test -s conftest.$ac_objext'
10900 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10901 +  (eval $ac_try) 2>&5
10902 +  ac_status=$?
10903 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10904 +  (exit $ac_status); }; }; then
10905 +
10906 +cat >>confdefs.h <<\_ACEOF
10907 +#define HAVE_STRERROR_L 1
10908 +_ACEOF
10909 +
10910 +else
10911 +  echo "$as_me: failed program was:" >&5
10912 +sed 's/^/| /' conftest.$ac_ext >&5
10913 +
10914 +fi
10915 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10916 +
10917 +    CFLAGS="$ac_save_CFLAGS"
10918    fi
10919  
10920 -  # Deal with gettext issues.  Default to not using it (=no) until we detect
10921 -  # support for it later.  Let the user turn it off via --e/d, but let that
10922 -  # default to on for easier handling.
10923 -  USE_NLS=no
10924 -  # Check whether --enable-nls or --disable-nls was given.
10925 -if test "${enable_nls+set}" = set; then
10926 -  enableval="$enable_nls"
10927 +  # Perhaps use strerror_r if available, and strerror_l isn't.
10928 +  ac_save_CFLAGS="$CFLAGS"
10929 +  CFLAGS="-Wimplicit-function-declaration -Werror"
10930 +  cat >conftest.$ac_ext <<_ACEOF
10931 +/* confdefs.h.  */
10932 +_ACEOF
10933 +cat confdefs.h >>conftest.$ac_ext
10934 +cat >>conftest.$ac_ext <<_ACEOF
10935 +/* end confdefs.h.  */
10936 +#define _GNU_SOURCE 1
10937 +                 #include <string.h>
10938 +                 #include <locale.h>
10939 +int
10940 +main ()
10941 +{
10942 +char s[128]; strerror_r(5, s, 128);
10943 +  ;
10944 +  return 0;
10945 +}
10946 +_ACEOF
10947 +rm -f conftest.$ac_objext
10948 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
10949 +  (eval $ac_compile) 2>conftest.er1
10950 +  ac_status=$?
10951 +  grep -v '^ *+' conftest.er1 >conftest.err
10952 +  rm -f conftest.er1
10953 +  cat conftest.err >&5
10954 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10955 +  (exit $ac_status); } &&
10956 +        { ac_try='test -z "$ac_c_werror_flag"
10957 +                        || test ! -s conftest.err'
10958 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10959 +  (eval $ac_try) 2>&5
10960 +  ac_status=$?
10961 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10962 +  (exit $ac_status); }; } &&
10963 +        { ac_try='test -s conftest.$ac_objext'
10964 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
10965 +  (eval $ac_try) 2>&5
10966 +  ac_status=$?
10967 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
10968 +  (exit $ac_status); }; }; then
10969  
10970 +cat >>confdefs.h <<\_ACEOF
10971 +#define HAVE_STRERROR_R 1
10972 +_ACEOF
10973 +
10974  else
10975 -  enable_nls=yes
10976 -fi;
10977 +  echo "$as_me: failed program was:" >&5
10978 +sed 's/^/| /' conftest.$ac_ext >&5
10979  
10980 +fi
10981 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
10982 +  CFLAGS="$ac_save_CFLAGS"
10983 +
10984    # Set configure bits for specified locale package
10985 +  echo "$as_me:$LINENO: checking for C locale to use" >&5
10986 +echo $ECHO_N "checking for C locale to use... $ECHO_C" >&6
10987    case ${enable_clocale_flag} in
10988      generic)
10989        echo "$as_me:$LINENO: result: generic" >&5
10990 @@ -8015,7 +8177,7 @@
10991  
10992    # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
10993      cat > conftest.$ac_ext << EOF
10994 -#line 8018 "configure"
10995 +#line 8180 "configure"
10996  int main()
10997  {
10998    // NB: _Atomic_word not necessarily int.
10999 @@ -8395,11 +8557,9 @@
11000      # NB: This flag only works reliably after 2.16.1. Configure tests
11001      # for this are difficult, so hard wire a value that should work.
11002  
11003 -    # All these tests are for C++, but run with the "C" compiler driver.
11004 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11005      ac_test_CFLAGS="${CFLAGS+set}"
11006      ac_save_CFLAGS="$CFLAGS"
11007 -    CFLAGS='-x c++ -Wl,--gc-sections'
11008 +    CFLAGS='-Wl,--gc-sections'
11009  
11010      # Check for -Wl,--gc-sections
11011      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11012 @@ -54307,11 +54467,9 @@
11013      # NB: This flag only works reliably after 2.16.1. Configure tests
11014      # for this are difficult, so hard wire a value that should work.
11015  
11016 -    # All these tests are for C++, but run with the "C" compiler driver.
11017 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11018      ac_test_CFLAGS="${CFLAGS+set}"
11019      ac_save_CFLAGS="$CFLAGS"
11020 -    CFLAGS='-x c++ -Wl,--gc-sections'
11021 +    CFLAGS='-Wl,--gc-sections'
11022  
11023      # Check for -Wl,--gc-sections
11024      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11025 @@ -75669,11 +75827,9 @@
11026      # NB: This flag only works reliably after 2.16.1. Configure tests
11027      # for this are difficult, so hard wire a value that should work.
11028  
11029 -    # All these tests are for C++, but run with the "C" compiler driver.
11030 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11031      ac_test_CFLAGS="${CFLAGS+set}"
11032      ac_save_CFLAGS="$CFLAGS"
11033 -    CFLAGS='-x c++ -Wl,--gc-sections'
11034 +    CFLAGS='-Wl,--gc-sections'
11035  
11036      # Check for -Wl,--gc-sections
11037      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11038 @@ -77194,11 +77350,9 @@
11039      # NB: This flag only works reliably after 2.16.1. Configure tests
11040      # for this are difficult, so hard wire a value that should work.
11041  
11042 -    # All these tests are for C++, but run with the "C" compiler driver.
11043 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11044      ac_test_CFLAGS="${CFLAGS+set}"
11045      ac_save_CFLAGS="$CFLAGS"
11046 -    CFLAGS='-x c++ -Wl,--gc-sections'
11047 +    CFLAGS='-Wl,--gc-sections'
11048  
11049      # Check for -Wl,--gc-sections
11050      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11051 @@ -78687,11 +78841,9 @@
11052      # NB: This flag only works reliably after 2.16.1. Configure tests
11053      # for this are difficult, so hard wire a value that should work.
11054  
11055 -    # All these tests are for C++, but run with the "C" compiler driver.
11056 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11057      ac_test_CFLAGS="${CFLAGS+set}"
11058      ac_save_CFLAGS="$CFLAGS"
11059 -    CFLAGS='-x c++ -Wl,--gc-sections'
11060 +    CFLAGS='-Wl,--gc-sections'
11061  
11062      # Check for -Wl,--gc-sections
11063      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11064 @@ -100579,11 +100731,9 @@
11065      # NB: This flag only works reliably after 2.16.1. Configure tests
11066      # for this are difficult, so hard wire a value that should work.
11067  
11068 -    # All these tests are for C++, but run with the "C" compiler driver.
11069 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11070      ac_test_CFLAGS="${CFLAGS+set}"
11071      ac_save_CFLAGS="$CFLAGS"
11072 -    CFLAGS='-x c++ -Wl,--gc-sections'
11073 +    CFLAGS='-Wl,--gc-sections'
11074  
11075      # Check for -Wl,--gc-sections
11076      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11077 @@ -101426,11 +101576,9 @@
11078      # NB: This flag only works reliably after 2.16.1. Configure tests
11079      # for this are difficult, so hard wire a value that should work.
11080  
11081 -    # All these tests are for C++, but run with the "C" compiler driver.
11082 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11083      ac_test_CFLAGS="${CFLAGS+set}"
11084      ac_save_CFLAGS="$CFLAGS"
11085 -    CFLAGS='-x c++ -Wl,--gc-sections'
11086 +    CFLAGS='-Wl,--gc-sections'
11087  
11088      # Check for -Wl,--gc-sections
11089      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11090 @@ -102829,11 +102977,9 @@
11091      # NB: This flag only works reliably after 2.16.1. Configure tests
11092      # for this are difficult, so hard wire a value that should work.
11093  
11094 -    # All these tests are for C++, but run with the "C" compiler driver.
11095 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11096      ac_test_CFLAGS="${CFLAGS+set}"
11097      ac_save_CFLAGS="$CFLAGS"
11098 -    CFLAGS='-x c++ -Wl,--gc-sections'
11099 +    CFLAGS='-Wl,--gc-sections'
11100  
11101      # Check for -Wl,--gc-sections
11102      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11103 @@ -104624,11 +104770,9 @@
11104      # NB: This flag only works reliably after 2.16.1. Configure tests
11105      # for this are difficult, so hard wire a value that should work.
11106  
11107 -    # All these tests are for C++, but run with the "C" compiler driver.
11108 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11109      ac_test_CFLAGS="${CFLAGS+set}"
11110      ac_save_CFLAGS="$CFLAGS"
11111 -    CFLAGS='-x c++ -Wl,--gc-sections'
11112 +    CFLAGS='-Wl,--gc-sections'
11113  
11114      # Check for -Wl,--gc-sections
11115      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11116 @@ -105869,11 +106013,9 @@
11117      # NB: This flag only works reliably after 2.16.1. Configure tests
11118      # for this are difficult, so hard wire a value that should work.
11119  
11120 -    # All these tests are for C++, but run with the "C" compiler driver.
11121 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11122      ac_test_CFLAGS="${CFLAGS+set}"
11123      ac_save_CFLAGS="$CFLAGS"
11124 -    CFLAGS='-x c++ -Wl,--gc-sections'
11125 +    CFLAGS='-Wl,--gc-sections'
11126  
11127      # Check for -Wl,--gc-sections
11128      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11129 @@ -106898,11 +107040,9 @@
11130      # NB: This flag only works reliably after 2.16.1. Configure tests
11131      # for this are difficult, so hard wire a value that should work.
11132  
11133 -    # All these tests are for C++, but run with the "C" compiler driver.
11134 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11135      ac_test_CFLAGS="${CFLAGS+set}"
11136      ac_save_CFLAGS="$CFLAGS"
11137 -    CFLAGS='-x c++ -Wl,--gc-sections'
11138 +    CFLAGS='-Wl,--gc-sections'
11139  
11140      # Check for -Wl,--gc-sections
11141      echo "$as_me:$LINENO: checking for ld that supports -Wl,--gc-sections" >&5
11142 Index: libstdc++-v3/include/bits/ostream.tcc
11143 ===================================================================
11144 --- libstdc++-v3/include/bits/ostream.tcc       (.../tags/gcc_4_2_0_release)    (revision 126002)
11145 +++ libstdc++-v3/include/bits/ostream.tcc       (.../branches/gcc-4_2-branch)   (revision 126002)
11146 @@ -334,7 +334,6 @@
11147    extern template ostream& operator<<(ostream&, const char*);
11148    extern template ostream& operator<<(ostream&, const unsigned char*);
11149    extern template ostream& operator<<(ostream&, const signed char*);
11150 -  extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
11151  
11152    extern template ostream& ostream::_M_insert(long);
11153    extern template ostream& ostream::_M_insert(unsigned long);
11154 @@ -356,8 +355,6 @@
11155    extern template wostream& operator<<(wostream&, char);
11156    extern template wostream& operator<<(wostream&, const wchar_t*);
11157    extern template wostream& operator<<(wostream&, const char*);
11158 -  extern template wostream& __ostream_insert(wostream&, const wchar_t*,
11159 -                                            streamsize);
11160  
11161    extern template wostream& wostream::_M_insert(long);
11162    extern template wostream& wostream::_M_insert(unsigned long);
11163 Index: libstdc++-v3/include/bits/ostream_insert.h
11164 ===================================================================
11165 --- libstdc++-v3/include/bits/ostream_insert.h  (.../tags/gcc_4_2_0_release)    (revision 126002)
11166 +++ libstdc++-v3/include/bits/ostream_insert.h  (.../branches/gcc-4_2-branch)   (revision 126002)
11167 @@ -109,6 +109,18 @@
11168        return __out;
11169      }
11170  
11171 +  // Inhibit implicit instantiations for required instantiations,
11172 +  // which are defined via explicit instantiations elsewhere.
11173 +  // NB:  This syntax is a GNU extension.
11174 +#if _GLIBCXX_EXTERN_TEMPLATE
11175 +  extern template ostream& __ostream_insert(ostream&, const char*, streamsize);
11176 +
11177 +#ifdef _GLIBCXX_USE_WCHAR_T
11178 +  extern template wostream& __ostream_insert(wostream&, const wchar_t*,
11179 +                                            streamsize);
11180 +#endif
11181 +#endif
11182 +
11183  _GLIBCXX_END_NAMESPACE
11184  
11185  #endif /* _OSTREAM_INSERT_H */
11186 Index: libstdc++-v3/include/std/std_fstream.h
11187 ===================================================================
11188 --- libstdc++-v3/include/std/std_fstream.h      (.../tags/gcc_4_2_0_release)    (revision 126002)
11189 +++ libstdc++-v3/include/std/std_fstream.h      (.../branches/gcc-4_2-branch)   (revision 126002)
11190 @@ -1,6 +1,7 @@
11191  // File based streams -*- C++ -*-
11192  
11193 -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
11194 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
11195 +// 2006, 2007
11196  // Free Software Foundation, Inc.
11197  //
11198  // This file is part of the GNU ISO C++ Library.  This library is free
11199 @@ -257,9 +258,30 @@
11200         *  Otherwise it tries to open the file named @a s using the flags
11201         *  given in @a mode.
11202         *
11203 -       *  [Table 92 gives the relation between openmode combinations and the
11204 -       *  equivalent fopen() flags, but the table has not been copied yet.]
11205 -      */
11206 +       *  Table 92, adapted here, gives the relation between openmode
11207 +       *  combinations and the equivalent fopen() flags.
11208 +       *  (NB: lines in|out|app and binary|in|out|app per DR 596)
11209 +       *  +---------------------------------------------------------+
11210 +       *  | ios_base Flag combination            stdio equivalent   |
11211 +       *  |binary  in  out  trunc  app                              |
11212 +       *  +---------------------------------------------------------+
11213 +       *  |             +                        "w"                |
11214 +       *  |             +           +            "a"                |
11215 +       *  |             +     +                  "w"                |
11216 +       *  |         +                            "r"                |
11217 +       *  |         +   +                        "r+"               |
11218 +       *  |         +   +     +                  "w+"               |
11219 +       *  |         +   +           +            "a+"               |
11220 +       *  +---------------------------------------------------------+
11221 +       *  |   +         +                        "wb"               |
11222 +       *  |   +         +           +            "ab"               |
11223 +       *  |   +         +     +                  "wb"               |
11224 +       *  |   +     +                            "rb"               |
11225 +       *  |   +     +   +                        "r+b"              |
11226 +       *  |   +     +   +     +                  "w+b"              |
11227 +       *  |   +     +   +           +            "a+b"              |
11228 +       *  +---------------------------------------------------------+
11229 +       */
11230        __filebuf_type*
11231        open(const char* __s, ios_base::openmode __mode);
11232  
11233 Index: libstdc++-v3/ChangeLog
11234 ===================================================================
11235 --- libstdc++-v3/ChangeLog      (.../tags/gcc_4_2_0_release)    (revision 126002)
11236 +++ libstdc++-v3/ChangeLog      (.../branches/gcc-4_2-branch)   (revision 126002)
11237 @@ -1,3 +1,39 @@
11238 +2007-06-08  Paolo Carlini  <pcarlini@suse.de>
11239 +
11240 +       * docs/html/install.html: Adjust consistently with libstdc++/31717.
11241 +
11242 +2007-06-08  Francesco Palagi  <palagi@arcetri.astro.it>
11243 +
11244 +       * include/std/std_fstream.h: Add Table 92 in comment.
11245 +
11246 +2007-06-06  Benjamin Kosnik  <bkoz@redhat.com>
11247 +           Frank Mori Hess  <frank.hess@nist.gov>
11248 +       
11249 +       * docs/html/debug.html: Correct link.
11250 +
11251 +2007-05-28  Benjamin Kosnik  <bkoz@redhat.com>
11252 +
11253 +       PR libstdc++/31717 
11254 +       * acinclude.m4 (GLIBCXX_ENABLE_CLOCALE): Re-organize. Sanity check
11255 +       gnu locale model requests to make sure it will work for the requested
11256 +       target. Add checks for strxfrm_l, strerror_l when in gnu locale,
11257 +       and strerror_r everywhere.
11258 +       * aclocal.m4: Regenerated.
11259 +       * configure: Regenerated.
11260 +       * config.h.in: Regenerated.
11261 +
11262 +2007-05-24  Paolo Carlini  <pcarlini@suse.de>
11263 +
11264 +       * include/bits/ostream.tcc: Do not inhibit implicit instantiation
11265 +       of __ostream_insert here...
11266 +       * include/bits/ostream_insert.h: ... do it here.
11267 +
11268 +2007-05-21  Paolo Carlini  <pcarlini@suse.de>
11269 +
11270 +       PR libstdc++/31621
11271 +       * acinclude.m4 ([GLIBCXX_CHECK_LINKER_FEATURES]): Use the C compiler.
11272 +       * configure: Regenerate.
11273 +
11274  2007-05-13  Release Manager
11275  
11276         * GCC 4.2.0 released.
11277 Index: libstdc++-v3/docs/html/debug.html
11278 ===================================================================
11279 --- libstdc++-v3/docs/html/debug.html   (.../tags/gcc_4_2_0_release)    (revision 126002)
11280 +++ libstdc++-v3/docs/html/debug.html   (.../branches/gcc-4_2-branch)   (revision 126002)
11281 @@ -420,7 +420,7 @@
11282  
11283  
11284  <h3 class="left"><a name="verbterm">Tracking uncaught exceptions</a></h3>
11285 -<p>The <a href="19_diagnostics/howto.html#4">verbose termination handler</a>
11286 +<p>The <a href="18_support/howto.html#4">verbose termination handler</a>
11287     gives information about uncaught exceptions which are killing the
11288     program.  It is described in the linked-to page.
11289  </p>
11290 Index: libstdc++-v3/docs/html/install.html
11291 ===================================================================
11292 --- libstdc++-v3/docs/html/install.html (.../tags/gcc_4_2_0_release)    (revision 126002)
11293 +++ libstdc++-v3/docs/html/install.html (.../branches/gcc-4_2-branch)   (revision 126002)
11294 @@ -80,8 +80,9 @@
11295        information must be installed.
11296  
11297        <p>
11298 -      The configure option --enable-clocale can be used force a
11299 -      particular behavior.
11300 +      Note that those sanity checks are also perfomed when an explicit
11301 +      --enable-clocale=gnu configure option is used:  this behavior is
11302 +      new in gcc 4.2.1 and defends against misconfigurations.
11303        </p>
11304  
11305        <p>
11306 Index: libstdc++-v3/config.h.in
11307 ===================================================================
11308 --- libstdc++-v3/config.h.in    (.../tags/gcc_4_2_0_release)    (revision 126002)
11309 +++ libstdc++-v3/config.h.in    (.../branches/gcc-4_2-branch)   (revision 126002)
11310 @@ -298,6 +298,12 @@
11311  /* Define to 1 if you have the <stdlib.h> header file. */
11312  #undef HAVE_STDLIB_H
11313  
11314 +/* Define if strerror_l is available in <string.h>. */
11315 +#undef HAVE_STRERROR_L
11316 +
11317 +/* Define if strerror_r is available in <string.h>. */
11318 +#undef HAVE_STRERROR_R
11319 +
11320  /* Define to 1 if you have the <strings.h> header file. */
11321  #undef HAVE_STRINGS_H
11322  
11323 @@ -310,6 +316,9 @@
11324  /* Define to 1 if you have the `strtold' function. */
11325  #undef HAVE_STRTOLD
11326  
11327 +/* Define if strxfrm_l is available in <string.h>. */
11328 +#undef HAVE_STRXFRM_L
11329 +
11330  /* Define to 1 if you have the <sys/filio.h> header file. */
11331  #undef HAVE_SYS_FILIO_H
11332  
11333 Index: libstdc++-v3/acinclude.m4
11334 ===================================================================
11335 --- libstdc++-v3/acinclude.m4   (.../tags/gcc_4_2_0_release)    (revision 126002)
11336 +++ libstdc++-v3/acinclude.m4   (.../branches/gcc-4_2-branch)   (revision 126002)
11337 @@ -251,11 +251,9 @@
11338      # NB: This flag only works reliably after 2.16.1. Configure tests
11339      # for this are difficult, so hard wire a value that should work.
11340  
11341 -    # All these tests are for C++, but run with the "C" compiler driver.
11342 -    # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
11343      ac_test_CFLAGS="${CFLAGS+set}"
11344      ac_save_CFLAGS="$CFLAGS"
11345 -    CFLAGS='-x c++ -Wl,--gc-sections'
11346 +    CFLAGS='-Wl,--gc-sections'
11347  
11348      # Check for -Wl,--gc-sections
11349      AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
11350 @@ -1334,64 +1332,31 @@
11351  dnl Default is generic.
11352  dnl
11353  AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
11354 -  AC_MSG_CHECKING([for C locale to use])
11355    GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
11356      [use MODEL for target locale package],
11357      [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
11358 +
11359 +  # Deal with gettext issues.  Default to not using it (=no) until we detect
11360 +  # support for it later.  Let the user turn it off via --e/d, but let that
11361 +  # default to on for easier handling.
11362 +  USE_NLS=no
11363 +  AC_ARG_ENABLE(nls,
11364 +    AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
11365 +    [],
11366 +    [enable_nls=yes])
11367    
11368 -  # If they didn't use this option switch, or if they specified --enable
11369 -  # with no specific model, we'll have to look for one.  If they
11370 -  # specified --disable (???), do likewise.
11371 +  # Either a known packaage, or "auto"
11372    if test $enable_clocale = no || test $enable_clocale = yes; then
11373       enable_clocale=auto
11374    fi
11375 -
11376 -  # Either a known package, or "auto"
11377    enable_clocale_flag=$enable_clocale
11378  
11379 -  # Probe for locale support if no specific model is specified.
11380 +  # Probe for locale model to use if none specified.
11381    # Default to "generic".
11382    if test $enable_clocale_flag = auto; then
11383      case ${target_os} in
11384        linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
11385 -        AC_EGREP_CPP([_GLIBCXX_ok], [
11386 -        #include <features.h>
11387 -        #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
11388 -          _GLIBCXX_ok
11389 -        #endif
11390 -        ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
11391 -
11392 -        # Test for bugs early in glibc-2.2.x series
11393 -          if test $enable_clocale_flag = gnu; then
11394 -          AC_TRY_RUN([
11395 -          #define _GNU_SOURCE 1
11396 -          #include <locale.h>
11397 -          #include <string.h>
11398 -          #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
11399 -          extern __typeof(newlocale) __newlocale;
11400 -          extern __typeof(duplocale) __duplocale;
11401 -          extern __typeof(strcoll_l) __strcoll_l;
11402 -          #endif
11403 -          int main()
11404 -          {
11405 -              const char __one[] = "Äuglein Augmen";
11406 -              const char __two[] = "Äuglein";
11407 -              int i;
11408 -              int j;
11409 -              __locale_t        loc;
11410 -               __locale_t        loc_dup;
11411 -              loc = __newlocale(1 << LC_ALL, "de_DE", 0);
11412 -              loc_dup = __duplocale(loc);
11413 -              i = __strcoll_l(__one, __two, loc);
11414 -              j = __strcoll_l(__one, __two, loc_dup);
11415 -              return 0;
11416 -          }
11417 -          ],
11418 -          [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
11419 -          [enable_clocale_flag=generic])
11420 -          fi
11421 -
11422 -        # ... at some point put __strxfrm_l tests in as well.
11423 +        enable_clocale_flag=gnu        
11424          ;;
11425        darwin* | freebsd*)
11426          enable_clocale_flag=darwin
11427 @@ -1402,16 +1367,79 @@
11428      esac
11429    fi
11430  
11431 -  # Deal with gettext issues.  Default to not using it (=no) until we detect
11432 -  # support for it later.  Let the user turn it off via --e/d, but let that
11433 -  # default to on for easier handling.
11434 -  USE_NLS=no
11435 -  AC_ARG_ENABLE(nls,
11436 -    AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
11437 -    [],
11438 -    [enable_nls=yes])
11439 +  # Sanity check model, and test for special functionality.
11440 +  if test $enable_clocale_flag = gnu; then
11441 +    AC_EGREP_CPP([_GLIBCXX_ok], [
11442 +    #include <features.h>
11443 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
11444 +      _GLIBCXX_ok
11445 +    #endif
11446 +    ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
11447  
11448 +    # Test for bugs early in glibc-2.2.x series
11449 +    AC_TRY_RUN([
11450 +    #define _GNU_SOURCE 1
11451 +    #include <locale.h>
11452 +    #include <string.h>
11453 +    #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
11454 +    extern __typeof(newlocale) __newlocale;
11455 +    extern __typeof(duplocale) __duplocale;
11456 +    extern __typeof(strcoll_l) __strcoll_l;
11457 +    #endif
11458 +    int main()
11459 +    {
11460 +        const char __one[] = "Äuglein Augmen";
11461 +        const char __two[] = "Äuglein";
11462 +        int i;
11463 +        int j;
11464 +        __locale_t        loc;
11465 +        __locale_t        loc_dup;
11466 +        loc = __newlocale(1 << LC_ALL, "de_DE", 0);
11467 +        loc_dup = __duplocale(loc);
11468 +        i = __strcoll_l(__one, __two, loc);
11469 +        j = __strcoll_l(__one, __two, loc_dup);
11470 +        return 0;
11471 +    }
11472 +    ],
11473 +    [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
11474 +    [enable_clocale_flag=generic])
11475 +
11476 +    # Set it to scream when it hurts.
11477 +    ac_save_CFLAGS="$CFLAGS"   
11478 +    CFLAGS="-Wimplicit-function-declaration -Werror"
11479 +
11480 +    # Use strxfrm_l if available.
11481 +    AC_TRY_COMPILE([#define _GNU_SOURCE 1
11482 +                   #include <string.h>
11483 +                   #include <locale.h>],
11484 +                   [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);], 
11485 +                    AC_DEFINE(HAVE_STRXFRM_L, 1, 
11486 +                    [Define if strxfrm_l is available in <string.h>.]),)
11487 +    
11488 +    # Use strerror_l if available.
11489 +    AC_TRY_COMPILE([#define _GNU_SOURCE 1
11490 +                   #include <string.h>
11491 +                   #include <locale.h>],
11492 +                   [__locale_t loc; strerror_l(5, loc);], 
11493 +                    AC_DEFINE(HAVE_STRERROR_L, 1, 
11494 +                    [Define if strerror_l is available in <string.h>.]),)
11495 +
11496 +    CFLAGS="$ac_save_CFLAGS"
11497 +  fi
11498 +
11499 +  # Perhaps use strerror_r if available, and strerror_l isn't.
11500 +  ac_save_CFLAGS="$CFLAGS"     
11501 +  CFLAGS="-Wimplicit-function-declaration -Werror"
11502 +  AC_TRY_COMPILE([#define _GNU_SOURCE 1
11503 +                 #include <string.h>
11504 +                 #include <locale.h>],
11505 +                 [char s[128]; strerror_r(5, s, 128);], 
11506 +                  AC_DEFINE(HAVE_STRERROR_R, 1, 
11507 +                  [Define if strerror_r is available in <string.h>.]),)
11508 +  CFLAGS="$ac_save_CFLAGS"
11509 +
11510    # Set configure bits for specified locale package
11511 +  AC_MSG_CHECKING([for C locale to use])
11512    case ${enable_clocale_flag} in
11513      generic)
11514        AC_MSG_RESULT(generic)
11515 Index: libgfortran/runtime/environ.c
11516 ===================================================================
11517 --- libgfortran/runtime/environ.c       (.../tags/gcc_4_2_0_release)    (revision 126002)
11518 +++ libgfortran/runtime/environ.c       (.../branches/gcc-4_2-branch)   (revision 126002)
11519 @@ -861,14 +861,13 @@
11520  static int
11521  do_parse (void)
11522  {
11523 -  int tok, def;
11524 +  int tok;
11525    int unit1;
11526    int continue_ulist;
11527    char *start;
11528  
11529    unit_count = 0;
11530  
11531 -  def = 0;
11532    start = p;
11533  
11534    /* Parse the string.  First, let's look for a default.  */
11535 @@ -923,6 +922,7 @@
11536        break;
11537  
11538      case END:
11539 +      def = endian;
11540        goto end;
11541        break;
11542  
11543 @@ -939,6 +939,18 @@
11544        tok = next_token ();
11545        switch (tok)
11546         {
11547 +       case NATIVE:
11548 +         if (next_token () != ':')
11549 +           goto error;
11550 +         endian = CONVERT_NATIVE;
11551 +         break;
11552 +
11553 +       case SWAP:
11554 +         if (next_token () != ':')
11555 +           goto error;
11556 +         endian = CONVERT_SWAP;
11557 +         break;
11558 +
11559         case LITTLE:
11560           if (next_token () != ':')
11561             goto error;
11562 Index: libgfortran/intrinsics/reshape_generic.c
11563 ===================================================================
11564 --- libgfortran/intrinsics/reshape_generic.c    (.../tags/gcc_4_2_0_release)    (revision 126002)
11565 +++ libgfortran/intrinsics/reshape_generic.c    (.../branches/gcc-4_2-branch)   (revision 126002)
11566 @@ -266,7 +266,7 @@
11567            else
11568              {
11569                scount[n]++;
11570 -              sptr += sstride[n] * size;
11571 +              src += sstride[n] * size;
11572              }
11573          }
11574      }
11575 Index: libgfortran/intrinsics/ishftc.c
11576 ===================================================================
11577 --- libgfortran/intrinsics/ishftc.c     (.../tags/gcc_4_2_0_release)    (revision 126002)
11578 +++ libgfortran/intrinsics/ishftc.c     (.../branches/gcc-4_2-branch)   (revision 126002)
11579 @@ -36,8 +36,7 @@
11580  GFC_INTEGER_4
11581  ishftc4 (GFC_INTEGER_4 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
11582  {
11583 -  GFC_INTEGER_4 mask;
11584 -  GFC_UINTEGER_4 bits;
11585 +  GFC_UINTEGER_4 mask, bits;
11586  
11587    if (shift < 0)
11588      shift = shift + size;
11589 @@ -45,9 +44,14 @@
11590    if (shift == 0 || shift == size)
11591      return i;
11592  
11593 -  mask = (~(GFC_INTEGER_4)0) << size;
11594 -  bits = i & ~mask;
11595 -  return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
11596 +  /* In C, the result of the shift operator is undefined if the right operand
11597 +     is greater than or equal to the number of bits in the left operand. So we
11598 +     have to special case it for fortran.  */
11599 +  mask = ~((size == 32) ? 0 : (~0 << size));
11600 +
11601 +  bits = i & mask;
11602 +  
11603 +  return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
11604  }
11605  
11606  extern GFC_INTEGER_8 ishftc8 (GFC_INTEGER_8, GFC_INTEGER_4, GFC_INTEGER_4);
11607 @@ -56,8 +60,7 @@
11608  GFC_INTEGER_8
11609  ishftc8 (GFC_INTEGER_8 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
11610  {
11611 -  GFC_INTEGER_8 mask;
11612 -  GFC_UINTEGER_8 bits;
11613 +  GFC_UINTEGER_8 mask, bits;
11614  
11615    if (shift < 0)
11616      shift = shift + size;
11617 @@ -65,9 +68,14 @@
11618    if (shift == 0 || shift == size)
11619      return i;
11620  
11621 -  mask = (~(GFC_INTEGER_8)0) << size;
11622 -  bits = i & ~mask;
11623 -  return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
11624 +  /* In C, the result of the shift operator is undefined if the right operand
11625 +     is greater than or equal to the number of bits in the left operand. So we
11626 +     have to special case it for fortran.  */
11627 +  mask = ~((size == 64) ? 0 : (~0 << size));
11628 +
11629 +  bits = i & mask;
11630 +  
11631 +  return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
11632  }
11633  
11634  #ifdef HAVE_GFC_INTEGER_16
11635 @@ -77,8 +85,7 @@
11636  GFC_INTEGER_16
11637  ishftc16 (GFC_INTEGER_16 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
11638  {
11639 -  GFC_INTEGER_16 mask;
11640 -  GFC_UINTEGER_16 bits;
11641 +  GFC_UINTEGER_16 mask, bits;
11642  
11643    if (shift < 0)
11644      shift = shift + size;
11645 @@ -86,8 +93,13 @@
11646    if (shift == 0 || shift == size)
11647      return i;
11648  
11649 -  mask = (~(GFC_INTEGER_16)0) << size;
11650 -  bits = i & ~mask;
11651 -  return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
11652 +  /* In C, the result of the shift operator is undefined if the right operand
11653 +     is greater than or equal to the number of bits in the left operand. So we
11654 +     have to special case it for fortran.  */
11655 +  mask = ~((size == 128) ? 0 : (~0 << size));
11656 +
11657 +  bits = i & mask;
11658 +  
11659 +  return (i & ~mask) | ((bits << shift) & mask) | (bits >> (size - shift));
11660  }
11661  #endif
11662 Index: libgfortran/ChangeLog
11663 ===================================================================
11664 --- libgfortran/ChangeLog       (.../tags/gcc_4_2_0_release)    (revision 126002)
11665 +++ libgfortran/ChangeLog       (.../branches/gcc-4_2-branch)   (revision 126002)
11666 @@ -1,3 +1,53 @@
11667 +2007-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
11668 +
11669 +       PR libfortran/31964
11670 +       Backport from trunk.
11671 +       * intrinsics/ishftc.c (ishftc4, ishftc8, ishftc16): Fix mask to handle
11672 +       shift of bit-size number of bits.
11673 +
11674 +2007-05-23  Tobias Burnus <burnus@net-b.de>
11675 +
11676 +       PR fortran/31917
11677 +       Backport from trunk.
11678 +       * runtime/environ.c (mark_range): Fix setting default convert unit.
11679 +
11680 +2007-05-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
11681 +
11682 +       PR libfortran/31051
11683 +       Backport from trunk.
11684 +       * io/transfer.c (formatted_transfer_scalar): Adjust position for pending
11685 +       spaces when in writing mode.  Clean up some formatting.
11686 +       
11687 +2007-05-22  Tobias Burnus  <burnus@net-b.de>
11688 +
11689 +       PR libfortran/31915
11690 +       Backport from trunk.
11691 +       * io/transfer.c (unformatted_read): Use proper size for real(10).
11692 +         (unformatted_write): Ditto.
11693 +
11694 +2007-05-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
11695 +
11696 +       PR libfortran/31395
11697 +       Backport from 4.3.
11698 +       * io/format.c (parse_format_list): Fix parsing. Regression against g77.
11699 +
11700 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
11701 +
11702 +       PR fortran/31618
11703 +       Backport from trunk.
11704 +       * io/transfer.c (read_block_direct):  Instead of calling us_read,
11705 +       set dtp->u.p.current_unit->current_record = 0 so that pre_position
11706 +       will read the record marker.
11707 +       (data_transfer_init):  For different error conditions, call
11708 +       generate_error, then return.
11709 +
11710 +2007-05-20  Thomas Koenig  <tkoenig@gcc.gnu.org>
11711 +
11712 +       PR libfortran/31196
11713 +       Backport from trunk.
11714 +       * intrinsics/reshape_generic.c (reshape_internal):  Increment
11715 +       correct variable.
11716 +
11717  2007-05-13  Release Manager
11718  
11719         * GCC 4.2.0 released.
11720 Index: libgfortran/io/transfer.c
11721 ===================================================================
11722 --- libgfortran/io/transfer.c   (.../tags/gcc_4_2_0_release)    (revision 126002)
11723 +++ libgfortran/io/transfer.c   (.../branches/gcc-4_2-branch)   (revision 126002)
11724 @@ -493,11 +493,11 @@
11725             }
11726           else
11727             {
11728 -             /* Let's make sure the file position is correctly set for the
11729 -                next read statement.  */
11730 +             /* Let's make sure the file position is correctly pre-positioned
11731 +                for the next read statement.  */
11732  
11733 +             dtp->u.p.current_unit->current_record = 0;
11734               next_record_r_unf (dtp, 0);
11735 -             us_read (dtp, 0);
11736               generate_error (&dtp->common, ERROR_SHORT_RECORD, NULL);
11737               return;
11738             }
11739 @@ -722,7 +722,11 @@
11740          of the padding.  If we hit a short record, then sz is
11741          adjusted accordingly, making later reads no-ops.  */
11742        
11743 -      sz = kind;
11744 +      if (type == BT_REAL || type == BT_COMPLEX)
11745 +       sz = size_from_real_kind (kind);
11746 +      else
11747 +       sz = kind;
11748 +
11749        for (i=0; i<nelems; i++)
11750         {
11751           read_block_direct (dtp, buffer, &sz);
11752 @@ -767,7 +771,11 @@
11753          read kind bytes.  We don't care about the contents
11754          of the padding.  */
11755  
11756 -      sz = kind;
11757 +      if (type == BT_REAL || type == BT_COMPLEX)
11758 +       sz = size_from_real_kind (kind);
11759 +      else
11760 +       sz = kind;
11761 +
11762        for (i=0; i<nelems; i++)
11763         {
11764           reverse_memcpy(buffer, p, size);
11765 @@ -1144,7 +1152,7 @@
11766         /* Format codes that don't transfer data.  */
11767         case FMT_X:
11768         case FMT_TR:
11769 -         consume_data_flag = 0 ;
11770 +         consume_data_flag = 0;
11771  
11772           pos = bytes_used + f->u.n + dtp->u.p.skips;
11773           dtp->u.p.skips = f->u.n + dtp->u.p.skips;
11774 @@ -1160,6 +1168,7 @@
11775               write_x (dtp, dtp->u.p.skips, dtp->u.p.pending_spaces);
11776               dtp->u.p.skips = dtp->u.p.pending_spaces = 0;
11777             }
11778 +
11779           if (dtp->u.p.mode == READING)
11780             read_x (dtp, f->u.n);
11781  
11782 @@ -1167,6 +1176,8 @@
11783  
11784         case FMT_TL:
11785         case FMT_T:
11786 +         consume_data_flag = 0;
11787 +
11788           if (f->format == FMT_TL)
11789             {
11790  
11791 @@ -1185,8 +1196,10 @@
11792             }
11793           else /* FMT_T */
11794             {
11795 -             consume_data_flag = 0;
11796 -             pos = f->u.n - 1;
11797 +             if (dtp->u.p.mode == READING)
11798 +               pos = f->u.n - 1;
11799 +             else
11800 +               pos = f->u.n - dtp->u.p.pending_spaces - 1;
11801             }
11802  
11803           /* Standard 10.6.1.1: excessive left tabbing is reset to the
11804 @@ -1753,16 +1766,19 @@
11805    /* Check the action.  */
11806  
11807    if (read_flag && dtp->u.p.current_unit->flags.action == ACTION_WRITE)
11808 -    generate_error (&dtp->common, ERROR_BAD_ACTION,
11809 -                   "Cannot read from file opened for WRITE");
11810 +    {
11811 +      generate_error (&dtp->common, ERROR_BAD_ACTION,
11812 +                     "Cannot read from file opened for WRITE");
11813 +      return;
11814 +    }
11815  
11816    if (!read_flag && dtp->u.p.current_unit->flags.action == ACTION_READ)
11817 -    generate_error (&dtp->common, ERROR_BAD_ACTION,
11818 -                   "Cannot write to file opened for READ");
11819 +    {
11820 +      generate_error (&dtp->common, ERROR_BAD_ACTION,
11821 +                     "Cannot write to file opened for READ");
11822 +      return;
11823 +    }
11824  
11825 -  if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
11826 -    return;
11827 -
11828    dtp->u.p.first_item = 1;
11829  
11830    /* Check the format.  */
11831 @@ -1770,14 +1786,14 @@
11832    if ((cf & IOPARM_DT_HAS_FORMAT) != 0)
11833      parse_format (dtp);
11834  
11835 -  if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
11836 -    return;
11837 -
11838    if (dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED
11839        && (cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
11840          != 0)
11841 -    generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11842 -                   "Format present for UNFORMATTED data transfer");
11843 +    {
11844 +      generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11845 +                     "Format present for UNFORMATTED data transfer");
11846 +      return;
11847 +    }
11848  
11849    if ((cf & IOPARM_DT_HAS_NAMELIST_NAME) != 0 && dtp->u.p.ionml != NULL)
11850       {
11851 @@ -1787,13 +1803,19 @@
11852       }
11853    else if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED &&
11854            !(cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT)))
11855 -    generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11856 -                   "Missing format for FORMATTED data transfer");
11857 +    {
11858 +      generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11859 +                     "Missing format for FORMATTED data transfer");
11860 +    }
11861  
11862    if (is_internal_unit (dtp)
11863        && dtp->u.p.current_unit->flags.form == FORM_UNFORMATTED)
11864 -    generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11865 -                   "Internal file cannot be accessed by UNFORMATTED data transfer");
11866 +    {
11867 +      generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11868 +                     "Internal file cannot be accessed by UNFORMATTED "
11869 +                     "data transfer");
11870 +      return;
11871 +    }
11872  
11873    /* Check the record or position number.  */
11874  
11875 @@ -1823,49 +1845,71 @@
11876    if (dtp->u.p.advance_status != ADVANCE_UNSPECIFIED)
11877      {
11878        if (dtp->u.p.current_unit->flags.access == ACCESS_DIRECT)
11879 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11880 -                       "ADVANCE specification conflicts with sequential access");
11881 +       {
11882 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11883 +                         "ADVANCE specification conflicts with sequential access");
11884 +         return;
11885 +       }
11886  
11887        if (is_internal_unit (dtp))
11888 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11889 -                       "ADVANCE specification conflicts with internal file");
11890 +       {
11891 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11892 +                         "ADVANCE specification conflicts with internal file");
11893 +         return;
11894 +       }
11895  
11896        if ((cf & (IOPARM_DT_HAS_FORMAT | IOPARM_DT_LIST_FORMAT))
11897           != IOPARM_DT_HAS_FORMAT)
11898 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11899 -                       "ADVANCE specification requires an explicit format");
11900 +       {
11901 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11902 +                         "ADVANCE specification requires an explicit format");
11903 +         return;
11904 +       }
11905      }
11906  
11907    if (read_flag)
11908      {
11909        if ((cf & IOPARM_EOR) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
11910 -       generate_error (&dtp->common, ERROR_MISSING_OPTION,
11911 -                       "EOR specification requires an ADVANCE specification of NO");
11912 +       {
11913 +         generate_error (&dtp->common, ERROR_MISSING_OPTION,
11914 +                         "EOR specification requires an ADVANCE specification "
11915 +                         "of NO");
11916 +         return;
11917 +       }
11918  
11919        if ((cf & IOPARM_DT_HAS_SIZE) != 0 && dtp->u.p.advance_status != ADVANCE_NO)
11920 -       generate_error (&dtp->common, ERROR_MISSING_OPTION,
11921 -                       "SIZE specification requires an ADVANCE specification of NO");
11922 -
11923 +       {
11924 +         generate_error (&dtp->common, ERROR_MISSING_OPTION,
11925 +                         "SIZE specification requires an ADVANCE specification of NO");
11926 +         return;
11927 +       }
11928      }
11929    else
11930      {                          /* Write constraints.  */
11931        if ((cf & IOPARM_END) != 0)
11932 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11933 -                       "END specification cannot appear in a write statement");
11934 +       {
11935 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11936 +                         "END specification cannot appear in a write statement");
11937 +         return;
11938 +       }
11939  
11940        if ((cf & IOPARM_EOR) != 0)
11941 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11942 -                       "EOR specification cannot appear in a write statement");
11943 +       {
11944 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11945 +                         "EOR specification cannot appear in a write statement");
11946 +         return;
11947 +       }
11948  
11949        if ((cf & IOPARM_DT_HAS_SIZE) != 0)
11950 -       generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11951 -                       "SIZE specification cannot appear in a write statement");
11952 +       {
11953 +         generate_error (&dtp->common, ERROR_OPTION_CONFLICT,
11954 +                         "SIZE specification cannot appear in a write statement");
11955 +         return;
11956 +       }
11957      }
11958  
11959    if (dtp->u.p.advance_status == ADVANCE_UNSPECIFIED)
11960      dtp->u.p.advance_status = ADVANCE_YES;
11961 -  if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
11962 -    return;
11963  
11964    /* Sanity checks on the record number.  */
11965    if ((cf & IOPARM_DT_HAS_REC) != 0)
11966 Index: libgfortran/io/format.c
11967 ===================================================================
11968 --- libgfortran/io/format.c     (.../tags/gcc_4_2_0_release)    (revision 126002)
11969 +++ libgfortran/io/format.c     (.../branches/gcc-4_2-branch)   (revision 126002)
11970 @@ -860,10 +860,11 @@
11971      case FMT_SLASH:
11972        get_fnode (fmt, &head, &tail, FMT_SLASH);
11973        tail->repeat = 1;
11974 +      goto optional_comma;
11975  
11976 -      /* Fall Through */
11977 -
11978      case FMT_COLON:
11979 +      get_fnode (fmt, &head, &tail, FMT_COLON);
11980 +      tail->repeat = 1;
11981        goto optional_comma;
11982  
11983      case FMT_END:
11984 Index: boehm-gc/darwin_stop_world.c
11985 ===================================================================
11986 --- boehm-gc/darwin_stop_world.c        (.../tags/gcc_4_2_0_release)    (revision 126002)
11987 +++ boehm-gc/darwin_stop_world.c        (.../branches/gcc-4_2-branch)   (revision 126002)
11988 @@ -10,7 +10,7 @@
11989     be allocated, is called the red zone. This area as shown in Figure 3-2 may
11990     be used for any purpose as long as a new stack frame does not need to be
11991     added to the stack."
11992 -   
11993 +
11994     Page 50: "If a leaf procedure's red zone usage would exceed 224 bytes, then
11995     it must set up a stack frame just like routines that call other routines."
11996  */
11997 @@ -20,48 +20,6 @@
11998  # define PPC_RED_ZONE_SIZE 320
11999  #endif
12000  
12001 -/* Try to work out the right way to access thread state structure members.
12002 -   The structure has changed its definition in different Darwin versions.  */
12003 -#if defined(__ppc__)
12004 -# define THREAD_STATE ppc_thread_state_t
12005 -# if defined (HAS_PPC_THREAD_STATE_R0)
12006 -#  define THREAD_FLD(x) x
12007 -# elif defined (HAS_PPC_THREAD_STATE___R0)
12008 -#  define THREAD_FLD(x) __ ## x
12009 -# else
12010 -#  error can not work out how to access fields of ppc_thread_state_t
12011 -# endif
12012 -#elif defined(__ppc64__)
12013 -# define THREAD_STATE ppc_thread_state64_t
12014 -# if defined (HAS_PPC_THREAD_STATE64_R0)
12015 -#  define THREAD_FLD(x) x
12016 -# elif defined (HAS_PPC_THREAD_STATE64___R0)
12017 -#  define THREAD_FLD(x) __ ## x
12018 -# else
12019 -#  error can not work out how to access fields of ppc_thread_state64_t
12020 -# endif
12021 -#elif defined(__i386__)
12022 -# define THREAD_STATE i386_thread_state_t
12023 -# if defined (HAS_I386_THREAD_STATE_EAX)
12024 -#  define THREAD_FLD(x) x
12025 -# elif defined (HAS_I386_THREAD_STATE___EAX)
12026 -#  define THREAD_FLD(x) __ ## x
12027 -# else
12028 -#  error can not work out how to access fields of i386_thread_state_t
12029 -# endif
12030 -#elif defined(__x86_64__)
12031 -# define THREAD_STATE i386_thread_state_t
12032 -# if defined (HAS_I386_THREAD_STATE_EAX)
12033 -#  define THREAD_FLD(x) x
12034 -# elif defined (HAS_I386_THREAD_STATE___EAX)
12035 -#  define THREAD_FLD(x) __ ## x
12036 -# else
12037 -#  error can not work out how to access fields of i386_thread_state_t
12038 -# endif
12039 -#else
12040 -# error unknown architecture
12041 -#endif
12042 -
12043  typedef struct StackFrame {
12044    unsigned long        savedSP;
12045    unsigned long        savedCR;
12046 @@ -115,8 +73,8 @@
12047    GC_thread p;
12048    pthread_t me;
12049    ptr_t lo, hi;
12050 -  THREAD_STATE state;
12051 -  mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
12052 +  GC_THREAD_STATE_T state;
12053 +  mach_msg_type_number_t thread_state_count = GC_MACH_THREAD_STATE_COUNT;
12054    
12055    me = pthread_self();
12056    if (!GC_thr_initialized) GC_thr_init();
12057 @@ -128,11 +86,8 @@
12058         lo = GC_approx_sp();
12059        } else {
12060         /* Get the thread state (registers, etc) */
12061 -       r = thread_get_state(
12062 -                            p->stop_info.mach_thread,
12063 -                            MACHINE_THREAD_STATE,
12064 -                            (natural_t*)&state,
12065 -                            &thread_state_count);
12066 +       r = thread_get_state(p->stop_info.mach_thread, GC_MACH_THREAD_STATE,
12067 +                            (natural_t*)&state, &thread_state_count);
12068         if(r != KERN_SUCCESS) ABORT("thread_get_state failed");
12069  
12070  #if defined(I386)
12071 @@ -144,7 +99,33 @@
12072         GC_push_one(state . THREAD_FLD (edx)); 
12073         GC_push_one(state . THREAD_FLD (edi)); 
12074         GC_push_one(state . THREAD_FLD (esi)); 
12075 -       GC_push_one(state . THREAD_FLD (ebp)); 
12076 +       GC_push_one(state . THREAD_FLD (ebp));
12077 +
12078 +#elif defined(X86_64)
12079 +       lo = (void*)state . THREAD_FLD (rsp);
12080 +
12081 +       GC_push_one(state . THREAD_FLD (rax));
12082 +       GC_push_one(state . THREAD_FLD (rbx));
12083 +       GC_push_one(state . THREAD_FLD (rcx));
12084 +       GC_push_one(state . THREAD_FLD (rdx));
12085 +       GC_push_one(state . THREAD_FLD (rdi));
12086 +       GC_push_one(state . THREAD_FLD (rsi));
12087 +       GC_push_one(state . THREAD_FLD (rbp));
12088 +       GC_push_one(state . THREAD_FLD (rsp));
12089 +       GC_push_one(state . THREAD_FLD (r8));
12090 +       GC_push_one(state . THREAD_FLD (r9));
12091 +       GC_push_one(state . THREAD_FLD (r10));
12092 +       GC_push_one(state . THREAD_FLD (r11));
12093 +       GC_push_one(state . THREAD_FLD (r12));
12094 +       GC_push_one(state . THREAD_FLD (r13));
12095 +       GC_push_one(state . THREAD_FLD (r14));
12096 +       GC_push_one(state . THREAD_FLD (r15));
12097 +       GC_push_one(state . THREAD_FLD (rip));
12098 +       GC_push_one(state . THREAD_FLD (rflags));
12099 +       GC_push_one(state . THREAD_FLD (cs));
12100 +       GC_push_one(state . THREAD_FLD (fs));
12101 +       GC_push_one(state . THREAD_FLD (gs));
12102 +
12103  #elif defined(POWERPC)
12104         lo = (void*)(state . THREAD_FLD (r1) - PPC_RED_ZONE_SIZE);
12105          
12106 @@ -221,9 +202,9 @@
12107         hi = (ptr_t)FindTopOfStack(0);
12108        } else {
12109  #     if defined(__ppc__) || defined(__ppc64__)
12110 -       THREAD_STATE info;
12111 +       GC_THREAD_STATE_T info;
12112         mach_msg_type_number_t outCount = THREAD_STATE_MAX;
12113 -       r = thread_get_state(thread, MACHINE_THREAD_STATE,
12114 +       r = thread_get_state(thread, GC_MACH_THREAD_STATE,
12115                              (natural_t *)&info, &outCount);
12116         if(r != KERN_SUCCESS) ABORT("task_get_state failed");
12117  
12118 @@ -264,10 +245,10 @@
12119  #      else
12120         /* FIXME: Remove after testing: */
12121         WARN("This is completely untested and likely will not work\n", 0);
12122 -       THREAD_STATE info;
12123 +       GC_THREAD_STATE_T info;
12124         mach_msg_type_number_t outCount = THREAD_STATE_MAX;
12125 -       r = thread_get_state(thread, MACHINE_THREAD_STATE,
12126 -                            (natural_t *)&info, &outCount);
12127 +       r = thread_get_state(thread, GC_MACH_THREAD_STATE, (natural_t *)&info,
12128 +                            &outCount);
12129         if(r != KERN_SUCCESS) ABORT("task_get_state failed");
12130  
12131         lo = (void*)info . THREAD_FLD (esp);
12132 Index: boehm-gc/Makefile.in
12133 ===================================================================
12134 --- boehm-gc/Makefile.in        (.../tags/gcc_4_2_0_release)    (revision 126002)
12135 +++ boehm-gc/Makefile.in        (.../branches/gcc-4_2-branch)   (revision 126002)
12136 @@ -224,6 +224,7 @@
12137  build_vendor = @build_vendor@
12138  datadir = @datadir@
12139  exec_prefix = @exec_prefix@
12140 +extra_ldflags_libgc = @extra_ldflags_libgc@
12141  host = @host@
12142  host_alias = @host_alias@
12143  host_cpu = @host_cpu@
12144 @@ -280,7 +281,7 @@
12145  # linuxthread semaphore functions get linked:
12146  libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
12147  libgcjgc_la_DEPENDENCIES = @addobjs@
12148 -libgcjgc_la_LDFLAGS = -version-info 1:2:0 -rpath $(toolexeclibdir)
12149 +libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir)
12150  libgcjgc_convenience_la_LIBADD = @addobjs@
12151  libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
12152  AM_CXXFLAGS = @GC_CFLAGS@
12153 Index: boehm-gc/configure.ac
12154 ===================================================================
12155 --- boehm-gc/configure.ac       (.../tags/gcc_4_2_0_release)    (revision 126002)
12156 +++ boehm-gc/configure.ac       (.../branches/gcc-4_2-branch)   (revision 126002)
12157 @@ -248,33 +248,46 @@
12158  case "$host" in
12159    powerpc*-*-darwin*)
12160      AC_CHECK_MEMBER(ppc_thread_state_t.r0,
12161 -      AC_DEFINE(HAS_PPC_THREAD_STATE_R0,,[ppc_thread_state_t has field r0]),,
12162 +      AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
12163 +       [ppc_thread_state_t has field r0]),,
12164        [#include <mach/thread_status.h>])
12165      AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
12166 -      AC_DEFINE(HAS_PPC_THREAD_STATE___R0,,dnl
12167 -        [ppc_thread_state_t has field __r0]),,
12168 +      AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
12169 +       [ppc_thread_state_t has field __r0]),,
12170        [#include <mach/thread_status.h>])
12171      AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
12172 -      AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,,dnl
12173 -        [ppc_thread_state64_t has field r0]),,
12174 +      AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
12175 +       [ppc_thread_state64_t has field r0]),,
12176        [#include <mach/thread_status.h>])
12177      AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
12178 -      AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,,dnl
12179 -        [ppc_thread_state64_t has field __r0]),,
12180 +      AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
12181 +       [ppc_thread_state64_t has field __r0]),,
12182        [#include <mach/thread_status.h>])
12183      ;;
12184    i?86*-*-darwin*)
12185 -    AC_CHECK_MEMBER(i386_thread_state_t.eax,
12186 -      AC_DEFINE(HAS_I386_THREAD_STATE_EAX,,dnl
12187 -        [i386_thread_state_t has field eax]),,
12188 +    AC_CHECK_MEMBER(x86_thread_state32_t.eax,
12189 +      AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
12190 +       [x86_thread_state32_t has field eax]),,
12191        [#include <sys/cdefs.h>
12192 -#include <mach/thread_status.h>])
12193 -    AC_CHECK_MEMBER(i386_thread_state_t.__eax,
12194 -      AC_DEFINE(HAS_I386_THREAD_STATE___EAX,,dnl
12195 -        [i386_thread_state_t has field __eax]),,
12196 +      #include <mach/thread_status.h>])
12197 +    AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
12198 +      AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
12199 +       [x86_thread_state32_t has field __eax]),,
12200        [#include <sys/cdefs.h>
12201 -#include <mach/thread_status.h>])
12202 +      #include <mach/thread_status.h>])
12203      ;;
12204 +  x86_64-*-darwin*)
12205 +    AC_CHECK_MEMBER(x86_thread_state64_t.rax,
12206 +      AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
12207 +       [x86_thread_state64_t has field rax]),,
12208 +      [#include <sys/cdefs.h>
12209 +      #include <mach/thread_status.h>])
12210 +    AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
12211 +      AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
12212 +       [x86_thread_state64_t has field __rax]),,
12213 +      [#include <sys/cdefs.h>
12214 +      #include <mach/thread_status.h>])
12215 +     ;;
12216    *) ;;
12217  esac
12218  
12219 @@ -287,6 +300,14 @@
12220      ;;
12221  esac
12222  
12223 +# extra LD Flags which are required for targets
12224 +case "${host}" in
12225 +  *-*-darwin*)
12226 +    extra_ldflags_libgc=-Wl,-single_module
12227 +    ;;
12228 +esac
12229 +AC_SUBST(extra_ldflags_libgc)
12230 +
12231  AC_SUBST(EXTRA_TEST_LIBS)
12232  
12233  target_all=libgcjgc.la
12234 Index: boehm-gc/include/Makefile.in
12235 ===================================================================
12236 --- boehm-gc/include/Makefile.in        (.../tags/gcc_4_2_0_release)    (revision 126002)
12237 +++ boehm-gc/include/Makefile.in        (.../branches/gcc-4_2-branch)   (revision 126002)
12238 @@ -149,6 +149,7 @@
12239  build_vendor = @build_vendor@
12240  datadir = @datadir@
12241  exec_prefix = @exec_prefix@
12242 +extra_ldflags_libgc = @extra_ldflags_libgc@
12243  host = @host@
12244  host_alias = @host_alias@
12245  host_cpu = @host_cpu@
12246 Index: boehm-gc/include/gc_config.h.in
12247 ===================================================================
12248 --- boehm-gc/include/gc_config.h.in     (.../tags/gcc_4_2_0_release)    (revision 126002)
12249 +++ boehm-gc/include/gc_config.h.in     (.../branches/gcc-4_2-branch)   (revision 126002)
12250 @@ -54,12 +54,6 @@
12251  /* support for win32 threads */
12252  #undef GC_WIN32_THREADS
12253  
12254 -/* i386_thread_state_t has field eax */
12255 -#undef HAS_I386_THREAD_STATE_EAX
12256 -
12257 -/* i386_thread_state_t has field __eax */
12258 -#undef HAS_I386_THREAD_STATE___EAX
12259 -
12260  /* ppc_thread_state64_t has field r0 */
12261  #undef HAS_PPC_THREAD_STATE64_R0
12262  
12263 @@ -72,6 +66,18 @@
12264  /* ppc_thread_state_t has field __r0 */
12265  #undef HAS_PPC_THREAD_STATE___R0
12266  
12267 +/* x86_thread_state32_t has field eax */
12268 +#undef HAS_X86_THREAD_STATE32_EAX
12269 +
12270 +/* x86_thread_state32_t has field __eax */
12271 +#undef HAS_X86_THREAD_STATE32___EAX
12272 +
12273 +/* x86_thread_state64_t has field rax */
12274 +#undef HAS_X86_THREAD_STATE64_RAX
12275 +
12276 +/* x86_thread_state64_t has field __rax */
12277 +#undef HAS_X86_THREAD_STATE64___RAX
12278 +
12279  /* Define to 1 if you have the <inttypes.h> header file. */
12280  #undef HAVE_INTTYPES_H
12281  
12282 Index: boehm-gc/include/private/gc_priv.h
12283 ===================================================================
12284 --- boehm-gc/include/private/gc_priv.h  (.../tags/gcc_4_2_0_release)    (revision 126002)
12285 +++ boehm-gc/include/private/gc_priv.h  (.../branches/gcc-4_2-branch)   (revision 126002)
12286 @@ -286,6 +286,53 @@
12287  #endif
12288  
12289  
12290 +#if defined(DARWIN)
12291 +#      if defined(POWERPC)
12292 +#              if CPP_WORDSZ == 32
12293 +#                define GC_THREAD_STATE_T ppc_thread_state_t
12294 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE
12295 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
12296 +#                define GC_MACH_HEADER mach_header
12297 +#                define GC_MACH_SECTION section
12298 +#              else
12299 +#                define GC_THREAD_STATE_T ppc_thread_state64_t
12300 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
12301 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
12302 +#                define GC_MACH_HEADER mach_header_64
12303 +#                define GC_MACH_SECTION section_64
12304 +#              endif
12305 +#      elif defined(I386) || defined(X86_64)
12306 +#              if CPP_WORDSZ == 32
12307 +#                define GC_THREAD_STATE_T x86_thread_state32_t
12308 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE32
12309 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
12310 +#                define GC_MACH_HEADER mach_header
12311 +#                define GC_MACH_SECTION section
12312 +#              else
12313 +#                define GC_THREAD_STATE_T x86_thread_state64_t
12314 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE64
12315 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
12316 +#                define GC_MACH_HEADER mach_header_64
12317 +#                define GC_MACH_SECTION section_64
12318 +#              endif
12319 +#      else
12320 +#              error define GC_THREAD_STATE_T
12321 +#              define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
12322 +#              define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
12323 +#      endif
12324 +/* Try to work out the right way to access thread state structure members.
12325 +   The structure has changed its definition in different Darwin versions.
12326 +   This now defaults to the (older) names without __, thus hopefully,
12327 +   not breaking any existing Makefile.direct builds.  */
12328 +#      if defined (HAS_PPC_THREAD_STATE___R0) \
12329 +        || defined (HAS_PPC_THREAD_STATE64___R0) \
12330 +        || defined (HAS_X86_THREAD_STATE32___EAX) \
12331 +        || defined (HAS_X86_THREAD_STATE64___RAX)
12332 +#        define THREAD_FLD(x) __ ## x
12333 +#      else
12334 +#        define THREAD_FLD(x) x
12335 +#      endif
12336 +#endif
12337  /*********************************/
12338  /*                               */
12339  /* OS interface routines        */
12340 @@ -468,6 +515,53 @@
12341  #   define GETENV(name) 0
12342  #endif
12343  
12344 +#if defined(DARWIN)
12345 +#      if defined(POWERPC)
12346 +#              if CPP_WORDSZ == 32
12347 +#                define GC_THREAD_STATE_T ppc_thread_state_t
12348 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE
12349 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE_COUNT
12350 +#                define GC_MACH_HEADER mach_header
12351 +#                define GC_MACH_SECTION section
12352 +#              else
12353 +#                define GC_THREAD_STATE_T ppc_thread_state64_t
12354 +#                define GC_MACH_THREAD_STATE PPC_THREAD_STATE64
12355 +#                define GC_MACH_THREAD_STATE_COUNT PPC_THREAD_STATE64_COUNT
12356 +#                define GC_MACH_HEADER mach_header_64
12357 +#                define GC_MACH_SECTION section_64
12358 +#              endif
12359 +#      elif defined(I386) || defined(X86_64)
12360 +#              if CPP_WORDSZ == 32
12361 +#                define GC_THREAD_STATE_T x86_thread_state32_t
12362 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE32
12363 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE32_COUNT
12364 +#                define GC_MACH_HEADER mach_header
12365 +#                define GC_MACH_SECTION section
12366 +#              else
12367 +#                define GC_THREAD_STATE_T x86_thread_state64_t
12368 +#                define GC_MACH_THREAD_STATE x86_THREAD_STATE64
12369 +#                define GC_MACH_THREAD_STATE_COUNT x86_THREAD_STATE64_COUNT
12370 +#                define GC_MACH_HEADER mach_header_64
12371 +#                define GC_MACH_SECTION section_64
12372 +#              endif
12373 +#      else
12374 +#              error define GC_THREAD_STATE_T
12375 +#              define GC_MACH_THREAD_STATE MACHINE_THREAD_STATE
12376 +#              define GC_MACH_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT
12377 +#      endif
12378 +/* Try to work out the right way to access thread state structure members.
12379 +   The structure has changed its definition in different Darwin versions.
12380 +   This now defaults to the (older) names without __, thus hopefully,
12381 +   not breaking any existing Makefile.direct builds.  */
12382 +#      if defined (HAS_PPC_THREAD_STATE___R0) \
12383 +        || defined (HAS_PPC_THREAD_STATE64___R0) \
12384 +        || defined (HAS_X86_THREAD_STATE32___EAX) \
12385 +        || defined (HAS_X86_THREAD_STATE64___RAX)
12386 +#        define THREAD_FLD(x) __ ## x
12387 +#      else
12388 +#        define THREAD_FLD(x) x
12389 +#      endif
12390 +#endif
12391  /*********************************/
12392  /*                               */
12393  /* Word-size-dependent defines   */
12394 Index: boehm-gc/include/private/gcconfig.h
12395 ===================================================================
12396 --- boehm-gc/include/private/gcconfig.h (.../tags/gcc_4_2_0_release)    (revision 126002)
12397 +++ boehm-gc/include/private/gcconfig.h (.../branches/gcc-4_2-branch)   (revision 126002)
12398 @@ -302,7 +302,10 @@
12399  #   if defined(__ppc__)  || defined(__ppc64__)
12400  #    define POWERPC
12401  #    define mach_type_known
12402 -#   elif defined(__i386__) || defined(__x86_64)
12403 +#   elif defined(__x86_64__)
12404 +#    define X86_64
12405 +#    define mach_type_known
12406 +#   elif defined(__i386__)
12407  #    define I386
12408  #    define mach_type_known
12409  #   endif
12410 @@ -791,26 +794,29 @@
12411  #     define DATAEND (_end)
12412  #   endif
12413  #   ifdef DARWIN
12414 -#     if defined(__ppc64__) || defined(__x86_64)
12415 +#     define OS_TYPE "DARWIN"
12416 +#     define DYNAMIC_LOADING
12417 +#     if defined(__ppc64__)
12418  #       define ALIGNMENT 8
12419  #       define CPP_WORDSZ 64
12420 +#       define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
12421 +#       define CACHE_LINE_SIZE 64
12422 +#       ifndef HBLKSIZE
12423 +#         define HBLKSIZE 4096
12424 +#       endif
12425  #     else
12426  #       define ALIGNMENT 4
12427 +#       define STACKBOTTOM ((ptr_t) 0xc0000000)
12428  #     endif
12429 -#     define OS_TYPE "DARWIN"
12430 -#     define DYNAMIC_LOADING
12431        /* XXX: see get_end(3), get_etext() and get_end() should not be used.
12432 -         These aren't used when dyld support is enabled (it is by default) */
12433 +        These aren't used when dyld support is enabled (it is by default) */
12434  #     define DATASTART ((ptr_t) get_etext())
12435  #     define DATAEND   ((ptr_t) get_end())
12436 -#     define STACKBOTTOM ((ptr_t) 0xc0000000)
12437  #     define USE_MMAP
12438  #     define USE_MMAP_ANON
12439  #     define USE_ASM_PUSH_REGS
12440 -      /* This is potentially buggy. It needs more testing. See the comments in
12441 -         os_dep.c.  It relies on threads to track writes. */
12442  #     ifdef GC_DARWIN_THREADS
12443 -/* #       define MPROTECT_VDB -- diabled for now.  May work for some apps. */
12444 +#       define MPROTECT_VDB
12445  #     endif
12446  #     include <unistd.h>
12447  #     define GETPAGESIZE() getpagesize()
12448 @@ -822,7 +828,7 @@
12449           __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
12450  #     endif
12451        /* There seems to be some issues with trylock hanging on darwin. This
12452 -         should be looked into some more */
12453 +        should be looked into some more */
12454  #     define NO_PTHREAD_TRYLOCK
12455  #   endif
12456  #   ifdef FREEBSD
12457 @@ -1317,23 +1323,21 @@
12458  #     define DARWIN_DONT_PARSE_STACK
12459  #     define DYNAMIC_LOADING
12460        /* XXX: see get_end(3), get_etext() and get_end() should not be used.
12461 -        These aren't used when dyld support is enabled (it is by default) */
12462 +        These aren't used when dyld support is enabled (it is by default) */
12463  #     define DATASTART ((ptr_t) get_etext())
12464  #     define DATAEND   ((ptr_t) get_end())
12465  #     define STACKBOTTOM ((ptr_t) 0xc0000000)
12466  #     define USE_MMAP
12467  #     define USE_MMAP_ANON
12468  #     define USE_ASM_PUSH_REGS
12469 -      /* This is potentially buggy. It needs more testing. See the comments in
12470 -        os_dep.c.  It relies on threads to track writes. */
12471  #     ifdef GC_DARWIN_THREADS
12472 -/* #       define MPROTECT_VDB -- disabled for now.  May work for some apps. */
12473 +#       define MPROTECT_VDB
12474  #     endif
12475  #     include <unistd.h>
12476  #     define GETPAGESIZE() getpagesize()
12477        /* There seems to be some issues with trylock hanging on darwin. This
12478 -         should be looked into some more */
12479 -#      define NO_PTHREAD_TRYLOCK
12480 +        should be looked into some more */
12481 +#     define NO_PTHREAD_TRYLOCK
12482  #   endif /* DARWIN */
12483  # endif
12484  
12485 @@ -1986,6 +1990,26 @@
12486  #          define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
12487  #      endif
12488  #   endif
12489 +#   ifdef DARWIN
12490 +#     define OS_TYPE "DARWIN"
12491 +#     define DARWIN_DONT_PARSE_STACK
12492 +#     define DYNAMIC_LOADING
12493 +      /* XXX: see get_end(3), get_etext() and get_end() should not be used.
12494 +        These aren't used when dyld support is enabled (it is by default) */
12495 +#     define DATASTART ((ptr_t) get_etext())
12496 +#     define DATAEND   ((ptr_t) get_end())
12497 +#     define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
12498 +#     define USE_MMAP
12499 +#     define USE_MMAP_ANON
12500 +#     ifdef GC_DARWIN_THREADS
12501 +#       define MPROTECT_VDB
12502 +#     endif
12503 +#     include <unistd.h>
12504 +#     define GETPAGESIZE() getpagesize()
12505 +      /* There seems to be some issues with trylock hanging on darwin. This
12506 +        should be looked into some more */
12507 +#     define NO_PTHREAD_TRYLOCK
12508 +#   endif
12509  #   ifdef FREEBSD
12510  #      define OS_TYPE "FREEBSD"
12511  #      ifndef GC_FREEBSD_THREADS
12512 Index: boehm-gc/ChangeLog
12513 ===================================================================
12514 --- boehm-gc/ChangeLog  (.../tags/gcc_4_2_0_release)    (revision 126002)
12515 +++ boehm-gc/ChangeLog  (.../branches/gcc-4_2-branch)   (revision 126002)
12516 @@ -1,3 +1,72 @@
12517 +2007-06-22  Jakub Jelinek  <jakub@redhat.com>
12518 +
12519 +       * pthread_support.c (GC_get_thread_stack_base): Handle
12520 +       pthread_getattr_np failures.
12521 +
12522 +2007-05-22  Andreas Tobler  <a.tobler@schweiz.org>
12523 +
12524 +       * Backport r124870 from main.
12525 +
12526 +       2007-05-20  Andreas Tobler  <a.tobler@schweiz.org>
12527 +
12528 +       * configure.ac: Introduce extra_ldflags_libgc. Use it for Darwin.
12529 +       * configure: Regenerate.
12530 +       * Makefile.am (libgc_la_LDFLAGS): Use extra_ldflags_libgc.
12531 +       * Makefile.in: Regenerate.
12532 +       * include/Makefile.in: Regenerate.
12533 +       * include/private/gcconfig.h: Enable MPROTECT_VDB for all Darwin
12534 +       targets. Remove comments. Prepare ppc64 support for Darwin.
12535 +
12536 +2007-05-19  Andreas Tobler  <a.tobler@schweiz.org>
12537 +
12538 +       * Backport r120684, 120801, 120853, 120874 and 120977 from main.
12539 +
12540 +       2007-01-19  Andreas Tobler  <a.tobler@schweiz.org>
12541 +
12542 +       * os_dep.c (defined(MPROTECT_VDB) && defined(DARWIN)): Moved recently
12543 +       added defines to include/private/gc_priv.h
12544 +       * darwin_stop_world.c: Removed the above defines.
12545 +       (catch_exception_raise): Added THREAD_FLD in exc_state for POWERPC too.
12546 +       * include/private/gc_priv.h: Moved definitions from darwin_stop_world.c
12547 +       and os_dep.c to here. Fixed THREAD definition fixes for ppc64.
12548 +
12549 +       2007-01-17  Mike Stump  <mrs@apple.com>
12550 +
12551 +       * os_dep.c: Fix i686-apple-darwin9 builds.
12552 +
12553 +       2007-01-17  Andreas Tobler  <a.tobler@schweiz.org>
12554 +
12555 +       * include/gc_config.h.in: Regenerate.
12556 +
12557 +       2007-01-15  Andreas Tobler  <a.tobler@schweiz.org>
12558 +
12559 +       * os_dep.c (defined(MPROTECT_VDB) && defined(DARWIN)): Adjust mail
12560 +       reference.
12561 +       (catch_exception_raise): Fix typo in the I386 exc_state.
12562 +
12563 +       2007-01-11  Andreas Tobler  <a.tobler@schweiz.org>
12564 +
12565 +       * configure.ac: Replaced HAS_I386_THREAD_STATE_* with
12566 +       HAS_X86_THREAD_STATE32_* and HAS_X86_THREAD_STATE64_* respectively.
12567 +       * configure: Regenerated.
12568 +       * include/private/gcconfig.h (DARWIN): Added X86_64 define for Darwin.
12569 +       Added base definitions for the X86_64 Darwin port.
12570 +       * include/private/gc_priv.h: Added definitions for Darwin MACH thread
12571 +       operations. Moved existing THREAD_STATE info from darwin_stop_world.c.
12572 +       * darwin_stop_world.c: Removed THREAD_STATE info. Added
12573 +       HAS_X86_THREAD_STATE64___RAX. And replaced HAS_I386_THREAD_STATE___EAX
12574 +       with HAS_X86_THREAD_STATE32___EAX.
12575 +       (GC_push_all_stacks): Use GC_MACH_THREAD_STATE_COUNT. Add code for
12576 +       X86_64 Darwin.
12577 +       * dyn_load.c (GC_dyld_name_for_hdr): Use GC_MACH_HEADER.
12578 +       (GC_dyld_image_add): Use GC_MACH_HEADER and GC_MACH_SECTION.
12579 +       Distinguish between getsectbynamefromheader_64 and
12580 +       getsectbynamefromheader.
12581 +       (GC_dyld_image_remove): Likewise.
12582 +       * os_dep.c (GC_dirty_init): Use GC_MACH_THREAD_STATE.
12583 +       (catch_exception_raise): Introduce exception information for I386 and
12584 +       X86_64 Darwin. Add X86_64 for exc_state.faultvaddr.
12585 +
12586  2007-05-13  Release Manager
12587  
12588         * GCC 4.2.0 released.
12589 Index: boehm-gc/configure
12590 ===================================================================
12591 --- boehm-gc/configure  (.../tags/gcc_4_2_0_release)    (revision 126002)
12592 +++ boehm-gc/configure  (.../branches/gcc-4_2-branch)   (revision 126002)
12593 @@ -309,7 +309,7 @@
12594  # include <unistd.h>
12595  #endif"
12596  
12597 -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical mkinstalldirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CFLAGS CXXFLAGS CCAS CCASFLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GC_CFLAGS LN_S LIBTOOL CXXCPP CPPFLAGS THREADLIBS POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE EXTRA_TEST_LIBS target_all CPLUSPLUS_TRUE CPLUSPLUS_FALSE AM_CPPFLAGS addobjs addincludes addlibs addtests CPP EGREP MY_CFLAGS toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
12598 +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical mkinstalldirs INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CFLAGS CXXFLAGS CCAS CCASFLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT GC_CFLAGS LN_S LIBTOOL CXXCPP CPPFLAGS THREADLIBS POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE extra_ldflags_libgc EXTRA_TEST_LIBS target_all CPLUSPLUS_TRUE CPLUSPLUS_FALSE AM_CPPFLAGS addobjs addincludes addlibs addtests CPP EGREP MY_CFLAGS toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
12599  ac_subst_files=''
12600  
12601  # Initialize some variables set by options.
12602 @@ -5741,7 +5741,7 @@
12603  if test $ac_cv_member_ppc_thread_state_t_r0 = yes; then
12604  
12605  cat >>confdefs.h <<\_ACEOF
12606 -#define HAS_PPC_THREAD_STATE_R0
12607 +#define HAS_PPC_THREAD_STATE_R0 1
12608  _ACEOF
12609  
12610  fi
12611 @@ -5852,7 +5852,7 @@
12612  if test $ac_cv_member_ppc_thread_state_t___r0 = yes; then
12613  
12614  cat >>confdefs.h <<\_ACEOF
12615 -#define HAS_PPC_THREAD_STATE___R0
12616 +#define HAS_PPC_THREAD_STATE___R0 1
12617  _ACEOF
12618  
12619  fi
12620 @@ -5963,7 +5963,7 @@
12621  if test $ac_cv_member_ppc_thread_state64_t_r0 = yes; then
12622  
12623  cat >>confdefs.h <<\_ACEOF
12624 -#define HAS_PPC_THREAD_STATE64_R0
12625 +#define HAS_PPC_THREAD_STATE64_R0 1
12626  _ACEOF
12627  
12628  fi
12629 @@ -6074,16 +6074,16 @@
12630  if test $ac_cv_member_ppc_thread_state64_t___r0 = yes; then
12631  
12632  cat >>confdefs.h <<\_ACEOF
12633 -#define HAS_PPC_THREAD_STATE64___R0
12634 +#define HAS_PPC_THREAD_STATE64___R0 1
12635  _ACEOF
12636  
12637  fi
12638  
12639      ;;
12640    i?86*-*-darwin*)
12641 -    echo "$as_me:$LINENO: checking for i386_thread_state_t.eax" >&5
12642 -echo $ECHO_N "checking for i386_thread_state_t.eax... $ECHO_C" >&6
12643 -if test "${ac_cv_member_i386_thread_state_t_eax+set}" = set; then
12644 +    echo "$as_me:$LINENO: checking for x86_thread_state32_t.eax" >&5
12645 +echo $ECHO_N "checking for x86_thread_state32_t.eax... $ECHO_C" >&6
12646 +if test "${ac_cv_member_x86_thread_state32_t_eax+set}" = set; then
12647    echo $ECHO_N "(cached) $ECHO_C" >&6
12648  else
12649    cat >conftest.$ac_ext <<_ACEOF
12650 @@ -6093,12 +6093,12 @@
12651  cat >>conftest.$ac_ext <<_ACEOF
12652  /* end confdefs.h.  */
12653  #include <sys/cdefs.h>
12654 -#include <mach/thread_status.h>
12655 +      #include <mach/thread_status.h>
12656  
12657  int
12658  main ()
12659  {
12660 -static i386_thread_state_t ac_aggr;
12661 +static x86_thread_state32_t ac_aggr;
12662  if (ac_aggr.eax)
12663  return 0;
12664    ;
12665 @@ -6127,7 +6127,7 @@
12666    ac_status=$?
12667    echo "$as_me:$LINENO: \$? = $ac_status" >&5
12668    (exit $ac_status); }; }; then
12669 -  ac_cv_member_i386_thread_state_t_eax=yes
12670 +  ac_cv_member_x86_thread_state32_t_eax=yes
12671  else
12672    echo "$as_me: failed program was:" >&5
12673  sed 's/^/| /' conftest.$ac_ext >&5
12674 @@ -6139,12 +6139,12 @@
12675  cat >>conftest.$ac_ext <<_ACEOF
12676  /* end confdefs.h.  */
12677  #include <sys/cdefs.h>
12678 -#include <mach/thread_status.h>
12679 +      #include <mach/thread_status.h>
12680  
12681  int
12682  main ()
12683  {
12684 -static i386_thread_state_t ac_aggr;
12685 +static x86_thread_state32_t ac_aggr;
12686  if (sizeof ac_aggr.eax)
12687  return 0;
12688    ;
12689 @@ -6173,30 +6173,30 @@
12690    ac_status=$?
12691    echo "$as_me:$LINENO: \$? = $ac_status" >&5
12692    (exit $ac_status); }; }; then
12693 -  ac_cv_member_i386_thread_state_t_eax=yes
12694 +  ac_cv_member_x86_thread_state32_t_eax=yes
12695  else
12696    echo "$as_me: failed program was:" >&5
12697  sed 's/^/| /' conftest.$ac_ext >&5
12698  
12699 -ac_cv_member_i386_thread_state_t_eax=no
12700 +ac_cv_member_x86_thread_state32_t_eax=no
12701  fi
12702  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
12703  fi
12704  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
12705  fi
12706 -echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t_eax" >&5
12707 -echo "${ECHO_T}$ac_cv_member_i386_thread_state_t_eax" >&6
12708 -if test $ac_cv_member_i386_thread_state_t_eax = yes; then
12709 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t_eax" >&5
12710 +echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t_eax" >&6
12711 +if test $ac_cv_member_x86_thread_state32_t_eax = yes; then
12712  
12713  cat >>confdefs.h <<\_ACEOF
12714 -#define HAS_I386_THREAD_STATE_EAX
12715 +#define HAS_X86_THREAD_STATE32_EAX 1
12716  _ACEOF
12717  
12718  fi
12719  
12720 -    echo "$as_me:$LINENO: checking for i386_thread_state_t.__eax" >&5
12721 -echo $ECHO_N "checking for i386_thread_state_t.__eax... $ECHO_C" >&6
12722 -if test "${ac_cv_member_i386_thread_state_t___eax+set}" = set; then
12723 +    echo "$as_me:$LINENO: checking for x86_thread_state32_t.__eax" >&5
12724 +echo $ECHO_N "checking for x86_thread_state32_t.__eax... $ECHO_C" >&6
12725 +if test "${ac_cv_member_x86_thread_state32_t___eax+set}" = set; then
12726    echo $ECHO_N "(cached) $ECHO_C" >&6
12727  else
12728    cat >conftest.$ac_ext <<_ACEOF
12729 @@ -6206,12 +6206,12 @@
12730  cat >>conftest.$ac_ext <<_ACEOF
12731  /* end confdefs.h.  */
12732  #include <sys/cdefs.h>
12733 -#include <mach/thread_status.h>
12734 +      #include <mach/thread_status.h>
12735  
12736  int
12737  main ()
12738  {
12739 -static i386_thread_state_t ac_aggr;
12740 +static x86_thread_state32_t ac_aggr;
12741  if (ac_aggr.__eax)
12742  return 0;
12743    ;
12744 @@ -6240,7 +6240,7 @@
12745    ac_status=$?
12746    echo "$as_me:$LINENO: \$? = $ac_status" >&5
12747    (exit $ac_status); }; }; then
12748 -  ac_cv_member_i386_thread_state_t___eax=yes
12749 +  ac_cv_member_x86_thread_state32_t___eax=yes
12750  else
12751    echo "$as_me: failed program was:" >&5
12752  sed 's/^/| /' conftest.$ac_ext >&5
12753 @@ -6252,12 +6252,12 @@
12754  cat >>conftest.$ac_ext <<_ACEOF
12755  /* end confdefs.h.  */
12756  #include <sys/cdefs.h>
12757 -#include <mach/thread_status.h>
12758 +      #include <mach/thread_status.h>
12759  
12760  int
12761  main ()
12762  {
12763 -static i386_thread_state_t ac_aggr;
12764 +static x86_thread_state32_t ac_aggr;
12765  if (sizeof ac_aggr.__eax)
12766  return 0;
12767    ;
12768 @@ -6286,28 +6286,256 @@
12769    ac_status=$?
12770    echo "$as_me:$LINENO: \$? = $ac_status" >&5
12771    (exit $ac_status); }; }; then
12772 -  ac_cv_member_i386_thread_state_t___eax=yes
12773 +  ac_cv_member_x86_thread_state32_t___eax=yes
12774  else
12775    echo "$as_me: failed program was:" >&5
12776  sed 's/^/| /' conftest.$ac_ext >&5
12777  
12778 -ac_cv_member_i386_thread_state_t___eax=no
12779 +ac_cv_member_x86_thread_state32_t___eax=no
12780  fi
12781  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
12782  fi
12783  rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
12784  fi
12785 -echo "$as_me:$LINENO: result: $ac_cv_member_i386_thread_state_t___eax" >&5
12786 -echo "${ECHO_T}$ac_cv_member_i386_thread_state_t___eax" >&6
12787 -if test $ac_cv_member_i386_thread_state_t___eax = yes; then
12788 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state32_t___eax" >&5
12789 +echo "${ECHO_T}$ac_cv_member_x86_thread_state32_t___eax" >&6
12790 +if test $ac_cv_member_x86_thread_state32_t___eax = yes; then
12791  
12792  cat >>confdefs.h <<\_ACEOF
12793 -#define HAS_I386_THREAD_STATE___EAX
12794 +#define HAS_X86_THREAD_STATE32___EAX 1
12795  _ACEOF
12796  
12797  fi
12798  
12799      ;;
12800 +  x86_64-*-darwin*)
12801 +    echo "$as_me:$LINENO: checking for x86_thread_state64_t.rax" >&5
12802 +echo $ECHO_N "checking for x86_thread_state64_t.rax... $ECHO_C" >&6
12803 +if test "${ac_cv_member_x86_thread_state64_t_rax+set}" = set; then
12804 +  echo $ECHO_N "(cached) $ECHO_C" >&6
12805 +else
12806 +  cat >conftest.$ac_ext <<_ACEOF
12807 +/* confdefs.h.  */
12808 +_ACEOF
12809 +cat confdefs.h >>conftest.$ac_ext
12810 +cat >>conftest.$ac_ext <<_ACEOF
12811 +/* end confdefs.h.  */
12812 +#include <sys/cdefs.h>
12813 +      #include <mach/thread_status.h>
12814 +
12815 +int
12816 +main ()
12817 +{
12818 +static x86_thread_state64_t ac_aggr;
12819 +if (ac_aggr.rax)
12820 +return 0;
12821 +  ;
12822 +  return 0;
12823 +}
12824 +_ACEOF
12825 +rm -f conftest.$ac_objext
12826 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
12827 +  (eval $ac_compile) 2>conftest.er1
12828 +  ac_status=$?
12829 +  grep -v '^ *+' conftest.er1 >conftest.err
12830 +  rm -f conftest.er1
12831 +  cat conftest.err >&5
12832 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12833 +  (exit $ac_status); } &&
12834 +        { ac_try='test -z "$ac_c_werror_flag"
12835 +                        || test ! -s conftest.err'
12836 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12837 +  (eval $ac_try) 2>&5
12838 +  ac_status=$?
12839 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12840 +  (exit $ac_status); }; } &&
12841 +        { ac_try='test -s conftest.$ac_objext'
12842 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12843 +  (eval $ac_try) 2>&5
12844 +  ac_status=$?
12845 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12846 +  (exit $ac_status); }; }; then
12847 +  ac_cv_member_x86_thread_state64_t_rax=yes
12848 +else
12849 +  echo "$as_me: failed program was:" >&5
12850 +sed 's/^/| /' conftest.$ac_ext >&5
12851 +
12852 +cat >conftest.$ac_ext <<_ACEOF
12853 +/* confdefs.h.  */
12854 +_ACEOF
12855 +cat confdefs.h >>conftest.$ac_ext
12856 +cat >>conftest.$ac_ext <<_ACEOF
12857 +/* end confdefs.h.  */
12858 +#include <sys/cdefs.h>
12859 +      #include <mach/thread_status.h>
12860 +
12861 +int
12862 +main ()
12863 +{
12864 +static x86_thread_state64_t ac_aggr;
12865 +if (sizeof ac_aggr.rax)
12866 +return 0;
12867 +  ;
12868 +  return 0;
12869 +}
12870 +_ACEOF
12871 +rm -f conftest.$ac_objext
12872 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
12873 +  (eval $ac_compile) 2>conftest.er1
12874 +  ac_status=$?
12875 +  grep -v '^ *+' conftest.er1 >conftest.err
12876 +  rm -f conftest.er1
12877 +  cat conftest.err >&5
12878 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12879 +  (exit $ac_status); } &&
12880 +        { ac_try='test -z "$ac_c_werror_flag"
12881 +                        || test ! -s conftest.err'
12882 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12883 +  (eval $ac_try) 2>&5
12884 +  ac_status=$?
12885 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12886 +  (exit $ac_status); }; } &&
12887 +        { ac_try='test -s conftest.$ac_objext'
12888 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12889 +  (eval $ac_try) 2>&5
12890 +  ac_status=$?
12891 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12892 +  (exit $ac_status); }; }; then
12893 +  ac_cv_member_x86_thread_state64_t_rax=yes
12894 +else
12895 +  echo "$as_me: failed program was:" >&5
12896 +sed 's/^/| /' conftest.$ac_ext >&5
12897 +
12898 +ac_cv_member_x86_thread_state64_t_rax=no
12899 +fi
12900 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
12901 +fi
12902 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
12903 +fi
12904 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t_rax" >&5
12905 +echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t_rax" >&6
12906 +if test $ac_cv_member_x86_thread_state64_t_rax = yes; then
12907 +
12908 +cat >>confdefs.h <<\_ACEOF
12909 +#define HAS_X86_THREAD_STATE64_RAX 1
12910 +_ACEOF
12911 +
12912 +fi
12913 +
12914 +    echo "$as_me:$LINENO: checking for x86_thread_state64_t.__rax" >&5
12915 +echo $ECHO_N "checking for x86_thread_state64_t.__rax... $ECHO_C" >&6
12916 +if test "${ac_cv_member_x86_thread_state64_t___rax+set}" = set; then
12917 +  echo $ECHO_N "(cached) $ECHO_C" >&6
12918 +else
12919 +  cat >conftest.$ac_ext <<_ACEOF
12920 +/* confdefs.h.  */
12921 +_ACEOF
12922 +cat confdefs.h >>conftest.$ac_ext
12923 +cat >>conftest.$ac_ext <<_ACEOF
12924 +/* end confdefs.h.  */
12925 +#include <sys/cdefs.h>
12926 +      #include <mach/thread_status.h>
12927 +
12928 +int
12929 +main ()
12930 +{
12931 +static x86_thread_state64_t ac_aggr;
12932 +if (ac_aggr.__rax)
12933 +return 0;
12934 +  ;
12935 +  return 0;
12936 +}
12937 +_ACEOF
12938 +rm -f conftest.$ac_objext
12939 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
12940 +  (eval $ac_compile) 2>conftest.er1
12941 +  ac_status=$?
12942 +  grep -v '^ *+' conftest.er1 >conftest.err
12943 +  rm -f conftest.er1
12944 +  cat conftest.err >&5
12945 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12946 +  (exit $ac_status); } &&
12947 +        { ac_try='test -z "$ac_c_werror_flag"
12948 +                        || test ! -s conftest.err'
12949 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12950 +  (eval $ac_try) 2>&5
12951 +  ac_status=$?
12952 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12953 +  (exit $ac_status); }; } &&
12954 +        { ac_try='test -s conftest.$ac_objext'
12955 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12956 +  (eval $ac_try) 2>&5
12957 +  ac_status=$?
12958 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12959 +  (exit $ac_status); }; }; then
12960 +  ac_cv_member_x86_thread_state64_t___rax=yes
12961 +else
12962 +  echo "$as_me: failed program was:" >&5
12963 +sed 's/^/| /' conftest.$ac_ext >&5
12964 +
12965 +cat >conftest.$ac_ext <<_ACEOF
12966 +/* confdefs.h.  */
12967 +_ACEOF
12968 +cat confdefs.h >>conftest.$ac_ext
12969 +cat >>conftest.$ac_ext <<_ACEOF
12970 +/* end confdefs.h.  */
12971 +#include <sys/cdefs.h>
12972 +      #include <mach/thread_status.h>
12973 +
12974 +int
12975 +main ()
12976 +{
12977 +static x86_thread_state64_t ac_aggr;
12978 +if (sizeof ac_aggr.__rax)
12979 +return 0;
12980 +  ;
12981 +  return 0;
12982 +}
12983 +_ACEOF
12984 +rm -f conftest.$ac_objext
12985 +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
12986 +  (eval $ac_compile) 2>conftest.er1
12987 +  ac_status=$?
12988 +  grep -v '^ *+' conftest.er1 >conftest.err
12989 +  rm -f conftest.er1
12990 +  cat conftest.err >&5
12991 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12992 +  (exit $ac_status); } &&
12993 +        { ac_try='test -z "$ac_c_werror_flag"
12994 +                        || test ! -s conftest.err'
12995 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
12996 +  (eval $ac_try) 2>&5
12997 +  ac_status=$?
12998 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
12999 +  (exit $ac_status); }; } &&
13000 +        { ac_try='test -s conftest.$ac_objext'
13001 +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
13002 +  (eval $ac_try) 2>&5
13003 +  ac_status=$?
13004 +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
13005 +  (exit $ac_status); }; }; then
13006 +  ac_cv_member_x86_thread_state64_t___rax=yes
13007 +else
13008 +  echo "$as_me: failed program was:" >&5
13009 +sed 's/^/| /' conftest.$ac_ext >&5
13010 +
13011 +ac_cv_member_x86_thread_state64_t___rax=no
13012 +fi
13013 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
13014 +fi
13015 +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
13016 +fi
13017 +echo "$as_me:$LINENO: result: $ac_cv_member_x86_thread_state64_t___rax" >&5
13018 +echo "${ECHO_T}$ac_cv_member_x86_thread_state64_t___rax" >&6
13019 +if test $ac_cv_member_x86_thread_state64_t___rax = yes; then
13020 +
13021 +cat >>confdefs.h <<\_ACEOF
13022 +#define HAS_X86_THREAD_STATE64___RAX 1
13023 +_ACEOF
13024 +
13025 +fi
13026 +
13027 +     ;;
13028    *) ;;
13029  esac
13030  
13031 @@ -6392,8 +6620,16 @@
13032      ;;
13033  esac
13034  
13035 +# extra LD Flags which are required for targets
13036 +case "${host}" in
13037 +  *-*-darwin*)
13038 +    extra_ldflags_libgc=-Wl,-single_module
13039 +    ;;
13040 +esac
13041  
13042  
13043 +
13044 +
13045  target_all=libgcjgc.la
13046  
13047  
13048 @@ -8246,6 +8482,7 @@
13049  s,@THREADLIBS@,$THREADLIBS,;t t
13050  s,@POWERPC_DARWIN_TRUE@,$POWERPC_DARWIN_TRUE,;t t
13051  s,@POWERPC_DARWIN_FALSE@,$POWERPC_DARWIN_FALSE,;t t
13052 +s,@extra_ldflags_libgc@,$extra_ldflags_libgc,;t t
13053  s,@EXTRA_TEST_LIBS@,$EXTRA_TEST_LIBS,;t t
13054  s,@target_all@,$target_all,;t t
13055  s,@CPLUSPLUS_TRUE@,$CPLUSPLUS_TRUE,;t t
13056 Index: boehm-gc/pthread_support.c
13057 ===================================================================
13058 --- boehm-gc/pthread_support.c  (.../tags/gcc_4_2_0_release)    (revision 126002)
13059 +++ boehm-gc/pthread_support.c  (.../branches/gcc-4_2-branch)   (revision 126002)
13060 @@ -1135,7 +1135,13 @@
13061    size_t stack_size;
13062    
13063    my_pthread = pthread_self();  
13064 -  pthread_getattr_np (my_pthread, &attr);
13065 +  if (pthread_getattr_np (my_pthread, &attr) != 0)
13066 +    {
13067 +#   ifdef DEBUG_THREADS
13068 +      GC_printf1("Can not determine stack base for attached thread");
13069 +#   endif
13070 +      return 0;
13071 +    }
13072    pthread_attr_getstack (&attr, (void **) &stack_addr, &stack_size);
13073    pthread_attr_destroy (&attr);
13074    
13075 Index: boehm-gc/os_dep.c
13076 ===================================================================
13077 --- boehm-gc/os_dep.c   (.../tags/gcc_4_2_0_release)    (revision 126002)
13078 +++ boehm-gc/os_dep.c   (.../branches/gcc-4_2-branch)   (revision 126002)
13079 @@ -3371,7 +3371,7 @@
13080        1. Apple's mach/xnu documentation
13081        2. Timothy J. Wood's "Mach Exception Handlers 101" post to the
13082           omnigroup's macosx-dev list. 
13083 -         www.omnigroup.com/mailman/archive/macosx-dev/2000-June/002030.html
13084 +         www.omnigroup.com/mailman/archive/macosx-dev/2000-June/014178.html
13085        3. macosx-nat.c from Apple's GDB source code.
13086  */
13087     
13088 @@ -3683,7 +3683,7 @@
13089          mask,
13090          GC_ports.exception,
13091          EXCEPTION_DEFAULT,
13092 -        MACHINE_THREAD_STATE
13093 +        GC_MACH_THREAD_STATE
13094      );
13095      if(r != KERN_SUCCESS) ABORT("task_set_exception_ports failed");
13096  
13097 @@ -3802,10 +3802,16 @@
13098          mach_msg_type_number_t exc_state_count = PPC_EXCEPTION_STATE64_COUNT;
13099          ppc_exception_state64_t exc_state;
13100  #     endif
13101 -#   elif defined(I386)
13102 -        thread_state_flavor_t flavor = i386_EXCEPTION_STATE;
13103 -        mach_msg_type_number_t exc_state_count = i386_EXCEPTION_STATE_COUNT;
13104 -        i386_exception_state_t exc_state;
13105 +#   elif defined(I386) || defined(X86_64)
13106 +#     if CPP_WORDSZ == 32
13107 +       thread_state_flavor_t flavor = x86_EXCEPTION_STATE32;
13108 +       mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE32_COUNT;
13109 +       x86_exception_state32_t exc_state;
13110 +#     else
13111 +       thread_state_flavor_t flavor = x86_EXCEPTION_STATE64;
13112 +       mach_msg_type_number_t exc_state_count = x86_EXCEPTION_STATE64_COUNT;
13113 +       x86_exception_state64_t exc_state;
13114 +#     endif
13115  #   else
13116  #      error FIXME for non-ppc darwin
13117  #   endif
13118 @@ -3838,9 +3844,9 @@
13119      
13120      /* This is the address that caused the fault */
13121  #if defined(POWERPC)
13122 -    addr = (char*) exc_state.dar;
13123 -#elif defined (I386)
13124 -    addr = (char*) exc_state.faultvaddr;
13125 +    addr = (char*) exc_state. THREAD_FLD(dar);
13126 +#elif defined (I386) || defined (X86_64)
13127 +    addr = (char*) exc_state. THREAD_FLD(faultvaddr);
13128  #else
13129  #   error FIXME for non POWERPC/I386
13130  #endif
13131 Index: boehm-gc/Makefile.am
13132 ===================================================================
13133 --- boehm-gc/Makefile.am        (.../tags/gcc_4_2_0_release)    (revision 126002)
13134 +++ boehm-gc/Makefile.am        (.../branches/gcc-4_2-branch)   (revision 126002)
13135 @@ -33,11 +33,13 @@
13136  rs6000_mach_dep.s sparc_mach_dep.S sparc_netbsd_mach_dep.s \
13137  sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s
13138  
13139 +extra_ldflags_libgc = @extra_ldflags_libgc@
13140 +
13141  # Include THREADLIBS here to ensure that the correct versions of
13142  # linuxthread semaphore functions get linked:
13143  libgcjgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
13144  libgcjgc_la_DEPENDENCIES = @addobjs@
13145 -libgcjgc_la_LDFLAGS = -version-info 1:2:0 -rpath $(toolexeclibdir)
13146 +libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir)
13147  
13148  libgcjgc_convenience_la_LIBADD = @addobjs@
13149  libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
13150 Index: boehm-gc/dyn_load.c
13151 ===================================================================
13152 --- boehm-gc/dyn_load.c (.../tags/gcc_4_2_0_release)    (revision 126002)
13153 +++ boehm-gc/dyn_load.c (.../branches/gcc-4_2-branch)   (revision 126002)
13154 @@ -1152,7 +1152,7 @@
13155  };
13156      
13157  #ifdef DARWIN_DEBUG
13158 -static const char *GC_dyld_name_for_hdr(struct mach_header *hdr) {
13159 +static const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) {
13160      unsigned long i,c;
13161      c = _dyld_image_count();
13162      for(i=0;i<c;i++) if(_dyld_get_image_header(i) == hdr)
13163 @@ -1162,12 +1162,17 @@
13164  #endif
13165          
13166  /* This should never be called by a thread holding the lock */
13167 -static void GC_dyld_image_add(struct mach_header* hdr, unsigned long slide) {
13168 +static void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr, intptr_t slide)
13169 +{
13170      unsigned long start,end,i;
13171 -    const struct section *sec;
13172 +    const struct GC_MACH_SECTION *sec;
13173      if (GC_no_dls) return;
13174      for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
13175 -        sec = getsectbynamefromheader(
13176 +#   if defined (__LP64__)
13177 +      sec = getsectbynamefromheader_64(
13178 +#   else
13179 +      sec = getsectbynamefromheader(
13180 +#   endif
13181              hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
13182          if(sec == NULL || sec->size == 0) continue;
13183          start = slide + sec->addr;
13184 @@ -1184,11 +1189,16 @@
13185  }
13186  
13187  /* This should never be called by a thread holding the lock */
13188 -static void GC_dyld_image_remove(struct mach_header* hdr, unsigned long slide) {
13189 +static void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr,
13190 +                                intptr_t slide) {
13191      unsigned long start,end,i;
13192 -    const struct section *sec;
13193 +    const struct GC_MACH_SECTION *sec;
13194      for(i=0;i<sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]);i++) {
13195 -        sec = getsectbynamefromheader(
13196 +#   if defined (__LP64__)
13197 +      sec = getsectbynamefromheader_64(
13198 +#   else
13199 +      sec = getsectbynamefromheader(
13200 +#   endif
13201              hdr,GC_dyld_sections[i].seg,GC_dyld_sections[i].sect);
13202          if(sec == NULL || sec->size == 0) continue;
13203          start = slide + sec->addr;
13204 Index: configure.in
13205 ===================================================================
13206 --- configure.in        (.../tags/gcc_4_2_0_release)    (revision 126002)
13207 +++ configure.in        (.../branches/gcc-4_2-branch)   (revision 126002)
13208 @@ -2419,7 +2419,13 @@
13209    # Pass -fkeep-inline-functions for stage 1 if the GCC version supports it.
13210    CFLAGS="$CFLAGS -fkeep-inline-functions"
13211    AC_MSG_CHECKING([whether -fkeep-inline-functions is supported])
13212 -  AC_TRY_COMPILE(,,
13213 +  AC_TRY_COMPILE([
13214 +#if (__GNUC__ < 3) \
13215 +    || (__GNUC__ == 3 && (__GNUC_MINOR__ < 3 \
13216 +                         || (__GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ < 1)))
13217 +#error http://gcc.gnu.org/PR29382
13218 +#endif
13219 +    ],,
13220      [AC_MSG_RESULT([yes]); stage1_cflags="$stage1_cflags -fkeep-inline-functions"],
13221      [AC_MSG_RESULT([no])])
13222  
13223 Index: ChangeLog
13224 ===================================================================
13225 --- ChangeLog   (.../tags/gcc_4_2_0_release)    (revision 126002)
13226 +++ ChangeLog   (.../branches/gcc-4_2-branch)   (revision 126002)
13227 @@ -1,3 +1,9 @@
13228 +2007-05-30  Jakub Jelinek  <jakub@redhat.com>
13229 +
13230 +       PR bootstrap/29382
13231 +       * configure.in: Don't use -fkeep-inline-functions for GCC < 3.3.1.
13232 +       * configure: Rebuilt.
13233 +
13234  2007-05-13  Release Manager
13235  
13236         * GCC 4.2.0 released.
13237 Index: config/ChangeLog
13238 ===================================================================
13239 --- config/ChangeLog    (.../tags/gcc_4_2_0_release)    (revision 126002)
13240 +++ config/ChangeLog    (.../branches/gcc-4_2-branch)   (revision 126002)
13241 @@ -1,3 +1,8 @@
13242 +2007-06-20  Mike Stump  <mrs@apple.com>
13243 +
13244 +       * acx.m4 (NCN_STRICT_CHECK_TARGET_TOOLS): Fix incremental builds.
13245 +       (ACX_HAVE_GCC_FOR_TARGET): Likewise.
13246 +
13247  2007-05-13  Release Manager
13248  
13249         * GCC 4.2.0 released.
13250 Index: config/acx.m4
13251 ===================================================================
13252 --- config/acx.m4       (.../tags/gcc_4_2_0_release)    (revision 126002)
13253 +++ config/acx.m4       (.../branches/gcc-4_2-branch)   (revision 126002)
13254 @@ -183,6 +183,8 @@
13255    else
13256      $1="${ncn_target_tool_prefix}[$]2"
13257    fi], [$1="$3"])
13258 +else
13259 +  $1="$ac_cv_prog_$1"
13260  fi
13261  ]) []dnl # NCN_STRICT_CHECK_TARGET_TOOLS
13262    
13263 @@ -297,7 +299,7 @@
13264    elif test $build != $host && test $have_gcc_for_target = yes; then
13265      $1=`$GCC_FOR_TARGET --print-prog-name=$2`
13266      test [$]$1=$2 && $1=
13267 -    ac_cv_path_$1=[$]$1
13268 +    test -n "[$]$1" && ac_cv_path_$1=[$]$1
13269    fi
13270  fi
13271  if test -z "$ac_cv_path_$1" ; then
13272 Index: libjava/java/lang/natClassLoader.cc
13273 ===================================================================
13274 --- libjava/java/lang/natClassLoader.cc (.../tags/gcc_4_2_0_release)    (revision 126002)
13275 +++ libjava/java/lang/natClassLoader.cc (.../branches/gcc-4_2-branch)   (revision 126002)
13276 @@ -235,6 +235,15 @@
13277  
13278    new_class->engine = &_Jv_soleIndirectCompiledEngine;
13279  
13280 +  /* FIXME:  Way back before the dawn of time, we overloaded the
13281 +     SYNTHETIC class access modifier to mean INTERPRETED.  This was a
13282 +     Bad Thing, but it didn't matter then because classes were never
13283 +     marked synthetic.  However, it is possible to redeem the
13284 +     situation: _Jv_NewClassFromInitializer is only called from
13285 +     compiled classes, so we clear the INTERPRETED flag.  This is a
13286 +     kludge!  */
13287 +  new_class->accflags &= ~java::lang::reflect::Modifier::INTERPRETED;
13288 +
13289    if (_Jv_CheckABIVersion ((unsigned long) new_class->next_or_version))
13290      (*_Jv_RegisterClassHook) (new_class);
13291    
13292 Index: libjava/ChangeLog
13293 ===================================================================
13294 --- libjava/ChangeLog   (.../tags/gcc_4_2_0_release)    (revision 126002)
13295 +++ libjava/ChangeLog   (.../branches/gcc-4_2-branch)   (revision 126002)
13296 @@ -1,3 +1,8 @@
13297 +2007-05-31  Andrew Haley  <aph@redhat.com>
13298 +
13299 +       * java/lang/natClassLoader.cc (_Jv_NewClassFromInitializer): Clear
13300 +       INTERPRETED access modifier.
13301 +
13302  2007-05-13  Release Manager
13303  
13304         * GCC 4.2.0 released.
13305 Index: maintainer-scripts/ChangeLog
13306 ===================================================================
13307 --- maintainer-scripts/ChangeLog        (.../tags/gcc_4_2_0_release)    (revision 126002)
13308 +++ maintainer-scripts/ChangeLog        (.../branches/gcc-4_2-branch)   (revision 126002)
13309 @@ -1,3 +1,7 @@
13310 +2007-05-28  Mark Mitchell  <mark@codesourcery.com>
13311 +
13312 +       * gcc_release: Adjust placement of release candidates.
13313 +
13314  2007-05-13  Release Manager
13315  
13316         * GCC 4.2.0 released.
13317 Index: maintainer-scripts/gcc_release
13318 ===================================================================
13319 --- maintainer-scripts/gcc_release      (.../tags/gcc_4_2_0_release)    (revision 126002)
13320 +++ maintainer-scripts/gcc_release      (.../branches/gcc-4_2-branch)   (revision 126002)
13321 @@ -699,10 +699,10 @@
13322    # and minor release numbers.
13323    SVNBRANCH="branches/gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
13324  
13325 -  # If this is not a final release, set various parameters acordingly.
13326 +  # If this is not a final release, set various parameters accordingly.
13327    if [ ${FINAL} -ne 1 ]; then
13328 -    RELEASE="${RELEASE}-${DATE}"
13329 -    FTP_PATH="${FTP_PATH}/prerelease-${RELEASE}/"
13330 +    RELEASE="${RELEASE}-RC-${DATE}"
13331 +    FTP_PATH="${SNAPSHOTS_DIR}/${RELEASE}"
13332    else
13333      FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/"
13334    fi
This page took 1.614935 seconds and 3 git commands to generate.