~ubuntu-branches/debian/sid/gcc-4.8/sid

« back to all changes in this revision

Viewing changes to .svn/pristine/54/545bc204c6741a3d4728131abfa86fca656cf708.svn-base

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-12-19 19:48:34 UTC
  • Revision ID: package-import@ubuntu.com-20141219194834-4dz1q7rrn5pad823
Tags: 4.8.4-1
* GCC 4.8.4 release.
  - Fix PR target/61407 (darwin), PR middle-end/58624 (ice),
    PR sanitizer/64265 (wrong code).
* Require recent binutils to pass go test failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: updates from the 4.8 branch upto 20140809 (r213778).
 
2
 
 
3
last_updated()
 
4
{
 
5
        cat > ${dir}LAST_UPDATED <<EOF
 
6
Sat Aug  9 17:20:21 CEST 2014
 
7
Sat Aug  9 15:20:21 UTC 2014 (revision 213778)
 
8
EOF
 
9
}
 
10
 
 
11
LANG=C svn diff svn://gcc.gnu.org/svn/gcc/tags/gcc_4_8_3_release svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch \
 
12
        | sed -r 's,^--- (\S+)\t(\S+)(.*)$,--- a/src/\1\t\2,;s,^\+\+\+ (\S+)\t(\S+)(.*)$,+++ b/src/\1\t\2,' \
 
13
        | awk '/^Index:.*\.(class|texi)/ {skip=1; next} /^Index:/ { skip=0 } skip==0'
 
14
 
 
15
Index: libstdc++-v3/scripts/run_doxygen
 
16
===================================================================
 
17
--- a/src/libstdc++-v3/scripts/run_doxygen      (.../tags/gcc_4_8_3_release)
 
18
+++ b/src/libstdc++-v3/scripts/run_doxygen      (.../branches/gcc-4_8-branch)
 
19
@@ -193,8 +193,15 @@
 
20
 if $do_latex; then
 
21
     cd ${outdir}/${mode}
 
22
 
 
23
-    # Also drop in the header file and style sheet
 
24
-    doxygen -w latex header.tex doxygen.sty
 
25
+    # Grrr, Doxygen 1.8.x changed the -w latex options.
 
26
+    need_footer=`doxygen -h | sed -n -e '/-w latex/s=.*footer.*=true=p'`
 
27
+
 
28
+    # Also drop in the header file (maybe footer file) and style sheet
 
29
+    if $need_footer; then
 
30
+      doxygen -w latex header.tex footer.tex doxygen.sty
 
31
+    else
 
32
+      doxygen -w latex header.tex doxygen.sty
 
33
+    fi
 
34
     
 
35
     echo ::
 
36
     echo :: LaTeX pages begin with
 
37
Index: libstdc++-v3/include/std/future
 
38
===================================================================
 
39
--- a/src/libstdc++-v3/include/std/future       (.../tags/gcc_4_8_3_release)
 
40
+++ b/src/libstdc++-v3/include/std/future       (.../branches/gcc-4_8-branch)
 
41
@@ -351,12 +351,14 @@
 
42
       void
 
43
       _M_set_result(function<_Ptr_type()> __res, bool __ignore_failure = false)
 
44
       {
 
45
-        bool __set = __ignore_failure;
 
46
+        bool __set = false;
 
47
         // all calls to this function are serialized,
 
48
         // side-effects of invoking __res only happen once
 
49
         call_once(_M_once, &_State_base::_M_do_set, this, ref(__res),
 
50
             ref(__set));
 
51
-        if (!__set)
 
52
+       if (__set)
 
53
+         _M_cond.notify_all();
 
54
+       else if (!__ignore_failure)
 
55
           __throw_future_error(int(future_errc::promise_already_satisfied));
 
56
       }
 
57
 
 
58
@@ -471,7 +473,6 @@
 
59
           lock_guard<mutex> __lock(_M_mutex);
 
60
           _M_result.swap(__res);
 
61
         }
 
62
-        _M_cond.notify_all();
 
63
         __set = true;
 
64
       }
 
65
 
 
66
@@ -983,22 +984,25 @@
 
67
       void
 
68
       set_value(const _Res& __r)
 
69
       {
 
70
+       auto __future = _M_future;
 
71
         auto __setter = _State::__setter(this, __r);
 
72
-        _M_future->_M_set_result(std::move(__setter));
 
73
+        __future->_M_set_result(std::move(__setter));
 
74
       }
 
75
 
 
76
       void
 
77
       set_value(_Res&& __r)
 
78
       {
 
79
+       auto __future = _M_future;
 
80
         auto __setter = _State::__setter(this, std::move(__r));
 
81
-        _M_future->_M_set_result(std::move(__setter));
 
82
+        __future->_M_set_result(std::move(__setter));
 
83
       }
 
84
 
 
85
       void
 
86
       set_exception(exception_ptr __p)
 
87
       {
 
88
+       auto __future = _M_future;
 
89
         auto __setter = _State::__setter(__p, this);
 
90
-        _M_future->_M_set_result(std::move(__setter));
 
91
+        __future->_M_set_result(std::move(__setter));
 
92
       }
 
93
     };
 
94
 
 
95
@@ -1081,15 +1085,17 @@
 
96
       void
 
97
       set_value(_Res& __r)
 
98
       {
 
99
+       auto __future = _M_future;
 
100
         auto __setter = _State::__setter(this, __r);
 
101
-        _M_future->_M_set_result(std::move(__setter));
 
102
+        __future->_M_set_result(std::move(__setter));
 
103
       }
 
104
 
 
105
       void
 
106
       set_exception(exception_ptr __p)
 
107
       {
 
108
+       auto __future = _M_future;
 
109
         auto __setter = _State::__setter(__p, this);
 
110
-        _M_future->_M_set_result(std::move(__setter));
 
111
+        __future->_M_set_result(std::move(__setter));
 
112
       }
 
113
     };
 
114
 
 
115
@@ -1166,8 +1172,9 @@
 
116
       void
 
117
       set_exception(exception_ptr __p)
 
118
       {
 
119
+       auto __future = _M_future;
 
120
         auto __setter = _State::__setter(__p, this);
 
121
-        _M_future->_M_set_result(std::move(__setter));
 
122
+        __future->_M_set_result(std::move(__setter));
 
123
       }
 
124
     };
 
125
 
 
126
@@ -1193,8 +1200,9 @@
 
127
   inline void
 
128
   promise<void>::set_value()
 
129
   {
 
130
+    auto __future = _M_future;
 
131
     auto __setter = _State::__setter(this);
 
132
-    _M_future->_M_set_result(std::move(__setter));
 
133
+    __future->_M_set_result(std::move(__setter));
 
134
   }
 
135
 
 
136
 
 
137
Index: libstdc++-v3/include/ext/rope
 
138
===================================================================
 
139
--- a/src/libstdc++-v3/include/ext/rope (.../tags/gcc_4_8_3_release)
 
140
+++ b/src/libstdc++-v3/include/ext/rope (.../branches/gcc-4_8-branch)
 
141
@@ -1544,7 +1544,7 @@
 
142
       typedef typename _Base::allocator_type allocator_type;
 
143
       using _Base::_M_tree_ptr;
 
144
       using _Base::get_allocator;
 
145
-      using _Base::_M_get_allocator;      
 
146
+      using _Base::_M_get_allocator;
 
147
       typedef __GC_CONST _CharT* _Cstrptr;
 
148
       
 
149
       static _CharT _S_empty_c_str[1];
 
150
@@ -1876,8 +1876,9 @@
 
151
           const allocator_type& __a = allocator_type())
 
152
       : _Base(__a)
 
153
       {
 
154
-       this->_M_tree_ptr = (0 == __len) ?
 
155
-         0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
 
156
+       this->_M_tree_ptr = (0 == __len)
 
157
+         ? 0
 
158
+         : _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator());
 
159
       }
 
160
 
 
161
       rope(const rope& __x, const allocator_type& __a = allocator_type())
 
162
Index: libstdc++-v3/include/bits/stl_tree.h
 
163
===================================================================
 
164
--- a/src/libstdc++-v3/include/bits/stl_tree.h  (.../tags/gcc_4_8_3_release)
 
165
+++ b/src/libstdc++-v3/include/bits/stl_tree.h  (.../branches/gcc-4_8-branch)
 
166
@@ -510,11 +510,11 @@
 
167
 
 
168
       _Link_type
 
169
       _M_end()
 
170
-      { return static_cast<_Link_type>(&this->_M_impl._M_header); }
 
171
+      { return reinterpret_cast<_Link_type>(&this->_M_impl._M_header); }
 
172
 
 
173
       _Const_Link_type
 
174
       _M_end() const
 
175
-      { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }
 
176
+      { return reinterpret_cast<_Const_Link_type>(&this->_M_impl._M_header); }
 
177
 
 
178
       static const_reference
 
179
       _S_value(_Const_Link_type __x)
 
180
Index: libstdc++-v3/include/tr2/bool_set
 
181
===================================================================
 
182
--- a/src/libstdc++-v3/include/tr2/bool_set     (.../tags/gcc_4_8_3_release)
 
183
+++ b/src/libstdc++-v3/include/tr2/bool_set     (.../branches/gcc-4_8-branch)
 
184
@@ -44,7 +44,7 @@
 
185
    *  bool_set
 
186
    *
 
187
    *  See N2136, Bool_set: multi-valued logic
 
188
-   *  by Herv� Br�nnimann, Guillaume Melquiond, Sylvain Pion.
 
189
+   *  by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion.
 
190
    *
 
191
    *  The implicit conversion to bool is slippery!  I may use the new
 
192
    *  explicit conversion.  This has been specialized in the language
 
193
Index: libstdc++-v3/ChangeLog
 
194
===================================================================
 
195
--- a/src/libstdc++-v3/ChangeLog        (.../tags/gcc_4_8_3_release)
 
196
+++ b/src/libstdc++-v3/ChangeLog        (.../branches/gcc-4_8-branch)
 
197
@@ -1,3 +1,43 @@
 
198
+2014-08-04  Jonathan Wakely  <jwakely@redhat.com>
 
199
+
 
200
+       Backported from mainline
 
201
+       2014-07-29  Jonathan Wakely  <jwakely@redhat.com>
 
202
+
 
203
+       PR libstdc++/61946
 
204
+       * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool,
 
205
+       const allocator_type&)): Pass non-const allocator to
 
206
+       _S_new_RopeFunction.
 
207
+       * testsuite/ext/rope/61946.cc: New.
 
208
+
 
209
+2014-08-04  Zifei Tong  <zifeitong@gmail.com>
 
210
+
 
211
+       * libsupc++/atexit_thread.cc (HAVE___CXA_THREAD_ATEXIT_IMPL): Add
 
212
+       _GLIBCXX_ prefix to macro.
 
213
+
 
214
+2014-06-03  Jonathan Wakely  <jwakely@redhat.com>
 
215
+
 
216
+       Backport from mainline
 
217
+       2014-04-15  Jonathan Wakely  <jwakely@redhat.com>
 
218
+
 
219
+       PR libstdc++/60734
 
220
+       * include/bits/stl_tree.h (_Rb_tree::_M_end): Fix invalid cast.
 
221
+
 
222
+       Backport from mainline
 
223
+       2014-05-16  Jonathan Wakely  <jwakely@redhat.com>
 
224
+
 
225
+       PR libstdc++/60966
 
226
+       * include/std/future (__future_base::_State_baseV2::_M_set_result):
 
227
+       Signal condition variable after call_once returns.
 
228
+       (__future_base::_State_baseV2::_M_do_set): Do not signal here.
 
229
+       (promise::set_value, promise::set_exception): Increment the reference
 
230
+       count on the shared state until the function returns.
 
231
+       * testsuite/30_threads/promise/60966.cc: New.
 
232
+
 
233
+2014-05-29  Jonathan Wakely  <jwakely@redhat.com>
 
234
+
 
235
+       * include/tr2/bool_set: Use UTF-8 for accented characters.
 
236
+       * scripts/run_doxygen: Handle Doxygen 1.8.x change.
 
237
+
 
238
 2014-05-22  Release Manager
 
239
 
 
240
        * GCC 4.8.3 released.
 
241
Index: libstdc++-v3/libsupc++/atexit_thread.cc
 
242
===================================================================
 
243
--- a/src/libstdc++-v3/libsupc++/atexit_thread.cc       (.../tags/gcc_4_8_3_release)
 
244
+++ b/src/libstdc++-v3/libsupc++/atexit_thread.cc       (.../branches/gcc-4_8-branch)
 
245
@@ -26,7 +26,7 @@
 
246
 #include <new>
 
247
 #include "bits/gthr.h"
 
248
 
 
249
-#if HAVE___CXA_THREAD_ATEXIT_IMPL
 
250
+#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
 
251
 
 
252
 extern "C" int __cxa_thread_atexit_impl (void (*func) (void *),
 
253
                                         void *arg, void *d);
 
254
@@ -38,7 +38,7 @@
 
255
   return __cxa_thread_atexit_impl (dtor, obj, dso_handle);
 
256
 }
 
257
 
 
258
-#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */
 
259
+#else /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
 
260
 
 
261
 namespace {
 
262
   // One element in a singly-linked stack of cleanups.
 
263
@@ -142,4 +142,4 @@
 
264
   return 0;
 
265
 }
 
266
 
 
267
-#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */
 
268
+#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
 
269
Index: libstdc++-v3/testsuite/30_threads/promise/60966.cc
 
270
===================================================================
 
271
--- a/src/libstdc++-v3/testsuite/30_threads/promise/60966.cc    (.../tags/gcc_4_8_3_release)
 
272
+++ b/src/libstdc++-v3/testsuite/30_threads/promise/60966.cc    (.../branches/gcc-4_8-branch)
 
273
@@ -0,0 +1,67 @@
 
274
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
 
275
+// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } }
 
276
+// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } }
 
277
+// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } }
 
278
+// { dg-require-cstdint "" }
 
279
+// { dg-require-gthreads "" }
 
280
+// { dg-require-atomic-builtins "" }
 
281
+
 
282
+// Copyright (C) 2014 Free Software Foundation, Inc.
 
283
+//
 
284
+// This file is part of the GNU ISO C++ Library.  This library is free
 
285
+// software; you can redistribute it and/or modify it under the
 
286
+// terms of the GNU General Public License as published by the
 
287
+// Free Software Foundation; either version 3, or (at your option)
 
288
+// any later version.
 
289
+
 
290
+// This library is distributed in the hope that it will be useful,
 
291
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
292
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
293
+// GNU General Public License for more details.
 
294
+
 
295
+// You should have received a copy of the GNU General Public License along
 
296
+// with this library; see the file COPYING3.  If not see
 
297
+// <http://www.gnu.org/licenses/>.
 
298
+
 
299
+// libstdc++/60966
 
300
+// This test hangs if std::promise::~promise() destroys the
 
301
+// shared state before std::promise::set_value() finishes using it.
 
302
+
 
303
+#include <future>
 
304
+#include <thread>
 
305
+#include <vector>
 
306
+
 
307
+const int THREADS = 10;
 
308
+
 
309
+void run_task(std::promise<void>* pr)
 
310
+{
 
311
+  std::this_thread::sleep_for(std::chrono::milliseconds(100));
 
312
+  pr->set_value();
 
313
+}
 
314
+
 
315
+int main()
 
316
+{
 
317
+  std::vector<std::promise<void>*> tasks(THREADS);
 
318
+  std::vector<std::thread> threads(THREADS);
 
319
+  std::vector<std::future<void>> futures(THREADS);
 
320
+
 
321
+  for (int i = 0; i < THREADS; ++i)
 
322
+  {
 
323
+    std::promise<void>* task = new std::promise<void>;
 
324
+    tasks[i] = task;
 
325
+    futures[i] = task->get_future();
 
326
+    threads[i] = std::thread(run_task, task);
 
327
+  }
 
328
+
 
329
+  for (int i = 0; i < THREADS; ++i)
 
330
+  {
 
331
+    // the temporary future releases the state as soon as wait() returns
 
332
+    std::future<void>(std::move(futures[i])).wait();
 
333
+    // state is ready, should now be safe to delete promise, so it
 
334
+    // releases the shared state too
 
335
+    delete tasks[i];
 
336
+  }
 
337
+
 
338
+  for (auto& t : threads)
 
339
+    t.join();
 
340
+}
 
341
Index: libstdc++-v3/testsuite/ext/rope/61946.cc
 
342
===================================================================
 
343
--- a/src/libstdc++-v3/testsuite/ext/rope/61946.cc      (.../tags/gcc_4_8_3_release)
 
344
+++ b/src/libstdc++-v3/testsuite/ext/rope/61946.cc      (.../branches/gcc-4_8-branch)
 
345
@@ -0,0 +1,31 @@
 
346
+// Copyright (C) 2014 Free Software Foundation, Inc.
 
347
+//
 
348
+// This file is part of the GNU ISO C++ Library.  This library is free
 
349
+// software; you can redistribute it and/or modify it under the
 
350
+// terms of the GNU General Public License as published by the
 
351
+// Free Software Foundation; either version 3, or (at your option)
 
352
+// any later version.
 
353
+
 
354
+// This library is distributed in the hope that it will be useful,
 
355
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
356
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
357
+// GNU General Public License for more details.
 
358
+
 
359
+// You should have received a copy of the GNU General Public License along
 
360
+// with this library; see the file COPYING3.  If not see
 
361
+// <http://www.gnu.org/licenses/>.
 
362
+
 
363
+// { dg-do compile }
 
364
+
 
365
+#include <ext/rope>
 
366
+
 
367
+struct empty_char_prod : __gnu_cxx::char_producer<char>
 
368
+{
 
369
+  virtual void operator()(size_t, size_t, char*) {}
 
370
+};
 
371
+
 
372
+int main ()
 
373
+{
 
374
+  empty_char_prod* ecp = new empty_char_prod;
 
375
+  __gnu_cxx::crope excrope( ecp, 10L, true );
 
376
+}
 
377
Index: configure.ac
 
378
===================================================================
 
379
--- a/src/configure.ac  (.../tags/gcc_4_8_3_release)
 
380
+++ b/src/configure.ac  (.../branches/gcc-4_8-branch)
 
381
@@ -1154,6 +1154,9 @@
 
382
   *-mingw*)
 
383
     host_makefile_frag="config/mh-mingw"
 
384
     ;;
 
385
+  alpha*-*-linux*)
 
386
+    host_makefile_frag="config/mh-alpha-linux"
 
387
+    ;;
 
388
   hppa*-hp-hpux10*)
 
389
     host_makefile_frag="config/mh-pa-hpux10"
 
390
     ;;
 
391
Index: ChangeLog
 
392
===================================================================
 
393
--- a/src/ChangeLog     (.../tags/gcc_4_8_3_release)
 
394
+++ b/src/ChangeLog     (.../branches/gcc-4_8-branch)
 
395
@@ -1,3 +1,9 @@
 
396
+2014-07-26  Uros Bizjak  <ubizjak@gmail.com>
 
397
+
 
398
+       PR target/47230
 
399
+       * configure.ac (alpha*-*-linux*): Use mh-alpha-linux.
 
400
+       * configure: Regenerate.
 
401
+
 
402
 2014-05-22  Release Manager
 
403
 
 
404
        * GCC 4.8.3 released.
 
405
Index: contrib/ChangeLog
 
406
===================================================================
 
407
--- a/src/contrib/ChangeLog     (.../tags/gcc_4_8_3_release)
 
408
+++ b/src/contrib/ChangeLog     (.../branches/gcc-4_8-branch)
 
409
@@ -1,3 +1,7 @@
 
410
+2014-07-07  Richard Biener  <rguenther@suse.de>
 
411
+
 
412
+        * gennews: Use gcc-3.0/index.html.
 
413
+
 
414
 2014-05-22  Release Manager
 
415
 
 
416
        * GCC 4.8.3 released.
 
417
Index: contrib/gennews
 
418
===================================================================
 
419
--- a/src/contrib/gennews       (.../tags/gcc_4_8_3_release)
 
420
+++ b/src/contrib/gennews       (.../branches/gcc-4_8-branch)
 
421
@@ -37,7 +37,7 @@
 
422
     gcc-3.3/index.html gcc-3.3/changes.html
 
423
     gcc-3.2/index.html gcc-3.2/changes.html
 
424
     gcc-3.1/index.html gcc-3.1/changes.html
 
425
-    gcc-3.0/gcc-3.0.html gcc-3.0/features.html gcc-3.0/caveats.html
 
426
+    gcc-3.0/index.html gcc-3.0/features.html gcc-3.0/caveats.html
 
427
     gcc-2.95/index.html gcc-2.95/features.html gcc-2.95/caveats.html
 
428
     egcs-1.1/index.html egcs-1.1/features.html egcs-1.1/caveats.html
 
429
     egcs-1.0/index.html egcs-1.0/features.html egcs-1.0/caveats.html"
 
430
Index: config/mh-alpha-linux
 
431
===================================================================
 
432
--- a/src/config/mh-alpha-linux (.../tags/gcc_4_8_3_release)
 
433
+++ b/src/config/mh-alpha-linux (.../branches/gcc-4_8-branch)
 
434
@@ -0,0 +1,3 @@
 
435
+# Prevent GPREL16 relocation truncation
 
436
+LDFLAGS += -Wl,--no-relax
 
437
+BOOT_LDFLAGS += -Wl,--no-relax
 
438
Index: config/ChangeLog
 
439
===================================================================
 
440
--- a/src/config/ChangeLog      (.../tags/gcc_4_8_3_release)
 
441
+++ b/src/config/ChangeLog      (.../branches/gcc-4_8-branch)
 
442
@@ -1,3 +1,8 @@
 
443
+2014-07-26  Uros Bizjak  <ubizjak@gmail.com>
 
444
+
 
445
+       PR target/47230
 
446
+       * mh-alpha-linux: New file.
 
447
+
 
448
 2014-05-22  Release Manager
 
449
 
 
450
        * GCC 4.8.3 released.
 
451
Index: libjava/classpath
 
452
===================================================================
 
453
--- a/src/libjava/classpath     (.../tags/gcc_4_8_3_release)
 
454
+++ b/src/libjava/classpath     (.../branches/gcc-4_8-branch)
 
455
 
 
456
Property changes on: libjava/classpath
 
457
___________________________________________________________________
 
458
Modified: svn:mergeinfo
 
459
   Merged /trunk/libjava/classpath:r211733
 
460
Index: configure
 
461
===================================================================
 
462
--- a/src/configure     (.../tags/gcc_4_8_3_release)
 
463
+++ b/src/configure     (.../branches/gcc-4_8-branch)
 
464
@@ -3834,6 +3834,9 @@
 
465
   *-mingw*)
 
466
     host_makefile_frag="config/mh-mingw"
 
467
     ;;
 
468
+  alpha*-*-linux*)
 
469
+    host_makefile_frag="config/mh-alpha-linux"
 
470
+    ;;
 
471
   hppa*-hp-hpux10*)
 
472
     host_makefile_frag="config/mh-pa-hpux10"
 
473
     ;;
 
474
Index: gcc/tree-ssa-tail-merge.c
 
475
===================================================================
 
476
--- a/src/gcc/tree-ssa-tail-merge.c     (.../tags/gcc_4_8_3_release)
 
477
+++ b/src/gcc/tree-ssa-tail-merge.c     (.../branches/gcc-4_8-branch)
 
478
@@ -1060,6 +1060,24 @@
 
479
     gcc_unreachable ();
 
480
 }
 
481
 
 
482
+/* Return true if gimple operands T1 and T2 have the same value.  */
 
483
+
 
484
+static bool
 
485
+gimple_operand_equal_value_p (tree t1, tree t2)
 
486
+{
 
487
+  if (t1 == t2)
 
488
+    return true;
 
489
+
 
490
+  if (t1 == NULL_TREE
 
491
+      || t2 == NULL_TREE)
 
492
+    return false;
 
493
+
 
494
+  if (operand_equal_p (t1, t2, 0))
 
495
+    return true;
 
496
+
 
497
+  return gvn_uses_equal (t1, t2);
 
498
+}
 
499
+
 
500
 /* Return true if gimple statements S1 and S2 are equal.  Gimple_bb (s1) and
 
501
    gimple_bb (s2) are members of SAME_SUCC.  */
 
502
 
 
503
@@ -1122,8 +1140,9 @@
 
504
       lhs2 = gimple_get_lhs (s2);
 
505
       if (TREE_CODE (lhs1) != SSA_NAME
 
506
          && TREE_CODE (lhs2) != SSA_NAME)
 
507
-       return (vn_valueize (gimple_vdef (s1))
 
508
-               == vn_valueize (gimple_vdef (s2)));
 
509
+       return (operand_equal_p (lhs1, lhs2, 0)
 
510
+               && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1),
 
511
+                                                gimple_assign_rhs1 (s2)));
 
512
       else if (TREE_CODE (lhs1) == SSA_NAME
 
513
               && TREE_CODE (lhs2) == SSA_NAME)
 
514
        return vn_valueize (lhs1) == vn_valueize (lhs2);
 
515
Index: gcc/DATESTAMP
 
516
===================================================================
 
517
--- a/src/gcc/DATESTAMP (.../tags/gcc_4_8_3_release)
 
518
+++ b/src/gcc/DATESTAMP (.../branches/gcc-4_8-branch)
 
519
@@ -1 +1 @@
 
520
-20140522
 
521
+20140809
 
522
Index: gcc/ipa-cp.c
 
523
===================================================================
 
524
--- a/src/gcc/ipa-cp.c  (.../tags/gcc_4_8_3_release)
 
525
+++ b/src/gcc/ipa-cp.c  (.../branches/gcc-4_8-branch)
 
526
@@ -447,6 +447,8 @@
 
527
   else if (!opt_for_fn (node->symbol.decl, optimize)
 
528
           || !opt_for_fn (node->symbol.decl, flag_ipa_cp))
 
529
     reason = "non-optimized function";
 
530
+  else if (node->tm_clone)
 
531
+    reason = "transactional memory clone";
 
532
 
 
533
   if (reason && dump_file && !node->alias && !node->thunk.thunk_p)
 
534
     fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n",
 
535
Index: gcc/omp-low.c
 
536
===================================================================
 
537
--- a/src/gcc/omp-low.c (.../tags/gcc_4_8_3_release)
 
538
+++ b/src/gcc/omp-low.c (.../branches/gcc-4_8-branch)
 
539
@@ -1586,7 +1586,6 @@
 
540
   TREE_STATIC (decl) = 1;
 
541
   TREE_USED (decl) = 1;
 
542
   DECL_ARTIFICIAL (decl) = 1;
 
543
-  DECL_NAMELESS (decl) = 1;
 
544
   DECL_IGNORED_P (decl) = 0;
 
545
   TREE_PUBLIC (decl) = 0;
 
546
   DECL_UNINLINABLE (decl) = 1;
 
547
Index: gcc/toplev.c
 
548
===================================================================
 
549
--- a/src/gcc/toplev.c  (.../tags/gcc_4_8_3_release)
 
550
+++ b/src/gcc/toplev.c  (.../branches/gcc-4_8-branch)
 
551
@@ -1036,16 +1036,19 @@
 
552
 
 
553
   if (warn_stack_usage >= 0)
 
554
     {
 
555
+      const location_t loc = DECL_SOURCE_LOCATION (current_function_decl);
 
556
+
 
557
       if (stack_usage_kind == DYNAMIC)
 
558
-       warning (OPT_Wstack_usage_, "stack usage might be unbounded");
 
559
+       warning_at (loc, OPT_Wstack_usage_, "stack usage might be unbounded");
 
560
       else if (stack_usage > warn_stack_usage)
 
561
        {
 
562
          if (stack_usage_kind == DYNAMIC_BOUNDED)
 
563
-           warning (OPT_Wstack_usage_, "stack usage might be %wd bytes",
 
564
-                    stack_usage);
 
565
+           warning_at (loc,
 
566
+                       OPT_Wstack_usage_, "stack usage might be %wd bytes",
 
567
+                       stack_usage);
 
568
          else
 
569
-           warning (OPT_Wstack_usage_, "stack usage is %wd bytes",
 
570
-                    stack_usage);
 
571
+           warning_at (loc, OPT_Wstack_usage_, "stack usage is %wd bytes",
 
572
+                       stack_usage);
 
573
        }
 
574
     }
 
575
 }
 
576
Index: gcc/ChangeLog
 
577
===================================================================
 
578
--- a/src/gcc/ChangeLog (.../tags/gcc_4_8_3_release)
 
579
+++ b/src/gcc/ChangeLog (.../branches/gcc-4_8-branch)
 
580
@@ -1,3 +1,358 @@
 
581
+2014-08-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
582
+
 
583
+       Backport from mainline
 
584
+       2014-06-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
585
+
 
586
+       PR tree-optimization/61375
 
587
+       * tree-ssa-math-opts.c (find_bswap_or_nop_1): Cancel optimization if
 
588
+       symbolic number cannot be represented in an unsigned HOST_WIDE_INT.
 
589
+       (execute_optimize_bswap): Cancel optimization if CHAR_BIT != 8.
 
590
+
 
591
+2014-08-01  Richard Biener  <rguenther@suse.de>
 
592
+
 
593
+       PR tree-optimization/61964
 
594
+       * tree-ssa-tail-merge.c (gimple_operand_equal_value_p): New
 
595
+       function merged from trunk.
 
596
+       (gimple_equal_p): Handle non-SSA LHS solely by structural
 
597
+       equality.
 
598
+
 
599
+2014-07-25  Uros Bizjak  <ubizjak@gmail.com>
 
600
+
 
601
+       * config/alpha/elf.h: Define TARGET_UNWIND_TABLES_DEFAULT.
 
602
+
 
603
+2014-07-24  Kyle McMartin  <kyle@redhat.com>
 
604
+
 
605
+       * config/aarch64/aarch64-linux.h (TARGET_ASM_FILE_END): Define.
 
606
+
 
607
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
608
+
 
609
+       * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p):
 
610
+       Add prototype.
 
611
+       * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): New
 
612
+       function.  Issue -Wpsabi warning if future GCC releases will use
 
613
+       different field alignment rules for this type.
 
614
+       * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Call it.
 
615
+       * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise.
 
616
+       * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise.
 
617
+
 
618
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
619
+
 
620
+       * config/rs6000/rs6000.c (rs6000_function_arg_boundary): Issue
 
621
+       -Wpsabi note when encountering a type where future GCC releases
 
622
+       will apply different alignment requirements.
 
623
+
 
624
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
625
+
 
626
+       * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument
 
627
+       does not fit fully into floating-point registers, and there is still
 
628
+       space in the register parameter area, issue -Wpsabi note that the ABI
 
629
+       will change in a future GCC release.
 
630
+
 
631
+2014-07-23  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
632
+
 
633
+       * config/arm/t-rtems-eabi: Add
 
634
+       mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard,
 
635
+       mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard,
 
636
+       mbig-endian/mthumb/march=armv7-r, and
 
637
+       mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
 
638
+       multilibs.
 
639
+
 
640
+2014-07-21  Peter Bergner  <bergner@vnet.ibm.com>
 
641
+
 
642
+       * config/rs6000/sysv4.h (LIBASAN_EARLY_SPEC): Define.
 
643
+       (LIBTSAN_EARLY_SPEC): Likewise.
 
644
+       (STATIC_LIBASAN_LIBS): Likewise.
 
645
+       (STATIC_LIBTSAN_LIBS): Likewise.
 
646
+
 
647
+2014-07-19  Eric Botcazou  <ebotcazou@adacore.com>
 
648
+
 
649
+       * toplev.c (output_stack_usage): Adjust the location of the warning.
 
650
+
 
651
+2014-07-19  Daniel Cederman  <cederman@gaisler.com>
 
652
+
 
653
+       * config/sparc/sync.md (*membar_storeload_leon3): New insn.
 
654
+       (*membar_storeload): Disable for LEON3.
 
655
+
 
656
+2014-07-17  Richard Biener  <rguenther@suse.de>
 
657
+
 
658
+       PR rtl-optimization/61801
 
659
+       * sched-deps.c (sched_analyze_2): For ASM_OPERANDS and
 
660
+       ASM_INPUT don't set reg_pending_barrier if it appears in a
 
661
+       debug-insn.
 
662
+
 
663
+2014-07-16  Jakub Jelinek  <jakub@redhat.com>
 
664
+
 
665
+       * omp-low.c (create_omp_child_function): Don't set DECL_NAMELESS
 
666
+       on the FUNCTION_DECL.
 
667
+
 
668
+2014-07-10  Tom G. Christensen  <tgc@jupiterrise.com>
 
669
+
 
670
+       * doc/install.texi: Remove links to defunct package providers for
 
671
+       Solaris.
 
672
+
 
673
+2014-07-10  Eric Botcazou  <ebotcazou@adacore.com>
 
674
+
 
675
+       PR middle-end/53590
 
676
+       * function.c (allocate_struct_function): Revert r188667 change.
 
677
+
 
678
+2014-07-04  Jakub Jelinek  <jakub@redhat.com>
 
679
+
 
680
+       PR tree-optimization/61684
 
681
+       * tree-ssa-ifcombine.c (recognize_single_bit_test): Make sure
 
682
+       rhs1 of conversion is a SSA_NAME before using SSA_NAME_DEF_STMT on it.
 
683
+
 
684
+2014-06-30  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
685
+
 
686
+       Backport from Mainline
 
687
+       2014-06-20  Jakub Jelinek  <jakub@redhat.com>
 
688
+       2014-06-11  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
689
+
 
690
+       PR tree-optimization/61306
 
691
+       * tree-ssa-math-opts.c (struct symbolic_number): Store type of
 
692
+       expression instead of its size.
 
693
+       (do_shift_rotate): Adapt to change in struct symbolic_number. Return
 
694
+       false to prevent optimization when the result is unpredictable due to
 
695
+       arithmetic right shift of signed type with highest byte is set.
 
696
+       (verify_symbolic_number_p): Adapt to change in struct symbolic_number.
 
697
+       (find_bswap_1): Likewise. Return NULL to prevent optimization when the
 
698
+       result is unpredictable due to sign extension.
 
699
+       (find_bswap): Adapt to change in struct symbolic_number.
 
700
+
 
701
+2014-06-27  Uros Bizjak  <ubizjak@gmail.com>
 
702
+
 
703
+       Backport from mainline
 
704
+       2014-06-26  Uros Bizjak  <ubizjak@gmail.com>
 
705
+
 
706
+       PR target/61586
 
707
+       * config/alpha/alpha.c (alpha_handle_trap_shadows): Handle BARRIER RTX.
 
708
+
 
709
+2014-06-26  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
710
+
 
711
+       PR target/61542
 
712
+       * config/rs6000/vsx.md (vsx_extract_v4sf): Fix bug with element
 
713
+       extraction other than index 3.
 
714
+
 
715
+2014-06-24  Jakub Jelinek  <jakub@redhat.com>
 
716
+
 
717
+       PR target/61570
 
718
+       * config/i386/driver-i386.c (host_detect_local_cpu): For unknown
 
719
+       model family 6 CPU with has_longmode never use a CPU without
 
720
+       64-bit support.
 
721
+
 
722
+2014-06-20  Chung-Lin Tang  <cltang@codesourcery.com>
 
723
+
 
724
+       Backport from mainline
 
725
+
 
726
+       2014-06-20  Julian Brown  <julian@codesourcery.com>
 
727
+                   Chung-Lin Tang  <cltang@codesourcery.com>
 
728
+
 
729
+       * config/arm/arm.c (arm_output_mi_thunk): Fix offset for
 
730
+       TARGET_THUMB1_ONLY. Add comments.
 
731
+
 
732
+2014-06-18  Uros Bizjak  <ubizjak@gmail.com>
 
733
+
 
734
+       Backport from mainline
 
735
+       2014-06-06  Uros Bizjak  <ubizjak@gmail.com>
 
736
+
 
737
+       PR target/61423
 
738
+       * config/i386/i386.md (*floatunssi<mode>2_i387_with_xmm): New
 
739
+       define_insn_and_split pattern, merged from *floatunssi<mode>2_1
 
740
+       and corresponding splitters.  Zero extend general register
 
741
+       or memory input operand to XMM temporary.  Enable for
 
742
+       TARGET_SSE2 and TARGET_INTER_UNIT_MOVES_TO_VEC only.
 
743
+       (floatunssi<mode>2): Update expander predicate.
 
744
+
 
745
+2014-06-18  Richard Henderson  <rth@redhat.com>
 
746
+
 
747
+       PR target/61545
 
748
+       * config/aarch64/aarch64.md (tlsdesc_small): Clobber CC_REGNUM.
 
749
+
 
750
+2014-06-17  Nagaraju Mekala <nagaraju.mekala@xilinx.com>
 
751
+
 
752
+       Revert on gcc-4_8-branch.
 
753
+       * config/microblaze/microblaze.md: Add movsi4_rev insn pattern.
 
754
+       * config/microblaze/predicates.md: Add reg_or_mem_operand predicate.
 
755
+
 
756
+2014-06-17  Yufeng Zhang  <yufeng.zhang@arm.com>
 
757
+
 
758
+       Backport from mainline
 
759
+
 
760
+       PR target/61483
 
761
+       * config/aarch64/aarch64.c (aarch64_layout_arg): Add new local
 
762
+       variable 'size'; calculate 'size' right in the front; use
 
763
+       'size' to compute 'nregs' (when 'allocate_ncrn != 0') and
 
764
+       pcum->aapcs_stack_words.
 
765
+
 
766
+2014-06-13  Peter Bergner  <bergner@vnet.ibm.com>
 
767
+
 
768
+       Backport from mainline
 
769
+
 
770
+       2014-06-13  Peter Bergner  <bergner@vnet.ibm.com>
 
771
+       PR target/61415
 
772
+       * config/rs6000/rs6000-builtin.def (BU_MISC_1): Delete.
 
773
+       (BU_MISC_2): Rename to ...
 
774
+       (BU_LDBL128_2): ... this.
 
775
+       * config/rs6000/rs6000.h (RS6000_BTM_LDBL128): New define.
 
776
+       (RS6000_BTM_COMMON): Add RS6000_BTM_LDBL128.
 
777
+       * config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Handle
 
778
+       RS6000_BTM_LDBL128.
 
779
+       (rs6000_invalid_builtin): Add long double 128-bit builtin support.
 
780
+       (rs6000_builtin_mask_names): Add RS6000_BTM_LDBL128.
 
781
+       * config/rs6000/rs6000.md (unpacktf_0): Remove define)expand.
 
782
+       (unpacktf_1): Likewise.
 
783
+       * doc/extend.texi (__builtin_longdouble_dw0): Remove documentation.
 
784
+       (__builtin_longdouble_dw1): Likewise.
 
785
+       * doc/sourcebuild.texi (longdouble128): Document.
 
786
+
 
787
+2014-06-13  Jason Merrill  <jason@redhat.com>
 
788
+
 
789
+       PR c++/60731
 
790
+       * common.opt (-fno-gnu-unique): Add.
 
791
+       * config/elfos.h (USE_GNU_UNIQUE_OBJECT): Check it.
 
792
+
 
793
+2014-06-12  Georg-Johann Lay  <avr@gjlay.de>
 
794
+
 
795
+       Backport from 2014-05-09 trunk r210272
 
796
+
 
797
+       * config/avr/avr-fixed.md (round<mode>3): Use -1U instead of -1 in
 
798
+       unsigned int initializers for regno_in, regno_out.
 
799
+
 
800
+       Backport from 2014-05-14 trunk r210418
 
801
+       * config/avr/avr.h (REG_CLASS_CONTENTS): Use unsigned suffix for
 
802
+       shifted values to avoid build warning.
 
803
+
 
804
+       Backport from 2014-06-12 trunk r211491
 
805
+
 
806
+       PR target/61443
 
807
+       * config/avr/avr.md (push<mode>1): Avoid (subreg(mem)) when
 
808
+       loading from address spaces.
 
809
+
 
810
+2014-06-12  Alan Modra  <amodra@gmail.com>
 
811
+
 
812
+       PR target/61300
 
813
+       * doc/tm.texi.in (INCOMING_REG_PARM_STACK_SPACE): Document.
 
814
+       * doc/tm.texi: Regenerate.
 
815
+       * function.c (INCOMING_REG_PARM_STACK_SPACE): Provide default.
 
816
+       Use throughout in place of REG_PARM_STACK_SPACE.
 
817
+       * config/rs6000/rs6000.c (rs6000_reg_parm_stack_space): Add
 
818
+       "incoming" param.  Pass to rs6000_function_parms_need_stack.
 
819
+       (rs6000_function_parms_need_stack): Add "incoming" param, ignore
 
820
+       prototype_p when incoming.  Use function decl when incoming
 
821
+       to handle K&R style functions.
 
822
+       * config/rs6000/rs6000.h (REG_PARM_STACK_SPACE): Adjust.
 
823
+       (INCOMING_REG_PARM_STACK_SPACE): Define.
 
824
+
 
825
+2014-06-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
826
+
 
827
+       Back port from trunk
 
828
+       2014-06-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
829
+
 
830
+       PR target/61431
 
831
+       * config/rs6000/vsx.md (VSX_LE): Split VSX_D into 2 separate
 
832
+       iterators, VSX_D that handles 64-bit types, and VSX_LE that
 
833
+       handles swapping the two 64-bit double words on little endian
 
834
+       systems.  Include V1TImode and optionally TImode in VSX_LE so that
 
835
+       these types are properly swapped.  Change all of the insns and
 
836
+       splits that do the 64-bit swaps to use VSX_LE.
 
837
+       (vsx_le_perm_load_<mode>): Likewise.
 
838
+       (vsx_le_perm_store_<mode>): Likewise.
 
839
+       (splitters for little endian memory operations): Likewise.
 
840
+       (vsx_xxpermdi2_le_<mode>): Likewise.
 
841
+       (vsx_lxvd2x2_le_<mode>): Likewise.
 
842
+       (vsx_stxvd2x2_le_<mode>): Likewise.
 
843
+
 
844
+2014-06-05  Martin Jambor  <mjambor@suse.cz>
 
845
+
 
846
+       PR ipa/61393
 
847
+       * ipa-cp.c (determine_versionability): Pretend that tm_clones are
 
848
+       not versionable.
 
849
+
 
850
+2014-06-04  Richard Biener  <rguenther@suse.de>
 
851
+
 
852
+       PR tree-optimization/61383
 
853
+       * tree-ssa-ifcombine.c (bb_no_side_effects_p): Make sure
 
854
+       stmts can't trap.
 
855
+
 
856
+2014-06-03  Andrey Belevantsev  <abel@ispras.ru>
 
857
+
 
858
+       Backport from mainline
 
859
+       2014-05-14  Andrey Belevantsev  <abel@ispras.ru>
 
860
+
 
861
+       PR rtl-optimization/60866
 
862
+       * sel-sched-ir (sel_init_new_insn): New parameter old_seqno.
 
863
+       Default it to -1.  Pass it down to init_simplejump_data.
 
864
+       (init_simplejump_data): New parameter old_seqno.  Pass it down
 
865
+       to get_seqno_for_a_jump.
 
866
+       (get_seqno_for_a_jump): New parameter old_seqno.  Use it for
 
867
+       initializing new jump seqno as a last resort.  Add comment.
 
868
+       (sel_redirect_edge_and_branch): Save old seqno of the conditional
 
869
+       jump and pass it down to sel_init_new_insn.
 
870
+       (sel_redirect_edge_and_branch_force): Likewise.
 
871
+
 
872
+2014-06-03  Andrey Belevantsev  <abel@ispras.ru>
 
873
+
 
874
+       Backport from mainline
 
875
+       2014-05-14  Andrey Belevantsev  <abel@ispras.ru>
 
876
+
 
877
+       PR rtl-optimization/60901
 
878
+       * config/i386/i386.c (ix86_dependencies_evaluation_hook): Check that
 
879
+       bb predecessor belongs to the same scheduling region.  Adjust comment.
 
880
+
 
881
+2014-06-03  Uros Bizjak  <ubizjak@gmail.com>
 
882
+
 
883
+       Backport from mainline
 
884
+       2014-06-02  Uros Bizjak  <ubizjak@gmail.com>
 
885
+
 
886
+       PR target/61239
 
887
+       * config/i386/i386.c (ix86_expand_vec_perm) [case V32QImode]: Use
 
888
+       GEN_INT (-128) instead of GEN_INT (128) to set MSB of QImode constant.
 
889
+
 
890
+2014-05-28  Guozhi Wei  <carrot@google.com>
 
891
+
 
892
+       PR target/61202
 
893
+       * config/aarch64/arm_neon.h (vqdmulh_n_s16): Change the last operand's
 
894
+       constraint.
 
895
+       (vqdmulhq_n_s16): Likewise.
 
896
+
 
897
+2014-05-28  Eric Botcazou  <ebotcazou@adacore.com>
 
898
+
 
899
+       Backport from mainline
 
900
+       2014-05-27  Eric Botcazou  <ebotcazou@adacore.com>
 
901
+
 
902
+       * double-int.c (div_and_round_double) <ROUND_DIV_EXPR>: Use the proper
 
903
+       predicate to detect a negative quotient.
 
904
+
 
905
+2014-05-28  Georg-Johann Lay  <avr@gjlay.de>
 
906
+
 
907
+       PR target/61044
 
908
+       * doc/extend.texi (Local Labels): Note that label differences are
 
909
+       not supported for AVR.
 
910
+
 
911
+2014-05-26  Michael Tautschnig  <mt@debian.org>
 
912
+
 
913
+       PR target/61249
 
914
+       * doc/extend.texi (X86 Built-in Functions): Fix parameter lists of
 
915
+       __builtin_ia32_vfrczs[sd] and __builtin_ia32_mpsadbw256.
 
916
+
 
917
+2014-05-23  Alan Modra  <amodra@gmail.com>
 
918
+
 
919
+       PR target/61231
 
920
+       * config/rs6000/rs6000.c (mem_operand_gpr): Handle SImode.
 
921
+       * config/rs6000/rs6000.md (extendsidi2_lfiwax, extendsidi2_nocell):
 
922
+       Use "Y" constraint rather than "m".
 
923
+
 
924
+2014-05-22  Peter Bergner  <bergner@vnet.ibm.com>
 
925
+
 
926
+       Backport from mainline
 
927
+       2014-05-22  Peter Bergner  <bergner@vnet.ibm.com>
 
928
+
 
929
+       * config/rs6000/htm.md (ttest): Use correct shift value to get CR0.
 
930
+
 
931
+2014-05-22  Richard Earnshaw  <rearnsha@arm.com>
 
932
+
 
933
+       PR target/61208
 
934
+       * arm.md (arm_cmpdi_unsigned): Fix length calculation for Thumb2.
 
935
+
 
936
 2014-05-22  Release Manager
 
937
 
 
938
        * GCC 4.8.3 released.
 
939
Index: gcc/testsuite/gcc.target/powerpc/tfmode_off.c
 
940
===================================================================
 
941
--- a/src/gcc/testsuite/gcc.target/powerpc/tfmode_off.c (.../tags/gcc_4_8_3_release)
 
942
+++ b/src/gcc/testsuite/gcc.target/powerpc/tfmode_off.c (.../branches/gcc-4_8-branch)
 
943
@@ -1,6 +1,7 @@
 
944
 /* { dg-do assemble } */
 
945
 /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */
 
946
 /* { dg-skip-if "no TFmode" { powerpc-*-eabi* } { "*" } { "" } } */
 
947
+/* { dg-require-effective-target longdouble128 } */
 
948
 /* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */
 
949
 
 
950
 typedef float TFmode __attribute__ ((mode (TF)));
 
951
Index: gcc/testsuite/gcc.target/powerpc/pack02.c
 
952
===================================================================
 
953
--- a/src/gcc/testsuite/gcc.target/powerpc/pack02.c     (.../tags/gcc_4_8_3_release)
 
954
+++ b/src/gcc/testsuite/gcc.target/powerpc/pack02.c     (.../branches/gcc-4_8-branch)
 
955
@@ -2,6 +2,7 @@
 
956
 /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
957
 /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
958
 /* { dg-require-effective-target powerpc_fprs } */
 
959
+/* { dg-require-effective-target longdouble128 } */
 
960
 /* { dg-options "-O2 -mhard-float" } */
 
961
 
 
962
 #include <stddef.h>
 
963
Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c
 
964
===================================================================
 
965
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c   (.../tags/gcc_4_8_3_release)
 
966
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c   (.../branches/gcc-4_8-branch)
 
967
@@ -0,0 +1,12 @@
 
968
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
 
969
+/* { dg-options "-mabi=elfv2" } */
 
970
+
 
971
+struct f8
 
972
+  {
 
973
+    float x[8];
 
974
+  };
 
975
+
 
976
+void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */
 
977
+{
 
978
+}
 
979
+
 
980
Index: gcc/testsuite/gcc.target/powerpc/htm-ttest.c
 
981
===================================================================
 
982
--- a/src/gcc/testsuite/gcc.target/powerpc/htm-ttest.c  (.../tags/gcc_4_8_3_release)
 
983
+++ b/src/gcc/testsuite/gcc.target/powerpc/htm-ttest.c  (.../branches/gcc-4_8-branch)
 
984
@@ -0,0 +1,14 @@
 
985
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
986
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
987
+/* { dg-require-effective-target powerpc_htm_ok } */
 
988
+/* { dg-options "-O2 -mhtm" } */
 
989
+
 
990
+/* { dg-final { scan-assembler "rlwinm r?\[0-9\]+,r?\[0-9\]+,3,30,31" { target { ilp32 } } } } */
 
991
+/* { dg-final { scan-assembler "rldicl r?\[0-9\]+,r?\[0-9\]+,35,62" { target { lp64 } } } } */
 
992
+
 
993
+#include <htmintrin.h>
 
994
+long
 
995
+ttest (void)
 
996
+{
 
997
+  return _HTM_STATE(__builtin_ttest());
 
998
+}
 
999
Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c
 
1000
===================================================================
 
1001
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c   (.../tags/gcc_4_8_3_release)
 
1002
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c   (.../branches/gcc-4_8-branch)
 
1003
@@ -0,0 +1,12 @@
 
1004
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
 
1005
+/* { dg-options "-mno-compat-align-parm" } */
 
1006
+
 
1007
+struct test
 
1008
+  {
 
1009
+    long a __attribute__((aligned (16)));
 
1010
+  };
 
1011
+
 
1012
+void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment will change" } */
 
1013
+{
 
1014
+}
 
1015
+
 
1016
Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c
 
1017
===================================================================
 
1018
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c   (.../tags/gcc_4_8_3_release)
 
1019
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c   (.../branches/gcc-4_8-branch)
 
1020
@@ -0,0 +1,9 @@
 
1021
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
 
1022
+/* { dg-require-effective-target powerpc_altivec_ok } */
 
1023
+/* { dg-options "-maltivec" } */
 
1024
+
 
1025
+struct test
 
1026
+  {
 
1027
+    int a __attribute__((vector_size (8)));
 
1028
+  }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment will change" } */
 
1029
+
 
1030
Index: gcc/testsuite/gcc.target/alpha/pr61586.c
 
1031
===================================================================
 
1032
--- a/src/gcc/testsuite/gcc.target/alpha/pr61586.c      (.../tags/gcc_4_8_3_release)
 
1033
+++ b/src/gcc/testsuite/gcc.target/alpha/pr61586.c      (.../branches/gcc-4_8-branch)
 
1034
@@ -0,0 +1,10 @@
 
1035
+/* { dg-do compile } */
 
1036
+/* { dg-options "-O2 -mieee" } */
 
1037
+
 
1038
+void foo (int *dimensions, double **params, int hh)
 
1039
+{
 
1040
+  if (params[hh])
 
1041
+    ;
 
1042
+  else if (dimensions[hh] > 0)
 
1043
+    params[hh][0] = 1.0f;
 
1044
+}
 
1045
Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c
 
1046
===================================================================
 
1047
--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c  (.../tags/gcc_4_8_3_release)
 
1048
+++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c  (.../branches/gcc-4_8-branch)
 
1049
@@ -0,0 +1,35 @@
 
1050
+/* Test AAPCS64 layout and __builtin_va_start.
 
1051
+
 
1052
+   Pass named HFA/HVA argument on stack.  */
 
1053
+
 
1054
+/* { dg-do run { target aarch64*-*-* } } */
 
1055
+
 
1056
+#ifndef IN_FRAMEWORK
 
1057
+#define AAPCS64_TEST_STDARG
 
1058
+#define TESTFILE "va_arg-14.c"
 
1059
+#include "type-def.h"
 
1060
+
 
1061
+struct hfa_fx2_t hfa_fx2 = {1.2f, 2.2f};
 
1062
+struct hfa_fx3_t hfa_fx3 = {3.2f, 4.2f, 5.2f};
 
1063
+vf4_t float32x4 = {6.2f, 7.2f, 8.2f, 9.2f};
 
1064
+vf4_t float32x4_2 = {10.2f, 11.2f, 12.2f, 13.2f};
 
1065
+
 
1066
+#include "abitest.h"
 
1067
+#else
 
1068
+  ARG (float, 1.0f, S0, 0)
 
1069
+  ARG (float, 2.0f, S1, 1)
 
1070
+  ARG (float, 3.0f, S2, 2)
 
1071
+  ARG (float, 4.0f, S3, 3)
 
1072
+  ARG (float, 5.0f, S4, 4)
 
1073
+  ARG (float, 6.0f, S5, 5)
 
1074
+  ARG (float, 7.0f, S6, 6)
 
1075
+  ARG (struct hfa_fx3_t, hfa_fx3, STACK, 7)
 
1076
+  /* Previous argument size has been rounded up to the nearest multiple of
 
1077
+     8 bytes.  */
 
1078
+  ARG (struct hfa_fx2_t, hfa_fx2, STACK + 16, 8)
 
1079
+  /* NSAA is rounded up to the nearest natural alignment of float32x4.  */
 
1080
+  ARG (vf4_t, float32x4, STACK + 32, 9)
 
1081
+  ARG (vf4_t, float32x4_2, STACK + 48, LAST_NAMED_ARG_ID)
 
1082
+  DOTS
 
1083
+  LAST_ANON (double, 123456789.987, STACK + 64, 11)
 
1084
+#endif
 
1085
Index: gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h
 
1086
===================================================================
 
1087
--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h   (.../tags/gcc_4_8_3_release)
 
1088
+++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h   (.../branches/gcc-4_8-branch)
 
1089
@@ -34,6 +34,13 @@
 
1090
   float b;
 
1091
 };
 
1092
 
 
1093
+struct hfa_fx3_t
 
1094
+{
 
1095
+  float a;
 
1096
+  float b;
 
1097
+  float c;
 
1098
+};
 
1099
+
 
1100
 struct hfa_dx2_t
 
1101
 {
 
1102
   double a;
 
1103
Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c
 
1104
===================================================================
 
1105
--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c  (.../tags/gcc_4_8_3_release)
 
1106
+++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c  (.../branches/gcc-4_8-branch)
 
1107
@@ -0,0 +1,59 @@
 
1108
+/* Test AAPCS64 layout and __builtin_va_start.
 
1109
+
 
1110
+   Pass named HFA/HVA argument on stack.  */
 
1111
+
 
1112
+/* { dg-do run { target aarch64*-*-* } } */
 
1113
+
 
1114
+#ifndef IN_FRAMEWORK
 
1115
+#define AAPCS64_TEST_STDARG
 
1116
+#define TESTFILE "va_arg-13.c"
 
1117
+
 
1118
+struct float_float_t
 
1119
+{
 
1120
+  float a;
 
1121
+  float b;
 
1122
+} float_float;
 
1123
+
 
1124
+union float_int_t
 
1125
+{
 
1126
+  float b8;
 
1127
+  int b5;
 
1128
+} float_int;
 
1129
+
 
1130
+#define HAS_DATA_INIT_FUNC
 
1131
+void
 
1132
+init_data ()
 
1133
+{
 
1134
+  float_float.a = 1.2f;
 
1135
+  float_float.b = 2.2f;
 
1136
+
 
1137
+  float_int.b8 = 4983.80f;
 
1138
+}
 
1139
+
 
1140
+#include "abitest.h"
 
1141
+#else
 
1142
+  ARG (float, 1.0f, S0, 0)
 
1143
+  ARG (float, 2.0f, S1, 1)
 
1144
+  ARG (float, 3.0f, S2, 2)
 
1145
+  ARG (float, 4.0f, S3, 3)
 
1146
+  ARG (float, 5.0f, S4, 4)
 
1147
+  ARG (float, 6.0f, S5, 5)
 
1148
+  ARG (float, 7.0f, S6, 6)
 
1149
+  ARG (struct float_float_t, float_float, STACK, 7)
 
1150
+  ARG (int,  9, W0, 8)
 
1151
+  ARG (int, 10, W1, 9)
 
1152
+  ARG (int, 11, W2, 10)
 
1153
+  ARG (int, 12, W3, 11)
 
1154
+  ARG (int, 13, W4, 12)
 
1155
+  ARG (int, 14, W5, 13)
 
1156
+  ARG (int, 15, W6, LAST_NAMED_ARG_ID)
 
1157
+  DOTS
 
1158
+  /* Note on the reason of using 'X7' instead of 'W7' here:
 
1159
+     Using 'X7' makes sure the test works in the big-endian mode.
 
1160
+     According to PCS rules B.4 and C.10, the size of float_int is rounded
 
1161
+     to 8 bytes and prepared in the register X7 as if loaded via LDR from
 
1162
+     the memory, with the content of the other 4 bytes unspecified.  The
 
1163
+     test framework will only compare the 4 relavent bytes.  */
 
1164
+  ANON (union float_int_t, float_int, X7, 15)
 
1165
+  LAST_ANON (long long, 12683143434LL, STACK + 8, 16)
 
1166
+#endif
 
1167
Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c
 
1168
===================================================================
 
1169
--- a/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c  (.../tags/gcc_4_8_3_release)
 
1170
+++ b/src/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c  (.../branches/gcc-4_8-branch)
 
1171
@@ -0,0 +1,39 @@
 
1172
+/* Test AAPCS64 layout and __builtin_va_start.
 
1173
+
 
1174
+   Pass named __128int argument on stack.  */
 
1175
+
 
1176
+/* { dg-do run { target aarch64*-*-* } } */
 
1177
+
 
1178
+#ifndef IN_FRAMEWORK
 
1179
+#define AAPCS64_TEST_STDARG
 
1180
+#define TESTFILE "va_arg-15.c"
 
1181
+#include "type-def.h"
 
1182
+
 
1183
+union int128_t qword;
 
1184
+
 
1185
+#define HAS_DATA_INIT_FUNC
 
1186
+void
 
1187
+init_data ()
 
1188
+{
 
1189
+  /* Init signed quad-word integer.  */
 
1190
+  qword.l64 = 0xfdb9753102468aceLL;
 
1191
+  qword.h64 = 0xeca8642013579bdfLL;
 
1192
+}
 
1193
+
 
1194
+#include "abitest.h"
 
1195
+#else
 
1196
+  ARG (int, 1, W0, 0)
 
1197
+  ARG (int, 2, W1, 1)
 
1198
+  ARG (int, 3, W2, 2)
 
1199
+  ARG (int, 4, W3, 3)
 
1200
+  ARG (int, 5, W4, 4)
 
1201
+  ARG (int, 6, W5, 5)
 
1202
+  ARG (int, 7, W6, 6)
 
1203
+  ARG (__int128, qword.i, STACK, LAST_NAMED_ARG_ID)
 
1204
+  DOTS
 
1205
+#ifndef __AAPCS64_BIG_ENDIAN__
 
1206
+  LAST_ANON (int, 8, STACK + 16, 8)
 
1207
+#else
 
1208
+  LAST_ANON (int, 8, STACK + 20, 8)
 
1209
+#endif
 
1210
+#endif
 
1211
Index: gcc/testsuite/gcc.target/avr/torture/pr61443.c
 
1212
===================================================================
 
1213
--- a/src/gcc/testsuite/gcc.target/avr/torture/pr61443.c        (.../tags/gcc_4_8_3_release)
 
1214
+++ b/src/gcc/testsuite/gcc.target/avr/torture/pr61443.c        (.../branches/gcc-4_8-branch)
 
1215
@@ -0,0 +1,134 @@
 
1216
+/* { dg-do run } */
 
1217
+/* { dg-options "-std=gnu99" } */
 
1218
+
 
1219
+#include <stdlib.h>
 
1220
+#include <stdarg.h>
 
1221
+
 
1222
+#define NC __attribute__((noinline,noclone))
 
1223
+
 
1224
+void NC vfun (char n, ...)
 
1225
+{
 
1226
+  va_list ap;
 
1227
+
 
1228
+  va_start (ap, n);
 
1229
+
 
1230
+  switch (n)
 
1231
+    {
 
1232
+    default:
 
1233
+      abort();
 
1234
+    case 1:
 
1235
+      if (11 != va_arg (ap, int))
 
1236
+        abort();
 
1237
+      break;
 
1238
+    case 2:
 
1239
+      if (2222 != va_arg (ap, int))
 
1240
+        abort();
 
1241
+      break;
 
1242
+    case 3:
 
1243
+      if (333333 != va_arg (ap, __int24))
 
1244
+        abort();
 
1245
+      break;
 
1246
+    case 4:
 
1247
+      if (44444444 != va_arg (ap, long))
 
1248
+        abort();
 
1249
+      break;
 
1250
+    case 8:
 
1251
+      if (8888888888888888 != va_arg (ap, long long))
 
1252
+        abort();
 
1253
+      break;
 
1254
+    }
 
1255
+
 
1256
+  va_end (ap);
 
1257
+}
 
1258
+
 
1259
+
 
1260
+void NC boo_qi (const __flash char *p)
 
1261
+{
 
1262
+  vfun (1, *p);
 
1263
+}
 
1264
+
 
1265
+void NC boox_qi (const __memx char *p)
 
1266
+{
 
1267
+  vfun (1, *p);
 
1268
+}
 
1269
+
 
1270
+void NC boo_hi (const __flash int *p)
 
1271
+{
 
1272
+  vfun (2, *p);
 
1273
+}
 
1274
+
 
1275
+void NC boox_hi (const __memx int *p)
 
1276
+{
 
1277
+  vfun (2, *p);
 
1278
+}
 
1279
+
 
1280
+void NC boo_psi (const __flash __int24 *p)
 
1281
+{
 
1282
+  vfun (3, *p);
 
1283
+}
 
1284
+
 
1285
+void NC boox_psi (const __memx __int24 *p)
 
1286
+{
 
1287
+  vfun (3, *p);
 
1288
+}
 
1289
+
 
1290
+void NC boo_si (const __flash long *p)
 
1291
+{
 
1292
+  vfun (4, *p);
 
1293
+}
 
1294
+
 
1295
+void NC boox_si (const __memx long *p)
 
1296
+{
 
1297
+  vfun (4, *p);
 
1298
+}
 
1299
+
 
1300
+void NC boo_di (const __flash long long *p)
 
1301
+{
 
1302
+  vfun (8, *p);
 
1303
+}
 
1304
+
 
1305
+void NC boox_di (const __memx long long *p)
 
1306
+{
 
1307
+  vfun (8, *p);
 
1308
+}
 
1309
+
 
1310
+const __flash char f_qi = 11;
 
1311
+const __flash int f_hi = 2222;
 
1312
+const __flash __int24 f_psi = 333333;
 
1313
+const __flash long f_si = 44444444;
 
1314
+const __flash long long f_di = 8888888888888888;
 
1315
+
 
1316
+const __memx char x_qi = 11;
 
1317
+const __memx int x_hi = 2222;
 
1318
+const __memx __int24 x_psi = 333333;
 
1319
+const __memx long x_si = 44444444;
 
1320
+const __memx long long x_di = 8888888888888888;
 
1321
+
 
1322
+char r_qi = 11;
 
1323
+int r_hi = 2222;
 
1324
+__int24 r_psi = 333333;
 
1325
+long r_si = 44444444;
 
1326
+long long r_di = 8888888888888888;
 
1327
+
 
1328
+int main (void)
 
1329
+{
 
1330
+  boo_qi (&f_qi);
 
1331
+  boo_hi (&f_hi);
 
1332
+  boo_psi (&f_psi);
 
1333
+  boo_si (&f_si);
 
1334
+  boo_di (&f_di);
 
1335
+
 
1336
+  boox_qi (&x_qi);
 
1337
+  boox_hi (&x_hi);
 
1338
+  boox_psi (&x_psi);
 
1339
+  boox_si (&x_si);
 
1340
+  boox_di (&x_di);
 
1341
+
 
1342
+  boox_qi (&r_qi);
 
1343
+  boox_hi (&r_hi);
 
1344
+  boox_psi (&r_psi);
 
1345
+  boox_si (&r_si);
 
1346
+  boox_di (&r_di);
 
1347
+
 
1348
+  exit (0);
 
1349
+}
 
1350
Index: gcc/testsuite/gcc.target/i386/pr61423.c
 
1351
===================================================================
 
1352
--- a/src/gcc/testsuite/gcc.target/i386/pr61423.c       (.../tags/gcc_4_8_3_release)
 
1353
+++ b/src/gcc/testsuite/gcc.target/i386/pr61423.c       (.../branches/gcc-4_8-branch)
 
1354
@@ -0,0 +1,38 @@
 
1355
+/* PR target/61423 */
 
1356
+/* { dg-do run { target ia32 } } */
 
1357
+/* { dg-options "-O1 -ftree-vectorize -msse2 -mfpmath=387 -mtune=core2" } */
 
1358
+
 
1359
+#define N 1024
 
1360
+static unsigned int A[N];
 
1361
+
 
1362
+double
 
1363
+__attribute__((noinline))
 
1364
+func (void)
 
1365
+{
 
1366
+  unsigned int sum = 0;
 
1367
+  unsigned i;
 
1368
+  double t;
 
1369
+
 
1370
+  for (i = 0; i < N; i++)
 
1371
+    sum += A[i];
 
1372
+
 
1373
+  t = sum;
 
1374
+  return t;
 
1375
+}
 
1376
+
 
1377
+int
 
1378
+main ()
 
1379
+{
 
1380
+  unsigned i;
 
1381
+  double d;
 
1382
+
 
1383
+  for(i = 0; i < N; i++)
 
1384
+    A[i] = 1;
 
1385
+
 
1386
+  d = func();
 
1387
+
 
1388
+  if (d != 1024.0)
 
1389
+    __builtin_abort ();
 
1390
+
 
1391
+  return 0;
 
1392
+}
 
1393
Index: gcc/testsuite/gcc.target/i386/pr60901.c
 
1394
===================================================================
 
1395
--- a/src/gcc/testsuite/gcc.target/i386/pr60901.c       (.../tags/gcc_4_8_3_release)
 
1396
+++ b/src/gcc/testsuite/gcc.target/i386/pr60901.c       (.../branches/gcc-4_8-branch)
 
1397
@@ -0,0 +1,17 @@
 
1398
+/* { dg-options "-O -fselective-scheduling -fschedule-insns -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fno-tree-dominator-opts"  } */
 
1399
+
 
1400
+extern int n;
 
1401
+extern void bar (void);
 
1402
+extern int baz (int);
 
1403
+
 
1404
+void
 
1405
+foo (void)
 
1406
+{
 
1407
+  int i, j;
 
1408
+  for (j = 0; j < n; j++)
 
1409
+    {
 
1410
+      for (i = 1; i < j; i++)
 
1411
+       bar ();
 
1412
+      baz (0);
 
1413
+    }
 
1414
+}
 
1415
Index: gcc/testsuite/gcc.target/i386/pr61801.c
 
1416
===================================================================
 
1417
--- a/src/gcc/testsuite/gcc.target/i386/pr61801.c       (.../tags/gcc_4_8_3_release)
 
1418
+++ b/src/gcc/testsuite/gcc.target/i386/pr61801.c       (.../branches/gcc-4_8-branch)
 
1419
@@ -0,0 +1,21 @@
 
1420
+/* PR rtl-optimization/61801 */
 
1421
+/* { dg-do compile } */
 
1422
+/* { dg-options "-Os -fcompare-debug" } */
 
1423
+
 
1424
+int a, c;
 
1425
+int bar (void);
 
1426
+void baz (void);
 
1427
+
 
1428
+void
 
1429
+foo (void)
 
1430
+{
 
1431
+  int d;
 
1432
+  if (bar ())
 
1433
+    {
 
1434
+      int e;
 
1435
+      baz ();
 
1436
+      asm volatile ("" : "=a" (e) : "0" (a), "i" (0));
 
1437
+      d = e;
 
1438
+    }
 
1439
+  c = d;
 
1440
+}
 
1441
Index: gcc/testsuite/gcc.target/i386/pr61446.c
 
1442
===================================================================
 
1443
--- a/src/gcc/testsuite/gcc.target/i386/pr61446.c       (.../tags/gcc_4_8_3_release)
 
1444
+++ b/src/gcc/testsuite/gcc.target/i386/pr61446.c       (.../branches/gcc-4_8-branch)
 
1445
@@ -0,0 +1,14 @@
 
1446
+/* PR rtl-optimization/61446 */
 
1447
+
 
1448
+/* { dg-do compile { target { ia32 } } } */
 
1449
+/* { dg-options "-O2 -march=corei7 -mfpmath=387" } */
 
1450
+
 
1451
+unsigned long long
 
1452
+foo (float a)
 
1453
+{
 
1454
+  const double dfa = a;
 
1455
+  const unsigned int hi = dfa / 0x1p32f;
 
1456
+  const unsigned int lo = dfa - (double) hi * 0x1p32f;
 
1457
+
 
1458
+  return ((unsigned long long) hi << (4 * (8))) | lo;
 
1459
+}
 
1460
Index: gcc/testsuite/lib/target-supports.exp
 
1461
===================================================================
 
1462
--- a/src/gcc/testsuite/lib/target-supports.exp (.../tags/gcc_4_8_3_release)
 
1463
+++ b/src/gcc/testsuite/lib/target-supports.exp (.../branches/gcc-4_8-branch)
 
1464
@@ -1790,6 +1790,15 @@
 
1465
     }]
 
1466
 }
 
1467
 
 
1468
+# Return 1 if the target supports long double of 128 bits,
 
1469
+# 0 otherwise.
 
1470
+
 
1471
+proc check_effective_target_longdouble128 { } {
 
1472
+    return [check_no_compiler_messages longdouble128 object {
 
1473
+       int dummy[sizeof(long double) == 16 ? 1 : -1];
 
1474
+    }]
 
1475
+}
 
1476
+
 
1477
 # Return 1 if the target supports double of 64 bits,
 
1478
 # 0 otherwise.
 
1479
 
 
1480
Index: gcc/testsuite/gfortran.dg/default_format_denormal_2.f90
 
1481
===================================================================
 
1482
--- a/src/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90       (.../tags/gcc_4_8_3_release)
 
1483
+++ b/src/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90       (.../branches/gcc-4_8-branch)
 
1484
@@ -1,6 +1,6 @@
 
1485
 ! { dg-require-effective-target fortran_large_real }
 
1486
-! { dg-do run { xfail powerpc*-apple-darwin* powerpc*-*-linux* } }
 
1487
-! Test XFAILed on these platforms because the system's printf() lacks
 
1488
+! { dg-do run { xfail powerpc*-apple-darwin* } }
 
1489
+! Test XFAILed on this platform because the system's printf() lacks
 
1490
 ! proper support for denormalized long doubles. See PR24685
 
1491
 !
 
1492
 ! This tests that the default formats for formatted I/O of reals are
 
1493
Index: gcc/testsuite/gfortran.dg/cray_pointers_10.f90
 
1494
===================================================================
 
1495
--- a/src/gcc/testsuite/gfortran.dg/cray_pointers_10.f90        (.../tags/gcc_4_8_3_release)
 
1496
+++ b/src/gcc/testsuite/gfortran.dg/cray_pointers_10.f90        (.../branches/gcc-4_8-branch)
 
1497
@@ -0,0 +1,18 @@
 
1498
+! { dg-do run }
 
1499
+! { dg-options "-fcray-pointer" }
 
1500
+!
 
1501
+! PR fortran/45187
 
1502
+!
 
1503
+module foo
 
1504
+  implicit none
 
1505
+  real :: a
 
1506
+  pointer(c_a, a)
 
1507
+end module foo
 
1508
+
 
1509
+program test
 
1510
+  use foo
 
1511
+  real :: z
 
1512
+  c_a = loc(z)
 
1513
+  a = 42
 
1514
+  if (z /= 42) call abort
 
1515
+end program test
 
1516
Index: gcc/testsuite/gfortran.dg/dependency_44.f90
 
1517
===================================================================
 
1518
--- a/src/gcc/testsuite/gfortran.dg/dependency_44.f90   (.../tags/gcc_4_8_3_release)
 
1519
+++ b/src/gcc/testsuite/gfortran.dg/dependency_44.f90   (.../branches/gcc-4_8-branch)
 
1520
@@ -0,0 +1,36 @@
 
1521
+! { dg-do run }
 
1522
+! Tests fix for PR61780 in which the loop reversal mechanism was
 
1523
+! not accounting for the first index being an element so that no
 
1524
+! loop in this dimension is created.
 
1525
+!
 
1526
+! Contributed by Manfred Tietze on clf.
 
1527
+!
 
1528
+program prgm3
 
1529
+    implicit none
 
1530
+    integer, parameter :: n = 10, k = 3
 
1531
+    integer :: i, j
 
1532
+    integer, dimension(n,n) :: y
 
1533
+    integer :: res1(n), res2(n)
 
1534
+
 
1535
+1   format(10i5)
 
1536
+
 
1537
+!initialize
 
1538
+    do i=1,n
 
1539
+        do j=1,n
 
1540
+            y(i,j) = n*i + j
 
1541
+        end do
 
1542
+    end do
 
1543
+    res2 = y(k,:)
 
1544
+
 
1545
+!shift right
 
1546
+    y(k,4:n) = y(k,3:n-1)
 
1547
+    y(k,3) = 0
 
1548
+    res1 = y(k,:)
 
1549
+    y(k,:) = res2
 
1550
+    y(k,n:4:-1) = y(k,n-1:3:-1)
 
1551
+    y(k,3) = 0
 
1552
+    res2 = y(k,:)
 
1553
+!    print *, res1
 
1554
+!    print *, res2
 
1555
+    if (any(res1 /= res2)) call abort ()
 
1556
+end program prgm3
 
1557
Index: gcc/testsuite/gfortran.dg/oldstyle_5.f
 
1558
===================================================================
 
1559
--- a/src/gcc/testsuite/gfortran.dg/oldstyle_5.f        (.../tags/gcc_4_8_3_release)
 
1560
+++ b/src/gcc/testsuite/gfortran.dg/oldstyle_5.f        (.../branches/gcc-4_8-branch)
 
1561
@@ -0,0 +1,8 @@
 
1562
+C { dg-do compile }
 
1563
+      TYPE T
 
1564
+      INTEGER A(2)/1,2/ ! { dg-error "Invalid old style initialization for derived type component" }
 
1565
+      END TYPE
 
1566
+      TYPE S
 
1567
+      INTEGER B/1/ ! { dg-error "Invalid old style initialization for derived type component" }
 
1568
+      END TYPE
 
1569
+      END
 
1570
Index: gcc/testsuite/gfortran.dg/nint_2.f90
 
1571
===================================================================
 
1572
--- a/src/gcc/testsuite/gfortran.dg/nint_2.f90  (.../tags/gcc_4_8_3_release)
 
1573
+++ b/src/gcc/testsuite/gfortran.dg/nint_2.f90  (.../branches/gcc-4_8-branch)
 
1574
@@ -4,7 +4,8 @@
 
1575
 ! http://gcc.gnu.org/ml/fortran/2005-04/msg00139.html
 
1576
 !
 
1577
 ! { dg-do run }
 
1578
-! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc*-*-linux* *-*-mingw* } { "-O0" } { "" } }
 
1579
+! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc-*-linux* powerpc64-*-linux* *-*-mingw* } { "-O0" } { "" } }
 
1580
+! Note that this doesn't fail on powerpc64le-*-linux*.
 
1581
   real(kind=8) :: a
 
1582
   integer(kind=8) :: i1, i2
 
1583
   real :: b
 
1584
Index: gcc/testsuite/gfortran.dg/pr45636.f90
 
1585
===================================================================
 
1586
--- a/src/gcc/testsuite/gfortran.dg/pr45636.f90 (.../tags/gcc_4_8_3_release)
 
1587
+++ b/src/gcc/testsuite/gfortran.dg/pr45636.f90 (.../branches/gcc-4_8-branch)
 
1588
@@ -10,5 +10,5 @@
 
1589
   b = y
 
1590
   call sub(a, b)
 
1591
 end program main
 
1592
-! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { mips*-*-* && { ! nomips16 } } } } }
 
1593
+! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { { hppa*-*-* && { ! lp64 } } || { mips*-*-* && { ! nomips16 } } } } } }
 
1594
 ! { dg-final { cleanup-tree-dump "forwprop2" } }
 
1595
Index: gcc/testsuite/gfortran.dg/allocatable_function_8.f90
 
1596
===================================================================
 
1597
--- a/src/gcc/testsuite/gfortran.dg/allocatable_function_8.f90  (.../tags/gcc_4_8_3_release)
 
1598
+++ b/src/gcc/testsuite/gfortran.dg/allocatable_function_8.f90  (.../branches/gcc-4_8-branch)
 
1599
@@ -0,0 +1,47 @@
 
1600
+! { dg-do run }
 
1601
+! Test the fix for PR61459.
 
1602
+!
 
1603
+! Contributed by John Wingate  <johnww@tds.net>
 
1604
+!
 
1605
+module a
 
1606
+
 
1607
+   implicit none
 
1608
+   private
 
1609
+   public :: f_segfault, f_segfault_plus, f_workaround
 
1610
+   integer, dimension(2,2) :: b = reshape([1,-1,1,1],[2,2])
 
1611
+
 
1612
+contains
 
1613
+
 
1614
+   function f_segfault(x)
 
1615
+      real, dimension(:), allocatable :: f_segfault
 
1616
+      real, dimension(:), intent(in)  :: x
 
1617
+      allocate(f_segfault(2))
 
1618
+      f_segfault = matmul(b,x)
 
1619
+   end function f_segfault
 
1620
+
 
1621
+! Sefaulted without the ALLOCATE as well.
 
1622
+   function f_segfault_plus(x)
 
1623
+      real, dimension(:), allocatable :: f_segfault_plus
 
1624
+      real, dimension(:), intent(in)  :: x
 
1625
+      f_segfault_plus = matmul(b,x)
 
1626
+   end function f_segfault_plus
 
1627
+
 
1628
+   function f_workaround(x)
 
1629
+      real, dimension(:), allocatable :: f_workaround
 
1630
+      real, dimension(:), intent(in)  :: x
 
1631
+      real, dimension(:), allocatable :: tmp
 
1632
+      allocate(f_workaround(2),tmp(2))
 
1633
+      tmp = matmul(b,x)
 
1634
+      f_workaround = tmp
 
1635
+   end function f_workaround
 
1636
+
 
1637
+end module a
 
1638
+
 
1639
+program main
 
1640
+   use a
 
1641
+   implicit none
 
1642
+   real, dimension(2) :: x = 1.0, y
 
1643
+   y = f_workaround (x)
 
1644
+   if (any (f_segfault (x) .ne. y)) call abort
 
1645
+   if (any (f_segfault_plus (x) .ne. y)) call abort
 
1646
+end program main
 
1647
Index: gcc/testsuite/gcc.c-torture/execute/pr61306-1.c
 
1648
===================================================================
 
1649
--- a/src/gcc/testsuite/gcc.c-torture/execute/pr61306-1.c       (.../tags/gcc_4_8_3_release)
 
1650
+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr61306-1.c       (.../branches/gcc-4_8-branch)
 
1651
@@ -0,0 +1,39 @@
 
1652
+#ifdef __INT32_TYPE__
 
1653
+typedef __INT32_TYPE__ int32_t;
 
1654
+#else
 
1655
+typedef int int32_t;
 
1656
+#endif
 
1657
+
 
1658
+#ifdef __UINT32_TYPE__
 
1659
+typedef __UINT32_TYPE__ uint32_t;
 
1660
+#else
 
1661
+typedef unsigned uint32_t;
 
1662
+#endif
 
1663
+
 
1664
+#define __fake_const_swab32(x) ((uint32_t)(                  \
 
1665
+       (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) |    \
 
1666
+       (((uint32_t)(x) & (uint32_t)0x0000ff00UL) <<  8) |    \
 
1667
+       (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >>  8) |    \
 
1668
+       (( (int32_t)(x) &  (int32_t)0xff000000UL) >> 24)))
 
1669
+
 
1670
+/* Previous version of bswap optimization failed to consider sign extension
 
1671
+   and as a result would replace an expression *not* doing a bswap by a
 
1672
+   bswap.  */
 
1673
+
 
1674
+__attribute__ ((noinline, noclone)) uint32_t
 
1675
+fake_bswap32 (uint32_t in)
 
1676
+{
 
1677
+  return __fake_const_swab32 (in);
 
1678
+}
 
1679
+
 
1680
+int
 
1681
+main(void)
 
1682
+{
 
1683
+  if (sizeof (int32_t) * __CHAR_BIT__ != 32)
 
1684
+    return 0;
 
1685
+  if (sizeof (uint32_t) * __CHAR_BIT__ != 32)
 
1686
+    return 0;
 
1687
+  if (fake_bswap32 (0x87654321) != 0xffffff87)
 
1688
+    __builtin_abort ();
 
1689
+  return 0;
 
1690
+}
 
1691
Index: gcc/testsuite/gcc.c-torture/execute/pr23135.x
 
1692
===================================================================
 
1693
--- a/src/gcc/testsuite/gcc.c-torture/execute/pr23135.x (.../tags/gcc_4_8_3_release)
 
1694
+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr23135.x (.../branches/gcc-4_8-branch)
 
1695
@@ -0,0 +1,2 @@
 
1696
+set additional_flags "-Wno-psabi"
 
1697
+return 0
 
1698
Index: gcc/testsuite/gcc.c-torture/execute/pr61306-3.c
 
1699
===================================================================
 
1700
--- a/src/gcc/testsuite/gcc.c-torture/execute/pr61306-3.c       (.../tags/gcc_4_8_3_release)
 
1701
+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr61306-3.c       (.../branches/gcc-4_8-branch)
 
1702
@@ -0,0 +1,13 @@
 
1703
+short a = -1;
 
1704
+int b;
 
1705
+char c;
 
1706
+
 
1707
+int
 
1708
+main ()
 
1709
+{
 
1710
+  c = a;
 
1711
+  b = a | c;
 
1712
+  if (b != -1)
 
1713
+    __builtin_abort ();
 
1714
+  return 0;
 
1715
+}
 
1716
Index: gcc/testsuite/gcc.c-torture/execute/20050604-1.x
 
1717
===================================================================
 
1718
--- a/src/gcc/testsuite/gcc.c-torture/execute/20050604-1.x      (.../tags/gcc_4_8_3_release)
 
1719
+++ b/src/gcc/testsuite/gcc.c-torture/execute/20050604-1.x      (.../branches/gcc-4_8-branch)
 
1720
@@ -6,4 +6,5 @@
 
1721
        set additional_flags "-mno-mmx"
 
1722
 }
 
1723
 
 
1724
+set additional_flags "-Wno-psabi"
 
1725
 return 0
 
1726
Index: gcc/testsuite/gcc.c-torture/execute/pr61306-2.c
 
1727
===================================================================
 
1728
--- a/src/gcc/testsuite/gcc.c-torture/execute/pr61306-2.c       (.../tags/gcc_4_8_3_release)
 
1729
+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr61306-2.c       (.../branches/gcc-4_8-branch)
 
1730
@@ -0,0 +1,40 @@
 
1731
+#ifdef __INT16_TYPE__
 
1732
+typedef __INT16_TYPE__ int16_t;
 
1733
+#else
 
1734
+typedef short int16_t;
 
1735
+#endif
 
1736
+
 
1737
+#ifdef __UINT32_TYPE__
 
1738
+typedef __UINT32_TYPE__ uint32_t;
 
1739
+#else
 
1740
+typedef unsigned uint32_t;
 
1741
+#endif
 
1742
+
 
1743
+#define __fake_const_swab32(x) ((uint32_t)(                          \
 
1744
+       (((uint32_t)         (x) & (uint32_t)0x000000ffUL) << 24) |   \
 
1745
+       (((uint32_t)(int16_t)(x) & (uint32_t)0x00ffff00UL) <<  8) |   \
 
1746
+       (((uint32_t)         (x) & (uint32_t)0x00ff0000UL) >>  8) |   \
 
1747
+       (((uint32_t)         (x) & (uint32_t)0xff000000UL) >> 24)))
 
1748
+
 
1749
+
 
1750
+/* Previous version of bswap optimization failed to consider sign extension
 
1751
+   and as a result would replace an expression *not* doing a bswap by a
 
1752
+   bswap.  */
 
1753
+
 
1754
+__attribute__ ((noinline, noclone)) uint32_t
 
1755
+fake_bswap32 (uint32_t in)
 
1756
+{
 
1757
+  return __fake_const_swab32 (in);
 
1758
+}
 
1759
+
 
1760
+int
 
1761
+main(void)
 
1762
+{
 
1763
+  if (sizeof (uint32_t) * __CHAR_BIT__ != 32)
 
1764
+    return 0;
 
1765
+  if (sizeof (int16_t) * __CHAR_BIT__ != 16)
 
1766
+    return 0;
 
1767
+  if (fake_bswap32 (0x81828384) != 0xff838281)
 
1768
+    __builtin_abort ();
 
1769
+  return 0;
 
1770
+}
 
1771
Index: gcc/testsuite/gcc.c-torture/execute/pr61375.c
 
1772
===================================================================
 
1773
--- a/src/gcc/testsuite/gcc.c-torture/execute/pr61375.c (.../tags/gcc_4_8_3_release)
 
1774
+++ b/src/gcc/testsuite/gcc.c-torture/execute/pr61375.c (.../branches/gcc-4_8-branch)
 
1775
@@ -0,0 +1,35 @@
 
1776
+#ifdef __UINT64_TYPE__
 
1777
+typedef __UINT64_TYPE__ uint64_t;
 
1778
+#else
 
1779
+typedef unsigned long long uint64_t;
 
1780
+#endif
 
1781
+
 
1782
+#ifndef __SIZEOF_INT128__
 
1783
+#define __int128 long long
 
1784
+#endif
 
1785
+
 
1786
+/* Some version of bswap optimization would ICE when analyzing a mask constant
 
1787
+   too big for an HOST_WIDE_INT (PR61375).  */
 
1788
+
 
1789
+__attribute__ ((noinline, noclone)) uint64_t
 
1790
+uint128_central_bitsi_ior (unsigned __int128 in1, uint64_t in2)
 
1791
+{
 
1792
+  __int128 mask = (__int128)0xffff << 56;
 
1793
+  return ((in1 & mask) >> 56) | in2;
 
1794
+}
 
1795
+
 
1796
+int
 
1797
+main (int argc)
 
1798
+{
 
1799
+  __int128 in = 1;
 
1800
+#ifdef __SIZEOF_INT128__
 
1801
+  in <<= 64;
 
1802
+#endif
 
1803
+  if (sizeof (uint64_t) * __CHAR_BIT__ != 64)
 
1804
+    return 0;
 
1805
+  if (sizeof (unsigned __int128) * __CHAR_BIT__ != 128)
 
1806
+    return 0;
 
1807
+  if (uint128_central_bitsi_ior (in, 2) != 0x102)
 
1808
+    __builtin_abort ();
 
1809
+  return 0;
 
1810
+}
 
1811
Index: gcc/testsuite/gcc.c-torture/execute/20050316-1.x
 
1812
===================================================================
 
1813
--- a/src/gcc/testsuite/gcc.c-torture/execute/20050316-1.x      (.../tags/gcc_4_8_3_release)
 
1814
+++ b/src/gcc/testsuite/gcc.c-torture/execute/20050316-1.x      (.../branches/gcc-4_8-branch)
 
1815
@@ -4,4 +4,5 @@
 
1816
        return 1
 
1817
 }
 
1818
 
 
1819
+set additional_flags "-Wno-psabi"
 
1820
 return 0;
 
1821
Index: gcc/testsuite/gcc.c-torture/execute/20050316-3.x
 
1822
===================================================================
 
1823
--- a/src/gcc/testsuite/gcc.c-torture/execute/20050316-3.x      (.../tags/gcc_4_8_3_release)
 
1824
+++ b/src/gcc/testsuite/gcc.c-torture/execute/20050316-3.x      (.../branches/gcc-4_8-branch)
 
1825
@@ -0,0 +1,2 @@
 
1826
+set additional_flags "-Wno-psabi"
 
1827
+return 0
 
1828
Index: gcc/testsuite/gcc.c-torture/compile/pr61684.c
 
1829
===================================================================
 
1830
--- a/src/gcc/testsuite/gcc.c-torture/compile/pr61684.c (.../tags/gcc_4_8_3_release)
 
1831
+++ b/src/gcc/testsuite/gcc.c-torture/compile/pr61684.c (.../branches/gcc-4_8-branch)
 
1832
@@ -0,0 +1,15 @@
 
1833
+/* PR tree-optimization/61684 */
 
1834
+
 
1835
+int a, c;
 
1836
+static int *b = 0;
 
1837
+short d;
 
1838
+static short **e = 0;
 
1839
+
 
1840
+void
 
1841
+foo ()
 
1842
+{
 
1843
+  for (; c < 1; c++)
 
1844
+    ;
 
1845
+  *e = &d;
 
1846
+  a = d && (c && 1) & *b;
 
1847
+}
 
1848
Index: gcc/testsuite/gnat.dg/opt39.adb
 
1849
===================================================================
 
1850
--- a/src/gcc/testsuite/gnat.dg/opt39.adb       (.../tags/gcc_4_8_3_release)
 
1851
+++ b/src/gcc/testsuite/gnat.dg/opt39.adb       (.../branches/gcc-4_8-branch)
 
1852
@@ -0,0 +1,31 @@
 
1853
+-- { dg-do compile }
 
1854
+-- { dg-options "-O2 -fno-inline -fdump-tree-optimized" }
 
1855
+
 
1856
+procedure Opt39 (I : Integer) is
 
1857
+
 
1858
+  type Rec is record
 
1859
+    I1 : Integer;
 
1860
+    I2 : Integer;
 
1861
+    I3 : Integer;
 
1862
+    I4 : Integer;
 
1863
+    I5 : Integer;
 
1864
+  end record;
 
1865
+
 
1866
+  procedure Set (A : access Rec; I : Integer) is
 
1867
+    Tmp : Rec := A.all;
 
1868
+  begin
 
1869
+    Tmp.I1 := I;
 
1870
+    A.all := Tmp;
 
1871
+  end;
 
1872
+
 
1873
+  R : aliased Rec;
 
1874
+
 
1875
+begin
 
1876
+  Set (R'Access, I);
 
1877
+  if R.I1 /= I then
 
1878
+    raise Program_Error;
 
1879
+  end if;
 
1880
+end;
 
1881
+
 
1882
+-- { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } }
 
1883
+-- { dg-final { cleanup-tree-dump "optimized" } }
 
1884
Index: gcc/testsuite/gnat.dg/overflow_fixed.adb
 
1885
===================================================================
 
1886
--- a/src/gcc/testsuite/gnat.dg/overflow_fixed.adb      (.../tags/gcc_4_8_3_release)
 
1887
+++ b/src/gcc/testsuite/gnat.dg/overflow_fixed.adb      (.../branches/gcc-4_8-branch)
 
1888
@@ -0,0 +1,19 @@
 
1889
+-- { dg-do run }
 
1890
+-- { dg-options "-gnato -O" }
 
1891
+
 
1892
+procedure Overflow_Fixed is
 
1893
+
 
1894
+  type Unsigned_8_Bit is mod 2**8;
 
1895
+
 
1896
+  procedure Fixed_To_Eight (Value : Duration) is
 
1897
+    Item : Unsigned_8_Bit;
 
1898
+  begin
 
1899
+    Item := Unsigned_8_Bit(Value);
 
1900
+    raise Program_Error;
 
1901
+  exception
 
1902
+    when Constraint_Error => null; -- expected case
 
1903
+  end;
 
1904
+
 
1905
+begin
 
1906
+  Fixed_To_Eight (-0.5);
 
1907
+end;
 
1908
Index: gcc/testsuite/gnat.dg/aliasing1.adb
 
1909
===================================================================
 
1910
--- a/src/gcc/testsuite/gnat.dg/aliasing1.adb   (.../tags/gcc_4_8_3_release)
 
1911
+++ b/src/gcc/testsuite/gnat.dg/aliasing1.adb   (.../branches/gcc-4_8-branch)
 
1912
@@ -18,5 +18,5 @@
 
1913
 
 
1914
 end Aliasing1;
 
1915
 
 
1916
--- { dg-final { scan-tree-dump-not "__gnat_rcheck" "optimized" } }
 
1917
+-- { dg-final { scan-tree-dump-not "gnat_rcheck" "optimized" } }
 
1918
 -- { dg-final { cleanup-tree-dump "optimized" } }
 
1919
Index: gcc/testsuite/gcc.dg/pr60866.c
 
1920
===================================================================
 
1921
--- a/src/gcc/testsuite/gcc.dg/pr60866.c        (.../tags/gcc_4_8_3_release)
 
1922
+++ b/src/gcc/testsuite/gcc.dg/pr60866.c        (.../branches/gcc-4_8-branch)
 
1923
@@ -0,0 +1,18 @@
 
1924
+/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
 
1925
+/* { dg-options "-O -fselective-scheduling -fno-if-conversion -fschedule-insns"  } */
 
1926
+
 
1927
+int n;
 
1928
+
 
1929
+void
 
1930
+foo (int w, int **dnroot, int **dn)
 
1931
+{
 
1932
+  int *child;
 
1933
+  int *xchild = xchild;
 
1934
+  for (; w < n; w++)
 
1935
+    if (!dnroot)
 
1936
+      {
 
1937
+       dnroot = dn;
 
1938
+       for (child = *dn; child; child = xchild)
 
1939
+         ;
 
1940
+      }
 
1941
+}
 
1942
Index: gcc/testsuite/gcc.dg/pr51879-18.c
 
1943
===================================================================
 
1944
--- a/src/gcc/testsuite/gcc.dg/pr51879-18.c     (.../tags/gcc_4_8_3_release)
 
1945
+++ b/src/gcc/testsuite/gcc.dg/pr51879-18.c     (.../branches/gcc-4_8-branch)
 
1946
@@ -13,5 +13,5 @@
 
1947
     *q = foo ();
 
1948
 }
 
1949
 
 
1950
-/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre"} } */
 
1951
+/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre" { xfail *-*-* } } } */
 
1952
 /* { dg-final { cleanup-tree-dump "pre" } } */
 
1953
Index: gcc/testsuite/gcc.dg/torture/pr61964.c
 
1954
===================================================================
 
1955
--- a/src/gcc/testsuite/gcc.dg/torture/pr61964.c        (.../tags/gcc_4_8_3_release)
 
1956
+++ b/src/gcc/testsuite/gcc.dg/torture/pr61964.c        (.../branches/gcc-4_8-branch)
 
1957
@@ -0,0 +1,33 @@
 
1958
+/* { dg-do run } */
 
1959
+
 
1960
+extern void abort (void);
 
1961
+
 
1962
+struct node { struct node *next, *prev; } node;
 
1963
+struct head { struct node *first; } heads[5];
 
1964
+int k = 2;
 
1965
+struct head *head = &heads[2];
 
1966
+
 
1967
+static int __attribute__((noinline))
 
1968
+foo()
 
1969
+{
 
1970
+  node.prev = (void *)head;
 
1971
+  head->first = &node;
 
1972
+
 
1973
+  struct node *n = head->first;
 
1974
+  struct head *h = &heads[k];
 
1975
+
 
1976
+  if (n->prev == (void *)h)
 
1977
+    h->first = n->next;
 
1978
+  else
 
1979
+    n->prev->next = n->next;
 
1980
+
 
1981
+  n->next = h->first;
 
1982
+  return n->next == &node;
 
1983
+}
 
1984
+
 
1985
+int main()
 
1986
+{
 
1987
+  if (foo ())
 
1988
+    abort ();
 
1989
+  return 0;
 
1990
+}
 
1991
Index: gcc/testsuite/gcc.dg/torture/pr61383-1.c
 
1992
===================================================================
 
1993
--- a/src/gcc/testsuite/gcc.dg/torture/pr61383-1.c      (.../tags/gcc_4_8_3_release)
 
1994
+++ b/src/gcc/testsuite/gcc.dg/torture/pr61383-1.c      (.../branches/gcc-4_8-branch)
 
1995
@@ -0,0 +1,35 @@
 
1996
+/* { dg-do run } */
 
1997
+
 
1998
+int a, b = 1, c, d, e, f, g;
 
1999
+
 
2000
+int
 
2001
+fn1 ()
 
2002
+{
 
2003
+  int h;
 
2004
+  for (;;)
 
2005
+    {
 
2006
+      g = b;
 
2007
+      g = g ? 0 : 1 % g;
 
2008
+      e = a + 1;
 
2009
+      for (; d < 1; d = e)
 
2010
+       {
 
2011
+         if (f == 0)
 
2012
+           h = 0;
 
2013
+         else
 
2014
+           h = 1 % f;
 
2015
+         if (f < 1)
 
2016
+           c = 0;
 
2017
+         else if (h)
 
2018
+           break;
 
2019
+       }
 
2020
+      if (b)
 
2021
+       return 0;
 
2022
+    }
 
2023
+}
 
2024
+
 
2025
+int
 
2026
+main ()
 
2027
+{
 
2028
+  fn1 ();
 
2029
+  return 0;
 
2030
+}
 
2031
Index: gcc/testsuite/gcc.dg/stack-usage-2.c
 
2032
===================================================================
 
2033
--- a/src/gcc/testsuite/gcc.dg/stack-usage-2.c  (.../tags/gcc_4_8_3_release)
 
2034
+++ b/src/gcc/testsuite/gcc.dg/stack-usage-2.c  (.../branches/gcc-4_8-branch)
 
2035
@@ -1,21 +1,21 @@
 
2036
 /* { dg-do compile } */
 
2037
 /* { dg-options "-Wstack-usage=512" } */
 
2038
 
 
2039
-int foo1 (void)
 
2040
+int foo1 (void)  /* { dg-bogus "stack usage" } */
 
2041
 {
 
2042
   char arr[16];
 
2043
   arr[0] = 1;
 
2044
   return 0;
 
2045
-} /* { dg-bogus "stack usage" } */
 
2046
+}
 
2047
 
 
2048
-int foo2 (void)
 
2049
+int foo2 (void)  /* { dg-warning "stack usage is \[0-9\]* bytes" } */
 
2050
 {
 
2051
   char arr[1024];
 
2052
   arr[0] = 1;
 
2053
   return 0;
 
2054
-} /* { dg-warning "stack usage is \[0-9\]* bytes" } */
 
2055
+}
 
2056
 
 
2057
-int foo3 (void)
 
2058
+int foo3 (void) /* { dg-warning "stack usage might be \[0-9\]* bytes" } */
 
2059
 {
 
2060
   char arr[1024] __attribute__((aligned (512)));
 
2061
   arr[0] = 1;
 
2062
@@ -22,12 +22,11 @@
 
2063
   /* Force dynamic realignment of argument pointer.  */
 
2064
   __builtin_apply ((void (*)()) foo2, 0, 0);
 
2065
   return 0;
 
2066
+}
 
2067
 
 
2068
-} /* { dg-warning "stack usage might be \[0-9\]* bytes" } */
 
2069
-
 
2070
-int foo4 (int n)
 
2071
+int foo4 (int n) /* { dg-warning "stack usage might be unbounded" } */
 
2072
 {
 
2073
   char arr[n];
 
2074
   arr[0] = 1;
 
2075
   return 0;
 
2076
-} /* { dg-warning "stack usage might be unbounded" } */
 
2077
+}
 
2078
Index: gcc/testsuite/ChangeLog
 
2079
===================================================================
 
2080
--- a/src/gcc/testsuite/ChangeLog       (.../tags/gcc_4_8_3_release)
 
2081
+++ b/src/gcc/testsuite/ChangeLog       (.../branches/gcc-4_8-branch)
 
2082
@@ -1,3 +1,214 @@
 
2083
+2014-08-07  John David Anglin  <danglin@gcc.gnu.org>
 
2084
+
 
2085
+       PR tree-optimization/60707
 
2086
+       * gfortran.dg/pr45636.f90: xfail on 32-bit hppa*-*-*.
 
2087
+
 
2088
+2014-08-06  Jakub Jelinek  <jakub@redhat.com>
 
2089
+
 
2090
+       PR rtl-optimization/61801
 
2091
+       * gcc.target/i386/pr61801.c: Rewritten.
 
2092
+
 
2093
+2014-08-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
2094
+
 
2095
+       Backport from mainline
 
2096
+       2014-06-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
2097
+
 
2098
+       PR tree-optimization/61375
 
2099
+       * gcc.c-torture/execute/pr61375-1.c: New test.
 
2100
+
 
2101
+2014-08-01  Richard Biener  <rguenther@suse.de>
 
2102
+
 
2103
+       PR tree-optimization/61964
 
2104
+       * gcc.dg/torture/pr61964.c: New testcase.
 
2105
+       * gcc.dg/pr51879-18.c: XFAIL.
 
2106
+
 
2107
+2014-07-28  Richard Biener  <rguenther@suse.de>
 
2108
+
 
2109
+       PR rtl-optimization/61801
 
2110
+       * gcc.target/i386/pr61801.c: Fix testcase.
 
2111
+
 
2112
+2014-07-28  Richard Biener  <rguenther@suse.de>
 
2113
+
 
2114
+       PR rtl-optimization/61801
 
2115
+       * gcc.target/i386/pr61801.c: New testcase.
 
2116
+
 
2117
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2118
+
 
2119
+       Backport from mainline:
 
2120
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2121
+
 
2122
+       * gcc.target/powerpc/ppc64-abi-warn-3.c: New test.
 
2123
+
 
2124
+       * gcc.c-torture/execute/20050316-1.x: Add -Wno-psabi.
 
2125
+       * gcc.c-torture/execute/20050604-1.x: Add -Wno-psabi.
 
2126
+       * gcc.c-torture/execute/20050316-3.x: New file.  Add -Wno-psabi.
 
2127
+       * gcc.c-torture/execute/pr23135.x: Likewise.
 
2128
+
 
2129
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2130
+
 
2131
+       Backport from mainline:
 
2132
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2133
+
 
2134
+       * gcc.target/powerpc/ppc64-abi-warn-2.c: New test.
 
2135
+
 
2136
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2137
+
 
2138
+       Backport from mainline:
 
2139
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2140
+
 
2141
+       * gcc.target/powerpc/ppc64-abi-warn-1.c: New test.
 
2142
+
 
2143
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2144
+
 
2145
+       Backport from mainline:
 
2146
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
2147
+
 
2148
+       * g++.dg/compat/struct-layout-1.exp: Load g++-dg.exp.
 
2149
+
 
2150
+2014-07-19  Eric Botcazou  <ebotcazou@adacore.com>
 
2151
+
 
2152
+       * gcc.dg/stack-usage-2.c: Adjust.
 
2153
+
 
2154
+2014-07-19  Paul Thomas  <pault@gcc.gnu.org>
 
2155
+
 
2156
+       Backport from trunk.
 
2157
+       PR fortran/61780
 
2158
+       * gfortran.dg/dependency_44.f90 : New test
 
2159
+
 
2160
+2014-07-10  Eric Botcazou  <ebotcazou@adacore.com>
 
2161
+
 
2162
+       * gnat.dg/opt39.adb: New test.
 
2163
+
 
2164
+2014-07-08  Paul Thomas  <pault@gcc.gnu.org>
 
2165
+
 
2166
+       PR fortran/61459
 
2167
+       PR fortran/58883
 
2168
+       * gfortran.dg/allocatable_function_8.f90 : New test
 
2169
+
 
2170
+2014-07-04  Jakub Jelinek  <jakub@redhat.com>
 
2171
+
 
2172
+       PR tree-optimization/61684
 
2173
+       * gcc.c-torture/compile/pr61684.c: New test.
 
2174
+
 
2175
+2014-07-02  Jakub Jelinek  <jakub@redhat.com>
 
2176
+           Fritz Reese  <Reese-Fritz@zai.com>
 
2177
+
 
2178
+       * gfortran.dg/oldstyle_5.f: New test.
 
2179
+
 
2180
+2014-06-30  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
2181
+
 
2182
+       Backport from mainline
 
2183
+       2014-06-11  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
2184
+
 
2185
+       PR tree-optimization/61306
 
2186
+       * gcc.c-torture/execute/pr61306-1.c: New test.
 
2187
+       * gcc.c-torture/execute/pr61306-2.c: Likewise.
 
2188
+       * gcc.c-torture/execute/pr61306-3.c: Likewise.
 
2189
+
 
2190
+2014-06-27  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
2191
+
 
2192
+       * gfortran.dg/nint_2.f90: Don't XFAIL for powerpc64le-*-linux*.
 
2193
+
 
2194
+2014-06-27  Uros Bizjak  <ubizjak@gmail.com>
 
2195
+
 
2196
+       Backport from mainline
 
2197
+       2014-06-26  Uros Bizjak  <ubizjak@gmail.com>
 
2198
+
 
2199
+       PR target/61586
 
2200
+       * gcc.target/alpha/pr61586.c: New test.
 
2201
+
 
2202
+2014-06-25  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
2203
+
 
2204
+       * gfortran.dg/default_format_denormal_2.f90:  Remove xfail for
 
2205
+       powerpc*-*-linux*.
 
2206
+
 
2207
+2014-06-18  Uros Bizjak  <ubizjak@gmail.com>
 
2208
+
 
2209
+       Backport from mainline
 
2210
+       2014-06-13  Ilya Enkovich  <ilya.enkovich@intel.com>
 
2211
+
 
2212
+       PR rtl-optimization/61094
 
2213
+       PR rtl-optimization/61446
 
2214
+       * gcc.target/i386/pr61446.c : New.
 
2215
+
 
2216
+       Backport from mainline
 
2217
+       2014-06-06  Uros Bizjak  <ubizjak@gmail.com>
 
2218
+
 
2219
+       PR target/61423
 
2220
+       * gcc.target/i386/pr61423.c: New test.
 
2221
+
 
2222
+2014-06-17  Yufeng Zhang  <yufeng.zhang@arm.com>
 
2223
+
 
2224
+       Backport from mainline
 
2225
+
 
2226
+       PR target/61483
 
2227
+       * gcc.target/aarch64/aapcs64/type-def.h (struct hfa_fx2_t): New type.
 
2228
+       * gcc.target/aarch64/aapcs64/va_arg-13.c: New test.
 
2229
+       * gcc.target/aarch64/aapcs64/va_arg-14.c: Ditto.
 
2230
+       * gcc.target/aarch64/aapcs64/va_arg-15.c: Ditto.
 
2231
+
 
2232
+2014-06-15  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
2233
+
 
2234
+       Backport from trunk.
 
2235
+       PR fortran/45187
 
2236
+       * gfortran.dg/cray_pointers_10.f90: New file.
 
2237
+
 
2238
+2014-06-13  Peter Bergner  <bergner@vnet.ibm.com>
 
2239
+
 
2240
+       Backport from mainline
 
2241
+
 
2242
+       2014-06-13  Peter Bergner  <bergner@vnet.ibm.com>
 
2243
+       PR target/61415
 
2244
+       * lib/target-supports.exp (check_effective_target_longdouble128): New.
 
2245
+       * gcc.target/powerpc/pack02.c: Use it.
 
2246
+       * gcc.target/powerpc/tfmode_off.c: Likewise.
 
2247
+
 
2248
+2014-06-12  Georg-Johann Lay  <avr@gjlay.de>
 
2249
+
 
2250
+       Backport from 2014-06-12 trunk r211491
 
2251
+
 
2252
+       PR target/61443
 
2253
+       * gcc.target/avr/torture/pr61443.c: New test.
 
2254
+
 
2255
+2014-06-04  Richard Biener  <rguenther@suse.de>
 
2256
+
 
2257
+       PR tree-optimization/61383
 
2258
+       * gcc.dg/torture/pr61383-1.c: New testcase.
 
2259
+
 
2260
+2014-06-03  Andrey Belevantsev  <abel@ispras.ru>
 
2261
+
 
2262
+       Backport from mainline
 
2263
+       2014-05-14  Andrey Belevantsev  <abel@ispras.ru>
 
2264
+
 
2265
+       PR rtl-optimization/60866
 
2266
+       * gcc.dg/pr60866.c: New test.
 
2267
+
 
2268
+2014-06-03  Andrey Belevantsev  <abel@ispras.ru>
 
2269
+
 
2270
+       Backport from mainline
 
2271
+       2014-05-14  Andrey Belevantsev  <abel@ispras.ru>
 
2272
+
 
2273
+       PR rtl-optimization/60901
 
2274
+       * gcc.target/i386/pr60901.c: New test.
 
2275
+
 
2276
+2014-05-28  Eric Botcazou  <ebotcazou@adacore.com>
 
2277
+
 
2278
+       Backport from mainline
 
2279
+       2014-05-27  Eric Botcazou  <ebotcazou@adacore.com>
 
2280
+
 
2281
+       * gnat.dg/overflow_fixed.adb: New test.
 
2282
+
 
2283
+2014-05-27  Eric Botcazou  <ebotcazou@adacore.com>
 
2284
+
 
2285
+       * gnat.dg/aliasing1.adb (dg-final): Robustify pattern matching.
 
2286
+
 
2287
+2014-05-22  Peter Bergner  <bergner@vnet.ibm.com>
 
2288
+
 
2289
+       Backport from mainline
 
2290
+       2014-05-22  Peter Bergner  <bergner@vnet.ibm.com>
 
2291
+
 
2292
+       * gcc.target/powerpc/htm-ttest.c: New test.
 
2293
+
 
2294
 2014-05-22  Release Manager
 
2295
 
 
2296
        * GCC 4.8.3 released.
 
2297
Index: gcc/testsuite/g++.dg/expr/cond12.C
 
2298
===================================================================
 
2299
--- a/src/gcc/testsuite/g++.dg/expr/cond12.C    (.../tags/gcc_4_8_3_release)
 
2300
+++ b/src/gcc/testsuite/g++.dg/expr/cond12.C    (.../branches/gcc-4_8-branch)
 
2301
@@ -0,0 +1,12 @@
 
2302
+// PR c++/58714
 
2303
+// { dg-do run }
 
2304
+
 
2305
+struct X {
 
2306
+    X& operator=(const X&){}
 
2307
+    X& operator=(X&){__builtin_abort();}
 
2308
+};
 
2309
+
 
2310
+int main(int argv,char**) {
 
2311
+  X a, b;
 
2312
+  ((argv > 2) ? a : b) = X();
 
2313
+}
 
2314
Index: gcc/testsuite/g++.dg/parse/typename7.C
 
2315
===================================================================
 
2316
--- a/src/gcc/testsuite/g++.dg/parse/typename7.C        (.../tags/gcc_4_8_3_release)
 
2317
+++ b/src/gcc/testsuite/g++.dg/parse/typename7.C        (.../branches/gcc-4_8-branch)
 
2318
@@ -7,10 +7,9 @@
 
2319
 
 
2320
 struct A
 
2321
 {
 
2322
-  template<typename>   void foo(int); // { dg-message "note" }
 
2323
-  template<typename T> void bar(T t) { // { dg-message "note" }
 
2324
+  template<typename>   void foo(int);
 
2325
+  template<typename T> void bar(T t) {
 
2326
     this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
 
2327
-  // { dg-message "candidate" "candidate note" { target *-*-* } 12 }
 
2328
   template<typename T> void bad(T t) {
 
2329
     foo<typename T>(t); } // { dg-error "expected|parse error|no matching" }
 
2330
 };
 
2331
@@ -20,7 +19,6 @@
 
2332
 {
 
2333
   void bar(T t) {
 
2334
     A().bar<typename T>(t); } // { dg-error "expected|parse error|no matching" }
 
2335
-  // { dg-message "candidate" "candidate note" { target *-*-* } 22 }
 
2336
   void bad(T t) {
 
2337
     B<typename T>::bar(t); } // { dg-error "invalid|not a template" }
 
2338
 };
 
2339
Index: gcc/testsuite/g++.dg/parse/parameter-declaration-2.C
 
2340
===================================================================
 
2341
--- a/src/gcc/testsuite/g++.dg/parse/parameter-declaration-2.C  (.../tags/gcc_4_8_3_release)
 
2342
+++ b/src/gcc/testsuite/g++.dg/parse/parameter-declaration-2.C  (.../branches/gcc-4_8-branch)
 
2343
@@ -1,2 +1,2 @@
 
2344
-void f (int i, int p[i]); // { dg-error "use of parameter .i. outside function body" }
 
2345
+void f (int i, int p[i]); // { dg-error "use of parameter.*outside function body" }
 
2346
 // { dg-prune-output "array bound" }
 
2347
Index: gcc/testsuite/g++.dg/parse/ambig7.C
 
2348
===================================================================
 
2349
--- a/src/gcc/testsuite/g++.dg/parse/ambig7.C   (.../tags/gcc_4_8_3_release)
 
2350
+++ b/src/gcc/testsuite/g++.dg/parse/ambig7.C   (.../branches/gcc-4_8-branch)
 
2351
@@ -0,0 +1,16 @@
 
2352
+// PR c++/60361
 
2353
+
 
2354
+struct Helper
 
2355
+{
 
2356
+  Helper(int a, void (*pfunc)());
 
2357
+};
 
2358
+
 
2359
+template <int I> void function();
 
2360
+
 
2361
+const int A = 1;
 
2362
+const int B = 2;
 
2363
+
 
2364
+Helper testOk(A, function<A>);
 
2365
+Helper testOk2(int(A), function<B>);
 
2366
+Helper testOk3((int(A)), function<A>);
 
2367
+Helper testFail(int(A), function<A>);
 
2368
Index: gcc/testsuite/g++.dg/compat/struct-layout-1.exp
 
2369
===================================================================
 
2370
--- a/src/gcc/testsuite/g++.dg/compat/struct-layout-1.exp       (.../tags/gcc_4_8_3_release)
 
2371
+++ b/src/gcc/testsuite/g++.dg/compat/struct-layout-1.exp       (.../branches/gcc-4_8-branch)
 
2372
@@ -89,6 +89,9 @@
 
2373
 # This must be done after the compat-use-*-compiler definitions.
 
2374
 load_lib compat.exp
 
2375
 
 
2376
+# Provide the g++-dg-prune routine (gcc-dp.exp is loaded by compat.exp)
 
2377
+load_lib g++-dg.exp
 
2378
+
 
2379
 g++_init
 
2380
 
 
2381
 # Save variables for the C++ compiler under test, which each test will
 
2382
Index: gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C
 
2383
===================================================================
 
2384
--- a/src/gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C (.../tags/gcc_4_8_3_release)
 
2385
+++ b/src/gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C (.../branches/gcc-4_8-branch)
 
2386
@@ -0,0 +1,28 @@
 
2387
+// PR c++/61959
 
2388
+// { dg-do compile { target c++11 } }
 
2389
+
 
2390
+template <class Coord> struct BasePoint
 
2391
+{
 
2392
+  Coord x, y;
 
2393
+  constexpr BasePoint (Coord, Coord) : x (0), y (0) {}
 
2394
+};
 
2395
+template <class T> struct BaseCoord
 
2396
+{
 
2397
+  int value;
 
2398
+  constexpr BaseCoord (T) : value (1) {}
 
2399
+};
 
2400
+template <class units> struct IntCoordTyped : BaseCoord<int>, units
 
2401
+{
 
2402
+  typedef BaseCoord Super;
 
2403
+  constexpr IntCoordTyped (int) : Super (0) {}
 
2404
+};
 
2405
+template <class units>
 
2406
+struct IntPointTyped : BasePoint<IntCoordTyped<units> >, units
 
2407
+{
 
2408
+  typedef BasePoint<IntCoordTyped<units> > Super;
 
2409
+  constexpr IntPointTyped (int, int) : Super (0, 0) {}
 
2410
+};
 
2411
+struct A
 
2412
+{
 
2413
+};
 
2414
+IntPointTyped<A> a (0, 0);
 
2415
Index: gcc/testsuite/g++.dg/cpp0x/variadic158.C
 
2416
===================================================================
 
2417
--- a/src/gcc/testsuite/g++.dg/cpp0x/variadic158.C      (.../tags/gcc_4_8_3_release)
 
2418
+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic158.C      (.../branches/gcc-4_8-branch)
 
2419
@@ -0,0 +1,24 @@
 
2420
+// PR c++/61134
 
2421
+// { dg-do compile { target c++11 } }
 
2422
+
 
2423
+struct Base { };
 
2424
+
 
2425
+template <typename>
 
2426
+struct Fixed {
 
2427
+  typedef const char* name;
 
2428
+};
 
2429
+
 
2430
+template <typename VT, typename... Fields>
 
2431
+void New(const char* name,
 
2432
+         typename Fixed<Fields>::name... field_names);
 
2433
+
 
2434
+template <typename VT, typename... Fields>
 
2435
+void CreateMetric(const char* name,
 
2436
+                  typename Fixed<Fields>::name... field_names,
 
2437
+                  const Base&) { }
 
2438
+
 
2439
+
 
2440
+void Fn()
 
2441
+{
 
2442
+  CreateMetric<int, const char*>("abcd", "def", Base());
 
2443
+}
 
2444
Index: gcc/testsuite/g++.dg/cpp0x/variadic160.C
 
2445
===================================================================
 
2446
--- a/src/gcc/testsuite/g++.dg/cpp0x/variadic160.C      (.../tags/gcc_4_8_3_release)
 
2447
+++ b/src/gcc/testsuite/g++.dg/cpp0x/variadic160.C      (.../branches/gcc-4_8-branch)
 
2448
@@ -0,0 +1,49 @@
 
2449
+// PR c++/61539
 
2450
+// { dg-do compile { target c++11 } }
 
2451
+
 
2452
+template <typename _CharT> class A;
 
2453
+template <typename> class B;
 
2454
+template <class charT> class C;
 
2455
+template <> class C<char>
 
2456
+{
 
2457
+  virtual void xparse (int &, const B<A<char> > &) const;
 
2458
+};
 
2459
+template <class T, class charT = char> class G : C<charT>
 
2460
+{
 
2461
+public:
 
2462
+  G (void *) {}
 
2463
+  void default_value (const T &);
 
2464
+  void xparse (int &, const B<A<charT> > &) const;
 
2465
+};
 
2466
+template <class T, class charT>
 
2467
+void validate (int &, const B<A<charT> > &, T *, int);
 
2468
+template <class T, class charT>
 
2469
+void G<T, charT>::xparse (int &p1, const B<A<charT> > &p2) const
 
2470
+{
 
2471
+  validate (p1, p2, (T *)0, 0);
 
2472
+}
 
2473
+template <class T> G<T> *value (T *) { return new G<T>(0); }
 
2474
+namespace Eigen
 
2475
+{
 
2476
+template <typename T> struct D;
 
2477
+template <typename, int, int, int = 0, int = 0, int = 0 > class F;
 
2478
+template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows,
 
2479
+          int _MaxCols>
 
2480
+struct D<F<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
 
2481
+{
 
2482
+  typedef _Scalar Scalar;
 
2483
+};
 
2484
+template <typename, int, int, int, int, int _MaxCols> class F
 
2485
+{
 
2486
+public:
 
2487
+  typedef typename Eigen::D<F>::Scalar Scalar;
 
2488
+  F (const Scalar &, const Scalar &, const Scalar &);
 
2489
+};
 
2490
+template <class... T>
 
2491
+void validate (int &, const B<A<char> > &, Eigen::F<T...> *);
 
2492
+}
 
2493
+int main (int, char *[])
 
2494
+{
 
2495
+  Eigen::F<double, 3, 1> a (0, 0, 0);
 
2496
+  value (&a)->default_value (Eigen::F<double, 3, 1>(0, 0, 0));
 
2497
+}
 
2498
Index: gcc/testsuite/g++.dg/cpp0x/rv-cond1.C
 
2499
===================================================================
 
2500
--- a/src/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C (.../tags/gcc_4_8_3_release)
 
2501
+++ b/src/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C (.../branches/gcc-4_8-branch)
 
2502
@@ -0,0 +1,13 @@
 
2503
+// PR c++/58714
 
2504
+// { dg-do compile { target c++11 } }
 
2505
+
 
2506
+struct X {
 
2507
+  X& operator=(const X&) = delete;
 
2508
+  X& operator=(X&& ) = default;
 
2509
+};
 
2510
+
 
2511
+void f(bool t) {
 
2512
+  X a, b;
 
2513
+  *(t ? &a : &b) = X();
 
2514
+  (t ? a : b) = X();
 
2515
+}
 
2516
Index: gcc/testsuite/g++.dg/cpp0x/overload3.C
 
2517
===================================================================
 
2518
--- a/src/gcc/testsuite/g++.dg/cpp0x/overload3.C        (.../tags/gcc_4_8_3_release)
 
2519
+++ b/src/gcc/testsuite/g++.dg/cpp0x/overload3.C        (.../branches/gcc-4_8-branch)
 
2520
@@ -0,0 +1,17 @@
 
2521
+// PR c++/59823
 
2522
+// { dg-options "-std=c++11" }
 
2523
+
 
2524
+struct X { };
 
2525
+
 
2526
+void f(X&&);                   // { dg-message "void f" }
 
2527
+
 
2528
+struct wrap
 
2529
+{
 
2530
+  operator const X&() const;
 
2531
+};
 
2532
+
 
2533
+int main()
 
2534
+{
 
2535
+  wrap w;
 
2536
+  f(w);                                // { dg-error "lvalue" }
 
2537
+}
 
2538
Index: gcc/testsuite/g++.dg/template/local-fn1.C
 
2539
===================================================================
 
2540
--- a/src/gcc/testsuite/g++.dg/template/local-fn1.C     (.../tags/gcc_4_8_3_release)
 
2541
+++ b/src/gcc/testsuite/g++.dg/template/local-fn1.C     (.../branches/gcc-4_8-branch)
 
2542
@@ -0,0 +1,8 @@
 
2543
+// PR c++/60605
 
2544
+
 
2545
+template <typename T = int>
 
2546
+struct Foo {
 
2547
+    void bar() {
 
2548
+        void bug();
 
2549
+    }
 
2550
+};
 
2551
Index: gcc/testsuite/g++.dg/template/conv14.C
 
2552
===================================================================
 
2553
--- a/src/gcc/testsuite/g++.dg/template/conv14.C        (.../tags/gcc_4_8_3_release)
 
2554
+++ b/src/gcc/testsuite/g++.dg/template/conv14.C        (.../branches/gcc-4_8-branch)
 
2555
@@ -0,0 +1,30 @@
 
2556
+// PR c++/61647
 
2557
+
 
2558
+class XX;
 
2559
+
 
2560
+template<typename Container, typename Key>
 
2561
+struct Accessor;
 
2562
+
 
2563
+template<typename Container, typename Key, typename KeyStore = Key>
 
2564
+class Variant {
 
2565
+protected:
 
2566
+    KeyStore index;
 
2567
+    Container state;
 
2568
+public:
 
2569
+    Variant(Container st, const Key& i) : index(i), state(st) {}
 
2570
+
 
2571
+    template<typename T>
 
2572
+    operator T() const {
 
2573
+        return Accessor<Container, KeyStore>::template get<T>(state, index);
 
2574
+    }
 
2575
+};
 
2576
+
 
2577
+class AutoCleanVariant : public Variant<XX*, int> {
 
2578
+public:
 
2579
+    AutoCleanVariant(XX* st, int i) : Variant<XX*,int>(st,i) {}
 
2580
+
 
2581
+    template<typename T>
 
2582
+    operator T() const {
 
2583
+         return Variant<XX*, int>::operator T();
 
2584
+    }
 
2585
+};
 
2586
Index: gcc/testsuite/g++.dg/template/friend55.C
 
2587
===================================================================
 
2588
--- a/src/gcc/testsuite/g++.dg/template/friend55.C      (.../tags/gcc_4_8_3_release)
 
2589
+++ b/src/gcc/testsuite/g++.dg/template/friend55.C      (.../branches/gcc-4_8-branch)
 
2590
@@ -0,0 +1,18 @@
 
2591
+// PR c++/59956
 
2592
+
 
2593
+template <int I> struct A;
 
2594
+template <int I> class B {
 
2595
+  int i;
 
2596
+  template <int A_S> friend void A<A_S>::impl();
 
2597
+};
 
2598
+
 
2599
+B<0> b1;
 
2600
+template<int I>struct A { void impl(); };
 
2601
+B<1> b2;
 
2602
+
 
2603
+template<int I> void A<I>::impl() { ++b1.i; ++b2.i; }
 
2604
+
 
2605
+int main()
 
2606
+{
 
2607
+  A<0>().impl();
 
2608
+}
 
2609
Index: gcc/testsuite/g++.dg/template/memclass5.C
 
2610
===================================================================
 
2611
--- a/src/gcc/testsuite/g++.dg/template/memclass5.C     (.../tags/gcc_4_8_3_release)
 
2612
+++ b/src/gcc/testsuite/g++.dg/template/memclass5.C     (.../branches/gcc-4_8-branch)
 
2613
@@ -0,0 +1,26 @@
 
2614
+// PR c++/60241
 
2615
+
 
2616
+template <typename T>
 
2617
+struct x
 
2618
+{
 
2619
+    template <typename U>
 
2620
+    struct y
 
2621
+    {
 
2622
+        typedef T result2;
 
2623
+    };
 
2624
+
 
2625
+    typedef y<int> zy;
 
2626
+};
 
2627
+
 
2628
+template<>
 
2629
+template<class T>
 
2630
+struct x<int>::y
 
2631
+{
 
2632
+    typedef double result2;
 
2633
+};
 
2634
+
 
2635
+int main()
 
2636
+{
 
2637
+    x<int>::zy::result2 xxx;
 
2638
+    x<int>::y<int>::result2 xxx2;
 
2639
+}
 
2640
Index: gcc/testsuite/g++.dg/template/ptrmem27.C
 
2641
===================================================================
 
2642
--- a/src/gcc/testsuite/g++.dg/template/ptrmem27.C      (.../tags/gcc_4_8_3_release)
 
2643
+++ b/src/gcc/testsuite/g++.dg/template/ptrmem27.C      (.../branches/gcc-4_8-branch)
 
2644
@@ -0,0 +1,22 @@
 
2645
+// PR c++/61500
 
2646
+
 
2647
+struct X {
 
2648
+  int i;
 
2649
+  int j;
 
2650
+
 
2651
+  int foo(int X::* ptr);
 
2652
+
 
2653
+  template <int X::* ptr>
 
2654
+  int bar();
 
2655
+};
 
2656
+
 
2657
+int X::foo(int X::* ptr) {
 
2658
+  int* p = &(this->*ptr);  // OK.
 
2659
+  return *p;
 
2660
+}
 
2661
+
 
2662
+template <int X::* ptr>
 
2663
+int X::bar() {
 
2664
+  int* p = &(this->*ptr);  // gcc 4.9.0: OK in C++98 mode, fails in C++11 mode.
 
2665
+  return *p;
 
2666
+}
 
2667
Index: gcc/cp/tree.c
 
2668
===================================================================
 
2669
--- a/src/gcc/cp/tree.c (.../tags/gcc_4_8_3_release)
 
2670
+++ b/src/gcc/cp/tree.c (.../branches/gcc-4_8-branch)
 
2671
@@ -97,6 +97,16 @@
 
2672
     case IMAGPART_EXPR:
 
2673
       return lvalue_kind (TREE_OPERAND (ref, 0));
 
2674
 
 
2675
+    case MEMBER_REF:
 
2676
+    case DOTSTAR_EXPR:
 
2677
+      if (TREE_CODE (ref) == MEMBER_REF)
 
2678
+       op1_lvalue_kind = clk_ordinary;
 
2679
+      else
 
2680
+       op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0));
 
2681
+      if (TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (ref, 1))))
 
2682
+       op1_lvalue_kind = clk_none;
 
2683
+      return op1_lvalue_kind;
 
2684
+
 
2685
     case COMPONENT_REF:
 
2686
       op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0));
 
2687
       /* Look at the member designator.  */
 
2688
@@ -3738,6 +3748,10 @@
 
2689
     {
 
2690
       init_expr = get_target_expr (exp);
 
2691
       exp = TARGET_EXPR_SLOT (init_expr);
 
2692
+      if (CLASS_TYPE_P (TREE_TYPE (exp)))
 
2693
+       exp = move (exp);
 
2694
+      else
 
2695
+       exp = rvalue (exp);
 
2696
     }
 
2697
   else
 
2698
     {
 
2699
Index: gcc/cp/ChangeLog
 
2700
===================================================================
 
2701
--- a/src/gcc/cp/ChangeLog      (.../tags/gcc_4_8_3_release)
 
2702
+++ b/src/gcc/cp/ChangeLog      (.../branches/gcc-4_8-branch)
 
2703
@@ -1,3 +1,67 @@
 
2704
+2014-08-07  Jason Merrill  <jason@redhat.com>
 
2705
+
 
2706
+       PR c++/61959
 
2707
+       * semantics.c (cxx_eval_bare_aggregate): Handle POINTER_PLUS_EXPR.
 
2708
+
 
2709
+       PR c++/58714
 
2710
+       * tree.c (stabilize_expr): A stabilized prvalue is an xvalue.
 
2711
+
 
2712
+2014-01-27  Jason Merrill  <jason@redhat.com>
 
2713
+
 
2714
+       PR c++/59823
 
2715
+       Core DR 1138
 
2716
+       * call.c (reference_binding): Pass LOOKUP_NO_TEMP_BIND for
 
2717
+       list-initialization.  A conversion to rvalue ref that involves
 
2718
+       an lvalue-rvalue conversion is bad.
 
2719
+       (convert_like_real): Give helpful error message.
 
2720
+
 
2721
+2014-01-29  Jason Merrill  <jason@redhat.com>
 
2722
+
 
2723
+       PR c++/59956
 
2724
+       * friend.c (do_friend): Pass the TEMPLATE_DECL to add_friend if we
 
2725
+       have a friend template in a class template.
 
2726
+       * pt.c (tsubst_friend_function): Look through it.
 
2727
+       (push_template_decl_real): A friend member template is
 
2728
+       primary.
 
2729
+
 
2730
+2014-02-21  Jason Merrill  <jason@redhat.com>
 
2731
+
 
2732
+       PR c++/60241
 
2733
+       * pt.c (lookup_template_class_1): Update DECL_TEMPLATE_INSTANTIATIONS
 
2734
+       of the partial instantiation, not the most general template.
 
2735
+       (maybe_process_partial_specialization): Reassign everything on
 
2736
+       that list.
 
2737
+
 
2738
+2014-03-05  Jason Merrill  <jason@redhat.com>
 
2739
+
 
2740
+       PR c++/60361
 
2741
+       * parser.c (cp_parser_template_id): Don't set up a CPP_TEMPLATE_ID
 
2742
+       if re-parsing might succeed.
 
2743
+       * semantics.c (finish_id_expression): Use of a parameter outside
 
2744
+       the function body is a parse error.
 
2745
+
 
2746
+2014-06-30  Jason Merrill  <jason@redhat.com>
 
2747
+
 
2748
+       PR c++/61647
 
2749
+       * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE.
 
2750
+
 
2751
+       PR c++/61539
 
2752
+       * pt.c (unify_one_argument): Type/expression mismatch just causes
 
2753
+       deduction failure.
 
2754
+
 
2755
+       PR c++/61500
 
2756
+       * tree.c (lvalue_kind): Handle MEMBER_REF and DOTSTAR_EXPR.
 
2757
+
 
2758
+2014-06-17  Jason Merrill  <jason@redhat.com>
 
2759
+
 
2760
+       PR c++/60605
 
2761
+       * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P.
 
2762
+
 
2763
+2014-06-02  Jason Merrill  <jason@redhat.com>
 
2764
+
 
2765
+       PR c++/61134
 
2766
+       * pt.c (pack_deducible_p): Handle canonicalization.
 
2767
+
 
2768
 2014-05-22  Release Manager
 
2769
 
 
2770
        * GCC 4.8.3 released.
 
2771
Index: gcc/cp/pt.c
 
2772
===================================================================
 
2773
--- a/src/gcc/cp/pt.c   (.../tags/gcc_4_8_3_release)
 
2774
+++ b/src/gcc/cp/pt.c   (.../branches/gcc-4_8-branch)
 
2775
@@ -907,11 +907,13 @@
 
2776
               t; t = TREE_CHAIN (t))
 
2777
            {
 
2778
              tree inst = TREE_VALUE (t);
 
2779
-             if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst))
 
2780
+             if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst)
 
2781
+                 || !COMPLETE_OR_OPEN_TYPE_P (inst))
 
2782
                {
 
2783
                  /* We already have a full specialization of this partial
 
2784
-                    instantiation.  Reassign it to the new member
 
2785
-                    specialization template.  */
 
2786
+                    instantiation, or a full specialization has been
 
2787
+                    looked up but not instantiated.  Reassign it to the
 
2788
+                    new member specialization template.  */
 
2789
                  spec_entry elt;
 
2790
                  spec_entry *entry;
 
2791
                  void **slot;
 
2792
@@ -930,7 +932,7 @@
 
2793
                  *entry = elt;
 
2794
                  *slot = entry;
 
2795
                }
 
2796
-             else if (COMPLETE_OR_OPEN_TYPE_P (inst))
 
2797
+             else
 
2798
                /* But if we've had an implicit instantiation, that's a
 
2799
                   problem ([temp.expl.spec]/6).  */
 
2800
                error ("specialization %qT after instantiation %qT",
 
2801
@@ -4308,7 +4310,8 @@
 
2802
      in the template-parameter-list of the definition of a member of a
 
2803
      class template.  */
 
2804
 
 
2805
-  if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL)
 
2806
+  if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL
 
2807
+      || (TREE_CODE (decl) == FUNCTION_DECL && DECL_LOCAL_FUNCTION_P (decl)))
 
2808
     /* You can't have a function template declaration in a local
 
2809
        scope, nor you can you define a member of a class template in a
 
2810
        local scope.  */
 
2811
@@ -4572,7 +4575,8 @@
 
2812
     DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace);
 
2813
 
 
2814
   /* See if this is a primary template.  */
 
2815
-  if (is_friend && ctx)
 
2816
+  if (is_friend && ctx
 
2817
+      && uses_template_parms_level (ctx, processing_template_decl))
 
2818
     /* A friend template that specifies a class context, i.e.
 
2819
          template <typename T> friend void A<T>::f();
 
2820
        is not primary.  */
 
2821
@@ -7454,7 +7458,7 @@
 
2822
        }
 
2823
 
 
2824
       /* Let's consider the explicit specialization of a member
 
2825
-         of a class template specialization that is implicitely instantiated,
 
2826
+         of a class template specialization that is implicitly instantiated,
 
2827
         e.g.:
 
2828
             template<class T>
 
2829
             struct S
 
2830
@@ -7552,9 +7556,9 @@
 
2831
 
 
2832
       /* Note this use of the partial instantiation so we can check it
 
2833
         later in maybe_process_partial_specialization.  */
 
2834
-      DECL_TEMPLATE_INSTANTIATIONS (templ)
 
2835
+      DECL_TEMPLATE_INSTANTIATIONS (found)
 
2836
        = tree_cons (arglist, t,
 
2837
-                    DECL_TEMPLATE_INSTANTIATIONS (templ));
 
2838
+                    DECL_TEMPLATE_INSTANTIATIONS (found));
 
2839
 
 
2840
       if (TREE_CODE (template_type) == ENUMERAL_TYPE && !is_dependent_type)
 
2841
        /* Now that the type has been registered on the instantiations
 
2842
@@ -8289,10 +8293,17 @@
 
2843
 
 
2844
       if (COMPLETE_TYPE_P (context))
 
2845
        {
 
2846
+         tree fn = new_friend;
 
2847
+         /* do_friend adds the TEMPLATE_DECL for any member friend
 
2848
+            template even if it isn't a member template, i.e.
 
2849
+              template <class T> friend A<T>::f();
 
2850
+            Look through it in that case.  */
 
2851
+         if (TREE_CODE (fn) == TEMPLATE_DECL
 
2852
+             && !PRIMARY_TEMPLATE_P (fn))
 
2853
+           fn = DECL_TEMPLATE_RESULT (fn);
 
2854
          /* Check to see that the declaration is really present, and,
 
2855
             possibly obtain an improved declaration.  */
 
2856
-         tree fn = check_classfn (context,
 
2857
-                                  new_friend, NULL_TREE);
 
2858
+         fn = check_classfn (context, fn, NULL_TREE);
 
2859
 
 
2860
          if (fn)
 
2861
            new_friend = fn;
 
2862
@@ -14934,7 +14945,7 @@
 
2863
        continue;
 
2864
       for (packs = PACK_EXPANSION_PARAMETER_PACKS (type);
 
2865
           packs; packs = TREE_CHAIN (packs))
 
2866
-       if (TREE_VALUE (packs) == parm)
 
2867
+       if (template_args_equal (TREE_VALUE (packs), parm))
 
2868
          {
 
2869
            /* The template parameter pack is used in a function parameter
 
2870
               pack.  If this is the end of the parameter list, the
 
2871
@@ -15502,8 +15513,9 @@
 
2872
        maybe_adjust_types_for_deduction (strict, &parm, &arg, arg_expr);
 
2873
     }
 
2874
   else
 
2875
-    gcc_assert ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL)
 
2876
-               == (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL));
 
2877
+    if ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL)
 
2878
+       != (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL))
 
2879
+      return unify_template_argument_mismatch (explain_p, parm, arg);
 
2880
 
 
2881
   /* For deduction from an init-list we need the actual list.  */
 
2882
   if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr))
 
2883
@@ -20009,7 +20021,12 @@
 
2884
        return true;
 
2885
 
 
2886
       if (BASELINK_P (expression))
 
2887
-       expression = BASELINK_FUNCTIONS (expression);
 
2888
+       {
 
2889
+         if (BASELINK_OPTYPE (expression)
 
2890
+             && dependent_type_p (BASELINK_OPTYPE (expression)))
 
2891
+           return true;
 
2892
+         expression = BASELINK_FUNCTIONS (expression);
 
2893
+       }
 
2894
 
 
2895
       if (TREE_CODE (expression) == TEMPLATE_ID_EXPR)
 
2896
        {
 
2897
Index: gcc/cp/semantics.c
 
2898
===================================================================
 
2899
--- a/src/gcc/cp/semantics.c    (.../tags/gcc_4_8_3_release)
 
2900
+++ b/src/gcc/cp/semantics.c    (.../branches/gcc-4_8-branch)
 
2901
@@ -3108,7 +3108,7 @@
 
2902
          && DECL_CONTEXT (decl) == NULL_TREE
 
2903
          && !cp_unevaluated_operand)
 
2904
        {
 
2905
-         error ("use of parameter %qD outside function body", decl);
 
2906
+         *error_msg = "use of parameter outside function body";
 
2907
          return error_mark_node;
 
2908
        }
 
2909
     }
 
2910
@@ -7296,7 +7296,9 @@
 
2911
          constructor_elt *inner = base_field_constructor_elt (n, ce->index);
 
2912
          inner->value = elt;
 
2913
        }
 
2914
-      else if (ce->index && TREE_CODE (ce->index) == NOP_EXPR)
 
2915
+      else if (ce->index
 
2916
+              && (TREE_CODE (ce->index) == NOP_EXPR
 
2917
+                  || TREE_CODE (ce->index) == POINTER_PLUS_EXPR))
 
2918
        {
 
2919
          /* This is an initializer for an empty base; now that we've
 
2920
             checked that it's constant, we can ignore it.  */
 
2921
Index: gcc/cp/parser.c
 
2922
===================================================================
 
2923
--- a/src/gcc/cp/parser.c       (.../tags/gcc_4_8_3_release)
 
2924
+++ b/src/gcc/cp/parser.c       (.../branches/gcc-4_8-branch)
 
2925
@@ -12831,7 +12831,12 @@
 
2926
      the effort required to do the parse, nor will we issue duplicate
 
2927
      error messages about problems during instantiation of the
 
2928
      template.  */
 
2929
-  if (start_of_id)
 
2930
+  if (start_of_id
 
2931
+      /* Don't do this if we had a parse error in a declarator; re-parsing
 
2932
+        might succeed if a name changes meaning (60361).  */
 
2933
+      && !(cp_parser_error_occurred (parser)
 
2934
+          && cp_parser_parsing_tentatively (parser)
 
2935
+          && parser->in_declarator_p))
 
2936
     {
 
2937
       cp_token *token = cp_lexer_token_at (parser->lexer, start_of_id);
 
2938
 
 
2939
Index: gcc/cp/call.c
 
2940
===================================================================
 
2941
--- a/src/gcc/cp/call.c (.../tags/gcc_4_8_3_release)
 
2942
+++ b/src/gcc/cp/call.c (.../branches/gcc-4_8-branch)
 
2943
@@ -1464,7 +1464,7 @@
 
2944
     {
 
2945
       maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
 
2946
       conv = implicit_conversion (to, from, expr, c_cast_p,
 
2947
-                                 flags, complain);
 
2948
+                                 flags|LOOKUP_NO_TEMP_BIND, complain);
 
2949
       if (!CLASS_TYPE_P (to)
 
2950
          && CONSTRUCTOR_NELTS (expr) == 1)
 
2951
        {
 
2952
@@ -1624,9 +1624,9 @@
 
2953
 
 
2954
   /* [dcl.init.ref]
 
2955
 
 
2956
-     Otherwise, the reference shall be to a non-volatile const type.
 
2957
-
 
2958
-     Under C++0x, [8.5.3/5 dcl.init.ref] it may also be an rvalue reference */
 
2959
+     Otherwise, the reference shall be an lvalue reference to a
 
2960
+     non-volatile const type, or the reference shall be an rvalue
 
2961
+     reference.  */
 
2962
   if (!CP_TYPE_CONST_NON_VOLATILE_P (to) && !TYPE_REF_IS_RVALUE (rto))
 
2963
     return NULL;
 
2964
 
 
2965
@@ -1664,7 +1664,16 @@
 
2966
   /* This reference binding, unlike those above, requires the
 
2967
      creation of a temporary.  */
 
2968
   conv->need_temporary_p = true;
 
2969
-  conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto);
 
2970
+  if (TYPE_REF_IS_RVALUE (rto))
 
2971
+    {
 
2972
+      conv->rvaluedness_matches_p = 1;
 
2973
+      /* In the second case, if the reference is an rvalue reference and
 
2974
+        the second standard conversion sequence of the user-defined
 
2975
+        conversion sequence includes an lvalue-to-rvalue conversion, the
 
2976
+        program is ill-formed.  */
 
2977
+      if (conv->user_conv_p && next_conversion (conv)->kind == ck_rvalue)
 
2978
+       conv->bad_p = 1;
 
2979
+    }
 
2980
 
 
2981
   return conv;
 
2982
 }
 
2983
@@ -5811,7 +5820,7 @@
 
2984
       && convs->kind != ck_list
 
2985
       && convs->kind != ck_ambig
 
2986
       && (convs->kind != ck_ref_bind
 
2987
-         || convs->user_conv_p)
 
2988
+         || (convs->user_conv_p && next_conversion (convs)->bad_p))
 
2989
       && (convs->kind != ck_rvalue
 
2990
          || SCALAR_TYPE_P (totype))
 
2991
       && convs->kind != ck_base)
 
2992
@@ -6110,7 +6119,8 @@
 
2993
        if (convs->bad_p && !next_conversion (convs)->bad_p)
 
2994
          {
 
2995
            gcc_assert (TYPE_REF_IS_RVALUE (ref_type)
 
2996
-                       && real_lvalue_p (expr));
 
2997
+                       && (real_lvalue_p (expr)
 
2998
+                           || next_conversion(convs)->kind == ck_rvalue));
 
2999
 
 
3000
            error_at (loc, "cannot bind %qT lvalue to %qT",
 
3001
                      TREE_TYPE (expr), totype);
 
3002
Index: gcc/cp/friend.c
 
3003
===================================================================
 
3004
--- a/src/gcc/cp/friend.c       (.../tags/gcc_4_8_3_release)
 
3005
+++ b/src/gcc/cp/friend.c       (.../branches/gcc-4_8-branch)
 
3006
@@ -502,7 +502,13 @@
 
3007
                                  ? current_template_parms
 
3008
                                  : NULL_TREE);
 
3009
 
 
3010
-         if (template_member_p && decl && TREE_CODE (decl) == FUNCTION_DECL)
 
3011
+         if ((template_member_p
 
3012
+              /* Always pull out the TEMPLATE_DECL if we have a friend
 
3013
+                 template in a class template so that it gets tsubsted
 
3014
+                 properly later on (59956).  tsubst_friend_function knows
 
3015
+                 how to tell this apart from a member template.  */
 
3016
+              || (class_template_depth && friend_depth))
 
3017
+             && decl && TREE_CODE (decl) == FUNCTION_DECL)
 
3018
            decl = DECL_TI_TEMPLATE (decl);
 
3019
 
 
3020
          if (decl)
 
3021
Index: gcc/double-int.c
 
3022
===================================================================
 
3023
--- a/src/gcc/double-int.c      (.../tags/gcc_4_8_3_release)
 
3024
+++ b/src/gcc/double-int.c      (.../branches/gcc-4_8-branch)
 
3025
@@ -616,7 +616,7 @@
 
3026
                 == (unsigned HOST_WIDE_INT) htwice)
 
3027
                && (labs_den <= ltwice)))
 
3028
          {
 
3029
-           if (*hquo < 0)
 
3030
+           if (quo_neg)
 
3031
              /* quo = quo - 1;  */
 
3032
              add_double (*lquo, *hquo,
 
3033
                          (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo);
 
3034
Index: gcc/tree-ssa-math-opts.c
 
3035
===================================================================
 
3036
--- a/src/gcc/tree-ssa-math-opts.c      (.../tags/gcc_4_8_3_release)
 
3037
+++ b/src/gcc/tree-ssa-math-opts.c      (.../branches/gcc-4_8-branch)
 
3038
@@ -1537,7 +1537,7 @@
 
3039
 
 
3040
 struct symbolic_number {
 
3041
   unsigned HOST_WIDEST_INT n;
 
3042
-  int size;
 
3043
+  tree type;
 
3044
 };
 
3045
 
 
3046
 /* Perform a SHIFT or ROTATE operation by COUNT bits on symbolic
 
3047
@@ -1549,13 +1549,15 @@
 
3048
                 struct symbolic_number *n,
 
3049
                 int count)
 
3050
 {
 
3051
+  int bitsize = TYPE_PRECISION (n->type);
 
3052
+
 
3053
   if (count % 8 != 0)
 
3054
     return false;
 
3055
 
 
3056
   /* Zero out the extra bits of N in order to avoid them being shifted
 
3057
      into the significant bits.  */
 
3058
-  if (n->size < (int)sizeof (HOST_WIDEST_INT))
 
3059
-    n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1;
 
3060
+  if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT))
 
3061
+    n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1;
 
3062
 
 
3063
   switch (code)
 
3064
     {
 
3065
@@ -1563,20 +1565,24 @@
 
3066
       n->n <<= count;
 
3067
       break;
 
3068
     case RSHIFT_EXPR:
 
3069
+      /* Arithmetic shift of signed type: result is dependent on the value.  */
 
3070
+      if (!TYPE_UNSIGNED (n->type)
 
3071
+         && (n->n & ((unsigned HOST_WIDEST_INT) 0xff << (bitsize - 8))))
 
3072
+       return false;
 
3073
       n->n >>= count;
 
3074
       break;
 
3075
     case LROTATE_EXPR:
 
3076
-      n->n = (n->n << count) | (n->n >> ((n->size * BITS_PER_UNIT) - count));
 
3077
+      n->n = (n->n << count) | (n->n >> (bitsize - count));
 
3078
       break;
 
3079
     case RROTATE_EXPR:
 
3080
-      n->n = (n->n >> count) | (n->n << ((n->size * BITS_PER_UNIT) - count));
 
3081
+      n->n = (n->n >> count) | (n->n << (bitsize - count));
 
3082
       break;
 
3083
     default:
 
3084
       return false;
 
3085
     }
 
3086
   /* Zero unused bits for size.  */
 
3087
-  if (n->size < (int)sizeof (HOST_WIDEST_INT))
 
3088
-    n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1;
 
3089
+  if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT))
 
3090
+    n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1;
 
3091
   return true;
 
3092
 }
 
3093
 
 
3094
@@ -1593,7 +1599,7 @@
 
3095
   if (TREE_CODE (lhs_type) != INTEGER_TYPE)
 
3096
     return false;
 
3097
 
 
3098
-  if (TYPE_PRECISION (lhs_type) != n->size * BITS_PER_UNIT)
 
3099
+  if (TYPE_PRECISION (lhs_type) != TYPE_PRECISION (n->type))
 
3100
     return false;
 
3101
 
 
3102
   return true;
 
3103
@@ -1650,20 +1656,25 @@
 
3104
         to initialize the symbolic number.  */
 
3105
       if (!source_expr1)
 
3106
        {
 
3107
+         int size;
 
3108
+
 
3109
          /* Set up the symbolic number N by setting each byte to a
 
3110
             value between 1 and the byte size of rhs1.  The highest
 
3111
             order byte is set to n->size and the lowest order
 
3112
             byte to 1.  */
 
3113
-         n->size = TYPE_PRECISION (TREE_TYPE (rhs1));
 
3114
-         if (n->size % BITS_PER_UNIT != 0)
 
3115
+         n->type = TREE_TYPE (rhs1);
 
3116
+         size = TYPE_PRECISION (n->type);
 
3117
+         if (size % BITS_PER_UNIT != 0)
 
3118
            return NULL_TREE;
 
3119
-         n->size /= BITS_PER_UNIT;
 
3120
+         if (size > HOST_BITS_PER_WIDEST_INT)
 
3121
+           return NULL_TREE;
 
3122
+         size /= BITS_PER_UNIT;
 
3123
          n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 :
 
3124
                  (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201);
 
3125
 
 
3126
-         if (n->size < (int)sizeof (HOST_WIDEST_INT))
 
3127
+         if (size < (int)sizeof (HOST_WIDEST_INT))
 
3128
            n->n &= ((unsigned HOST_WIDEST_INT)1 <<
 
3129
-                    (n->size * BITS_PER_UNIT)) - 1;
 
3130
+                    (size * BITS_PER_UNIT)) - 1;
 
3131
 
 
3132
          source_expr1 = rhs1;
 
3133
        }
 
3134
@@ -1672,12 +1683,12 @@
 
3135
        {
 
3136
        case BIT_AND_EXPR:
 
3137
          {
 
3138
-           int i;
 
3139
+           int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
 
3140
            unsigned HOST_WIDEST_INT val = widest_int_cst_value (rhs2);
 
3141
            unsigned HOST_WIDEST_INT tmp = val;
 
3142
 
 
3143
            /* Only constants masking full bytes are allowed.  */
 
3144
-           for (i = 0; i < n->size; i++, tmp >>= BITS_PER_UNIT)
 
3145
+           for (i = 0; i < size; i++, tmp >>= BITS_PER_UNIT)
 
3146
              if ((tmp & 0xff) != 0 && (tmp & 0xff) != 0xff)
 
3147
                return NULL_TREE;
 
3148
 
 
3149
@@ -1693,12 +1704,24 @@
 
3150
          break;
 
3151
        CASE_CONVERT:
 
3152
          {
 
3153
-           int type_size;
 
3154
+           int type_size, old_type_size;
 
3155
+           tree type;
 
3156
 
 
3157
-           type_size = TYPE_PRECISION (gimple_expr_type (stmt));
 
3158
+           type = gimple_expr_type (stmt);
 
3159
+           type_size = TYPE_PRECISION (type);
 
3160
            if (type_size % BITS_PER_UNIT != 0)
 
3161
              return NULL_TREE;
 
3162
+           if (type_size > (int) HOST_BITS_PER_WIDEST_INT)
 
3163
+             return NULL_TREE;
 
3164
 
 
3165
+           /* Sign extension: result is dependent on the value.  */
 
3166
+           old_type_size = TYPE_PRECISION (n->type);
 
3167
+           if (!TYPE_UNSIGNED (n->type)
 
3168
+               && type_size > old_type_size
 
3169
+               && n->n &
 
3170
+                  ((unsigned HOST_WIDEST_INT) 0xff << (old_type_size - 8)))
 
3171
+             return NULL_TREE;
 
3172
+
 
3173
            if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT)))
 
3174
              {
 
3175
                /* If STMT casts to a smaller type mask out the bits not
 
3176
@@ -1705,7 +1728,7 @@
 
3177
                   belonging to the target type.  */
 
3178
                n->n &= ((unsigned HOST_WIDEST_INT)1 << type_size) - 1;
 
3179
              }
 
3180
-           n->size = type_size / BITS_PER_UNIT;
 
3181
+           n->type = type;
 
3182
          }
 
3183
          break;
 
3184
        default:
 
3185
@@ -1718,7 +1741,7 @@
 
3186
 
 
3187
   if (rhs_class == GIMPLE_BINARY_RHS)
 
3188
     {
 
3189
-      int i;
 
3190
+      int i, size;
 
3191
       struct symbolic_number n1, n2;
 
3192
       unsigned HOST_WIDEST_INT mask;
 
3193
       tree source_expr2;
 
3194
@@ -1742,11 +1765,12 @@
 
3195
          source_expr2 = find_bswap_1 (rhs2_stmt, &n2, limit - 1);
 
3196
 
 
3197
          if (source_expr1 != source_expr2
 
3198
-             || n1.size != n2.size)
 
3199
+             || TYPE_PRECISION (n1.type) != TYPE_PRECISION (n2.type))
 
3200
            return NULL_TREE;
 
3201
 
 
3202
-         n->size = n1.size;
 
3203
-         for (i = 0, mask = 0xff; i < n->size; i++, mask <<= BITS_PER_UNIT)
 
3204
+         n->type = n1.type;
 
3205
+         size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
 
3206
+         for (i = 0, mask = 0xff; i < size; i++, mask <<= BITS_PER_UNIT)
 
3207
            {
 
3208
              unsigned HOST_WIDEST_INT masked1, masked2;
 
3209
 
 
3210
@@ -1785,7 +1809,7 @@
 
3211
 
 
3212
   struct symbolic_number n;
 
3213
   tree source_expr;
 
3214
-  int limit;
 
3215
+  int limit, bitsize;
 
3216
 
 
3217
   /* The last parameter determines the depth search limit.  It usually
 
3218
      correlates directly to the number of bytes to be touched.  We
 
3219
@@ -1800,13 +1824,14 @@
 
3220
     return NULL_TREE;
 
3221
 
 
3222
   /* Zero out the extra bits of N and CMP.  */
 
3223
-  if (n.size < (int)sizeof (HOST_WIDEST_INT))
 
3224
+  bitsize = TYPE_PRECISION (n.type);
 
3225
+  if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT))
 
3226
     {
 
3227
       unsigned HOST_WIDEST_INT mask =
 
3228
-       ((unsigned HOST_WIDEST_INT)1 << (n.size * BITS_PER_UNIT)) - 1;
 
3229
+       ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1;
 
3230
 
 
3231
       n.n &= mask;
 
3232
-      cmp >>= (sizeof (HOST_WIDEST_INT) - n.size) * BITS_PER_UNIT;
 
3233
+      cmp >>= sizeof (HOST_WIDEST_INT) * BITS_PER_UNIT - bitsize;
 
3234
     }
 
3235
 
 
3236
   /* A complete byte swap should make the symbolic number to start
 
3237
@@ -1828,7 +1853,7 @@
 
3238
   bool changed = false;
 
3239
   tree bswap16_type = NULL_TREE, bswap32_type = NULL_TREE, bswap64_type = NULL_TREE;
 
3240
 
 
3241
-  if (BITS_PER_UNIT != 8)
 
3242
+  if (BITS_PER_UNIT != 8 || CHAR_BIT != 8)
 
3243
     return 0;
 
3244
 
 
3245
   if (sizeof (HOST_WIDEST_INT) < 8)
 
3246
Index: gcc/tree-ssa-ifcombine.c
 
3247
===================================================================
 
3248
--- a/src/gcc/tree-ssa-ifcombine.c      (.../tags/gcc_4_8_3_release)
 
3249
+++ b/src/gcc/tree-ssa-ifcombine.c      (.../branches/gcc-4_8-branch)
 
3250
@@ -105,7 +105,11 @@
 
3251
     {
 
3252
       gimple stmt = gsi_stmt (gsi);
 
3253
 
 
3254
+      if (is_gimple_debug (stmt))
 
3255
+       continue;
 
3256
+
 
3257
       if (gimple_has_side_effects (stmt)
 
3258
+         || gimple_could_trap_p (stmt)
 
3259
          || gimple_vuse (stmt))
 
3260
        return false;
 
3261
     }
 
3262
@@ -197,7 +201,8 @@
 
3263
       while (is_gimple_assign (stmt)
 
3264
             && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
 
3265
                  && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt)))
 
3266
-                     <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt)))))
 
3267
+                     <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt))))
 
3268
+                 && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME)
 
3269
                 || gimple_assign_ssa_name_copy_p (stmt)))
 
3270
        stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
 
3271
 
 
3272
Index: gcc/sel-sched-ir.c
 
3273
===================================================================
 
3274
--- a/src/gcc/sel-sched-ir.c    (.../tags/gcc_4_8_3_release)
 
3275
+++ b/src/gcc/sel-sched-ir.c    (.../branches/gcc-4_8-branch)
 
3276
@@ -162,7 +162,7 @@
 
3277
 static void free_av_set (basic_block);
 
3278
 static void invalidate_av_set (basic_block);
 
3279
 static void extend_insn_data (void);
 
3280
-static void sel_init_new_insn (insn_t, int);
 
3281
+static void sel_init_new_insn (insn_t, int, int = -1);
 
3282
 static void finish_insns (void);
 
3283
 
 
3284
 /* Various list functions.  */
 
3285
@@ -4011,9 +4011,10 @@
 
3286
   return seqno;
 
3287
 }
 
3288
 
 
3289
-/* Compute seqno for INSN by its preds or succs.  */
 
3290
+/* Compute seqno for INSN by its preds or succs.  Use OLD_SEQNO to compute
 
3291
+   seqno in corner cases.  */
 
3292
 static int
 
3293
-get_seqno_for_a_jump (insn_t insn)
 
3294
+get_seqno_for_a_jump (insn_t insn, int old_seqno)
 
3295
 {
 
3296
   int seqno;
 
3297
 
 
3298
@@ -4069,8 +4070,16 @@
 
3299
   if (seqno < 0)
 
3300
     seqno = get_seqno_by_succs (insn);
 
3301
 
 
3302
+  if (seqno < 0)
 
3303
+    {
 
3304
+      /* The only case where this could be here legally is that the only
 
3305
+        unscheduled insn was a conditional jump that got removed and turned
 
3306
+        into this unconditional one.  Initialize from the old seqno
 
3307
+        of that jump passed down to here.  */
 
3308
+      seqno = old_seqno;
 
3309
+    }
 
3310
+
 
3311
   gcc_assert (seqno >= 0);
 
3312
-
 
3313
   return seqno;
 
3314
 }
 
3315
 
 
3316
@@ -4250,22 +4259,24 @@
 
3317
 }
 
3318
 
 
3319
 /* This is used to initialize spurious jumps generated by
 
3320
-   sel_redirect_edge ().  */
 
3321
+   sel_redirect_edge ().  OLD_SEQNO is used for initializing seqnos
 
3322
+   in corner cases within get_seqno_for_a_jump.  */
 
3323
 static void
 
3324
-init_simplejump_data (insn_t insn)
 
3325
+init_simplejump_data (insn_t insn, int old_seqno)
 
3326
 {
 
3327
   init_expr (INSN_EXPR (insn), vinsn_create (insn, false), 0,
 
3328
             REG_BR_PROB_BASE, 0, 0, 0, 0, 0, 0,
 
3329
             vNULL, true, false, false,
 
3330
             false, true);
 
3331
-  INSN_SEQNO (insn) = get_seqno_for_a_jump (insn);
 
3332
+  INSN_SEQNO (insn) = get_seqno_for_a_jump (insn, old_seqno);
 
3333
   init_first_time_insn_data (insn);
 
3334
 }
 
3335
 
 
3336
 /* Perform deferred initialization of insns.  This is used to process
 
3337
-   a new jump that may be created by redirect_edge.  */
 
3338
-void
 
3339
-sel_init_new_insn (insn_t insn, int flags)
 
3340
+   a new jump that may be created by redirect_edge.  OLD_SEQNO is used
 
3341
+   for initializing simplejumps in init_simplejump_data.  */
 
3342
+static void
 
3343
+sel_init_new_insn (insn_t insn, int flags, int old_seqno)
 
3344
 {
 
3345
   /* We create data structures for bb when the first insn is emitted in it.  */
 
3346
   if (INSN_P (insn)
 
3347
@@ -4292,7 +4303,7 @@
 
3348
   if (flags & INSN_INIT_TODO_SIMPLEJUMP)
 
3349
     {
 
3350
       extend_insn_data ();
 
3351
-      init_simplejump_data (insn);
 
3352
+      init_simplejump_data (insn, old_seqno);
 
3353
     }
 
3354
 
 
3355
   gcc_assert (CONTAINING_RGN (BLOCK_NUM (insn))
 
3356
@@ -5578,8 +5589,7 @@
 
3357
 }
 
3358
 
 
3359
 /* A wrapper for redirect_edge_and_branch_force, which also initializes
 
3360
-   data structures for possibly created bb and insns.  Returns the newly
 
3361
-   added bb or NULL, when a bb was not needed.  */
 
3362
+   data structures for possibly created bb and insns.  */
 
3363
 void
 
3364
 sel_redirect_edge_and_branch_force (edge e, basic_block to)
 
3365
 {
 
3366
@@ -5586,6 +5596,7 @@
 
3367
   basic_block jump_bb, src, orig_dest = e->dest;
 
3368
   int prev_max_uid;
 
3369
   rtx jump;
 
3370
+  int old_seqno = -1;
 
3371
 
 
3372
   /* This function is now used only for bookkeeping code creation, where
 
3373
      we'll never get the single pred of orig_dest block and thus will not
 
3374
@@ -5594,8 +5605,13 @@
 
3375
               && !single_pred_p (orig_dest));
 
3376
   src = e->src;
 
3377
   prev_max_uid = get_max_uid ();
 
3378
+  /* Compute and pass old_seqno down to sel_init_new_insn only for the case
 
3379
+     when the conditional jump being redirected may become unconditional.  */
 
3380
+  if (any_condjump_p (BB_END (src))
 
3381
+      && INSN_SEQNO (BB_END (src)) >= 0)
 
3382
+    old_seqno = INSN_SEQNO (BB_END (src));
 
3383
+
 
3384
   jump_bb = redirect_edge_and_branch_force (e, to);
 
3385
-
 
3386
   if (jump_bb != NULL)
 
3387
     sel_add_bb (jump_bb);
 
3388
 
 
3389
@@ -5607,7 +5623,8 @@
 
3390
 
 
3391
   jump = find_new_jump (src, jump_bb, prev_max_uid);
 
3392
   if (jump)
 
3393
-    sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP);
 
3394
+    sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP,
 
3395
+                      old_seqno);
 
3396
   set_immediate_dominator (CDI_DOMINATORS, to,
 
3397
                           recompute_dominator (CDI_DOMINATORS, to));
 
3398
   set_immediate_dominator (CDI_DOMINATORS, orig_dest,
 
3399
@@ -5626,6 +5643,7 @@
 
3400
   edge redirected;
 
3401
   bool recompute_toporder_p = false;
 
3402
   bool maybe_unreachable = single_pred_p (orig_dest);
 
3403
+  int old_seqno = -1;
 
3404
 
 
3405
   latch_edge_p = (pipelining_p
 
3406
                   && current_loop_nest
 
3407
@@ -5634,6 +5652,12 @@
 
3408
   src = e->src;
 
3409
   prev_max_uid = get_max_uid ();
 
3410
 
 
3411
+  /* Compute and pass old_seqno down to sel_init_new_insn only for the case
 
3412
+     when the conditional jump being redirected may become unconditional.  */
 
3413
+  if (any_condjump_p (BB_END (src))
 
3414
+      && INSN_SEQNO (BB_END (src)) >= 0)
 
3415
+    old_seqno = INSN_SEQNO (BB_END (src));
 
3416
+
 
3417
   redirected = redirect_edge_and_branch (e, to);
 
3418
 
 
3419
   gcc_assert (redirected && !last_added_blocks.exists ());
 
3420
@@ -5654,7 +5678,7 @@
 
3421
 
 
3422
   jump = find_new_jump (src, NULL, prev_max_uid);
 
3423
   if (jump)
 
3424
-    sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP);
 
3425
+    sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP, old_seqno);
 
3426
 
 
3427
   /* Only update dominator info when we don't have unreachable blocks.
 
3428
      Otherwise we'll update in maybe_tidy_empty_bb.  */
 
3429
Index: gcc/fortran/trans-expr.c
 
3430
===================================================================
 
3431
--- a/src/gcc/fortran/trans-expr.c      (.../tags/gcc_4_8_3_release)
 
3432
+++ b/src/gcc/fortran/trans-expr.c      (.../branches/gcc-4_8-branch)
 
3433
@@ -7096,7 +7096,7 @@
 
3434
 
 
3435
   res_desc = gfc_evaluate_now (desc, &se->pre);
 
3436
   gfc_conv_descriptor_data_set (&se->pre, res_desc, null_pointer_node);
 
3437
-  se->expr = gfc_build_addr_expr (TREE_TYPE (se->expr), res_desc);
 
3438
+  se->expr = gfc_build_addr_expr (NULL_TREE, res_desc);
 
3439
 
 
3440
   /* Free the lhs after the function call and copy the result data to
 
3441
      the lhs descriptor.  */
 
3442
Index: gcc/fortran/decl.c
 
3443
===================================================================
 
3444
--- a/src/gcc/fortran/decl.c    (.../tags/gcc_4_8_3_release)
 
3445
+++ b/src/gcc/fortran/decl.c    (.../branches/gcc-4_8-branch)
 
3446
@@ -1996,6 +1996,13 @@
 
3447
       if (gfc_notify_std (GFC_STD_GNU, "Old-style "
 
3448
                          "initialization at %C") == FAILURE)
 
3449
        return MATCH_ERROR;
 
3450
+      else if (gfc_current_state () == COMP_DERIVED)
 
3451
+       {
 
3452
+         gfc_error ("Invalid old style initialization for derived type "
 
3453
+                    "component at %C");
 
3454
+         m = MATCH_ERROR;
 
3455
+         goto cleanup;
 
3456
+       }
 
3457
 
 
3458
       return match_old_style_init (name);
 
3459
     }
 
3460
Index: gcc/fortran/ChangeLog
 
3461
===================================================================
 
3462
--- a/src/gcc/fortran/ChangeLog (.../tags/gcc_4_8_3_release)
 
3463
+++ b/src/gcc/fortran/ChangeLog (.../branches/gcc-4_8-branch)
 
3464
@@ -1,3 +1,38 @@
 
3465
+2014-07-19  Paul Thomas  <pault@gcc.gnu.org>
 
3466
+
 
3467
+       Backport from trunk.
 
3468
+       PR fortran/61780
 
3469
+       * dependency.c (gfc_dep_resolver): Index the 'reverse' array so
 
3470
+       that elements are skipped. This then correctly aligns 'reverse'
 
3471
+       with the scalarizer loops.
 
3472
+
 
3473
+2014-07-08  Paul Thomas  <pault@gcc.gnu.org>
 
3474
+
 
3475
+       PR fortran/61459
 
3476
+       PR fortran/58883
 
3477
+       * trans-expr.c (fcncall_realloc_result): Use the natural type
 
3478
+       for the address expression of 'res_desc'.
 
3479
+
 
3480
+2014-07-02  Jakub Jelinek  <jakub@redhat.com>
 
3481
+           Fritz Reese  <Reese-Fritz@zai.com>
 
3482
+
 
3483
+       * decl.c (variable_decl): Reject old style initialization
 
3484
+       for derived type components.
 
3485
+
 
3486
+2014-06-15  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
3487
+
 
3488
+       Backport from trunk.
 
3489
+       PR fortran/45187
 
3490
+       * trans-decl.c (gfc_create_module_variable): Don't create
 
3491
+       Cray-pointee decls twice.
 
3492
+
 
3493
+2014-05-26  Janne Blomqvist  <jb@gcc.gnu.org>
 
3494
+
 
3495
+       Backport from mainline
 
3496
+       PR libfortran/61310
 
3497
+       * intrinsics.texi (CTIME): Remove mention of locale-dependent
 
3498
+       behavior.
 
3499
+
 
3500
 2014-05-22  Release Manager
 
3501
 
 
3502
        * GCC 4.8.3 released.
 
3503
Index: gcc/fortran/trans-decl.c
 
3504
===================================================================
 
3505
--- a/src/gcc/fortran/trans-decl.c      (.../tags/gcc_4_8_3_release)
 
3506
+++ b/src/gcc/fortran/trans-decl.c      (.../branches/gcc-4_8-branch)
 
3507
@@ -4084,8 +4084,8 @@
 
3508
     }
 
3509
 
 
3510
   /* Don't generate variables from other modules. Variables from
 
3511
-     COMMONs will already have been generated.  */
 
3512
-  if (sym->attr.use_assoc || sym->attr.in_common)
 
3513
+     COMMONs and Cray pointees will already have been generated.  */
 
3514
+  if (sym->attr.use_assoc || sym->attr.in_common || sym->attr.cray_pointee)
 
3515
     return;
 
3516
 
 
3517
   /* Equivalenced variables arrive here after creation.  */
 
3518
Index: gcc/fortran/dependency.c
 
3519
===================================================================
 
3520
--- a/src/gcc/fortran/dependency.c      (.../tags/gcc_4_8_3_release)
 
3521
+++ b/src/gcc/fortran/dependency.c      (.../branches/gcc-4_8-branch)
 
3522
@@ -1779,6 +1779,7 @@
 
3523
 gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
 
3524
 {
 
3525
   int n;
 
3526
+  int m;
 
3527
   gfc_dependency fin_dep;
 
3528
   gfc_dependency this_dep;
 
3529
 
 
3530
@@ -1828,6 +1829,8 @@
 
3531
              break;
 
3532
            }
 
3533
 
 
3534
+         /* Index for the reverse array.  */
 
3535
+         m = -1;
 
3536
          for (n=0; n < lref->u.ar.dimen; n++)
 
3537
            {
 
3538
              /* Assume dependency when either of array reference is vector
 
3539
@@ -1862,31 +1865,37 @@
 
3540
                 The ability to reverse or not is set by previous conditions
 
3541
                 in this dimension.  If reversal is not activated, the
 
3542
                 value GFC_DEP_BACKWARD is reset to GFC_DEP_OVERLAP.  */
 
3543
+
 
3544
+             /* Get the indexing right for the scalarizing loop. If this
 
3545
+                is an element, there is no corresponding loop.  */
 
3546
+             if (lref->u.ar.dimen_type[n] != DIMEN_ELEMENT)
 
3547
+               m++;
 
3548
+
 
3549
              if (rref->u.ar.dimen_type[n] == DIMEN_RANGE
 
3550
                    && lref->u.ar.dimen_type[n] == DIMEN_RANGE)
 
3551
                {
 
3552
                  /* Set reverse if backward dependence and not inhibited.  */
 
3553
-                 if (reverse && reverse[n] == GFC_ENABLE_REVERSE)
 
3554
-                   reverse[n] = (this_dep == GFC_DEP_BACKWARD) ?
 
3555
-                                GFC_REVERSE_SET : reverse[n];
 
3556
+                 if (reverse && reverse[m] == GFC_ENABLE_REVERSE)
 
3557
+                   reverse[m] = (this_dep == GFC_DEP_BACKWARD) ?
 
3558
+                                GFC_REVERSE_SET : reverse[m];
 
3559
 
 
3560
                  /* Set forward if forward dependence and not inhibited.  */
 
3561
-                 if (reverse && reverse[n] == GFC_ENABLE_REVERSE)
 
3562
-                   reverse[n] = (this_dep == GFC_DEP_FORWARD) ?
 
3563
-                                GFC_FORWARD_SET : reverse[n];
 
3564
+                 if (reverse && reverse[m] == GFC_ENABLE_REVERSE)
 
3565
+                   reverse[m] = (this_dep == GFC_DEP_FORWARD) ?
 
3566
+                                GFC_FORWARD_SET : reverse[m];
 
3567
 
 
3568
                  /* Flag up overlap if dependence not compatible with
 
3569
                     the overall state of the expression.  */
 
3570
-                 if (reverse && reverse[n] == GFC_REVERSE_SET
 
3571
+                 if (reverse && reverse[m] == GFC_REVERSE_SET
 
3572
                        && this_dep == GFC_DEP_FORWARD)
 
3573
                    {
 
3574
-                     reverse[n] = GFC_INHIBIT_REVERSE;
 
3575
+                     reverse[m] = GFC_INHIBIT_REVERSE;
 
3576
                      this_dep = GFC_DEP_OVERLAP;
 
3577
                    }
 
3578
-                 else if (reverse && reverse[n] == GFC_FORWARD_SET
 
3579
+                 else if (reverse && reverse[m] == GFC_FORWARD_SET
 
3580
                        && this_dep == GFC_DEP_BACKWARD)
 
3581
                    {
 
3582
-                     reverse[n] = GFC_INHIBIT_REVERSE;
 
3583
+                     reverse[m] = GFC_INHIBIT_REVERSE;
 
3584
                      this_dep = GFC_DEP_OVERLAP;
 
3585
                    }
 
3586
 
 
3587
@@ -1893,7 +1902,7 @@
 
3588
                  /* If no intention of reversing or reversing is explicitly
 
3589
                     inhibited, convert backward dependence to overlap.  */
 
3590
                  if ((reverse == NULL && this_dep == GFC_DEP_BACKWARD)
 
3591
-                     || (reverse != NULL && reverse[n] == GFC_INHIBIT_REVERSE))
 
3592
+                     || (reverse != NULL && reverse[m] == GFC_INHIBIT_REVERSE))
 
3593
                    this_dep = GFC_DEP_OVERLAP;
 
3594
                }
 
3595
 
 
3596
Index: gcc/function.c
 
3597
===================================================================
 
3598
--- a/src/gcc/function.c        (.../tags/gcc_4_8_3_release)
 
3599
+++ b/src/gcc/function.c        (.../branches/gcc-4_8-branch)
 
3600
@@ -1354,9 +1354,13 @@
 
3601
 #define STACK_POINTER_OFFSET   0
 
3602
 #endif
 
3603
 
 
3604
+#if defined (REG_PARM_STACK_SPACE) && !defined (INCOMING_REG_PARM_STACK_SPACE)
 
3605
+#define INCOMING_REG_PARM_STACK_SPACE REG_PARM_STACK_SPACE
 
3606
+#endif
 
3607
+
 
3608
 /* If not defined, pick an appropriate default for the offset of dynamically
 
3609
    allocated memory depending on the value of ACCUMULATE_OUTGOING_ARGS,
 
3610
-   REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE.  */
 
3611
+   INCOMING_REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE.  */
 
3612
 
 
3613
 #ifndef STACK_DYNAMIC_OFFSET
 
3614
 
 
3615
@@ -1368,12 +1372,12 @@
 
3616
    `crtl->outgoing_args_size'.  Nevertheless, we must allow
 
3617
    for it when allocating stack dynamic objects.  */
 
3618
 
 
3619
-#if defined(REG_PARM_STACK_SPACE)
 
3620
+#ifdef INCOMING_REG_PARM_STACK_SPACE
 
3621
 #define STACK_DYNAMIC_OFFSET(FNDECL)   \
 
3622
 ((ACCUMULATE_OUTGOING_ARGS                                                   \
 
3623
   ? (crtl->outgoing_args_size                                \
 
3624
      + (OUTGOING_REG_PARM_STACK_SPACE ((!(FNDECL) ? NULL_TREE : TREE_TYPE (FNDECL))) ? 0 \
 
3625
-                                              : REG_PARM_STACK_SPACE (FNDECL))) \
 
3626
+                                              : INCOMING_REG_PARM_STACK_SPACE (FNDECL))) \
 
3627
   : 0) + (STACK_POINTER_OFFSET))
 
3628
 #else
 
3629
 #define STACK_DYNAMIC_OFFSET(FNDECL)   \
 
3630
@@ -2211,8 +2215,9 @@
 
3631
 #endif
 
3632
   all->args_so_far = pack_cumulative_args (&all->args_so_far_v);
 
3633
 
 
3634
-#ifdef REG_PARM_STACK_SPACE
 
3635
-  all->reg_parm_stack_space = REG_PARM_STACK_SPACE (current_function_decl);
 
3636
+#ifdef INCOMING_REG_PARM_STACK_SPACE
 
3637
+  all->reg_parm_stack_space
 
3638
+    = INCOMING_REG_PARM_STACK_SPACE (current_function_decl);
 
3639
 #endif
 
3640
 }
 
3641
 
 
3642
@@ -4518,6 +4523,7 @@
 
3643
       /* ??? This could be set on a per-function basis by the front-end
 
3644
          but is this worth the hassle?  */
 
3645
       cfun->can_throw_non_call_exceptions = flag_non_call_exceptions;
 
3646
+      cfun->can_delete_dead_exceptions = flag_delete_dead_exceptions;
 
3647
     }
 
3648
 }
 
3649
 
 
3650
Index: gcc/common.opt
 
3651
===================================================================
 
3652
--- a/src/gcc/common.opt        (.../tags/gcc_4_8_3_release)
 
3653
+++ b/src/gcc/common.opt        (.../branches/gcc-4_8-branch)
 
3654
@@ -1226,6 +1226,10 @@
 
3655
 Common Report Var(flag_tm)
 
3656
 Enable support for GNU transactional memory
 
3657
 
 
3658
+fgnu-unique
 
3659
+Common Report Var(flag_gnu_unique) Init(1)
 
3660
+Use STB_GNU_UNIQUE if supported by the assembler
 
3661
+
 
3662
 floop-flatten
 
3663
 Common Ignore
 
3664
 Does nothing. Preserved for backward compatibility.
 
3665
Index: gcc/sched-deps.c
 
3666
===================================================================
 
3667
--- a/src/gcc/sched-deps.c      (.../tags/gcc_4_8_3_release)
 
3668
+++ b/src/gcc/sched-deps.c      (.../branches/gcc-4_8-branch)
 
3669
@@ -2744,7 +2744,8 @@
 
3670
           Consider for instance a volatile asm that changes the fpu rounding
 
3671
           mode.  An insn should not be moved across this even if it only uses
 
3672
           pseudo-regs because it might give an incorrectly rounded result.  */
 
3673
-       if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
 
3674
+       if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x))
 
3675
+           && !DEBUG_INSN_P (insn))
 
3676
          reg_pending_barrier = TRUE_BARRIER;
 
3677
 
 
3678
        /* For all ASM_OPERANDS, we must traverse the vector of input operands.
 
3679
Index: gcc/config/alpha/elf.h
 
3680
===================================================================
 
3681
--- a/src/gcc/config/alpha/elf.h        (.../tags/gcc_4_8_3_release)
 
3682
+++ b/src/gcc/config/alpha/elf.h        (.../branches/gcc-4_8-branch)
 
3683
@@ -126,6 +126,10 @@
 
3684
   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
 
3685
    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
 
3686
 
 
3687
+/* This variable should be set to 'true' if the target ABI requires
 
3688
+   unwinding tables even when exceptions are not used.  */
 
3689
+#define TARGET_UNWIND_TABLES_DEFAULT true
 
3690
+
 
3691
 /* Select a format to encode pointers in exception handling data.  CODE
 
3692
    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
 
3693
    true if the symbol may be affected by dynamic relocations.
 
3694
Index: gcc/config/alpha/alpha.c
 
3695
===================================================================
 
3696
--- a/src/gcc/config/alpha/alpha.c      (.../tags/gcc_4_8_3_release)
 
3697
+++ b/src/gcc/config/alpha/alpha.c      (.../branches/gcc-4_8-branch)
 
3698
@@ -8658,6 +8658,11 @@
 
3699
                        }
 
3700
                      break;
 
3701
 
 
3702
+                   case BARRIER:
 
3703
+                     /* __builtin_unreachable can expand to no code at all,
 
3704
+                        leaving (barrier) RTXes in the instruction stream.  */
 
3705
+                     goto close_shadow_notrapb;
 
3706
+
 
3707
                    case JUMP_INSN:
 
3708
                    case CALL_INSN:
 
3709
                    case CODE_LABEL:
 
3710
@@ -8673,6 +8678,7 @@
 
3711
                  n = emit_insn_before (gen_trapb (), i);
 
3712
                  PUT_MODE (n, TImode);
 
3713
                  PUT_MODE (i, TImode);
 
3714
+               close_shadow_notrapb:
 
3715
                  trap_pending = 0;
 
3716
                  shadow.used.i = 0;
 
3717
                  shadow.used.fp = 0;
 
3718
Index: gcc/config/elfos.h
 
3719
===================================================================
 
3720
--- a/src/gcc/config/elfos.h    (.../tags/gcc_4_8_3_release)
 
3721
+++ b/src/gcc/config/elfos.h    (.../branches/gcc-4_8-branch)
 
3722
@@ -287,7 +287,7 @@
 
3723
 /* Write the extra assembler code needed to declare an object properly.  */
 
3724
 
 
3725
 #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
 
3726
-#define USE_GNU_UNIQUE_OBJECT 1
 
3727
+#define USE_GNU_UNIQUE_OBJECT flag_gnu_unique
 
3728
 #else
 
3729
 #define USE_GNU_UNIQUE_OBJECT 0
 
3730
 #endif
 
3731
Index: gcc/config/sparc/sync.md
 
3732
===================================================================
 
3733
--- a/src/gcc/config/sparc/sync.md      (.../tags/gcc_4_8_3_release)
 
3734
+++ b/src/gcc/config/sparc/sync.md      (.../branches/gcc-4_8-branch)
 
3735
@@ -64,11 +64,19 @@
 
3736
   "stbar"
 
3737
   [(set_attr "type" "multi")])
 
3738
 
 
3739
+;; For LEON3, STB has the effect of membar #StoreLoad.
 
3740
+(define_insn "*membar_storeload_leon3"
 
3741
+  [(set (match_operand:BLK 0 "" "")
 
3742
+       (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))]
 
3743
+  "TARGET_LEON3"
 
3744
+  "stb\t%%g0, [%%sp-1]"
 
3745
+  [(set_attr "type" "store")])
 
3746
+
 
3747
 ;; For V8, LDSTUB has the effect of membar #StoreLoad.
 
3748
 (define_insn "*membar_storeload"
 
3749
   [(set (match_operand:BLK 0 "" "")
 
3750
        (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))]
 
3751
-  "TARGET_V8"
 
3752
+  "TARGET_V8 && !TARGET_LEON3"
 
3753
   "ldstub\t[%%sp-1], %%g0"
 
3754
   [(set_attr "type" "multi")])
 
3755
 
 
3756
Index: gcc/config/i386/i386.md
 
3757
===================================================================
 
3758
--- a/src/gcc/config/i386/i386.md       (.../tags/gcc_4_8_3_release)
 
3759
+++ b/src/gcc/config/i386/i386.md       (.../branches/gcc-4_8-branch)
 
3760
@@ -5339,66 +5339,37 @@
 
3761
 
 
3762
 ;; Avoid store forwarding (partial memory) stall penalty by extending
 
3763
 ;; SImode value to DImode through XMM register instead of pushing two
 
3764
-;; SImode values to stack. Note that even !TARGET_INTER_UNIT_MOVES
 
3765
-;; targets benefit from this optimization. Also note that fild
 
3766
-;; loads from memory only.
 
3767
+;; SImode values to stack. Also note that fild loads from memory only.
 
3768
 
 
3769
-(define_insn "*floatunssi<mode>2_1"
 
3770
-  [(set (match_operand:X87MODEF 0 "register_operand" "=f,f")
 
3771
+(define_insn_and_split "*floatunssi<mode>2_i387_with_xmm"
 
3772
+  [(set (match_operand:X87MODEF 0 "register_operand" "=f")
 
3773
        (unsigned_float:X87MODEF
 
3774
-         (match_operand:SI 1 "nonimmediate_operand" "x,m")))
 
3775
-   (clobber (match_operand:DI 2 "memory_operand" "=m,m"))
 
3776
-   (clobber (match_scratch:SI 3 "=X,x"))]
 
3777
+         (match_operand:SI 1 "nonimmediate_operand" "rm")))
 
3778
+   (clobber (match_scratch:DI 3 "=x"))
 
3779
+   (clobber (match_operand:DI 2 "memory_operand" "=m"))]
 
3780
   "!TARGET_64BIT
 
3781
    && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
 
3782
-   && TARGET_SSE"
 
3783
+   && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES"
 
3784
   "#"
 
3785
+  "&& reload_completed"
 
3786
+  [(set (match_dup 3) (zero_extend:DI (match_dup 1)))
 
3787
+   (set (match_dup 2) (match_dup 3))
 
3788
+   (set (match_dup 0)
 
3789
+       (float:X87MODEF (match_dup 2)))]
 
3790
+  ""
 
3791
   [(set_attr "type" "multi")
 
3792
    (set_attr "mode" "<MODE>")])
 
3793
 
 
3794
-(define_split
 
3795
-  [(set (match_operand:X87MODEF 0 "register_operand")
 
3796
-       (unsigned_float:X87MODEF
 
3797
-         (match_operand:SI 1 "register_operand")))
 
3798
-   (clobber (match_operand:DI 2 "memory_operand"))
 
3799
-   (clobber (match_scratch:SI 3))]
 
3800
-  "!TARGET_64BIT
 
3801
-   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
 
3802
-   && TARGET_SSE
 
3803
-   && reload_completed"
 
3804
-  [(set (match_dup 2) (match_dup 1))
 
3805
-   (set (match_dup 0)
 
3806
-       (float:X87MODEF (match_dup 2)))]
 
3807
-  "operands[1] = simplify_gen_subreg (DImode, operands[1], SImode, 0);")
 
3808
-
 
3809
-(define_split
 
3810
-  [(set (match_operand:X87MODEF 0 "register_operand")
 
3811
-       (unsigned_float:X87MODEF
 
3812
-         (match_operand:SI 1 "memory_operand")))
 
3813
-   (clobber (match_operand:DI 2 "memory_operand"))
 
3814
-   (clobber (match_scratch:SI 3))]
 
3815
-  "!TARGET_64BIT
 
3816
-   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
 
3817
-   && TARGET_SSE
 
3818
-   && reload_completed"
 
3819
-  [(set (match_dup 2) (match_dup 3))
 
3820
-   (set (match_dup 0)
 
3821
-       (float:X87MODEF (match_dup 2)))]
 
3822
-{
 
3823
-  emit_move_insn (operands[3], operands[1]);
 
3824
-  operands[3] = simplify_gen_subreg (DImode, operands[3], SImode, 0);
 
3825
-})
 
3826
-
 
3827
 (define_expand "floatunssi<mode>2"
 
3828
   [(parallel
 
3829
      [(set (match_operand:X87MODEF 0 "register_operand")
 
3830
           (unsigned_float:X87MODEF
 
3831
             (match_operand:SI 1 "nonimmediate_operand")))
 
3832
-      (clobber (match_dup 2))
 
3833
-      (clobber (match_scratch:SI 3))])]
 
3834
+      (clobber (match_scratch:DI 3))
 
3835
+      (clobber (match_dup 2))])]
 
3836
   "!TARGET_64BIT
 
3837
    && ((TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
 
3838
-       && TARGET_SSE)
 
3839
+       && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES)
 
3840
        || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH))"
 
3841
 {
 
3842
   if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH)
 
3843
Index: gcc/config/i386/driver-i386.c
 
3844
===================================================================
 
3845
--- a/src/gcc/config/i386/driver-i386.c (.../tags/gcc_4_8_3_release)
 
3846
+++ b/src/gcc/config/i386/driver-i386.c (.../branches/gcc-4_8-branch)
 
3847
@@ -713,6 +713,11 @@
 
3848
                    /* Assume Core 2.  */
 
3849
                    cpu = "core2";
 
3850
                }
 
3851
+             else if (has_longmode)
 
3852
+               /* Perhaps some emulator?  Assume x86-64, otherwise gcc
 
3853
+                  -march=native would be unusable for 64-bit compilations,
 
3854
+                  as all the CPUs below are 32-bit only.  */
 
3855
+               cpu = "x86-64";
 
3856
              else if (has_sse3)
 
3857
                /* It is Core Duo.  */
 
3858
                cpu = "pentium-m";
 
3859
Index: gcc/config/i386/i386.c
 
3860
===================================================================
 
3861
--- a/src/gcc/config/i386/i386.c        (.../tags/gcc_4_8_3_release)
 
3862
+++ b/src/gcc/config/i386/i386.c        (.../branches/gcc-4_8-branch)
 
3863
@@ -20505,7 +20505,7 @@
 
3864
          t1 = gen_reg_rtx (V32QImode);
 
3865
          t2 = gen_reg_rtx (V32QImode);
 
3866
          t3 = gen_reg_rtx (V32QImode);
 
3867
-         vt2 = GEN_INT (128);
 
3868
+         vt2 = GEN_INT (-128);
 
3869
          for (i = 0; i < 32; i++)
 
3870
            vec[i] = vt2;
 
3871
          vt = gen_rtx_CONST_VECTOR (V32QImode, gen_rtvec_v (32, vec));
 
3872
@@ -24640,13 +24640,17 @@
 
3873
              {
 
3874
                edge e;
 
3875
                edge_iterator ei;
 
3876
-               /* Assume that region is SCC, i.e. all immediate predecessors
 
3877
-                  of non-head block are in the same region.  */
 
3878
+
 
3879
+               /* Regions are SCCs with the exception of selective
 
3880
+                  scheduling with pipelining of outer blocks enabled.
 
3881
+                  So also check that immediate predecessors of a non-head
 
3882
+                  block are in the same region.  */
 
3883
                FOR_EACH_EDGE (e, ei, bb->preds)
 
3884
                  {
 
3885
                    /* Avoid creating of loop-carried dependencies through
 
3886
-                      using topological odering in region.  */
 
3887
-                   if (BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index))
 
3888
+                      using topological ordering in the region.  */
 
3889
+                   if (rgn == CONTAINING_RGN (e->src->index)
 
3890
+                       && BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index))
 
3891
                      add_dependee_for_func_arg (first_arg, e->src); 
 
3892
                  }
 
3893
              }
 
3894
Index: gcc/config/microblaze/predicates.md
 
3895
===================================================================
 
3896
--- a/src/gcc/config/microblaze/predicates.md   (.../tags/gcc_4_8_3_release)
 
3897
+++ b/src/gcc/config/microblaze/predicates.md   (.../branches/gcc-4_8-branch)
 
3898
@@ -85,10 +85,6 @@
 
3899
   (ior (match_operand 0 "const_0_operand")
 
3900
        (match_operand 0 "register_operand")))
 
3901
 
 
3902
-(define_predicate "reg_or_mem_operand"
 
3903
-  (ior (match_operand 0 "memory_operand")
 
3904
-       (match_operand 0 "register_operand")))
 
3905
-
 
3906
 ;;  Return if the operand is either the PC or a label_ref.  
 
3907
 (define_special_predicate "pc_or_label_operand"
 
3908
   (ior (match_code "pc,label_ref")
 
3909
Index: gcc/config/microblaze/microblaze.md
 
3910
===================================================================
 
3911
--- a/src/gcc/config/microblaze/microblaze.md   (.../tags/gcc_4_8_3_release)
 
3912
+++ b/src/gcc/config/microblaze/microblaze.md   (.../branches/gcc-4_8-branch)
 
3913
@@ -1119,18 +1119,6 @@
 
3914
   }
 
3915
 )
 
3916
 
 
3917
-;;Load and store reverse
 
3918
-(define_insn "movsi4_rev"
 
3919
-  [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Q")
 
3920
-        (bswap:SI (match_operand:SF 1 "reg_or_mem_operand" "Q,r")))]
 
3921
-  "TARGET_REORDER"
 
3922
-  "@
 
3923
-   lwr\t%0,%y1,r0
 
3924
-   swr\t%1,%y0,r0"
 
3925
-  [(set_attr "type"     "load,store")
 
3926
-  (set_attr "mode"      "SI")
 
3927
-  (set_attr "length"    "4,4")])
 
3928
-
 
3929
 ;; 32-bit floating point moves
 
3930
 
 
3931
 (define_expand "movsf"
 
3932
Index: gcc/config/avr/avr-fixed.md
 
3933
===================================================================
 
3934
--- a/src/gcc/config/avr/avr-fixed.md   (.../tags/gcc_4_8_3_release)
 
3935
+++ b/src/gcc/config/avr/avr-fixed.md   (.../branches/gcc-4_8-branch)
 
3936
@@ -430,8 +430,8 @@
 
3937
       }
 
3938
 
 
3939
     // Input and output of the libgcc function
 
3940
-    const unsigned int regno_in[]  = { -1, 22, 22, -1, 18 };
 
3941
-    const unsigned int regno_out[] = { -1, 24, 24, -1, 22 };
 
3942
+    const unsigned int regno_in[]  = { -1U, 22, 22, -1U, 18 };
 
3943
+    const unsigned int regno_out[] = { -1U, 24, 24, -1U, 22 };
 
3944
 
 
3945
     operands[3] = gen_rtx_REG (<MODE>mode, regno_out[(size_t) GET_MODE_SIZE (<MODE>mode)]);
 
3946
     operands[4] = gen_rtx_REG (<MODE>mode,  regno_in[(size_t) GET_MODE_SIZE (<MODE>mode)]);
 
3947
Index: gcc/config/avr/avr.md
 
3948
===================================================================
 
3949
--- a/src/gcc/config/avr/avr.md (.../tags/gcc_4_8_3_release)
 
3950
+++ b/src/gcc/config/avr/avr.md (.../branches/gcc-4_8-branch)
 
3951
@@ -367,6 +367,15 @@
 
3952
   ""
 
3953
   {
 
3954
     int i;
 
3955
+
 
3956
+    // Avoid (subreg (mem)) for non-generic address spaces below.  Because
 
3957
+    // of the poor addressing capabilities of these spaces it's better to
 
3958
+    // load them in one chunk.  And it avoids PR61443.
 
3959
+
 
3960
+    if (MEM_P (operands[0])
 
3961
+        && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[0])))
 
3962
+      operands[0] = copy_to_mode_reg (<MODE>mode, operands[0]);
 
3963
+
 
3964
     for (i = GET_MODE_SIZE (<MODE>mode) - 1; i >= 0; --i)
 
3965
       {
 
3966
         rtx part = simplify_gen_subreg (QImode, operands[0], <MODE>mode, i);
 
3967
Index: gcc/config/avr/avr.h
 
3968
===================================================================
 
3969
--- a/src/gcc/config/avr/avr.h  (.../tags/gcc_4_8_3_release)
 
3970
+++ b/src/gcc/config/avr/avr.h  (.../branches/gcc-4_8-branch)
 
3971
@@ -250,18 +250,18 @@
 
3972
 #define REG_CLASS_CONTENTS {                                           \
 
3973
   {0x00000000,0x00000000},     /* NO_REGS */                           \
 
3974
   {0x00000001,0x00000000},     /* R0_REG */                            \
 
3975
-  {3 << REG_X,0x00000000},      /* POINTER_X_REGS, r26 - r27 */                \
 
3976
-  {3 << REG_Y,0x00000000},      /* POINTER_Y_REGS, r28 - r29 */                \
 
3977
-  {3 << REG_Z,0x00000000},      /* POINTER_Z_REGS, r30 - r31 */                \
 
3978
+  {3u << REG_X,0x00000000},     /* POINTER_X_REGS, r26 - r27 */                \
 
3979
+  {3u << REG_Y,0x00000000},     /* POINTER_Y_REGS, r28 - r29 */                \
 
3980
+  {3u << REG_Z,0x00000000},     /* POINTER_Z_REGS, r30 - r31 */                \
 
3981
   {0x00000000,0x00000003},     /* STACK_REG, STACK */                  \
 
3982
-  {(3 << REG_Y) | (3 << REG_Z),                                                \
 
3983
+  {(3u << REG_Y) | (3u << REG_Z),                                      \
 
3984
      0x00000000},              /* BASE_POINTER_REGS, r28 - r31 */      \
 
3985
-  {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z),                         \
 
3986
+  {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z),                      \
 
3987
      0x00000000},              /* POINTER_REGS, r26 - r31 */           \
 
3988
-  {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W),          \
 
3989
+  {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z) | (3u << REG_W),      \
 
3990
      0x00000000},              /* ADDW_REGS, r24 - r31 */              \
 
3991
   {0x00ff0000,0x00000000},     /* SIMPLE_LD_REGS r16 - r23 */          \
 
3992
-  {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16),   \
 
3993
+  {(3u << REG_X)|(3u << REG_Y)|(3u << REG_Z)|(3u << REG_W)|(0xffu << 16),\
 
3994
      0x00000000},      /* LD_REGS, r16 - r31 */                        \
 
3995
   {0x0000ffff,0x00000000},     /* NO_LD_REGS  r0 - r15 */              \
 
3996
   {0xffffffff,0x00000000},     /* GENERAL_REGS, r0 - r31 */            \
 
3997
Index: gcc/config/aarch64/arm_neon.h
 
3998
===================================================================
 
3999
--- a/src/gcc/config/aarch64/arm_neon.h (.../tags/gcc_4_8_3_release)
 
4000
+++ b/src/gcc/config/aarch64/arm_neon.h (.../branches/gcc-4_8-branch)
 
4001
@@ -13815,7 +13815,7 @@
 
4002
   int16x4_t result;
 
4003
   __asm__ ("sqdmulh %0.4h,%1.4h,%2.h[0]"
 
4004
            : "=w"(result)
 
4005
-           : "w"(a), "w"(b)
 
4006
+           : "w"(a), "x"(b)
 
4007
            : /* No clobbers */);
 
4008
   return result;
 
4009
 }
 
4010
@@ -13837,7 +13837,7 @@
 
4011
   int16x8_t result;
 
4012
   __asm__ ("sqdmulh %0.8h,%1.8h,%2.h[0]"
 
4013
            : "=w"(result)
 
4014
-           : "w"(a), "w"(b)
 
4015
+           : "w"(a), "x"(b)
 
4016
            : /* No clobbers */);
 
4017
   return result;
 
4018
 }
 
4019
Index: gcc/config/aarch64/aarch64.md
 
4020
===================================================================
 
4021
--- a/src/gcc/config/aarch64/aarch64.md (.../tags/gcc_4_8_3_release)
 
4022
+++ b/src/gcc/config/aarch64/aarch64.md (.../branches/gcc-4_8-branch)
 
4023
@@ -3292,6 +3292,7 @@
 
4024
         (unspec:DI [(match_operand:DI 0 "aarch64_valid_symref" "S")]
 
4025
                   UNSPEC_TLSDESC))
 
4026
    (clobber (reg:DI LR_REGNUM))
 
4027
+   (clobber (reg:CC CC_REGNUM))
 
4028
    (clobber (match_scratch:DI 1 "=r"))]
 
4029
   "TARGET_TLS_DESC"
 
4030
   "adrp\\tx0, %A0\;ldr\\t%1, [x0, #%L0]\;add\\tx0, x0, %L0\;.tlsdesccall\\t%0\;blr\\t%1"
 
4031
Index: gcc/config/aarch64/aarch64.c
 
4032
===================================================================
 
4033
--- a/src/gcc/config/aarch64/aarch64.c  (.../tags/gcc_4_8_3_release)
 
4034
+++ b/src/gcc/config/aarch64/aarch64.c  (.../branches/gcc-4_8-branch)
 
4035
@@ -1201,6 +1201,7 @@
 
4036
   CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v);
 
4037
   int ncrn, nvrn, nregs;
 
4038
   bool allocate_ncrn, allocate_nvrn;
 
4039
+  HOST_WIDE_INT size;
 
4040
 
 
4041
   /* We need to do this once per argument.  */
 
4042
   if (pcum->aapcs_arg_processed)
 
4043
@@ -1208,6 +1209,11 @@
 
4044
 
 
4045
   pcum->aapcs_arg_processed = true;
 
4046
 
 
4047
+  /* Size in bytes, rounded to the nearest multiple of 8 bytes.  */
 
4048
+  size
 
4049
+    = AARCH64_ROUND_UP (type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode),
 
4050
+                       UNITS_PER_WORD);
 
4051
+
 
4052
   allocate_ncrn = (type) ? !(FLOAT_TYPE_P (type)) : !FLOAT_MODE_P (mode);
 
4053
   allocate_nvrn = aarch64_vfp_is_call_candidate (pcum_v,
 
4054
                                                 mode,
 
4055
@@ -1258,10 +1264,8 @@
 
4056
     }
 
4057
 
 
4058
   ncrn = pcum->aapcs_ncrn;
 
4059
-  nregs = ((type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode))
 
4060
-          + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
 
4061
+  nregs = size / UNITS_PER_WORD;
 
4062
 
 
4063
-
 
4064
   /* C6 - C9.  though the sign and zero extension semantics are
 
4065
      handled elsewhere.  This is the case where the argument fits
 
4066
      entirely general registers.  */
 
4067
@@ -1309,13 +1313,12 @@
 
4068
   pcum->aapcs_nextncrn = NUM_ARG_REGS;
 
4069
 
 
4070
   /* The argument is passed on stack; record the needed number of words for
 
4071
-     this argument (we can re-use NREGS) and align the total size if
 
4072
-     necessary.  */
 
4073
+     this argument and align the total size if necessary.  */
 
4074
 on_stack:
 
4075
-  pcum->aapcs_stack_words = nregs;
 
4076
+  pcum->aapcs_stack_words = size / UNITS_PER_WORD;
 
4077
   if (aarch64_function_arg_alignment (mode, type) == 16 * BITS_PER_UNIT)
 
4078
     pcum->aapcs_stack_size = AARCH64_ROUND_UP (pcum->aapcs_stack_size,
 
4079
-                                              16 / UNITS_PER_WORD) + 1;
 
4080
+                                              16 / UNITS_PER_WORD);
 
4081
   return;
 
4082
 }
 
4083
 
 
4084
Index: gcc/config/aarch64/aarch64-linux.h
 
4085
===================================================================
 
4086
--- a/src/gcc/config/aarch64/aarch64-linux.h    (.../tags/gcc_4_8_3_release)
 
4087
+++ b/src/gcc/config/aarch64/aarch64-linux.h    (.../branches/gcc-4_8-branch)
 
4088
@@ -43,4 +43,6 @@
 
4089
     }                                          \
 
4090
   while (0)
 
4091
 
 
4092
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
4093
+
 
4094
 #endif  /* GCC_AARCH64_LINUX_H */
 
4095
Index: gcc/config/rs6000/htm.md
 
4096
===================================================================
 
4097
--- a/src/gcc/config/rs6000/htm.md      (.../tags/gcc_4_8_3_release)
 
4098
+++ b/src/gcc/config/rs6000/htm.md      (.../branches/gcc-4_8-branch)
 
4099
@@ -179,7 +179,7 @@
 
4100
                             (const_int 0)]
 
4101
                            UNSPECV_HTM_TABORTWCI))
 
4102
    (set (subreg:CC (match_dup 2) 0) (match_dup 1))
 
4103
-   (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 24)))
 
4104
+   (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 28)))
 
4105
    (parallel [(set (match_operand:SI 0 "int_reg_operand" "")
 
4106
                   (and:SI (match_dup 3) (const_int 15)))
 
4107
               (clobber (scratch:CC))])]
 
4108
Index: gcc/config/rs6000/freebsd64.h
 
4109
===================================================================
 
4110
--- a/src/gcc/config/rs6000/freebsd64.h (.../tags/gcc_4_8_3_release)
 
4111
+++ b/src/gcc/config/rs6000/freebsd64.h (.../branches/gcc-4_8-branch)
 
4112
@@ -367,7 +367,7 @@
 
4113
 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
 
4114
 #undef  ADJUST_FIELD_ALIGN
 
4115
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
 
4116
-  ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
 
4117
+  (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))           \
 
4118
    ? 128                                                                \
 
4119
    : (TARGET_64BIT                                                      \
 
4120
       && TARGET_ALIGN_NATURAL == 0                                      \
 
4121
Index: gcc/config/rs6000/rs6000-protos.h
 
4122
===================================================================
 
4123
--- a/src/gcc/config/rs6000/rs6000-protos.h     (.../tags/gcc_4_8_3_release)
 
4124
+++ b/src/gcc/config/rs6000/rs6000-protos.h     (.../branches/gcc-4_8-branch)
 
4125
@@ -153,6 +153,7 @@
 
4126
 
 
4127
 #ifdef TREE_CODE
 
4128
 extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align);
 
4129
+extern bool rs6000_special_adjust_field_align_p (tree, unsigned int);
 
4130
 extern unsigned int rs6000_special_round_type_align (tree, unsigned int,
 
4131
                                                     unsigned int);
 
4132
 extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int,
 
4133
@@ -161,7 +162,7 @@
 
4134
 extern rtx rs6000_libcall_value (enum machine_mode);
 
4135
 extern rtx rs6000_va_arg (tree, tree);
 
4136
 extern int function_ok_for_sibcall (tree);
 
4137
-extern int rs6000_reg_parm_stack_space (tree);
 
4138
+extern int rs6000_reg_parm_stack_space (tree, bool);
 
4139
 extern void rs6000_elf_declare_function_name (FILE *, const char *, tree);
 
4140
 extern bool rs6000_elf_in_small_data_p (const_tree);
 
4141
 #ifdef ARGS_SIZE_RTX
 
4142
Index: gcc/config/rs6000/rs6000-builtin.def
 
4143
===================================================================
 
4144
--- a/src/gcc/config/rs6000/rs6000-builtin.def  (.../tags/gcc_4_8_3_release)
 
4145
+++ b/src/gcc/config/rs6000/rs6000-builtin.def  (.../branches/gcc-4_8-branch)
 
4146
@@ -622,20 +622,13 @@
 
4147
                     | RS6000_BTC_TERNARY),                             \
 
4148
                    CODE_FOR_ ## ICODE)                 /* ICODE */
 
4149
 
 
4150
-/* Miscellaneous builtins.  */
 
4151
-#define BU_MISC_1(ENUM, NAME, ATTR, ICODE)                             \
 
4152
+/* 128-bit long double floating point builtins.  */
 
4153
+#define BU_LDBL128_2(ENUM, NAME, ATTR, ICODE)                          \
 
4154
   RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM,             /* ENUM */      \
 
4155
                    "__builtin_" NAME,                  /* NAME */      \
 
4156
-                   RS6000_BTM_HARD_FLOAT,              /* MASK */      \
 
4157
+                   (RS6000_BTM_HARD_FLOAT              /* MASK */      \
 
4158
+                    | RS6000_BTM_LDBL128),                             \
 
4159
                    (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
4160
-                    | RS6000_BTC_UNARY),                               \
 
4161
-                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
4162
-
 
4163
-#define BU_MISC_2(ENUM, NAME, ATTR, ICODE)                             \
 
4164
-  RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM,             /* ENUM */      \
 
4165
-                   "__builtin_" NAME,                  /* NAME */      \
 
4166
-                   RS6000_BTM_HARD_FLOAT,              /* MASK */      \
 
4167
-                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
4168
                     | RS6000_BTC_BINARY),                              \
 
4169
                    CODE_FOR_ ## ICODE)                 /* ICODE */
 
4170
 
 
4171
@@ -1593,10 +1586,8 @@
 
4172
 BU_DFP_MISC_2 (PACK_TD,                "pack_dec128",          CONST,  packtd)
 
4173
 BU_DFP_MISC_2 (UNPACK_TD,      "unpack_dec128",        CONST,  unpacktd)
 
4174
 
 
4175
-BU_MISC_2 (PACK_TF,            "pack_longdouble",      CONST,  packtf)
 
4176
-BU_MISC_2 (UNPACK_TF,          "unpack_longdouble",    CONST,  unpacktf)
 
4177
-BU_MISC_1 (UNPACK_TF_0,                "longdouble_dw0",       CONST,  unpacktf_0)
 
4178
-BU_MISC_1 (UNPACK_TF_1,                "longdouble_dw1",       CONST,  unpacktf_1)
 
4179
+BU_LDBL128_2 (PACK_TF,         "pack_longdouble",      CONST,  packtf)
 
4180
+BU_LDBL128_2 (UNPACK_TF,       "unpack_longdouble",    CONST,  unpacktf)
 
4181
 
 
4182
 BU_P7_MISC_2 (PACK_V1TI,       "pack_vector_int128",   CONST,  packv1ti)
 
4183
 BU_P7_MISC_2 (UNPACK_V1TI,     "unpack_vector_int128", CONST,  unpackv1ti)
 
4184
Index: gcc/config/rs6000/linux64.h
 
4185
===================================================================
 
4186
--- a/src/gcc/config/rs6000/linux64.h   (.../tags/gcc_4_8_3_release)
 
4187
+++ b/src/gcc/config/rs6000/linux64.h   (.../branches/gcc-4_8-branch)
 
4188
@@ -246,7 +246,7 @@
 
4189
 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
 
4190
 #undef  ADJUST_FIELD_ALIGN
 
4191
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
 
4192
-  ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)    \
 
4193
+  (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))           \
 
4194
    ? 128                                                               \
 
4195
    : (TARGET_64BIT                                                     \
 
4196
       && TARGET_ALIGN_NATURAL == 0                                     \
 
4197
Index: gcc/config/rs6000/rs6000.c
 
4198
===================================================================
 
4199
--- a/src/gcc/config/rs6000/rs6000.c    (.../tags/gcc_4_8_3_release)
 
4200
+++ b/src/gcc/config/rs6000/rs6000.c    (.../branches/gcc-4_8-branch)
 
4201
@@ -3014,7 +3014,8 @@
 
4202
          | ((TARGET_CRYPTO)                ? RS6000_BTM_CRYPTO    : 0)
 
4203
          | ((TARGET_HTM)                   ? RS6000_BTM_HTM       : 0)
 
4204
          | ((TARGET_DFP)                   ? RS6000_BTM_DFP       : 0)
 
4205
-         | ((TARGET_HARD_FLOAT)            ? RS6000_BTM_HARD_FLOAT : 0));
 
4206
+         | ((TARGET_HARD_FLOAT)            ? RS6000_BTM_HARD_FLOAT : 0)
 
4207
+         | ((TARGET_LONG_DOUBLE_128)       ? RS6000_BTM_LDBL128 : 0));
 
4208
 }
 
4209
 
 
4210
 /* Override command line options.  Mostly we process the processor type and
 
4211
@@ -5861,6 +5862,34 @@
 
4212
   return align;
 
4213
 }
 
4214
 
 
4215
+/* Previous GCC releases forced all vector types to have 16-byte alignment.  */
 
4216
+
 
4217
+bool
 
4218
+rs6000_special_adjust_field_align_p (tree field, unsigned int computed)
 
4219
+{
 
4220
+  if (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (field)) == VECTOR_TYPE)
 
4221
+    {
 
4222
+      if (computed != 128)
 
4223
+       {
 
4224
+         static bool warned;
 
4225
+         if (!warned && warn_psabi)
 
4226
+           {
 
4227
+             warned = true;
 
4228
+             inform (input_location,
 
4229
+                     "the layout of aggregates containing vectors with"
 
4230
+                     " %d-byte alignment will change in a future GCC release",
 
4231
+                     computed / BITS_PER_UNIT);
 
4232
+           }
 
4233
+       }
 
4234
+      /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we
 
4235
+        keep the special treatment of vector types, but warn if there will
 
4236
+        be differences in future GCC releases.  */
 
4237
+      return true;
 
4238
+    }
 
4239
+
 
4240
+  return false;
 
4241
+}
 
4242
+
 
4243
 /* AIX increases natural record alignment to doubleword if the first
 
4244
    field is an FP double while the FP fields remain word aligned.  */
 
4245
 
 
4246
@@ -6109,7 +6138,8 @@
 
4247
     return false;
 
4248
 
 
4249
   extra = GET_MODE_SIZE (mode) - UNITS_PER_WORD;
 
4250
-  gcc_assert (extra >= 0);
 
4251
+  if (extra < 0)
 
4252
+    extra = 0;
 
4253
 
 
4254
   if (GET_CODE (addr) == LO_SUM)
 
4255
     /* For lo_sum addresses, we must allow any offset except one that
 
4256
@@ -9198,14 +9228,51 @@
 
4257
           || (type && TREE_CODE (type) == VECTOR_TYPE
 
4258
               && int_size_in_bytes (type) >= 16))
 
4259
     return 128;
 
4260
-  else if (((TARGET_MACHO && rs6000_darwin64_abi)
 
4261
-           || DEFAULT_ABI == ABI_ELFv2
 
4262
-            || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
 
4263
-          && mode == BLKmode
 
4264
-          && type && TYPE_ALIGN (type) > 64)
 
4265
+
 
4266
+  /* Aggregate types that need > 8 byte alignment are quadword-aligned
 
4267
+     in the parameter area in the ELFv2 ABI, and in the AIX ABI unless
 
4268
+     -mcompat-align-parm is used.  */
 
4269
+  if (((DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)
 
4270
+       || DEFAULT_ABI == ABI_ELFv2)
 
4271
+      && type && TYPE_ALIGN (type) > 64)
 
4272
+    {
 
4273
+      /* "Aggregate" means any AGGREGATE_TYPE except for single-element
 
4274
+         or homogeneous float/vector aggregates here.  We already handled
 
4275
+         vector aggregates above, but still need to check for float here. */
 
4276
+      bool aggregate_p = (AGGREGATE_TYPE_P (type)
 
4277
+                         && !SCALAR_FLOAT_MODE_P (elt_mode));
 
4278
+
 
4279
+      /* We used to check for BLKmode instead of the above aggregate type
 
4280
+        check.  Warn when this results in any difference to the ABI.  */
 
4281
+      if (aggregate_p != (mode == BLKmode))
 
4282
+       {
 
4283
+         static bool warned;
 
4284
+         if (!warned && warn_psabi)
 
4285
+           {
 
4286
+             warned = true;
 
4287
+             inform (input_location,
 
4288
+                     "the ABI of passing aggregates with %d-byte alignment"
 
4289
+                     " will change in a future GCC release",
 
4290
+                     (int) TYPE_ALIGN (type) / BITS_PER_UNIT);
 
4291
+           }
 
4292
+       }
 
4293
+
 
4294
+      /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we
 
4295
+        keep using the BLKmode check, but warn if there will be differences
 
4296
+        in future GCC releases.  */
 
4297
+      if (mode == BLKmode)
 
4298
+       return 128;
 
4299
+    }
 
4300
+
 
4301
+  /* Similar for the Darwin64 ABI.  Note that for historical reasons we
 
4302
+     implement the "aggregate type" check as a BLKmode check here; this
 
4303
+     means certain aggregate types are in fact not aligned.  */
 
4304
+  if (TARGET_MACHO && rs6000_darwin64_abi
 
4305
+      && mode == BLKmode
 
4306
+      && type && TYPE_ALIGN (type) > 64)
 
4307
     return 128;
 
4308
-  else
 
4309
-    return PARM_BOUNDARY;
 
4310
+
 
4311
+  return PARM_BOUNDARY;
 
4312
 }
 
4313
 
 
4314
 /* The offset in words to the start of the parameter save area.  */
 
4315
@@ -10243,6 +10310,7 @@
 
4316
          rtx r, off;
 
4317
          int i, k = 0;
 
4318
          unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
 
4319
+         int fpr_words;
 
4320
 
 
4321
          /* Do we also need to pass this argument in the parameter
 
4322
             save area?  */
 
4323
@@ -10271,6 +10339,37 @@
 
4324
              rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
 
4325
            }
 
4326
 
 
4327
+         /* If there were not enough FPRs to hold the argument, the rest
 
4328
+            usually goes into memory.  However, if the current position
 
4329
+            is still within the register parameter area, a portion may
 
4330
+            actually have to go into GPRs.
 
4331
+
 
4332
+            Note that it may happen that the portion of the argument
 
4333
+            passed in the first "half" of the first GPR was already
 
4334
+            passed in the last FPR as well.
 
4335
+
 
4336
+            For unnamed arguments, we already set up GPRs to cover the
 
4337
+            whole argument in rs6000_psave_function_arg, so there is
 
4338
+            nothing further to do at this point.
 
4339
+
 
4340
+            GCC 4.8/4.9 Note: This was implemented incorrectly in earlier
 
4341
+            GCC releases.  To avoid any ABI change on the release branch,
 
4342
+            we retain that original implementation here, but warn if we
 
4343
+            encounter a case where the ABI will change in the future.  */
 
4344
+         fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8);
 
4345
+         if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG
 
4346
+             && cum->nargs_prototype > 0)
 
4347
+            {
 
4348
+             static bool warned;
 
4349
+             if (!warned && warn_psabi)
 
4350
+               {
 
4351
+                 warned = true;
 
4352
+                 inform (input_location,
 
4353
+                         "the ABI of passing homogeneous float aggregates"
 
4354
+                         " will change in a future GCC release");
 
4355
+               }
 
4356
+           }
 
4357
+
 
4358
          return rs6000_finish_function_arg (mode, rvec, k);
 
4359
        }
 
4360
       else if (align_words < GP_ARG_NUM_REG)
 
4361
@@ -10497,10 +10596,9 @@
 
4362
    list, or passes any parameter in memory.  */
 
4363
 
 
4364
 static bool
 
4365
-rs6000_function_parms_need_stack (tree fun)
 
4366
+rs6000_function_parms_need_stack (tree fun, bool incoming)
 
4367
 {
 
4368
-  function_args_iterator args_iter;
 
4369
-  tree arg_type;
 
4370
+  tree fntype, result;
 
4371
   CUMULATIVE_ARGS args_so_far_v;
 
4372
   cumulative_args_t args_so_far;
 
4373
 
 
4374
@@ -10507,26 +10605,57 @@
 
4375
   if (!fun)
 
4376
     /* Must be a libcall, all of which only use reg parms.  */
 
4377
     return false;
 
4378
+
 
4379
+  fntype = fun;
 
4380
   if (!TYPE_P (fun))
 
4381
-    fun = TREE_TYPE (fun);
 
4382
+    fntype = TREE_TYPE (fun);
 
4383
 
 
4384
   /* Varargs functions need the parameter save area.  */
 
4385
-  if (!prototype_p (fun) || stdarg_p (fun))
 
4386
+  if ((!incoming && !prototype_p (fntype)) || stdarg_p (fntype))
 
4387
     return true;
 
4388
 
 
4389
-  INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX);
 
4390
+  INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fntype, NULL_RTX);
 
4391
   args_so_far = pack_cumulative_args (&args_so_far_v);
 
4392
 
 
4393
-  if (aggregate_value_p (TREE_TYPE (fun), fun))
 
4394
+  /* When incoming, we will have been passed the function decl.
 
4395
+     It is necessary to use the decl to handle K&R style functions,
 
4396
+     where TYPE_ARG_TYPES may not be available.  */
 
4397
+  if (incoming)
 
4398
     {
 
4399
-      tree type = build_pointer_type (TREE_TYPE (fun));
 
4400
-      rs6000_parm_needs_stack (args_so_far, type);
 
4401
+      gcc_assert (DECL_P (fun));
 
4402
+      result = DECL_RESULT (fun);
 
4403
     }
 
4404
+  else
 
4405
+    result = TREE_TYPE (fntype);
 
4406
 
 
4407
-  FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter)
 
4408
-    if (rs6000_parm_needs_stack (args_so_far, arg_type))
 
4409
-      return true;
 
4410
+  if (result && aggregate_value_p (result, fntype))
 
4411
+    {
 
4412
+      if (!TYPE_P (result))
 
4413
+       result = TREE_TYPE (result);
 
4414
+      result = build_pointer_type (result);
 
4415
+      rs6000_parm_needs_stack (args_so_far, result);
 
4416
+    }
 
4417
 
 
4418
+  if (incoming)
 
4419
+    {
 
4420
+      tree parm;
 
4421
+
 
4422
+      for (parm = DECL_ARGUMENTS (fun);
 
4423
+          parm && parm != void_list_node;
 
4424
+          parm = TREE_CHAIN (parm))
 
4425
+       if (rs6000_parm_needs_stack (args_so_far, TREE_TYPE (parm)))
 
4426
+         return true;
 
4427
+    }
 
4428
+  else
 
4429
+    {
 
4430
+      function_args_iterator args_iter;
 
4431
+      tree arg_type;
 
4432
+
 
4433
+      FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter)
 
4434
+       if (rs6000_parm_needs_stack (args_so_far, arg_type))
 
4435
+         return true;
 
4436
+    }
 
4437
+
 
4438
   return false;
 
4439
 }
 
4440
 
 
4441
@@ -10537,7 +10666,7 @@
 
4442
    all parameters in registers.  */
 
4443
 
 
4444
 int
 
4445
-rs6000_reg_parm_stack_space (tree fun)
 
4446
+rs6000_reg_parm_stack_space (tree fun, bool incoming)
 
4447
 {
 
4448
   int reg_parm_stack_space;
 
4449
 
 
4450
@@ -10555,7 +10684,7 @@
 
4451
     case ABI_ELFv2:
 
4452
       /* ??? Recomputing this every time is a bit expensive.  Is there
 
4453
         a place to cache this information?  */
 
4454
-      if (rs6000_function_parms_need_stack (fun))
 
4455
+      if (rs6000_function_parms_need_stack (fun, incoming))
 
4456
        reg_parm_stack_space = TARGET_64BIT ? 64 : 32;
 
4457
       else
 
4458
        reg_parm_stack_space = 0;
 
4459
@@ -13544,11 +13673,15 @@
 
4460
   else if ((fnmask & (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR))
 
4461
           == (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR))
 
4462
     error ("Builtin function %s requires the -mhard-dfp and"
 
4463
-          "-mpower8-vector options", name);
 
4464
+          " -mpower8-vector options", name);
 
4465
   else if ((fnmask & RS6000_BTM_DFP) != 0)
 
4466
     error ("Builtin function %s requires the -mhard-dfp option", name);
 
4467
   else if ((fnmask & RS6000_BTM_P8_VECTOR) != 0)
 
4468
     error ("Builtin function %s requires the -mpower8-vector option", name);
 
4469
+  else if ((fnmask & (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128))
 
4470
+          == (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128))
 
4471
+    error ("Builtin function %s requires the -mhard-float and"
 
4472
+          " -mlong-double-128 options", name);
 
4473
   else if ((fnmask & RS6000_BTM_HARD_FLOAT) != 0)
 
4474
     error ("Builtin function %s requires the -mhard-float option", name);
 
4475
   else
 
4476
@@ -31413,6 +31546,7 @@
 
4477
   { "htm",              RS6000_BTM_HTM,        false, false },
 
4478
   { "hard-dfp",                 RS6000_BTM_DFP,        false, false },
 
4479
   { "hard-float",       RS6000_BTM_HARD_FLOAT, false, false },
 
4480
+  { "long-double-128",  RS6000_BTM_LDBL128,    false, false },
 
4481
 };
 
4482
 
 
4483
 /* Option variables that we want to support inside attribute((target)) and
 
4484
Index: gcc/config/rs6000/vsx.md
 
4485
===================================================================
 
4486
--- a/src/gcc/config/rs6000/vsx.md      (.../tags/gcc_4_8_3_release)
 
4487
+++ b/src/gcc/config/rs6000/vsx.md      (.../branches/gcc-4_8-branch)
 
4488
@@ -24,6 +24,13 @@
 
4489
 ;; Iterator for the 2 64-bit vector types
 
4490
 (define_mode_iterator VSX_D [V2DF V2DI])
 
4491
 
 
4492
+;; Iterator for the 2 64-bit vector types + 128-bit types that are loaded with
 
4493
+;; lxvd2x to properly handle swapping words on little endian
 
4494
+(define_mode_iterator VSX_LE [V2DF
 
4495
+                             V2DI
 
4496
+                             V1TI
 
4497
+                             (TI       "VECTOR_MEM_VSX_P (TImode)")])
 
4498
+
 
4499
 ;; Iterator for the 2 32-bit vector types
 
4500
 (define_mode_iterator VSX_W [V4SF V4SI])
 
4501
 
 
4502
@@ -228,8 +235,8 @@
 
4503
 ;; The patterns for LE permuted loads and stores come before the general
 
4504
 ;; VSX moves so they match first.
 
4505
 (define_insn_and_split "*vsx_le_perm_load_<mode>"
 
4506
-  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
 
4507
-        (match_operand:VSX_D 1 "memory_operand" "Z"))]
 
4508
+  [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa")
 
4509
+        (match_operand:VSX_LE 1 "memory_operand" "Z"))]
 
4510
   "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
4511
   "#"
 
4512
   "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
4513
@@ -342,8 +349,8 @@
 
4514
    (set_attr "length" "8")])
 
4515
 
 
4516
 (define_insn "*vsx_le_perm_store_<mode>"
 
4517
-  [(set (match_operand:VSX_D 0 "memory_operand" "=Z")
 
4518
-        (match_operand:VSX_D 1 "vsx_register_operand" "+wa"))]
 
4519
+  [(set (match_operand:VSX_LE 0 "memory_operand" "=Z")
 
4520
+        (match_operand:VSX_LE 1 "vsx_register_operand" "+wa"))]
 
4521
   "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
4522
   "#"
 
4523
   [(set_attr "type" "vecstore")
 
4524
@@ -350,8 +357,8 @@
 
4525
    (set_attr "length" "12")])
 
4526
 
 
4527
 (define_split
 
4528
-  [(set (match_operand:VSX_D 0 "memory_operand" "")
 
4529
-        (match_operand:VSX_D 1 "vsx_register_operand" ""))]
 
4530
+  [(set (match_operand:VSX_LE 0 "memory_operand" "")
 
4531
+        (match_operand:VSX_LE 1 "vsx_register_operand" ""))]
 
4532
   "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
 
4533
   [(set (match_dup 2)
 
4534
         (vec_select:<MODE>
 
4535
@@ -369,8 +376,8 @@
 
4536
 ;; The post-reload split requires that we re-permute the source
 
4537
 ;; register in case it is still live.
 
4538
 (define_split
 
4539
-  [(set (match_operand:VSX_D 0 "memory_operand" "")
 
4540
-        (match_operand:VSX_D 1 "vsx_register_operand" ""))]
 
4541
+  [(set (match_operand:VSX_LE 0 "memory_operand" "")
 
4542
+        (match_operand:VSX_LE 1 "vsx_register_operand" ""))]
 
4543
   "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
 
4544
   [(set (match_dup 1)
 
4545
         (vec_select:<MODE>
 
4546
@@ -1352,9 +1359,9 @@
 
4547
 ;; xxpermdi for little endian loads and stores.  We need several of
 
4548
 ;; these since the form of the PARALLEL differs by mode.
 
4549
 (define_insn "*vsx_xxpermdi2_le_<mode>"
 
4550
-  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
 
4551
-        (vec_select:VSX_D
 
4552
-          (match_operand:VSX_D 1 "vsx_register_operand" "wa")
 
4553
+  [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa")
 
4554
+        (vec_select:VSX_LE
 
4555
+          (match_operand:VSX_LE 1 "vsx_register_operand" "wa")
 
4556
           (parallel [(const_int 1) (const_int 0)])))]
 
4557
   "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
4558
   "xxpermdi %x0,%x1,%x1,2"
 
4559
@@ -1401,9 +1408,9 @@
 
4560
 ;; lxvd2x for little endian loads.  We need several of
 
4561
 ;; these since the form of the PARALLEL differs by mode.
 
4562
 (define_insn "*vsx_lxvd2x2_le_<mode>"
 
4563
-  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
 
4564
-        (vec_select:VSX_D
 
4565
-          (match_operand:VSX_D 1 "memory_operand" "Z")
 
4566
+  [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa")
 
4567
+        (vec_select:VSX_LE
 
4568
+          (match_operand:VSX_LE 1 "memory_operand" "Z")
 
4569
           (parallel [(const_int 1) (const_int 0)])))]
 
4570
   "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
4571
   "lxvd2x %x0,%y1"
 
4572
@@ -1450,9 +1457,9 @@
 
4573
 ;; stxvd2x for little endian stores.  We need several of
 
4574
 ;; these since the form of the PARALLEL differs by mode.
 
4575
 (define_insn "*vsx_stxvd2x2_le_<mode>"
 
4576
-  [(set (match_operand:VSX_D 0 "memory_operand" "=Z")
 
4577
-        (vec_select:VSX_D
 
4578
-          (match_operand:VSX_D 1 "vsx_register_operand" "wa")
 
4579
+  [(set (match_operand:VSX_LE 0 "memory_operand" "=Z")
 
4580
+        (vec_select:VSX_LE
 
4581
+          (match_operand:VSX_LE 1 "vsx_register_operand" "wa")
 
4582
           (parallel [(const_int 1) (const_int 0)])))]
 
4583
   "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
4584
   "stxvd2x %x1,%y0"
 
4585
@@ -1606,7 +1613,7 @@
 
4586
     {
 
4587
       if (GET_CODE (op3) == SCRATCH)
 
4588
        op3 = gen_reg_rtx (V4SFmode);
 
4589
-      emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, op2));
 
4590
+      emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, GEN_INT (ele)));
 
4591
       tmp = op3;
 
4592
     }
 
4593
   emit_insn (gen_vsx_xscvspdp_scalar2 (op0, tmp));
 
4594
Index: gcc/config/rs6000/rs6000.h
 
4595
===================================================================
 
4596
--- a/src/gcc/config/rs6000/rs6000.h    (.../tags/gcc_4_8_3_release)
 
4597
+++ b/src/gcc/config/rs6000/rs6000.h    (.../branches/gcc-4_8-branch)
 
4598
@@ -1593,8 +1593,15 @@
 
4599
 /* Define this if stack space is still allocated for a parameter passed
 
4600
    in a register.  The value is the number of bytes allocated to this
 
4601
    area.  */
 
4602
-#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL))
 
4603
+#define REG_PARM_STACK_SPACE(FNDECL) \
 
4604
+  rs6000_reg_parm_stack_space ((FNDECL), false)
 
4605
 
 
4606
+/* Define this macro if space guaranteed when compiling a function body
 
4607
+   is different to space required when making a call, a situation that
 
4608
+   can arise with K&R style function definitions.  */
 
4609
+#define INCOMING_REG_PARM_STACK_SPACE(FNDECL) \
 
4610
+  rs6000_reg_parm_stack_space ((FNDECL), true)
 
4611
+
 
4612
 /* Define this if the above stack space is to be considered part of the
 
4613
    space allocated by the caller.  */
 
4614
 #define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1
 
4615
@@ -2483,8 +2490,8 @@
 
4616
 #define RS6000_BTC_SAT         RS6000_BTC_MISC /* saturate sets VSCR.  */
 
4617
 
 
4618
 /* Builtin targets.  For now, we reuse the masks for those options that are in
 
4619
-   target flags, and pick two random bits for SPE and paired which aren't in
 
4620
-   target_flags.  */
 
4621
+   target flags, and pick three random bits for SPE, paired and ldbl128 which
 
4622
+   aren't in target_flags.  */
 
4623
 #define RS6000_BTM_ALWAYS      0               /* Always enabled.  */
 
4624
 #define RS6000_BTM_ALTIVEC     MASK_ALTIVEC    /* VMX/altivec vectors.  */
 
4625
 #define RS6000_BTM_VSX         MASK_VSX        /* VSX (vector/scalar).  */
 
4626
@@ -2501,6 +2508,7 @@
 
4627
 #define RS6000_BTM_CELL                MASK_FPRND      /* Target is cell powerpc.  */
 
4628
 #define RS6000_BTM_DFP         MASK_DFP        /* Decimal floating point.  */
 
4629
 #define RS6000_BTM_HARD_FLOAT  MASK_SOFT_FLOAT /* Hardware floating point.  */
 
4630
+#define RS6000_BTM_LDBL128     MASK_MULTIPLE   /* 128-bit long double.  */
 
4631
 
 
4632
 #define RS6000_BTM_COMMON      (RS6000_BTM_ALTIVEC                     \
 
4633
                                 | RS6000_BTM_VSX                       \
 
4634
@@ -2514,7 +2522,8 @@
 
4635
                                 | RS6000_BTM_POPCNTD                   \
 
4636
                                 | RS6000_BTM_CELL                      \
 
4637
                                 | RS6000_BTM_DFP                       \
 
4638
-                                | RS6000_BTM_HARD_FLOAT)
 
4639
+                                | RS6000_BTM_HARD_FLOAT                \
 
4640
+                                | RS6000_BTM_LDBL128)
 
4641
 
 
4642
 /* Define builtin enum index.  */
 
4643
 
 
4644
Index: gcc/config/rs6000/rs6000.md
 
4645
===================================================================
 
4646
--- a/src/gcc/config/rs6000/rs6000.md   (.../tags/gcc_4_8_3_release)
 
4647
+++ b/src/gcc/config/rs6000/rs6000.md   (.../branches/gcc-4_8-branch)
 
4648
@@ -737,7 +737,7 @@
 
4649
 
 
4650
 (define_insn "*extendsidi2_lfiwax"
 
4651
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
 
4652
-       (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))]
 
4653
+       (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))]
 
4654
   "TARGET_POWERPC64 && TARGET_LFIWAX"
 
4655
   "@
 
4656
    lwa%U1%X1 %0,%1
 
4657
@@ -760,7 +760,7 @@
 
4658
 
 
4659
 (define_insn "*extendsidi2_nocell"
 
4660
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
 
4661
-       (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
 
4662
+       (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))]
 
4663
   "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
 
4664
   "@
 
4665
    lwa%U1%X1 %0,%1
 
4666
@@ -15847,26 +15847,6 @@
 
4667
   ""
 
4668
   "")
 
4669
 
 
4670
-;; The Advance Toolchain 7.0-3 added private builtins: __builtin_longdouble_dw0
 
4671
-;; and __builtin_longdouble_dw1 to optimize glibc.  Add support for these
 
4672
-;; builtins here.
 
4673
-
 
4674
-(define_expand "unpacktf_0"
 
4675
-  [(set (match_operand:DF 0 "nonimmediate_operand" "")
 
4676
-       (unspec:DF [(match_operand:TF 1 "register_operand" "")
 
4677
-                   (const_int 0)]
 
4678
-        UNSPEC_UNPACK_128BIT))]
 
4679
-  ""
 
4680
-  "")
 
4681
-
 
4682
-(define_expand "unpacktf_1"
 
4683
-  [(set (match_operand:DF 0 "nonimmediate_operand" "")
 
4684
-       (unspec:DF [(match_operand:TF 1 "register_operand" "")
 
4685
-                   (const_int 1)]
 
4686
-        UNSPEC_UNPACK_128BIT))]
 
4687
-  ""
 
4688
-  "")
 
4689
-
 
4690
 (define_insn_and_split "unpack<mode>_dm"
 
4691
   [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m")
 
4692
        (unspec:<FP128_64>
 
4693
Index: gcc/config/rs6000/sysv4.h
 
4694
===================================================================
 
4695
--- a/src/gcc/config/rs6000/sysv4.h     (.../tags/gcc_4_8_3_release)
 
4696
+++ b/src/gcc/config/rs6000/sysv4.h     (.../branches/gcc-4_8-branch)
 
4697
@@ -292,7 +292,7 @@
 
4698
 /* An expression for the alignment of a structure field FIELD if the
 
4699
    alignment computed in the usual way is COMPUTED.  */
 
4700
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)                                  \
 
4701
-       ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
 
4702
+       (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))            \
 
4703
         ? 128 : COMPUTED)
 
4704
 
 
4705
 #undef  BIGGEST_FIELD_ALIGNMENT
 
4706
@@ -949,3 +949,27 @@
 
4707
 #define TARGET_USES_SYSV4_OPT 1
 
4708
 
 
4709
 #undef DBX_REGISTER_NUMBER
 
4710
+
 
4711
+/* Link -lasan early on the command line.  For -static-libasan, don't link
 
4712
+   it for -shared link, the executable should be compiled with -static-libasan
 
4713
+   in that case, and for executable link link with --{,no-}whole-archive around
 
4714
+   it to force everything into the executable.  And similarly for -ltsan.  */
 
4715
+#if defined(HAVE_LD_STATIC_DYNAMIC)
 
4716
+#undef LIBASAN_EARLY_SPEC
 
4717
+#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
 
4718
+  "%{static-libasan:%{!shared:" \
 
4719
+  LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
 
4720
+  LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
 
4721
+#undef LIBTSAN_EARLY_SPEC
 
4722
+#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
 
4723
+  LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
 
4724
+  LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
 
4725
+#endif
 
4726
+
 
4727
+/* Additional libraries needed by -static-libasan.  */
 
4728
+#undef STATIC_LIBASAN_LIBS
 
4729
+#define STATIC_LIBASAN_LIBS "-ldl -lpthread"
 
4730
+
 
4731
+/* Additional libraries needed by -static-libtsan.  */
 
4732
+#undef STATIC_LIBTSAN_LIBS
 
4733
+#define STATIC_LIBTSAN_LIBS "-ldl -lpthread"
 
4734
Index: gcc/config/arm/arm.c
 
4735
===================================================================
 
4736
--- a/src/gcc/config/arm/arm.c  (.../tags/gcc_4_8_3_release)
 
4737
+++ b/src/gcc/config/arm/arm.c  (.../branches/gcc-4_8-branch)
 
4738
@@ -24476,9 +24476,13 @@
 
4739
       fputs (":\n", file);
 
4740
       if (flag_pic)
 
4741
        {
 
4742
-         /* Output ".word .LTHUNKn-7-.LTHUNKPCn".  */
 
4743
+         /* Output ".word .LTHUNKn-[3,7]-.LTHUNKPCn".  */
 
4744
          rtx tem = XEXP (DECL_RTL (function), 0);
 
4745
-         tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7));
 
4746
+         /* For TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC
 
4747
+            pipeline offset is four rather than eight.  Adjust the offset
 
4748
+            accordingly.  */
 
4749
+         tem = plus_constant (GET_MODE (tem), tem,
 
4750
+                              TARGET_THUMB1_ONLY ? -3 : -7);
 
4751
          tem = gen_rtx_MINUS (GET_MODE (tem),
 
4752
                               tem,
 
4753
                               gen_rtx_SYMBOL_REF (Pmode,
 
4754
Index: gcc/config/arm/arm.md
 
4755
===================================================================
 
4756
--- a/src/gcc/config/arm/arm.md (.../tags/gcc_4_8_3_release)
 
4757
+++ b/src/gcc/config/arm/arm.md (.../branches/gcc-4_8-branch)
 
4758
@@ -7630,12 +7630,13 @@
 
4759
 
 
4760
 (define_insn "*arm_cmpdi_unsigned"
 
4761
   [(set (reg:CC_CZ CC_REGNUM)
 
4762
-       (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r")
 
4763
-                      (match_operand:DI 1 "arm_di_operand"     "rDi")))]
 
4764
+       (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r,r")
 
4765
+                      (match_operand:DI 1 "arm_di_operand"     "rDi,rDi")))]
 
4766
   "TARGET_32BIT"
 
4767
   "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1"
 
4768
   [(set_attr "conds" "set")
 
4769
-   (set_attr "length" "8")]
 
4770
+   (set_attr "arch" "a,t2")
 
4771
+   (set_attr "length" "8,10")]
 
4772
 )
 
4773
 
 
4774
 (define_insn "*arm_cmpdi_zero"
 
4775
Index: gcc/config/arm/t-rtems-eabi
 
4776
===================================================================
 
4777
--- a/src/gcc/config/arm/t-rtems-eabi   (.../tags/gcc_4_8_3_release)
 
4778
+++ b/src/gcc/config/arm/t-rtems-eabi   (.../branches/gcc-4_8-branch)
 
4779
@@ -1,47 +1,167 @@
 
4780
 # Custom RTEMS EABI multilibs
 
4781
 
 
4782
-MULTILIB_OPTIONS  = mthumb march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m mfpu=neon mfloat-abi=hard
 
4783
-MULTILIB_DIRNAMES = thumb armv6-m armv7-a armv7-r armv7-m neon hard
 
4784
+MULTILIB_OPTIONS  = mbig-endian mthumb march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m mfpu=neon/mfpu=vfpv3-d16/mfpu=fpv4-sp-d16 mfloat-abi=hard
 
4785
+MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m neon vfpv3-d16 fpv4-sp-d16 hard
 
4786
 
 
4787
 # Enumeration of multilibs
 
4788
 
 
4789
 MULTILIB_EXCEPTIONS =
 
4790
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard
 
4791
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon
 
4792
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4793
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16
 
4794
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4795
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16
 
4796
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfloat-abi=hard
 
4797
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m
 
4798
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard
 
4799
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon
 
4800
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
 
4801
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16
 
4802
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4803
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16
 
4804
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfloat-abi=hard
 
4805
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a
 
4806
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard
 
4807
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon
 
4808
+# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
 
4809
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16
 
4810
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4811
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16
 
4812
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfloat-abi=hard
 
4813
+# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r
 
4814
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard
 
4815
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon
 
4816
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4817
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16
 
4818
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4819
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16
 
4820
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfloat-abi=hard
 
4821
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m
 
4822
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon/mfloat-abi=hard
 
4823
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon
 
4824
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16/mfloat-abi=hard
 
4825
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16
 
4826
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4827
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16
 
4828
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfloat-abi=hard
 
4829
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb
 
4830
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon/mfloat-abi=hard
 
4831
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon
 
4832
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4833
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16
 
4834
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4835
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16
 
4836
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfloat-abi=hard
 
4837
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m
 
4838
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon/mfloat-abi=hard
 
4839
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon
 
4840
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
 
4841
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16
 
4842
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4843
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16
 
4844
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfloat-abi=hard
 
4845
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a
 
4846
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon/mfloat-abi=hard
 
4847
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon
 
4848
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
 
4849
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16
 
4850
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4851
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16
 
4852
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfloat-abi=hard
 
4853
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r
 
4854
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon/mfloat-abi=hard
 
4855
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon
 
4856
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4857
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16
 
4858
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4859
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16
 
4860
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfloat-abi=hard
 
4861
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m
 
4862
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon/mfloat-abi=hard
 
4863
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon
 
4864
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16/mfloat-abi=hard
 
4865
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16
 
4866
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4867
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16
 
4868
+MULTILIB_EXCEPTIONS += mbig-endian/mfloat-abi=hard
 
4869
+MULTILIB_EXCEPTIONS += mbig-endian
 
4870
 MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard
 
4871
 MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon
 
4872
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4873
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16
 
4874
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4875
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16
 
4876
 MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfloat-abi=hard
 
4877
 # MULTILIB_EXCEPTIONS += mthumb/march=armv6-m
 
4878
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard
 
4879
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon
 
4880
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
 
4881
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16
 
4882
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4883
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16
 
4884
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfloat-abi=hard
 
4885
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a
 
4886
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard
 
4887
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon
 
4888
+# MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
 
4889
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16
 
4890
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4891
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16
 
4892
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfloat-abi=hard
 
4893
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-r
 
4894
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard
 
4895
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon
 
4896
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4897
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16
 
4898
+# MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4899
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16
 
4900
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfloat-abi=hard
 
4901
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-m
 
4902
 MULTILIB_EXCEPTIONS += mthumb/mfpu=neon/mfloat-abi=hard
 
4903
 MULTILIB_EXCEPTIONS += mthumb/mfpu=neon
 
4904
+MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16/mfloat-abi=hard
 
4905
+MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16
 
4906
+MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4907
+MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16
 
4908
 MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=hard
 
4909
 # MULTILIB_EXCEPTIONS += mthumb
 
4910
 MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon/mfloat-abi=hard
 
4911
 MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon
 
4912
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4913
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16
 
4914
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4915
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16
 
4916
 MULTILIB_EXCEPTIONS += march=armv6-m/mfloat-abi=hard
 
4917
 MULTILIB_EXCEPTIONS += march=armv6-m
 
4918
 MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon/mfloat-abi=hard
 
4919
 MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon
 
4920
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
 
4921
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16
 
4922
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4923
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16
 
4924
 MULTILIB_EXCEPTIONS += march=armv7-a/mfloat-abi=hard
 
4925
 MULTILIB_EXCEPTIONS += march=armv7-a
 
4926
 MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon/mfloat-abi=hard
 
4927
 MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon
 
4928
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
 
4929
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16
 
4930
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4931
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16
 
4932
 MULTILIB_EXCEPTIONS += march=armv7-r/mfloat-abi=hard
 
4933
 MULTILIB_EXCEPTIONS += march=armv7-r
 
4934
 MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon/mfloat-abi=hard
 
4935
 MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon
 
4936
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
 
4937
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16
 
4938
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4939
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16
 
4940
 MULTILIB_EXCEPTIONS += march=armv7-m/mfloat-abi=hard
 
4941
 MULTILIB_EXCEPTIONS += march=armv7-m
 
4942
 MULTILIB_EXCEPTIONS += mfpu=neon/mfloat-abi=hard
 
4943
 MULTILIB_EXCEPTIONS += mfpu=neon
 
4944
+MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16/mfloat-abi=hard
 
4945
+MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16
 
4946
+MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16/mfloat-abi=hard
 
4947
+MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16
 
4948
 MULTILIB_EXCEPTIONS += mfloat-abi=hard
 
4949
Index: libobjc/encoding.c
 
4950
===================================================================
 
4951
--- a/src/libobjc/encoding.c    (.../tags/gcc_4_8_3_release)
 
4952
+++ b/src/libobjc/encoding.c    (.../branches/gcc-4_8-branch)
 
4953
@@ -192,6 +192,8 @@
 
4954
    ? MAX (MAX (COMPUTED, SPECIFIED), 64)                               \
 
4955
    : MAX (COMPUTED, SPECIFIED));})
 
4956
 
 
4957
+#define rs6000_special_adjust_field_align_p(FIELD, COMPUTED) \
 
4958
+ (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)
 
4959
 
 
4960
 /* Skip a variable name, enclosed in quotes (").  */
 
4961
 static inline
 
4962
Index: libobjc/ChangeLog
 
4963
===================================================================
 
4964
--- a/src/libobjc/ChangeLog     (.../tags/gcc_4_8_3_release)
 
4965
+++ b/src/libobjc/ChangeLog     (.../branches/gcc-4_8-branch)
 
4966
@@ -1,3 +1,16 @@
 
4967
+2014-07-27  Ulrich Weigand  <uweigand@de.ibm.com>
 
4968
+
 
4969
+       PR libobjc/61920
 
4970
+       * encoding.c (rs6000_special_adjust_field_align_p): Use definition
 
4971
+       that matches the 4.8 branch ABI.
 
4972
+
 
4973
+2014-07-27  Alan Modra  <amodra@gmail.com>
 
4974
+           Matthias Klose  <doko@ubuntu.com>
 
4975
+
 
4976
+       PR libobjc/61920
 
4977
+
 
4978
+       * encoding.c: Define rs6000_special_adjust_field_align_p.
 
4979
+
 
4980
 2014-05-22  Release Manager
 
4981
 
 
4982
        * GCC 4.8.3 released.
 
4983
Index: libgfortran/m4/in_pack.m4
 
4984
===================================================================
 
4985
--- a/src/libgfortran/m4/in_pack.m4     (.../tags/gcc_4_8_3_release)
 
4986
+++ b/src/libgfortran/m4/in_pack.m4     (.../branches/gcc-4_8-branch)
 
4987
@@ -79,7 +79,7 @@
 
4988
     return source->base_addr;
 
4989
 
 
4990
   /* Allocate storage for the destination.  */
 
4991
-  destptr = ('rtype_name` *)xmalloc (ssize * sizeof ('rtype_name`));
 
4992
+  destptr = xmallocarray (ssize, sizeof ('rtype_name`));
 
4993
   dest = destptr;
 
4994
   src = source->base_addr;
 
4995
   stride0 = stride[0];
 
4996
Index: libgfortran/m4/pack.m4
 
4997
===================================================================
 
4998
--- a/src/libgfortran/m4/pack.m4        (.../tags/gcc_4_8_3_release)
 
4999
+++ b/src/libgfortran/m4/pack.m4        (.../branches/gcc-4_8-branch)
 
5000
@@ -168,8 +168,8 @@
 
5001
 
 
5002
          ret->offset = 0;
 
5003
 
 
5004
-         /* xmalloc allocates a single byte for zero size.  */
 
5005
-         ret->base_addr = xmalloc (sizeof ('rtype_name`) * total);
 
5006
+         /* xmallocarray allocates a single byte for zero size.  */
 
5007
+         ret->base_addr = xmallocarray (total, sizeof ('rtype_name`));
 
5008
 
 
5009
          if (total == 0)
 
5010
            return;
 
5011
Index: libgfortran/m4/spread.m4
 
5012
===================================================================
 
5013
--- a/src/libgfortran/m4/spread.m4      (.../tags/gcc_4_8_3_release)
 
5014
+++ b/src/libgfortran/m4/spread.m4      (.../branches/gcc-4_8-branch)
 
5015
@@ -102,8 +102,8 @@
 
5016
        }
 
5017
       ret->offset = 0;
 
5018
 
 
5019
-      /* xmalloc allocates a single byte for zero size.  */
 
5020
-      ret->base_addr = xmalloc (rs * sizeof('rtype_name`));
 
5021
+      /* xmallocarray allocates a single byte for zero size.  */
 
5022
+      ret->base_addr = xmallocarray (rs, sizeof('rtype_name`));
 
5023
       if (rs <= 0)
 
5024
         return;
 
5025
     }
 
5026
@@ -245,7 +245,7 @@
 
5027
 
 
5028
   if (ret->base_addr == NULL)
 
5029
     {
 
5030
-      ret->base_addr = xmalloc (ncopies * sizeof ('rtype_name`));
 
5031
+      ret->base_addr = xmallocarray (ncopies, sizeof ('rtype_name`));
 
5032
       ret->offset = 0;
 
5033
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
5034
     }
 
5035
Index: libgfortran/m4/transpose.m4
 
5036
===================================================================
 
5037
--- a/src/libgfortran/m4/transpose.m4   (.../tags/gcc_4_8_3_release)
 
5038
+++ b/src/libgfortran/m4/transpose.m4   (.../branches/gcc-4_8-branch)
 
5039
@@ -61,7 +61,8 @@
 
5040
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
5041
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
5042
 
 
5043
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) ret));
 
5044
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
5045
+                                     sizeof ('rtype_name`));
 
5046
       ret->offset = 0;
 
5047
     } else if (unlikely (compile_options.bounds_check))
 
5048
     {
 
5049
Index: libgfortran/m4/iforeach.m4
 
5050
===================================================================
 
5051
--- a/src/libgfortran/m4/iforeach.m4    (.../tags/gcc_4_8_3_release)
 
5052
+++ b/src/libgfortran/m4/iforeach.m4    (.../branches/gcc-4_8-branch)
 
5053
@@ -30,7 +30,7 @@
 
5054
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
5055
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
5056
       retarray->offset = 0;
 
5057
-      retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
 
5058
+      retarray->base_addr = xmallocarray (rank, sizeof (rtype_name));
 
5059
     }
 
5060
   else
 
5061
     {
 
5062
@@ -133,7 +133,7 @@
 
5063
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
5064
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
5065
       retarray->offset = 0;
 
5066
-      retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
 
5067
+      retarray->base_addr = xmallocarray (rank, sizeof (rtype_name));
 
5068
     }
 
5069
   else
 
5070
     {
 
5071
@@ -264,7 +264,7 @@
 
5072
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
5073
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
5074
       retarray->offset = 0;
 
5075
-      retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
 
5076
+      retarray->base_addr = xmallocarray (rank, sizeof (rtype_name));
 
5077
     }
 
5078
   else if (unlikely (compile_options.bounds_check))
 
5079
     {
 
5080
Index: libgfortran/m4/eoshift1.m4
 
5081
===================================================================
 
5082
--- a/src/libgfortran/m4/eoshift1.m4    (.../tags/gcc_4_8_3_release)
 
5083
+++ b/src/libgfortran/m4/eoshift1.m4    (.../branches/gcc-4_8-branch)
 
5084
@@ -106,8 +106,8 @@
 
5085
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
5086
 
 
5087
         }
 
5088
-      /* xmalloc allocates a single byte for zero size.  */
 
5089
-      ret->base_addr = xmalloc (size * arraysize);
 
5090
+      /* xmallocarray allocates a single byte for zero size.  */
 
5091
+      ret->base_addr = xmallocarray (arraysize, size);
 
5092
 
 
5093
     }
 
5094
   else if (unlikely (compile_options.bounds_check))
 
5095
Index: libgfortran/m4/eoshift3.m4
 
5096
===================================================================
 
5097
--- a/src/libgfortran/m4/eoshift3.m4    (.../tags/gcc_4_8_3_release)
 
5098
+++ b/src/libgfortran/m4/eoshift3.m4    (.../branches/gcc-4_8-branch)
 
5099
@@ -90,7 +90,7 @@
 
5100
     {
 
5101
       int i;
 
5102
 
 
5103
-      ret->base_addr = xmalloc (size * arraysize);
 
5104
+      ret->base_addr = xmallocarray (arraysize, size);
 
5105
       ret->offset = 0;
 
5106
       ret->dtype = array->dtype;
 
5107
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
5108
@@ -108,8 +108,8 @@
 
5109
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
5110
 
 
5111
         }
 
5112
-      /* xmalloc allocates a single byte for zero size.  */
 
5113
-      ret->base_addr = xmalloc (size * arraysize);
 
5114
+      /* xmallocarray allocates a single byte for zero size.  */
 
5115
+      ret->base_addr = xmallocarray (arraysize, size);
 
5116
 
 
5117
     }
 
5118
   else if (unlikely (compile_options.bounds_check))
 
5119
Index: libgfortran/m4/shape.m4
 
5120
===================================================================
 
5121
--- a/src/libgfortran/m4/shape.m4       (.../tags/gcc_4_8_3_release)
 
5122
+++ b/src/libgfortran/m4/shape.m4       (.../branches/gcc-4_8-branch)
 
5123
@@ -50,7 +50,7 @@
 
5124
     {
 
5125
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
 
5126
       ret->offset = 0;
 
5127
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * rank);
 
5128
+      ret->base_addr = xmallocarray (rank, sizeof ('rtype_name`));
 
5129
     }
 
5130
 
 
5131
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
5132
Index: libgfortran/m4/cshift1.m4
 
5133
===================================================================
 
5134
--- a/src/libgfortran/m4/cshift1.m4     (.../tags/gcc_4_8_3_release)
 
5135
+++ b/src/libgfortran/m4/cshift1.m4     (.../branches/gcc-4_8-branch)
 
5136
@@ -81,7 +81,7 @@
 
5137
     {
 
5138
       int i;
 
5139
 
 
5140
-      ret->base_addr = xmalloc (size * arraysize);
 
5141
+      ret->base_addr = xmallocarray (arraysize, size);
 
5142
       ret->offset = 0;
 
5143
       ret->dtype = array->dtype;
 
5144
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
5145
Index: libgfortran/m4/matmull.m4
 
5146
===================================================================
 
5147
--- a/src/libgfortran/m4/matmull.m4     (.../tags/gcc_4_8_3_release)
 
5148
+++ b/src/libgfortran/m4/matmull.m4     (.../branches/gcc-4_8-branch)
 
5149
@@ -89,7 +89,7 @@
 
5150
         }
 
5151
           
 
5152
       retarray->base_addr
 
5153
-       = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
 
5154
+       = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`));
 
5155
       retarray->offset = 0;
 
5156
     }
 
5157
     else if (unlikely (compile_options.bounds_check))
 
5158
Index: libgfortran/m4/bessel.m4
 
5159
===================================================================
 
5160
--- a/src/libgfortran/m4/bessel.m4      (.../tags/gcc_4_8_3_release)
 
5161
+++ b/src/libgfortran/m4/bessel.m4      (.../branches/gcc-4_8-branch)
 
5162
@@ -56,7 +56,7 @@
 
5163
     {
 
5164
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
5165
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
5166
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * size);
 
5167
+      ret->base_addr = xmallocarray (size, sizeof ('rtype_name`));
 
5168
       ret->offset = 0;
 
5169
     }
 
5170
 
 
5171
@@ -123,7 +123,7 @@
 
5172
     {
 
5173
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
5174
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
5175
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * size);
 
5176
+      ret->base_addr = xmallocarray (size, sizeof ('rtype_name`));
 
5177
       ret->offset = 0;
 
5178
     }
 
5179
 
 
5180
Index: libgfortran/m4/unpack.m4
 
5181
===================================================================
 
5182
--- a/src/libgfortran/m4/unpack.m4      (.../tags/gcc_4_8_3_release)
 
5183
+++ b/src/libgfortran/m4/unpack.m4      (.../branches/gcc-4_8-branch)
 
5184
@@ -100,7 +100,7 @@
 
5185
          rs *= extent[n];
 
5186
        }
 
5187
       ret->offset = 0;
 
5188
-      ret->base_addr = xmalloc (rs * sizeof ('rtype_name`));
 
5189
+      ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`));
 
5190
     }
 
5191
   else
 
5192
     {
 
5193
@@ -245,7 +245,7 @@
 
5194
          rs *= extent[n];
 
5195
        }
 
5196
       ret->offset = 0;
 
5197
-      ret->base_addr = xmalloc (rs * sizeof ('rtype_name`));
 
5198
+      ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`));
 
5199
     }
 
5200
   else
 
5201
     {
 
5202
Index: libgfortran/m4/reshape.m4
 
5203
===================================================================
 
5204
--- a/src/libgfortran/m4/reshape.m4     (.../tags/gcc_4_8_3_release)
 
5205
+++ b/src/libgfortran/m4/reshape.m4     (.../branches/gcc-4_8-branch)
 
5206
@@ -115,11 +115,11 @@
 
5207
       ret->offset = 0;
 
5208
 
 
5209
       if (unlikely (rs < 1))
 
5210
-        alloc_size = 1;
 
5211
+        alloc_size = 0;
 
5212
       else
 
5213
-        alloc_size = rs * sizeof ('rtype_name`);
 
5214
+        alloc_size = rs;
 
5215
 
 
5216
-      ret->base_addr = xmalloc (alloc_size);
 
5217
+      ret->base_addr = xmallocarray (alloc_size, sizeof ('rtype_name`));
 
5218
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
5219
     }
 
5220
 
 
5221
Index: libgfortran/m4/ifunction_logical.m4
 
5222
===================================================================
 
5223
--- a/src/libgfortran/m4/ifunction_logical.m4   (.../tags/gcc_4_8_3_release)
 
5224
+++ b/src/libgfortran/m4/ifunction_logical.m4   (.../branches/gcc-4_8-branch)
 
5225
@@ -89,8 +89,7 @@
 
5226
       retarray->offset = 0;
 
5227
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5228
 
 
5229
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5230
-                  * extent[rank-1];
 
5231
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5232
 
 
5233
       if (alloc_size == 0)
 
5234
        {
 
5235
@@ -99,7 +98,7 @@
 
5236
          return;
 
5237
        }
 
5238
       else
 
5239
-       retarray->base_addr = xmalloc (alloc_size);
 
5240
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
 
5241
     }
 
5242
   else
 
5243
     {
 
5244
Index: libgfortran/m4/ifunction.m4
 
5245
===================================================================
 
5246
--- a/src/libgfortran/m4/ifunction.m4   (.../tags/gcc_4_8_3_release)
 
5247
+++ b/src/libgfortran/m4/ifunction.m4   (.../branches/gcc-4_8-branch)
 
5248
@@ -85,10 +85,9 @@
 
5249
       retarray->offset = 0;
 
5250
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5251
 
 
5252
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5253
-                  * extent[rank-1];
 
5254
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5255
 
 
5256
-      retarray->base_addr = xmalloc (alloc_size);
 
5257
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
 
5258
       if (alloc_size == 0)
 
5259
        {
 
5260
          /* Make sure we have a zero-sized array.  */
 
5261
@@ -260,8 +259,7 @@
 
5262
 
 
5263
        }
 
5264
 
 
5265
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5266
-                  * extent[rank-1];
 
5267
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5268
 
 
5269
       retarray->offset = 0;
 
5270
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5271
@@ -273,7 +271,7 @@
 
5272
          return;
 
5273
        }
 
5274
       else
 
5275
-       retarray->base_addr = xmalloc (alloc_size);
 
5276
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
 
5277
 
 
5278
     }
 
5279
   else
 
5280
@@ -417,8 +415,7 @@
 
5281
       retarray->offset = 0;
 
5282
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5283
 
 
5284
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5285
-                  * extent[rank-1];
 
5286
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5287
 
 
5288
       if (alloc_size == 0)
 
5289
        {
 
5290
@@ -427,7 +424,7 @@
 
5291
          return;
 
5292
        }
 
5293
       else
 
5294
-       retarray->base_addr = xmalloc (alloc_size);
 
5295
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
 
5296
     }
 
5297
   else
 
5298
     {
 
5299
Index: libgfortran/m4/matmul.m4
 
5300
===================================================================
 
5301
--- a/src/libgfortran/m4/matmul.m4      (.../tags/gcc_4_8_3_release)
 
5302
+++ b/src/libgfortran/m4/matmul.m4      (.../branches/gcc-4_8-branch)
 
5303
@@ -125,7 +125,7 @@
 
5304
         }
 
5305
 
 
5306
       retarray->base_addr
 
5307
-       = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
 
5308
+       = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`));
 
5309
       retarray->offset = 0;
 
5310
     }
 
5311
     else if (unlikely (compile_options.bounds_check))
 
5312
Index: libgfortran/runtime/in_pack_generic.c
 
5313
===================================================================
 
5314
--- a/src/libgfortran/runtime/in_pack_generic.c (.../tags/gcc_4_8_3_release)
 
5315
+++ b/src/libgfortran/runtime/in_pack_generic.c (.../branches/gcc-4_8-branch)
 
5316
@@ -180,7 +180,7 @@
 
5317
     return source->base_addr;
 
5318
 
 
5319
    /* Allocate storage for the destination.  */
 
5320
-  destptr = xmalloc (ssize * size);
 
5321
+  destptr = xmallocarray (ssize, size);
 
5322
   dest = (char *)destptr;
 
5323
   src = source->base_addr;
 
5324
   stride0 = stride[0] * size;
 
5325
Index: libgfortran/runtime/memory.c
 
5326
===================================================================
 
5327
--- a/src/libgfortran/runtime/memory.c  (.../tags/gcc_4_8_3_release)
 
5328
+++ b/src/libgfortran/runtime/memory.c  (.../branches/gcc-4_8-branch)
 
5329
@@ -25,8 +25,13 @@
 
5330
 
 
5331
 #include "libgfortran.h"
 
5332
 #include <stdlib.h>
 
5333
+#include <errno.h>
 
5334
 
 
5335
+#ifndef SIZE_MAX
 
5336
+#define SIZE_MAX ((size_t)-1)
 
5337
+#endif
 
5338
 
 
5339
+
 
5340
 void *
 
5341
 xmalloc (size_t n)
 
5342
 {
 
5343
@@ -44,12 +49,34 @@
 
5344
 }
 
5345
 
 
5346
 
 
5347
+void *
 
5348
+xmallocarray (size_t nmemb, size_t size)
 
5349
+{
 
5350
+  void *p;
 
5351
+
 
5352
+  if (!nmemb || !size)
 
5353
+    size = nmemb = 1;
 
5354
+  else if (nmemb > SIZE_MAX / size)
 
5355
+    {
 
5356
+      errno = ENOMEM;
 
5357
+      os_error ("Integer overflow in xmallocarray");
 
5358
+    }
 
5359
+
 
5360
+  p = malloc (nmemb * size);
 
5361
+
 
5362
+  if (!p)
 
5363
+    os_error ("Memory allocation failed in xmallocarray");
 
5364
+
 
5365
+  return p;
 
5366
+}
 
5367
+
 
5368
+
 
5369
 /* calloc wrapper that aborts on error.  */
 
5370
 
 
5371
 void *
 
5372
 xcalloc (size_t nmemb, size_t size)
 
5373
 {
 
5374
-  if (nmemb * size == 0)
 
5375
+  if (!nmemb || !size)
 
5376
     nmemb = size = 1;
 
5377
 
 
5378
   void *p = calloc (nmemb, size);
 
5379
Index: libgfortran/runtime/convert_char.c
 
5380
===================================================================
 
5381
--- a/src/libgfortran/runtime/convert_char.c    (.../tags/gcc_4_8_3_release)
 
5382
+++ b/src/libgfortran/runtime/convert_char.c    (.../branches/gcc-4_8-branch)
 
5383
@@ -44,7 +44,7 @@
 
5384
   gfc_charlen_type i, l;
 
5385
 
 
5386
   l = len > 0 ? len : 0;
 
5387
-  *dst = xmalloc ((l + 1) * sizeof (gfc_char4_t));
 
5388
+  *dst = xmallocarray ((l + 1), sizeof (gfc_char4_t));
 
5389
 
 
5390
   for (i = 0; i < l; i++)
 
5391
     (*dst)[i] = src[i];
 
5392
@@ -60,7 +60,7 @@
 
5393
   gfc_charlen_type i, l;
 
5394
 
 
5395
   l = len > 0 ? len : 0;
 
5396
-  *dst = xmalloc ((l + 1) * sizeof (unsigned char));
 
5397
+  *dst = xmalloc (l + 1);
 
5398
 
 
5399
   for (i = 0; i < l; i++)
 
5400
     (*dst)[i] = src[i];
 
5401
Index: libgfortran/runtime/environ.c
 
5402
===================================================================
 
5403
--- a/src/libgfortran/runtime/environ.c (.../tags/gcc_4_8_3_release)
 
5404
+++ b/src/libgfortran/runtime/environ.c (.../branches/gcc-4_8-branch)
 
5405
@@ -833,7 +833,7 @@
 
5406
     }
 
5407
   else
 
5408
     {
 
5409
-      elist = xmalloc (unit_count * sizeof (exception_t));
 
5410
+      elist = xmallocarray (unit_count, sizeof (exception_t));
 
5411
       do_count = 0;
 
5412
       p = val;
 
5413
       do_parse ();
 
5414
Index: libgfortran/intrinsics/string_intrinsics_inc.c
 
5415
===================================================================
 
5416
--- a/src/libgfortran/intrinsics/string_intrinsics_inc.c        (.../tags/gcc_4_8_3_release)
 
5417
+++ b/src/libgfortran/intrinsics/string_intrinsics_inc.c        (.../branches/gcc-4_8-branch)
 
5418
@@ -164,7 +164,7 @@
 
5419
   else
 
5420
     {
 
5421
       /* Allocate space for result string.  */
 
5422
-      *dest = xmalloc (*len * sizeof (CHARTYPE));
 
5423
+      *dest = xmallocarray (*len, sizeof (CHARTYPE));
 
5424
 
 
5425
       /* Copy string if necessary.  */
 
5426
       memcpy (*dest, src, *len * sizeof (CHARTYPE));
 
5427
@@ -442,7 +442,7 @@
 
5428
     *dest = &zero_length_string;
 
5429
   else
 
5430
     {
 
5431
-      CHARTYPE *tmp = xmalloc (*rlen * sizeof (CHARTYPE));
 
5432
+      CHARTYPE *tmp = xmallocarray (*rlen, sizeof (CHARTYPE));
 
5433
       memcpy (tmp, res, reslen * sizeof (CHARTYPE));
 
5434
       MEMSET (&tmp[reslen], ' ', *rlen - reslen);
 
5435
       *dest = tmp;
 
5436
Index: libgfortran/intrinsics/pack_generic.c
 
5437
===================================================================
 
5438
--- a/src/libgfortran/intrinsics/pack_generic.c (.../tags/gcc_4_8_3_release)
 
5439
+++ b/src/libgfortran/intrinsics/pack_generic.c (.../branches/gcc-4_8-branch)
 
5440
@@ -152,8 +152,8 @@
 
5441
          GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
 
5442
 
 
5443
          ret->offset = 0;
 
5444
-         /* xmalloc allocates a single byte for zero size.  */
 
5445
-         ret->base_addr = xmalloc (size * total);
 
5446
+         /* xmallocarray allocates a single byte for zero size.  */
 
5447
+         ret->base_addr = xmallocarray (total, size);
 
5448
 
 
5449
          if (total == 0)
 
5450
            return;      /* In this case, nothing remains to be done.  */
 
5451
@@ -519,7 +519,7 @@
 
5452
 
 
5453
       ret->offset = 0;
 
5454
 
 
5455
-      ret->base_addr = xmalloc (size * total);
 
5456
+      ret->base_addr = xmallocarray (total, size);
 
5457
 
 
5458
       if (total == 0)
 
5459
        return;
 
5460
Index: libgfortran/intrinsics/transpose_generic.c
 
5461
===================================================================
 
5462
--- a/src/libgfortran/intrinsics/transpose_generic.c    (.../tags/gcc_4_8_3_release)
 
5463
+++ b/src/libgfortran/intrinsics/transpose_generic.c    (.../branches/gcc-4_8-branch)
 
5464
@@ -60,7 +60,7 @@
 
5465
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
5466
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
5467
 
 
5468
-      ret->base_addr = xmalloc (size * size0 ((array_t*)ret));
 
5469
+      ret->base_addr = xmallocarray (size0 ((array_t*)ret), size);
 
5470
       ret->offset = 0;
 
5471
     }
 
5472
   else if (unlikely (compile_options.bounds_check))
 
5473
Index: libgfortran/intrinsics/cshift0.c
 
5474
===================================================================
 
5475
--- a/src/libgfortran/intrinsics/cshift0.c      (.../tags/gcc_4_8_3_release)
 
5476
+++ b/src/libgfortran/intrinsics/cshift0.c      (.../branches/gcc-4_8-branch)
 
5477
@@ -79,8 +79,8 @@
 
5478
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
5479
         }
 
5480
 
 
5481
-      /* xmalloc allocates a single byte for zero size.  */
 
5482
-      ret->base_addr = xmalloc (size * arraysize);
 
5483
+      /* xmallocarray allocates a single byte for zero size.  */
 
5484
+      ret->base_addr = xmallocarray (arraysize, size);
 
5485
     }
 
5486
   else if (unlikely (compile_options.bounds_check))
 
5487
     {
 
5488
Index: libgfortran/intrinsics/ctime.c
 
5489
===================================================================
 
5490
--- a/src/libgfortran/intrinsics/ctime.c        (.../tags/gcc_4_8_3_release)
 
5491
+++ b/src/libgfortran/intrinsics/ctime.c        (.../branches/gcc-4_8-branch)
 
5492
@@ -31,31 +31,53 @@
 
5493
 #include <string.h>
 
5494
 
 
5495
 
 
5496
-/* strftime-like function that fills a C string with %c format which
 
5497
-   is identical to ctime in the default locale. As ctime and ctime_r
 
5498
-   are poorly specified and their usage not recommended, the
 
5499
-   implementation instead uses strftime.  */
 
5500
+/* Maximum space a ctime-like string might need. A "normal" ctime
 
5501
+   string is 26 bytes, and in our case 24 bytes as we don't include
 
5502
+   the trailing newline and null. However, the longest possible year
 
5503
+   number is -2,147,481,748 (1900 - 2,147,483,648, since tm_year is a
 
5504
+   32-bit signed integer) so an extra 7 bytes are needed. */
 
5505
+#define CTIME_BUFSZ 31
 
5506
 
 
5507
-static size_t
 
5508
-strctime (char *s, size_t max, const time_t *timep)
 
5509
+
 
5510
+/* Thread-safe ctime-like function that fills a Fortran
 
5511
+   string. ctime_r is a portability headache and marked as obsolescent
 
5512
+   in POSIX 2008, which recommends strftime in its place. However,
 
5513
+   strftime(..., "%c",...)  doesn't produce ctime-like output on
 
5514
+   MinGW, so do it manually with snprintf.  */
 
5515
+
 
5516
+static int
 
5517
+gf_ctime (char *s, size_t max, const time_t timev)
 
5518
 {
 
5519
   struct tm ltm;
 
5520
   int failed;
 
5521
+  char buf[CTIME_BUFSZ + 1];
 
5522
   /* Some targets provide a localtime_r based on a draft of the POSIX
 
5523
      standard where the return type is int rather than the
 
5524
      standardized struct tm*.  */
 
5525
-  __builtin_choose_expr (__builtin_classify_type (localtime_r (timep, &ltm)) 
 
5526
+  __builtin_choose_expr (__builtin_classify_type (localtime_r (&timev, &ltm)) 
 
5527
                         == 5,
 
5528
-                        failed = localtime_r (timep, &ltm) == NULL,
 
5529
-                        failed = localtime_r (timep, &ltm) != 0);
 
5530
+                        failed = localtime_r (&timev, &ltm) == NULL,
 
5531
+                        failed = localtime_r (&timev, &ltm) != 0);
 
5532
   if (failed)
 
5533
-    return 0;
 
5534
-  return strftime (s, max, "%c", &ltm);
 
5535
+    goto blank;
 
5536
+  int n = snprintf (buf, sizeof (buf), 
 
5537
+                   "%3.3s %3.3s%3d %.2d:%.2d:%.2d %d",
 
5538
+                   "SunMonTueWedThuFriSat" + ltm.tm_wday * 3,
 
5539
+                   "JanFebMarAprMayJunJulAugSepOctNovDec" + ltm.tm_mon * 3,
 
5540
+                   ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, 
 
5541
+                   1900 + ltm.tm_year);
 
5542
+  if (n < 0)
 
5543
+    goto blank;
 
5544
+  if ((size_t) n <= max)
 
5545
+    {
 
5546
+      cf_strcpy (s, max, buf);
 
5547
+      return n;
 
5548
+    }
 
5549
+ blank:
 
5550
+  memset (s, ' ', max);
 
5551
+  return 0;
 
5552
 }
 
5553
 
 
5554
-/* In the default locale, the date and time representation fits in 26
 
5555
-   bytes. However, other locales might need more space.  */
 
5556
-#define CSZ 100
 
5557
 
 
5558
 extern void fdate (char **, gfc_charlen_type *);
 
5559
 export_proto(fdate);
 
5560
@@ -64,8 +86,8 @@
 
5561
 fdate (char ** date, gfc_charlen_type * date_len)
 
5562
 {
 
5563
   time_t now = time(NULL);
 
5564
-  *date = xmalloc (CSZ);
 
5565
-  *date_len = strctime (*date, CSZ, &now);
 
5566
+  *date = xmalloc (CTIME_BUFSZ);
 
5567
+  *date_len = gf_ctime (*date, CTIME_BUFSZ, now);
 
5568
 }
 
5569
 
 
5570
 
 
5571
@@ -76,10 +98,7 @@
 
5572
 fdate_sub (char * date, gfc_charlen_type date_len)
 
5573
 {
 
5574
   time_t now = time(NULL);
 
5575
-  char *s = xmalloc (date_len + 1);
 
5576
-  size_t n = strctime (s, date_len + 1, &now);
 
5577
-  fstrcpy (date, date_len, s, n);
 
5578
-  free (s);
 
5579
+  gf_ctime (date, date_len, now);
 
5580
 }
 
5581
 
 
5582
 
 
5583
@@ -91,8 +110,8 @@
 
5584
 PREFIX(ctime) (char ** date, gfc_charlen_type * date_len, GFC_INTEGER_8 t)
 
5585
 {
 
5586
   time_t now = t;
 
5587
-  *date = xmalloc (CSZ);
 
5588
-  *date_len = strctime (*date, CSZ, &now);
 
5589
+  *date = xmalloc (CTIME_BUFSZ);
 
5590
+  *date_len = gf_ctime (*date, CTIME_BUFSZ, now);
 
5591
 }
 
5592
 
 
5593
 
 
5594
@@ -103,8 +122,5 @@
 
5595
 ctime_sub (GFC_INTEGER_8 * t, char * date, gfc_charlen_type date_len)
 
5596
 {
 
5597
   time_t now = *t;
 
5598
-  char *s = xmalloc (date_len + 1);
 
5599
-  size_t n = strctime (s, date_len + 1, &now);
 
5600
-  fstrcpy (date, date_len, s, n);
 
5601
-  free (s);
 
5602
+  gf_ctime (date, date_len, now);
 
5603
 }
 
5604
Index: libgfortran/intrinsics/spread_generic.c
 
5605
===================================================================
 
5606
--- a/src/libgfortran/intrinsics/spread_generic.c       (.../tags/gcc_4_8_3_release)
 
5607
+++ b/src/libgfortran/intrinsics/spread_generic.c       (.../branches/gcc-4_8-branch)
 
5608
@@ -100,7 +100,7 @@
 
5609
          GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
 
5610
        }
 
5611
       ret->offset = 0;
 
5612
-      ret->base_addr = xmalloc (rs * size);
 
5613
+      ret->base_addr = xmallocarray (rs, size);
 
5614
 
 
5615
       if (rs <= 0)
 
5616
        return;
 
5617
@@ -245,7 +245,7 @@
 
5618
 
 
5619
   if (ret->base_addr == NULL)
 
5620
     {
 
5621
-      ret->base_addr = xmalloc (ncopies * size);
 
5622
+      ret->base_addr = xmallocarray (ncopies, size);
 
5623
       ret->offset = 0;
 
5624
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
5625
     }
 
5626
Index: libgfortran/intrinsics/unpack_generic.c
 
5627
===================================================================
 
5628
--- a/src/libgfortran/intrinsics/unpack_generic.c       (.../tags/gcc_4_8_3_release)
 
5629
+++ b/src/libgfortran/intrinsics/unpack_generic.c       (.../branches/gcc-4_8-branch)
 
5630
@@ -125,7 +125,7 @@
 
5631
          rs *= extent[n];
 
5632
        }
 
5633
       ret->offset = 0;
 
5634
-      ret->base_addr = xmalloc (rs * size);
 
5635
+      ret->base_addr = xmallocarray (rs, size);
 
5636
     }
 
5637
   else
 
5638
     {
 
5639
Index: libgfortran/intrinsics/eoshift0.c
 
5640
===================================================================
 
5641
--- a/src/libgfortran/intrinsics/eoshift0.c     (.../tags/gcc_4_8_3_release)
 
5642
+++ b/src/libgfortran/intrinsics/eoshift0.c     (.../branches/gcc-4_8-branch)
 
5643
@@ -86,8 +86,8 @@
 
5644
 
 
5645
         }
 
5646
 
 
5647
-      /* xmalloc allocates a single byte for zero size.  */
 
5648
-      ret->base_addr = xmalloc (size * arraysize);
 
5649
+      /* xmallocarray allocates a single byte for zero size.  */
 
5650
+      ret->base_addr = xmallocarray (arraysize, size);
 
5651
     }
 
5652
   else if (unlikely (compile_options.bounds_check))
 
5653
     {
 
5654
Index: libgfortran/intrinsics/eoshift2.c
 
5655
===================================================================
 
5656
--- a/src/libgfortran/intrinsics/eoshift2.c     (.../tags/gcc_4_8_3_release)
 
5657
+++ b/src/libgfortran/intrinsics/eoshift2.c     (.../branches/gcc-4_8-branch)
 
5658
@@ -78,8 +78,8 @@
 
5659
       ret->offset = 0;
 
5660
       ret->dtype = array->dtype;
 
5661
 
 
5662
-      /* xmalloc allocates a single byte for zero size.  */
 
5663
-      ret->base_addr = xmalloc (size * arraysize);
 
5664
+      /* xmallocarray allocates a single byte for zero size.  */
 
5665
+      ret->base_addr = xmallocarray (arraysize, size);
 
5666
 
 
5667
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
5668
         {
 
5669
Index: libgfortran/intrinsics/reshape_generic.c
 
5670
===================================================================
 
5671
--- a/src/libgfortran/intrinsics/reshape_generic.c      (.../tags/gcc_4_8_3_release)
 
5672
+++ b/src/libgfortran/intrinsics/reshape_generic.c      (.../branches/gcc-4_8-branch)
 
5673
@@ -99,11 +99,11 @@
 
5674
       ret->offset = 0;
 
5675
 
 
5676
       if (unlikely (rs < 1))
 
5677
-       alloc_size = 1;
 
5678
+       alloc_size = 0; /* xmalloc will allocate 1 byte.  */
 
5679
       else
 
5680
-       alloc_size = rs * size;
 
5681
+       alloc_size = rs;
 
5682
 
 
5683
-      ret->base_addr = xmalloc (alloc_size);
 
5684
+      ret->base_addr = xmallocarray (alloc_size, size);
 
5685
 
 
5686
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
5687
     }
 
5688
Index: libgfortran/ChangeLog
 
5689
===================================================================
 
5690
--- a/src/libgfortran/ChangeLog (.../tags/gcc_4_8_3_release)
 
5691
+++ b/src/libgfortran/ChangeLog (.../branches/gcc-4_8-branch)
 
5692
@@ -1,3 +1,75 @@
 
5693
+2014-07-31  Janne Blomqvist  <jb@gcc.gnu.org>
 
5694
+
 
5695
+       Backport from mainline
 
5696
+       CVE-2014-5044
 
5697
+        * libgfortran.h (xmallocarray): New prototype.
 
5698
+        * runtime/memory.c (xmallocarray): New function.
 
5699
+        (xcalloc): Check for nonzero separately instead of multiplying.
 
5700
+        * generated/*.c: Regenerated.
 
5701
+        * intrinsics/cshift0.c (cshift0): Call xmallocarray instead of
 
5702
+        xmalloc.
 
5703
+        * intrinsics/eoshift0.c (eoshift0): Likewise.
 
5704
+        * intrinsics/eoshift2.c (eoshift2): Likewise.
 
5705
+        * intrinsics/pack_generic.c (pack_internal): Likewise.
 
5706
+        (pack_s_internal): Likewise.
 
5707
+        * intrinsics/reshape_generic.c (reshape_internal): Likewise.
 
5708
+        * intrinsics/spread_generic.c (spread_internal): Likewise.
 
5709
+        (spread_internal_scalar): Likewise.
 
5710
+        * intrinsics/string_intrinsics_inc.c (string_trim): Likewise.
 
5711
+        (string_minmax): Likewise.
 
5712
+        * intrinsics/transpose_generic.c (transpose_internal): Likewise.
 
5713
+        * intrinsics/unpack_generic.c (unpack_internal): Likewise.
 
5714
+        * io/list_read.c (nml_touch_nodes): Don't cast xmalloc return value.
 
5715
+        * io/transfer.c (st_set_nml_var): Call xmallocarray instead of
 
5716
+        xmalloc.
 
5717
+        * io/unit.c (get_internal_unit): Likewise.
 
5718
+        (filename_from_unit): Don't cast xmalloc return value.
 
5719
+        * io/write.c (nml_write_obj): Likewise, formatting.
 
5720
+        * m4/bessel.m4 (bessel_jn_r'rtype_kind`): Call xmallocarray
 
5721
+        instead of xmalloc.
 
5722
+        (besse_yn_r'rtype_kind`): Likewise.
 
5723
+        * m4/cshift1.m4 (cshift1): Likewise.
 
5724
+        * m4/eoshift1.m4 (eoshift1): Likewise.
 
5725
+        * m4/eoshift3.m4 (eoshift3): Likewise.
 
5726
+        * m4/iforeach.m4: Likewise.
 
5727
+        * m4/ifunction.m4: Likewise.
 
5728
+        * m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code):
 
5729
+        Likewise.
 
5730
+        * m4/in_pack.m4 (internal_pack_'rtype_ccode`): Likewise.
 
5731
+        * m4/matmul.m4 (matmul_'rtype_code`): Likewise.
 
5732
+        * m4/matmull.m4 (matmul_'rtype_code`): Likewise.
 
5733
+        * m4/pack.m4 (pack_'rtype_code`): Likewise.
 
5734
+        * m4/reshape.m4 (reshape_'rtype_ccode`): Likewise.
 
5735
+        * m4/shape.m4 (shape_'rtype_kind`): Likewise.
 
5736
+        * m4/spread.m4 (spread_'rtype_code`): Likewise.
 
5737
+        (spread_scalar_'rtype_code`): Likewise.
 
5738
+        * m4/transpose.m4 (transpose_'rtype_code`): Likewise.
 
5739
+        * m4/unpack.m4 (unpack0_'rtype_code`): Likewise.
 
5740
+        (unpack1_'rtype_code`): Likewise.
 
5741
+        * runtime/convert_char.c (convert_char1_to_char4): Likewise.
 
5742
+        (convert_char4_to_char1): Simplify.
 
5743
+        * runtime/environ.c (init_unformatted): Call xmallocarray instead
 
5744
+        of xmalloc.
 
5745
+        * runtime/in_pack_generic.c (internal_pack): Likewise.
 
5746
+
 
5747
+2014-05-26  Janne Blomqvist  <jb@gcc.gnu.org>
 
5748
+
 
5749
+       Backport from mainline
 
5750
+       PR libfortran/61310
 
5751
+       * intrinsics/ctime.c (strctime): Rename to gf_ctime, use snprintf
 
5752
+       instead of strftime.
 
5753
+       (fdate): Use gf_ctime.
 
5754
+       (fdate_sub): Likewise.
 
5755
+       (ctime): Likewise.
 
5756
+       (ctime_sub): Likewise.
 
5757
+
 
5758
+2014-05-25  Janne Blomqvist  <jb@gcc.gnu.org>
 
5759
+
 
5760
+       Backport from trunk.
 
5761
+       PR libfortran/61187
 
5762
+       * io/unix.c (raw_close): Check if s->fd is -1.
 
5763
+       (fd_to_stream): Check return value of fstat(), handle error.
 
5764
+
 
5765
 2014-05-22  Release Manager
 
5766
 
 
5767
        * GCC 4.8.3 released.
 
5768
Index: libgfortran/generated/spread_r10.c
 
5769
===================================================================
 
5770
--- a/src/libgfortran/generated/spread_r10.c    (.../tags/gcc_4_8_3_release)
 
5771
+++ b/src/libgfortran/generated/spread_r10.c    (.../branches/gcc-4_8-branch)
 
5772
@@ -101,8 +101,8 @@
 
5773
        }
 
5774
       ret->offset = 0;
 
5775
 
 
5776
-      /* xmalloc allocates a single byte for zero size.  */
 
5777
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_10));
 
5778
+      /* xmallocarray allocates a single byte for zero size.  */
 
5779
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_10));
 
5780
       if (rs <= 0)
 
5781
         return;
 
5782
     }
 
5783
@@ -244,7 +244,7 @@
 
5784
 
 
5785
   if (ret->base_addr == NULL)
 
5786
     {
 
5787
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_10));
 
5788
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_10));
 
5789
       ret->offset = 0;
 
5790
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
5791
     }
 
5792
Index: libgfortran/generated/maxloc1_4_r8.c
 
5793
===================================================================
 
5794
--- a/src/libgfortran/generated/maxloc1_4_r8.c  (.../tags/gcc_4_8_3_release)
 
5795
+++ b/src/libgfortran/generated/maxloc1_4_r8.c  (.../branches/gcc-4_8-branch)
 
5796
@@ -98,10 +98,9 @@
 
5797
       retarray->offset = 0;
 
5798
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5799
 
 
5800
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5801
-                  * extent[rank-1];
 
5802
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5803
 
 
5804
-      retarray->base_addr = xmalloc (alloc_size);
 
5805
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
5806
       if (alloc_size == 0)
 
5807
        {
 
5808
          /* Make sure we have a zero-sized array.  */
 
5809
@@ -294,8 +293,7 @@
 
5810
 
 
5811
        }
 
5812
 
 
5813
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5814
-                  * extent[rank-1];
 
5815
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5816
 
 
5817
       retarray->offset = 0;
 
5818
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5819
@@ -307,7 +305,7 @@
 
5820
          return;
 
5821
        }
 
5822
       else
 
5823
-       retarray->base_addr = xmalloc (alloc_size);
 
5824
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
5825
 
 
5826
     }
 
5827
   else
 
5828
@@ -485,8 +483,7 @@
 
5829
       retarray->offset = 0;
 
5830
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5831
 
 
5832
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5833
-                  * extent[rank-1];
 
5834
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5835
 
 
5836
       if (alloc_size == 0)
 
5837
        {
 
5838
@@ -495,7 +492,7 @@
 
5839
          return;
 
5840
        }
 
5841
       else
 
5842
-       retarray->base_addr = xmalloc (alloc_size);
 
5843
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
5844
     }
 
5845
   else
 
5846
     {
 
5847
Index: libgfortran/generated/norm2_r4.c
 
5848
===================================================================
 
5849
--- a/src/libgfortran/generated/norm2_r4.c      (.../tags/gcc_4_8_3_release)
 
5850
+++ b/src/libgfortran/generated/norm2_r4.c      (.../branches/gcc-4_8-branch)
 
5851
@@ -101,10 +101,9 @@
 
5852
       retarray->offset = 0;
 
5853
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5854
 
 
5855
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5856
-                  * extent[rank-1];
 
5857
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5858
 
 
5859
-      retarray->base_addr = xmalloc (alloc_size);
 
5860
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
5861
       if (alloc_size == 0)
 
5862
        {
 
5863
          /* Make sure we have a zero-sized array.  */
 
5864
Index: libgfortran/generated/parity_l2.c
 
5865
===================================================================
 
5866
--- a/src/libgfortran/generated/parity_l2.c     (.../tags/gcc_4_8_3_release)
 
5867
+++ b/src/libgfortran/generated/parity_l2.c     (.../branches/gcc-4_8-branch)
 
5868
@@ -98,10 +98,9 @@
 
5869
       retarray->offset = 0;
 
5870
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5871
 
 
5872
-      alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5873
-                  * extent[rank-1];
 
5874
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5875
 
 
5876
-      retarray->base_addr = xmalloc (alloc_size);
 
5877
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
 
5878
       if (alloc_size == 0)
 
5879
        {
 
5880
          /* Make sure we have a zero-sized array.  */
 
5881
Index: libgfortran/generated/eoshift3_4.c
 
5882
===================================================================
 
5883
--- a/src/libgfortran/generated/eoshift3_4.c    (.../tags/gcc_4_8_3_release)
 
5884
+++ b/src/libgfortran/generated/eoshift3_4.c    (.../branches/gcc-4_8-branch)
 
5885
@@ -89,7 +89,7 @@
 
5886
     {
 
5887
       int i;
 
5888
 
 
5889
-      ret->base_addr = xmalloc (size * arraysize);
 
5890
+      ret->base_addr = xmallocarray (arraysize, size);
 
5891
       ret->offset = 0;
 
5892
       ret->dtype = array->dtype;
 
5893
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
5894
@@ -107,8 +107,8 @@
 
5895
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
5896
 
 
5897
         }
 
5898
-      /* xmalloc allocates a single byte for zero size.  */
 
5899
-      ret->base_addr = xmalloc (size * arraysize);
 
5900
+      /* xmallocarray allocates a single byte for zero size.  */
 
5901
+      ret->base_addr = xmallocarray (arraysize, size);
 
5902
 
 
5903
     }
 
5904
   else if (unlikely (compile_options.bounds_check))
 
5905
Index: libgfortran/generated/transpose_c8.c
 
5906
===================================================================
 
5907
--- a/src/libgfortran/generated/transpose_c8.c  (.../tags/gcc_4_8_3_release)
 
5908
+++ b/src/libgfortran/generated/transpose_c8.c  (.../branches/gcc-4_8-branch)
 
5909
@@ -60,7 +60,8 @@
 
5910
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
5911
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
5912
 
 
5913
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) ret));
 
5914
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
5915
+                                     sizeof (GFC_COMPLEX_8));
 
5916
       ret->offset = 0;
 
5917
     } else if (unlikely (compile_options.bounds_check))
 
5918
     {
 
5919
Index: libgfortran/generated/eoshift1_8.c
 
5920
===================================================================
 
5921
--- a/src/libgfortran/generated/eoshift1_8.c    (.../tags/gcc_4_8_3_release)
 
5922
+++ b/src/libgfortran/generated/eoshift1_8.c    (.../branches/gcc-4_8-branch)
 
5923
@@ -105,8 +105,8 @@
 
5924
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
5925
 
 
5926
         }
 
5927
-      /* xmalloc allocates a single byte for zero size.  */
 
5928
-      ret->base_addr = xmalloc (size * arraysize);
 
5929
+      /* xmallocarray allocates a single byte for zero size.  */
 
5930
+      ret->base_addr = xmallocarray (arraysize, size);
 
5931
 
 
5932
     }
 
5933
   else if (unlikely (compile_options.bounds_check))
 
5934
Index: libgfortran/generated/reshape_r16.c
 
5935
===================================================================
 
5936
--- a/src/libgfortran/generated/reshape_r16.c   (.../tags/gcc_4_8_3_release)
 
5937
+++ b/src/libgfortran/generated/reshape_r16.c   (.../branches/gcc-4_8-branch)
 
5938
@@ -111,11 +111,11 @@
 
5939
       ret->offset = 0;
 
5940
 
 
5941
       if (unlikely (rs < 1))
 
5942
-        alloc_size = 1;
 
5943
+        alloc_size = 0;
 
5944
       else
 
5945
-        alloc_size = rs * sizeof (GFC_REAL_16);
 
5946
+        alloc_size = rs;
 
5947
 
 
5948
-      ret->base_addr = xmalloc (alloc_size);
 
5949
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
5950
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
5951
     }
 
5952
 
 
5953
Index: libgfortran/generated/bessel_r4.c
 
5954
===================================================================
 
5955
--- a/src/libgfortran/generated/bessel_r4.c     (.../tags/gcc_4_8_3_release)
 
5956
+++ b/src/libgfortran/generated/bessel_r4.c     (.../branches/gcc-4_8-branch)
 
5957
@@ -55,7 +55,7 @@
 
5958
     {
 
5959
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
5960
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
5961
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size);
 
5962
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4));
 
5963
       ret->offset = 0;
 
5964
     }
 
5965
 
 
5966
@@ -122,7 +122,7 @@
 
5967
     {
 
5968
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
5969
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
5970
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size);
 
5971
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4));
 
5972
       ret->offset = 0;
 
5973
     }
 
5974
 
 
5975
Index: libgfortran/generated/any_l2.c
 
5976
===================================================================
 
5977
--- a/src/libgfortran/generated/any_l2.c        (.../tags/gcc_4_8_3_release)
 
5978
+++ b/src/libgfortran/generated/any_l2.c        (.../branches/gcc-4_8-branch)
 
5979
@@ -101,8 +101,7 @@
 
5980
       retarray->offset = 0;
 
5981
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
5982
 
 
5983
-      alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
5984
-                  * extent[rank-1];
 
5985
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
5986
 
 
5987
       if (alloc_size == 0)
 
5988
        {
 
5989
@@ -111,7 +110,7 @@
 
5990
          return;
 
5991
        }
 
5992
       else
 
5993
-       retarray->base_addr = xmalloc (alloc_size);
 
5994
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
 
5995
     }
 
5996
   else
 
5997
     {
 
5998
Index: libgfortran/generated/product_r4.c
 
5999
===================================================================
 
6000
--- a/src/libgfortran/generated/product_r4.c    (.../tags/gcc_4_8_3_release)
 
6001
+++ b/src/libgfortran/generated/product_r4.c    (.../branches/gcc-4_8-branch)
 
6002
@@ -97,10 +97,9 @@
 
6003
       retarray->offset = 0;
 
6004
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6005
 
 
6006
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6007
-                  * extent[rank-1];
 
6008
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6009
 
 
6010
-      retarray->base_addr = xmalloc (alloc_size);
 
6011
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
6012
       if (alloc_size == 0)
 
6013
        {
 
6014
          /* Make sure we have a zero-sized array.  */
 
6015
@@ -272,8 +271,7 @@
 
6016
 
 
6017
        }
 
6018
 
 
6019
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6020
-                  * extent[rank-1];
 
6021
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6022
 
 
6023
       retarray->offset = 0;
 
6024
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6025
@@ -285,7 +283,7 @@
 
6026
          return;
 
6027
        }
 
6028
       else
 
6029
-       retarray->base_addr = xmalloc (alloc_size);
 
6030
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
6031
 
 
6032
     }
 
6033
   else
 
6034
@@ -430,8 +428,7 @@
 
6035
       retarray->offset = 0;
 
6036
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6037
 
 
6038
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6039
-                  * extent[rank-1];
 
6040
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6041
 
 
6042
       if (alloc_size == 0)
 
6043
        {
 
6044
@@ -440,7 +437,7 @@
 
6045
          return;
 
6046
        }
 
6047
       else
 
6048
-       retarray->base_addr = xmalloc (alloc_size);
 
6049
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
6050
     }
 
6051
   else
 
6052
     {
 
6053
Index: libgfortran/generated/iany_i1.c
 
6054
===================================================================
 
6055
--- a/src/libgfortran/generated/iany_i1.c       (.../tags/gcc_4_8_3_release)
 
6056
+++ b/src/libgfortran/generated/iany_i1.c       (.../branches/gcc-4_8-branch)
 
6057
@@ -97,10 +97,9 @@
 
6058
       retarray->offset = 0;
 
6059
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6060
 
 
6061
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6062
-                  * extent[rank-1];
 
6063
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6064
 
 
6065
-      retarray->base_addr = xmalloc (alloc_size);
 
6066
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
6067
       if (alloc_size == 0)
 
6068
        {
 
6069
          /* Make sure we have a zero-sized array.  */
 
6070
@@ -272,8 +271,7 @@
 
6071
 
 
6072
        }
 
6073
 
 
6074
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6075
-                  * extent[rank-1];
 
6076
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6077
 
 
6078
       retarray->offset = 0;
 
6079
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6080
@@ -285,7 +283,7 @@
 
6081
          return;
 
6082
        }
 
6083
       else
 
6084
-       retarray->base_addr = xmalloc (alloc_size);
 
6085
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
6086
 
 
6087
     }
 
6088
   else
 
6089
@@ -430,8 +428,7 @@
 
6090
       retarray->offset = 0;
 
6091
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6092
 
 
6093
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6094
-                  * extent[rank-1];
 
6095
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6096
 
 
6097
       if (alloc_size == 0)
 
6098
        {
 
6099
@@ -440,7 +437,7 @@
 
6100
          return;
 
6101
        }
 
6102
       else
 
6103
-       retarray->base_addr = xmalloc (alloc_size);
 
6104
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
6105
     }
 
6106
   else
 
6107
     {
 
6108
Index: libgfortran/generated/parity_l16.c
 
6109
===================================================================
 
6110
--- a/src/libgfortran/generated/parity_l16.c    (.../tags/gcc_4_8_3_release)
 
6111
+++ b/src/libgfortran/generated/parity_l16.c    (.../branches/gcc-4_8-branch)
 
6112
@@ -98,10 +98,9 @@
 
6113
       retarray->offset = 0;
 
6114
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6115
 
 
6116
-      alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6117
-                  * extent[rank-1];
 
6118
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6119
 
 
6120
-      retarray->base_addr = xmalloc (alloc_size);
 
6121
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
 
6122
       if (alloc_size == 0)
 
6123
        {
 
6124
          /* Make sure we have a zero-sized array.  */
 
6125
Index: libgfortran/generated/in_pack_r4.c
 
6126
===================================================================
 
6127
--- a/src/libgfortran/generated/in_pack_r4.c    (.../tags/gcc_4_8_3_release)
 
6128
+++ b/src/libgfortran/generated/in_pack_r4.c    (.../branches/gcc-4_8-branch)
 
6129
@@ -76,7 +76,7 @@
 
6130
     return source->base_addr;
 
6131
 
 
6132
   /* Allocate storage for the destination.  */
 
6133
-  destptr = (GFC_REAL_4 *)xmalloc (ssize * sizeof (GFC_REAL_4));
 
6134
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_4));
 
6135
   dest = destptr;
 
6136
   src = source->base_addr;
 
6137
   stride0 = stride[0];
 
6138
Index: libgfortran/generated/product_i2.c
 
6139
===================================================================
 
6140
--- a/src/libgfortran/generated/product_i2.c    (.../tags/gcc_4_8_3_release)
 
6141
+++ b/src/libgfortran/generated/product_i2.c    (.../branches/gcc-4_8-branch)
 
6142
@@ -97,10 +97,9 @@
 
6143
       retarray->offset = 0;
 
6144
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6145
 
 
6146
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6147
-                  * extent[rank-1];
 
6148
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6149
 
 
6150
-      retarray->base_addr = xmalloc (alloc_size);
 
6151
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
6152
       if (alloc_size == 0)
 
6153
        {
 
6154
          /* Make sure we have a zero-sized array.  */
 
6155
@@ -272,8 +271,7 @@
 
6156
 
 
6157
        }
 
6158
 
 
6159
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6160
-                  * extent[rank-1];
 
6161
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6162
 
 
6163
       retarray->offset = 0;
 
6164
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6165
@@ -285,7 +283,7 @@
 
6166
          return;
 
6167
        }
 
6168
       else
 
6169
-       retarray->base_addr = xmalloc (alloc_size);
 
6170
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
6171
 
 
6172
     }
 
6173
   else
 
6174
@@ -430,8 +428,7 @@
 
6175
       retarray->offset = 0;
 
6176
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6177
 
 
6178
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6179
-                  * extent[rank-1];
 
6180
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6181
 
 
6182
       if (alloc_size == 0)
 
6183
        {
 
6184
@@ -440,7 +437,7 @@
 
6185
          return;
 
6186
        }
 
6187
       else
 
6188
-       retarray->base_addr = xmalloc (alloc_size);
 
6189
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
6190
     }
 
6191
   else
 
6192
     {
 
6193
Index: libgfortran/generated/iparity_i4.c
 
6194
===================================================================
 
6195
--- a/src/libgfortran/generated/iparity_i4.c    (.../tags/gcc_4_8_3_release)
 
6196
+++ b/src/libgfortran/generated/iparity_i4.c    (.../branches/gcc-4_8-branch)
 
6197
@@ -97,10 +97,9 @@
 
6198
       retarray->offset = 0;
 
6199
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6200
 
 
6201
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6202
-                  * extent[rank-1];
 
6203
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6204
 
 
6205
-      retarray->base_addr = xmalloc (alloc_size);
 
6206
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
6207
       if (alloc_size == 0)
 
6208
        {
 
6209
          /* Make sure we have a zero-sized array.  */
 
6210
@@ -272,8 +271,7 @@
 
6211
 
 
6212
        }
 
6213
 
 
6214
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6215
-                  * extent[rank-1];
 
6216
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6217
 
 
6218
       retarray->offset = 0;
 
6219
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6220
@@ -285,7 +283,7 @@
 
6221
          return;
 
6222
        }
 
6223
       else
 
6224
-       retarray->base_addr = xmalloc (alloc_size);
 
6225
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
6226
 
 
6227
     }
 
6228
   else
 
6229
@@ -430,8 +428,7 @@
 
6230
       retarray->offset = 0;
 
6231
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6232
 
 
6233
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6234
-                  * extent[rank-1];
 
6235
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6236
 
 
6237
       if (alloc_size == 0)
 
6238
        {
 
6239
@@ -440,7 +437,7 @@
 
6240
          return;
 
6241
        }
 
6242
       else
 
6243
-       retarray->base_addr = xmalloc (alloc_size);
 
6244
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
6245
     }
 
6246
   else
 
6247
     {
 
6248
Index: libgfortran/generated/minloc0_4_i1.c
 
6249
===================================================================
 
6250
--- a/src/libgfortran/generated/minloc0_4_i1.c  (.../tags/gcc_4_8_3_release)
 
6251
+++ b/src/libgfortran/generated/minloc0_4_i1.c  (.../branches/gcc-4_8-branch)
 
6252
@@ -58,7 +58,7 @@
 
6253
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6254
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6255
       retarray->offset = 0;
 
6256
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6257
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6258
     }
 
6259
   else
 
6260
     {
 
6261
@@ -199,7 +199,7 @@
 
6262
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
6263
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6264
       retarray->offset = 0;
 
6265
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6266
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6267
     }
 
6268
   else
 
6269
     {
 
6270
@@ -367,7 +367,7 @@
 
6271
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6272
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6273
       retarray->offset = 0;
 
6274
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6275
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6276
     }
 
6277
   else if (unlikely (compile_options.bounds_check))
 
6278
     {
 
6279
Index: libgfortran/generated/reshape_c4.c
 
6280
===================================================================
 
6281
--- a/src/libgfortran/generated/reshape_c4.c    (.../tags/gcc_4_8_3_release)
 
6282
+++ b/src/libgfortran/generated/reshape_c4.c    (.../branches/gcc-4_8-branch)
 
6283
@@ -111,11 +111,11 @@
 
6284
       ret->offset = 0;
 
6285
 
 
6286
       if (unlikely (rs < 1))
 
6287
-        alloc_size = 1;
 
6288
+        alloc_size = 0;
 
6289
       else
 
6290
-        alloc_size = rs * sizeof (GFC_COMPLEX_4);
 
6291
+        alloc_size = rs;
 
6292
 
 
6293
-      ret->base_addr = xmalloc (alloc_size);
 
6294
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
6295
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
6296
     }
 
6297
 
 
6298
Index: libgfortran/generated/maxloc0_4_r16.c
 
6299
===================================================================
 
6300
--- a/src/libgfortran/generated/maxloc0_4_r16.c (.../tags/gcc_4_8_3_release)
 
6301
+++ b/src/libgfortran/generated/maxloc0_4_r16.c (.../branches/gcc-4_8-branch)
 
6302
@@ -58,7 +58,7 @@
 
6303
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6304
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6305
       retarray->offset = 0;
 
6306
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6307
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6308
     }
 
6309
   else
 
6310
     {
 
6311
@@ -199,7 +199,7 @@
 
6312
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
6313
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6314
       retarray->offset = 0;
 
6315
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6316
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6317
     }
 
6318
   else
 
6319
     {
 
6320
@@ -367,7 +367,7 @@
 
6321
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6322
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6323
       retarray->offset = 0;
 
6324
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6325
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6326
     }
 
6327
   else if (unlikely (compile_options.bounds_check))
 
6328
     {
 
6329
Index: libgfortran/generated/iall_i8.c
 
6330
===================================================================
 
6331
--- a/src/libgfortran/generated/iall_i8.c       (.../tags/gcc_4_8_3_release)
 
6332
+++ b/src/libgfortran/generated/iall_i8.c       (.../branches/gcc-4_8-branch)
 
6333
@@ -97,10 +97,9 @@
 
6334
       retarray->offset = 0;
 
6335
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6336
 
 
6337
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6338
-                  * extent[rank-1];
 
6339
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6340
 
 
6341
-      retarray->base_addr = xmalloc (alloc_size);
 
6342
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6343
       if (alloc_size == 0)
 
6344
        {
 
6345
          /* Make sure we have a zero-sized array.  */
 
6346
@@ -272,8 +271,7 @@
 
6347
 
 
6348
        }
 
6349
 
 
6350
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6351
-                  * extent[rank-1];
 
6352
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6353
 
 
6354
       retarray->offset = 0;
 
6355
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6356
@@ -285,7 +283,7 @@
 
6357
          return;
 
6358
        }
 
6359
       else
 
6360
-       retarray->base_addr = xmalloc (alloc_size);
 
6361
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6362
 
 
6363
     }
 
6364
   else
 
6365
@@ -430,8 +428,7 @@
 
6366
       retarray->offset = 0;
 
6367
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6368
 
 
6369
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6370
-                  * extent[rank-1];
 
6371
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6372
 
 
6373
       if (alloc_size == 0)
 
6374
        {
 
6375
@@ -440,7 +437,7 @@
 
6376
          return;
 
6377
        }
 
6378
       else
 
6379
-       retarray->base_addr = xmalloc (alloc_size);
 
6380
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6381
     }
 
6382
   else
 
6383
     {
 
6384
Index: libgfortran/generated/maxloc1_8_r16.c
 
6385
===================================================================
 
6386
--- a/src/libgfortran/generated/maxloc1_8_r16.c (.../tags/gcc_4_8_3_release)
 
6387
+++ b/src/libgfortran/generated/maxloc1_8_r16.c (.../branches/gcc-4_8-branch)
 
6388
@@ -98,10 +98,9 @@
 
6389
       retarray->offset = 0;
 
6390
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6391
 
 
6392
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6393
-                  * extent[rank-1];
 
6394
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6395
 
 
6396
-      retarray->base_addr = xmalloc (alloc_size);
 
6397
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6398
       if (alloc_size == 0)
 
6399
        {
 
6400
          /* Make sure we have a zero-sized array.  */
 
6401
@@ -294,8 +293,7 @@
 
6402
 
 
6403
        }
 
6404
 
 
6405
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6406
-                  * extent[rank-1];
 
6407
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6408
 
 
6409
       retarray->offset = 0;
 
6410
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6411
@@ -307,7 +305,7 @@
 
6412
          return;
 
6413
        }
 
6414
       else
 
6415
-       retarray->base_addr = xmalloc (alloc_size);
 
6416
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6417
 
 
6418
     }
 
6419
   else
 
6420
@@ -485,8 +483,7 @@
 
6421
       retarray->offset = 0;
 
6422
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6423
 
 
6424
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6425
-                  * extent[rank-1];
 
6426
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6427
 
 
6428
       if (alloc_size == 0)
 
6429
        {
 
6430
@@ -495,7 +492,7 @@
 
6431
          return;
 
6432
        }
 
6433
       else
 
6434
-       retarray->base_addr = xmalloc (alloc_size);
 
6435
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6436
     }
 
6437
   else
 
6438
     {
 
6439
Index: libgfortran/generated/sum_r16.c
 
6440
===================================================================
 
6441
--- a/src/libgfortran/generated/sum_r16.c       (.../tags/gcc_4_8_3_release)
 
6442
+++ b/src/libgfortran/generated/sum_r16.c       (.../branches/gcc-4_8-branch)
 
6443
@@ -97,10 +97,9 @@
 
6444
       retarray->offset = 0;
 
6445
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6446
 
 
6447
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6448
-                  * extent[rank-1];
 
6449
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6450
 
 
6451
-      retarray->base_addr = xmalloc (alloc_size);
 
6452
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
6453
       if (alloc_size == 0)
 
6454
        {
 
6455
          /* Make sure we have a zero-sized array.  */
 
6456
@@ -272,8 +271,7 @@
 
6457
 
 
6458
        }
 
6459
 
 
6460
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6461
-                  * extent[rank-1];
 
6462
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6463
 
 
6464
       retarray->offset = 0;
 
6465
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6466
@@ -285,7 +283,7 @@
 
6467
          return;
 
6468
        }
 
6469
       else
 
6470
-       retarray->base_addr = xmalloc (alloc_size);
 
6471
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
6472
 
 
6473
     }
 
6474
   else
 
6475
@@ -430,8 +428,7 @@
 
6476
       retarray->offset = 0;
 
6477
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6478
 
 
6479
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6480
-                  * extent[rank-1];
 
6481
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6482
 
 
6483
       if (alloc_size == 0)
 
6484
        {
 
6485
@@ -440,7 +437,7 @@
 
6486
          return;
 
6487
        }
 
6488
       else
 
6489
-       retarray->base_addr = xmalloc (alloc_size);
 
6490
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
6491
     }
 
6492
   else
 
6493
     {
 
6494
Index: libgfortran/generated/sum_i1.c
 
6495
===================================================================
 
6496
--- a/src/libgfortran/generated/sum_i1.c        (.../tags/gcc_4_8_3_release)
 
6497
+++ b/src/libgfortran/generated/sum_i1.c        (.../branches/gcc-4_8-branch)
 
6498
@@ -97,10 +97,9 @@
 
6499
       retarray->offset = 0;
 
6500
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6501
 
 
6502
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6503
-                  * extent[rank-1];
 
6504
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6505
 
 
6506
-      retarray->base_addr = xmalloc (alloc_size);
 
6507
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
6508
       if (alloc_size == 0)
 
6509
        {
 
6510
          /* Make sure we have a zero-sized array.  */
 
6511
@@ -272,8 +271,7 @@
 
6512
 
 
6513
        }
 
6514
 
 
6515
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6516
-                  * extent[rank-1];
 
6517
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6518
 
 
6519
       retarray->offset = 0;
 
6520
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6521
@@ -285,7 +283,7 @@
 
6522
          return;
 
6523
        }
 
6524
       else
 
6525
-       retarray->base_addr = xmalloc (alloc_size);
 
6526
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
6527
 
 
6528
     }
 
6529
   else
 
6530
@@ -430,8 +428,7 @@
 
6531
       retarray->offset = 0;
 
6532
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6533
 
 
6534
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6535
-                  * extent[rank-1];
 
6536
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6537
 
 
6538
       if (alloc_size == 0)
 
6539
        {
 
6540
@@ -440,7 +437,7 @@
 
6541
          return;
 
6542
        }
 
6543
       else
 
6544
-       retarray->base_addr = xmalloc (alloc_size);
 
6545
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
6546
     }
 
6547
   else
 
6548
     {
 
6549
Index: libgfortran/generated/in_pack_i2.c
 
6550
===================================================================
 
6551
--- a/src/libgfortran/generated/in_pack_i2.c    (.../tags/gcc_4_8_3_release)
 
6552
+++ b/src/libgfortran/generated/in_pack_i2.c    (.../branches/gcc-4_8-branch)
 
6553
@@ -76,7 +76,7 @@
 
6554
     return source->base_addr;
 
6555
 
 
6556
   /* Allocate storage for the destination.  */
 
6557
-  destptr = (GFC_INTEGER_2 *)xmalloc (ssize * sizeof (GFC_INTEGER_2));
 
6558
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_2));
 
6559
   dest = destptr;
 
6560
   src = source->base_addr;
 
6561
   stride0 = stride[0];
 
6562
Index: libgfortran/generated/transpose_r10.c
 
6563
===================================================================
 
6564
--- a/src/libgfortran/generated/transpose_r10.c (.../tags/gcc_4_8_3_release)
 
6565
+++ b/src/libgfortran/generated/transpose_r10.c (.../branches/gcc-4_8-branch)
 
6566
@@ -60,7 +60,8 @@
 
6567
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
6568
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
6569
 
 
6570
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) ret));
 
6571
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
6572
+                                     sizeof (GFC_REAL_10));
 
6573
       ret->offset = 0;
 
6574
     } else if (unlikely (compile_options.bounds_check))
 
6575
     {
 
6576
Index: libgfortran/generated/maxloc1_16_r16.c
 
6577
===================================================================
 
6578
--- a/src/libgfortran/generated/maxloc1_16_r16.c        (.../tags/gcc_4_8_3_release)
 
6579
+++ b/src/libgfortran/generated/maxloc1_16_r16.c        (.../branches/gcc-4_8-branch)
 
6580
@@ -98,10 +98,9 @@
 
6581
       retarray->offset = 0;
 
6582
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6583
 
 
6584
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6585
-                  * extent[rank-1];
 
6586
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6587
 
 
6588
-      retarray->base_addr = xmalloc (alloc_size);
 
6589
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
6590
       if (alloc_size == 0)
 
6591
        {
 
6592
          /* Make sure we have a zero-sized array.  */
 
6593
@@ -294,8 +293,7 @@
 
6594
 
 
6595
        }
 
6596
 
 
6597
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6598
-                  * extent[rank-1];
 
6599
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6600
 
 
6601
       retarray->offset = 0;
 
6602
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6603
@@ -307,7 +305,7 @@
 
6604
          return;
 
6605
        }
 
6606
       else
 
6607
-       retarray->base_addr = xmalloc (alloc_size);
 
6608
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
6609
 
 
6610
     }
 
6611
   else
 
6612
@@ -485,8 +483,7 @@
 
6613
       retarray->offset = 0;
 
6614
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6615
 
 
6616
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6617
-                  * extent[rank-1];
 
6618
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6619
 
 
6620
       if (alloc_size == 0)
 
6621
        {
 
6622
@@ -495,7 +492,7 @@
 
6623
          return;
 
6624
        }
 
6625
       else
 
6626
-       retarray->base_addr = xmalloc (alloc_size);
 
6627
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
6628
     }
 
6629
   else
 
6630
     {
 
6631
Index: libgfortran/generated/maxloc1_16_i4.c
 
6632
===================================================================
 
6633
--- a/src/libgfortran/generated/maxloc1_16_i4.c (.../tags/gcc_4_8_3_release)
 
6634
+++ b/src/libgfortran/generated/maxloc1_16_i4.c (.../branches/gcc-4_8-branch)
 
6635
@@ -98,10 +98,9 @@
 
6636
       retarray->offset = 0;
 
6637
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6638
 
 
6639
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6640
-                  * extent[rank-1];
 
6641
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6642
 
 
6643
-      retarray->base_addr = xmalloc (alloc_size);
 
6644
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
6645
       if (alloc_size == 0)
 
6646
        {
 
6647
          /* Make sure we have a zero-sized array.  */
 
6648
@@ -294,8 +293,7 @@
 
6649
 
 
6650
        }
 
6651
 
 
6652
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6653
-                  * extent[rank-1];
 
6654
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6655
 
 
6656
       retarray->offset = 0;
 
6657
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6658
@@ -307,7 +305,7 @@
 
6659
          return;
 
6660
        }
 
6661
       else
 
6662
-       retarray->base_addr = xmalloc (alloc_size);
 
6663
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
6664
 
 
6665
     }
 
6666
   else
 
6667
@@ -485,8 +483,7 @@
 
6668
       retarray->offset = 0;
 
6669
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6670
 
 
6671
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6672
-                  * extent[rank-1];
 
6673
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6674
 
 
6675
       if (alloc_size == 0)
 
6676
        {
 
6677
@@ -495,7 +492,7 @@
 
6678
          return;
 
6679
        }
 
6680
       else
 
6681
-       retarray->base_addr = xmalloc (alloc_size);
 
6682
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
6683
     }
 
6684
   else
 
6685
     {
 
6686
Index: libgfortran/generated/spread_i1.c
 
6687
===================================================================
 
6688
--- a/src/libgfortran/generated/spread_i1.c     (.../tags/gcc_4_8_3_release)
 
6689
+++ b/src/libgfortran/generated/spread_i1.c     (.../branches/gcc-4_8-branch)
 
6690
@@ -101,8 +101,8 @@
 
6691
        }
 
6692
       ret->offset = 0;
 
6693
 
 
6694
-      /* xmalloc allocates a single byte for zero size.  */
 
6695
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_1));
 
6696
+      /* xmallocarray allocates a single byte for zero size.  */
 
6697
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_1));
 
6698
       if (rs <= 0)
 
6699
         return;
 
6700
     }
 
6701
@@ -244,7 +244,7 @@
 
6702
 
 
6703
   if (ret->base_addr == NULL)
 
6704
     {
 
6705
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_1));
 
6706
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_1));
 
6707
       ret->offset = 0;
 
6708
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
6709
     }
 
6710
Index: libgfortran/generated/maxloc0_16_i8.c
 
6711
===================================================================
 
6712
--- a/src/libgfortran/generated/maxloc0_16_i8.c (.../tags/gcc_4_8_3_release)
 
6713
+++ b/src/libgfortran/generated/maxloc0_16_i8.c (.../branches/gcc-4_8-branch)
 
6714
@@ -58,7 +58,7 @@
 
6715
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6716
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6717
       retarray->offset = 0;
 
6718
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
6719
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
6720
     }
 
6721
   else
 
6722
     {
 
6723
@@ -199,7 +199,7 @@
 
6724
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
6725
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6726
       retarray->offset = 0;
 
6727
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
6728
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
6729
     }
 
6730
   else
 
6731
     {
 
6732
@@ -367,7 +367,7 @@
 
6733
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6734
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6735
       retarray->offset = 0;
 
6736
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
6737
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
6738
     }
 
6739
   else if (unlikely (compile_options.bounds_check))
 
6740
     {
 
6741
Index: libgfortran/generated/maxval_r16.c
 
6742
===================================================================
 
6743
--- a/src/libgfortran/generated/maxval_r16.c    (.../tags/gcc_4_8_3_release)
 
6744
+++ b/src/libgfortran/generated/maxval_r16.c    (.../branches/gcc-4_8-branch)
 
6745
@@ -97,10 +97,9 @@
 
6746
       retarray->offset = 0;
 
6747
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6748
 
 
6749
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6750
-                  * extent[rank-1];
 
6751
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6752
 
 
6753
-      retarray->base_addr = xmalloc (alloc_size);
 
6754
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
6755
       if (alloc_size == 0)
 
6756
        {
 
6757
          /* Make sure we have a zero-sized array.  */
 
6758
@@ -286,8 +285,7 @@
 
6759
 
 
6760
        }
 
6761
 
 
6762
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6763
-                  * extent[rank-1];
 
6764
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6765
 
 
6766
       retarray->offset = 0;
 
6767
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6768
@@ -299,7 +297,7 @@
 
6769
          return;
 
6770
        }
 
6771
       else
 
6772
-       retarray->base_addr = xmalloc (alloc_size);
 
6773
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
6774
 
 
6775
     }
 
6776
   else
 
6777
@@ -472,8 +470,7 @@
 
6778
       retarray->offset = 0;
 
6779
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6780
 
 
6781
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6782
-                  * extent[rank-1];
 
6783
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6784
 
 
6785
       if (alloc_size == 0)
 
6786
        {
 
6787
@@ -482,7 +479,7 @@
 
6788
          return;
 
6789
        }
 
6790
       else
 
6791
-       retarray->base_addr = xmalloc (alloc_size);
 
6792
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
6793
     }
 
6794
   else
 
6795
     {
 
6796
Index: libgfortran/generated/product_c10.c
 
6797
===================================================================
 
6798
--- a/src/libgfortran/generated/product_c10.c   (.../tags/gcc_4_8_3_release)
 
6799
+++ b/src/libgfortran/generated/product_c10.c   (.../branches/gcc-4_8-branch)
 
6800
@@ -97,10 +97,9 @@
 
6801
       retarray->offset = 0;
 
6802
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6803
 
 
6804
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6805
-                  * extent[rank-1];
 
6806
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6807
 
 
6808
-      retarray->base_addr = xmalloc (alloc_size);
 
6809
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
6810
       if (alloc_size == 0)
 
6811
        {
 
6812
          /* Make sure we have a zero-sized array.  */
 
6813
@@ -272,8 +271,7 @@
 
6814
 
 
6815
        }
 
6816
 
 
6817
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6818
-                  * extent[rank-1];
 
6819
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6820
 
 
6821
       retarray->offset = 0;
 
6822
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6823
@@ -285,7 +283,7 @@
 
6824
          return;
 
6825
        }
 
6826
       else
 
6827
-       retarray->base_addr = xmalloc (alloc_size);
 
6828
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
6829
 
 
6830
     }
 
6831
   else
 
6832
@@ -430,8 +428,7 @@
 
6833
       retarray->offset = 0;
 
6834
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6835
 
 
6836
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6837
-                  * extent[rank-1];
 
6838
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6839
 
 
6840
       if (alloc_size == 0)
 
6841
        {
 
6842
@@ -440,7 +437,7 @@
 
6843
          return;
 
6844
        }
 
6845
       else
 
6846
-       retarray->base_addr = xmalloc (alloc_size);
 
6847
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
6848
     }
 
6849
   else
 
6850
     {
 
6851
Index: libgfortran/generated/minloc1_8_i4.c
 
6852
===================================================================
 
6853
--- a/src/libgfortran/generated/minloc1_8_i4.c  (.../tags/gcc_4_8_3_release)
 
6854
+++ b/src/libgfortran/generated/minloc1_8_i4.c  (.../branches/gcc-4_8-branch)
 
6855
@@ -98,10 +98,9 @@
 
6856
       retarray->offset = 0;
 
6857
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6858
 
 
6859
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6860
-                  * extent[rank-1];
 
6861
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6862
 
 
6863
-      retarray->base_addr = xmalloc (alloc_size);
 
6864
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6865
       if (alloc_size == 0)
 
6866
        {
 
6867
          /* Make sure we have a zero-sized array.  */
 
6868
@@ -294,8 +293,7 @@
 
6869
 
 
6870
        }
 
6871
 
 
6872
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6873
-                  * extent[rank-1];
 
6874
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6875
 
 
6876
       retarray->offset = 0;
 
6877
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6878
@@ -307,7 +305,7 @@
 
6879
          return;
 
6880
        }
 
6881
       else
 
6882
-       retarray->base_addr = xmalloc (alloc_size);
 
6883
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6884
 
 
6885
     }
 
6886
   else
 
6887
@@ -485,8 +483,7 @@
 
6888
       retarray->offset = 0;
 
6889
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6890
 
 
6891
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6892
-                  * extent[rank-1];
 
6893
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6894
 
 
6895
       if (alloc_size == 0)
 
6896
        {
 
6897
@@ -495,7 +492,7 @@
 
6898
          return;
 
6899
        }
 
6900
       else
 
6901
-       retarray->base_addr = xmalloc (alloc_size);
 
6902
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
6903
     }
 
6904
   else
 
6905
     {
 
6906
Index: libgfortran/generated/minloc0_16_i16.c
 
6907
===================================================================
 
6908
--- a/src/libgfortran/generated/minloc0_16_i16.c        (.../tags/gcc_4_8_3_release)
 
6909
+++ b/src/libgfortran/generated/minloc0_16_i16.c        (.../branches/gcc-4_8-branch)
 
6910
@@ -58,7 +58,7 @@
 
6911
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6912
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6913
       retarray->offset = 0;
 
6914
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
6915
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
6916
     }
 
6917
   else
 
6918
     {
 
6919
@@ -199,7 +199,7 @@
 
6920
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
6921
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6922
       retarray->offset = 0;
 
6923
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
6924
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
6925
     }
 
6926
   else
 
6927
     {
 
6928
@@ -367,7 +367,7 @@
 
6929
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6930
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6931
       retarray->offset = 0;
 
6932
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
6933
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
6934
     }
 
6935
   else if (unlikely (compile_options.bounds_check))
 
6936
     {
 
6937
Index: libgfortran/generated/matmul_r16.c
 
6938
===================================================================
 
6939
--- a/src/libgfortran/generated/matmul_r16.c    (.../tags/gcc_4_8_3_release)
 
6940
+++ b/src/libgfortran/generated/matmul_r16.c    (.../branches/gcc-4_8-branch)
 
6941
@@ -124,7 +124,7 @@
 
6942
         }
 
6943
 
 
6944
       retarray->base_addr
 
6945
-       = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) retarray));
 
6946
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_16));
 
6947
       retarray->offset = 0;
 
6948
     }
 
6949
     else if (unlikely (compile_options.bounds_check))
 
6950
Index: libgfortran/generated/minloc0_4_r4.c
 
6951
===================================================================
 
6952
--- a/src/libgfortran/generated/minloc0_4_r4.c  (.../tags/gcc_4_8_3_release)
 
6953
+++ b/src/libgfortran/generated/minloc0_4_r4.c  (.../branches/gcc-4_8-branch)
 
6954
@@ -58,7 +58,7 @@
 
6955
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6956
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6957
       retarray->offset = 0;
 
6958
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6959
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6960
     }
 
6961
   else
 
6962
     {
 
6963
@@ -199,7 +199,7 @@
 
6964
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
6965
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6966
       retarray->offset = 0;
 
6967
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6968
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6969
     }
 
6970
   else
 
6971
     {
 
6972
@@ -367,7 +367,7 @@
 
6973
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
6974
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
6975
       retarray->offset = 0;
 
6976
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
6977
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
6978
     }
 
6979
   else if (unlikely (compile_options.bounds_check))
 
6980
     {
 
6981
Index: libgfortran/generated/iany_i2.c
 
6982
===================================================================
 
6983
--- a/src/libgfortran/generated/iany_i2.c       (.../tags/gcc_4_8_3_release)
 
6984
+++ b/src/libgfortran/generated/iany_i2.c       (.../branches/gcc-4_8-branch)
 
6985
@@ -97,10 +97,9 @@
 
6986
       retarray->offset = 0;
 
6987
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
6988
 
 
6989
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
6990
-                  * extent[rank-1];
 
6991
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
6992
 
 
6993
-      retarray->base_addr = xmalloc (alloc_size);
 
6994
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
6995
       if (alloc_size == 0)
 
6996
        {
 
6997
          /* Make sure we have a zero-sized array.  */
 
6998
@@ -272,8 +271,7 @@
 
6999
 
 
7000
        }
 
7001
 
 
7002
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7003
-                  * extent[rank-1];
 
7004
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7005
 
 
7006
       retarray->offset = 0;
 
7007
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7008
@@ -285,7 +283,7 @@
 
7009
          return;
 
7010
        }
 
7011
       else
 
7012
-       retarray->base_addr = xmalloc (alloc_size);
 
7013
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
7014
 
 
7015
     }
 
7016
   else
 
7017
@@ -430,8 +428,7 @@
 
7018
       retarray->offset = 0;
 
7019
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7020
 
 
7021
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7022
-                  * extent[rank-1];
 
7023
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7024
 
 
7025
       if (alloc_size == 0)
 
7026
        {
 
7027
@@ -440,7 +437,7 @@
 
7028
          return;
 
7029
        }
 
7030
       else
 
7031
-       retarray->base_addr = xmalloc (alloc_size);
 
7032
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
7033
     }
 
7034
   else
 
7035
     {
 
7036
Index: libgfortran/generated/sum_r4.c
 
7037
===================================================================
 
7038
--- a/src/libgfortran/generated/sum_r4.c        (.../tags/gcc_4_8_3_release)
 
7039
+++ b/src/libgfortran/generated/sum_r4.c        (.../branches/gcc-4_8-branch)
 
7040
@@ -97,10 +97,9 @@
 
7041
       retarray->offset = 0;
 
7042
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7043
 
 
7044
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7045
-                  * extent[rank-1];
 
7046
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7047
 
 
7048
-      retarray->base_addr = xmalloc (alloc_size);
 
7049
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
7050
       if (alloc_size == 0)
 
7051
        {
 
7052
          /* Make sure we have a zero-sized array.  */
 
7053
@@ -272,8 +271,7 @@
 
7054
 
 
7055
        }
 
7056
 
 
7057
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7058
-                  * extent[rank-1];
 
7059
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7060
 
 
7061
       retarray->offset = 0;
 
7062
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7063
@@ -285,7 +283,7 @@
 
7064
          return;
 
7065
        }
 
7066
       else
 
7067
-       retarray->base_addr = xmalloc (alloc_size);
 
7068
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
7069
 
 
7070
     }
 
7071
   else
 
7072
@@ -430,8 +428,7 @@
 
7073
       retarray->offset = 0;
 
7074
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7075
 
 
7076
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7077
-                  * extent[rank-1];
 
7078
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7079
 
 
7080
       if (alloc_size == 0)
 
7081
        {
 
7082
@@ -440,7 +437,7 @@
 
7083
          return;
 
7084
        }
 
7085
       else
 
7086
-       retarray->base_addr = xmalloc (alloc_size);
 
7087
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
7088
     }
 
7089
   else
 
7090
     {
 
7091
Index: libgfortran/generated/unpack_c8.c
 
7092
===================================================================
 
7093
--- a/src/libgfortran/generated/unpack_c8.c     (.../tags/gcc_4_8_3_release)
 
7094
+++ b/src/libgfortran/generated/unpack_c8.c     (.../branches/gcc-4_8-branch)
 
7095
@@ -99,7 +99,7 @@
 
7096
          rs *= extent[n];
 
7097
        }
 
7098
       ret->offset = 0;
 
7099
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8));
 
7100
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8));
 
7101
     }
 
7102
   else
 
7103
     {
 
7104
@@ -244,7 +244,7 @@
 
7105
          rs *= extent[n];
 
7106
        }
 
7107
       ret->offset = 0;
 
7108
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8));
 
7109
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8));
 
7110
     }
 
7111
   else
 
7112
     {
 
7113
Index: libgfortran/generated/in_pack_c16.c
 
7114
===================================================================
 
7115
--- a/src/libgfortran/generated/in_pack_c16.c   (.../tags/gcc_4_8_3_release)
 
7116
+++ b/src/libgfortran/generated/in_pack_c16.c   (.../branches/gcc-4_8-branch)
 
7117
@@ -76,7 +76,7 @@
 
7118
     return source->base_addr;
 
7119
 
 
7120
   /* Allocate storage for the destination.  */
 
7121
-  destptr = (GFC_COMPLEX_16 *)xmalloc (ssize * sizeof (GFC_COMPLEX_16));
 
7122
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_16));
 
7123
   dest = destptr;
 
7124
   src = source->base_addr;
 
7125
   stride0 = stride[0];
 
7126
Index: libgfortran/generated/minloc0_4_i2.c
 
7127
===================================================================
 
7128
--- a/src/libgfortran/generated/minloc0_4_i2.c  (.../tags/gcc_4_8_3_release)
 
7129
+++ b/src/libgfortran/generated/minloc0_4_i2.c  (.../branches/gcc-4_8-branch)
 
7130
@@ -58,7 +58,7 @@
 
7131
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7132
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7133
       retarray->offset = 0;
 
7134
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
7135
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
7136
     }
 
7137
   else
 
7138
     {
 
7139
@@ -199,7 +199,7 @@
 
7140
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7141
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7142
       retarray->offset = 0;
 
7143
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
7144
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
7145
     }
 
7146
   else
 
7147
     {
 
7148
@@ -367,7 +367,7 @@
 
7149
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7150
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7151
       retarray->offset = 0;
 
7152
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
7153
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
7154
     }
 
7155
   else if (unlikely (compile_options.bounds_check))
 
7156
     {
 
7157
Index: libgfortran/generated/spread_c10.c
 
7158
===================================================================
 
7159
--- a/src/libgfortran/generated/spread_c10.c    (.../tags/gcc_4_8_3_release)
 
7160
+++ b/src/libgfortran/generated/spread_c10.c    (.../branches/gcc-4_8-branch)
 
7161
@@ -101,8 +101,8 @@
 
7162
        }
 
7163
       ret->offset = 0;
 
7164
 
 
7165
-      /* xmalloc allocates a single byte for zero size.  */
 
7166
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_10));
 
7167
+      /* xmallocarray allocates a single byte for zero size.  */
 
7168
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_10));
 
7169
       if (rs <= 0)
 
7170
         return;
 
7171
     }
 
7172
@@ -244,7 +244,7 @@
 
7173
 
 
7174
   if (ret->base_addr == NULL)
 
7175
     {
 
7176
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_10));
 
7177
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_10));
 
7178
       ret->offset = 0;
 
7179
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
7180
     }
 
7181
Index: libgfortran/generated/maxloc0_8_i1.c
 
7182
===================================================================
 
7183
--- a/src/libgfortran/generated/maxloc0_8_i1.c  (.../tags/gcc_4_8_3_release)
 
7184
+++ b/src/libgfortran/generated/maxloc0_8_i1.c  (.../branches/gcc-4_8-branch)
 
7185
@@ -58,7 +58,7 @@
 
7186
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7187
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7188
       retarray->offset = 0;
 
7189
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7190
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7191
     }
 
7192
   else
 
7193
     {
 
7194
@@ -199,7 +199,7 @@
 
7195
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7196
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7197
       retarray->offset = 0;
 
7198
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7199
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7200
     }
 
7201
   else
 
7202
     {
 
7203
@@ -367,7 +367,7 @@
 
7204
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7205
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7206
       retarray->offset = 0;
 
7207
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7208
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7209
     }
 
7210
   else if (unlikely (compile_options.bounds_check))
 
7211
     {
 
7212
Index: libgfortran/generated/spread_r4.c
 
7213
===================================================================
 
7214
--- a/src/libgfortran/generated/spread_r4.c     (.../tags/gcc_4_8_3_release)
 
7215
+++ b/src/libgfortran/generated/spread_r4.c     (.../branches/gcc-4_8-branch)
 
7216
@@ -101,8 +101,8 @@
 
7217
        }
 
7218
       ret->offset = 0;
 
7219
 
 
7220
-      /* xmalloc allocates a single byte for zero size.  */
 
7221
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_4));
 
7222
+      /* xmallocarray allocates a single byte for zero size.  */
 
7223
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_4));
 
7224
       if (rs <= 0)
 
7225
         return;
 
7226
     }
 
7227
@@ -244,7 +244,7 @@
 
7228
 
 
7229
   if (ret->base_addr == NULL)
 
7230
     {
 
7231
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_4));
 
7232
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_4));
 
7233
       ret->offset = 0;
 
7234
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
7235
     }
 
7236
Index: libgfortran/generated/minloc0_8_i8.c
 
7237
===================================================================
 
7238
--- a/src/libgfortran/generated/minloc0_8_i8.c  (.../tags/gcc_4_8_3_release)
 
7239
+++ b/src/libgfortran/generated/minloc0_8_i8.c  (.../branches/gcc-4_8-branch)
 
7240
@@ -58,7 +58,7 @@
 
7241
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7242
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7243
       retarray->offset = 0;
 
7244
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7245
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7246
     }
 
7247
   else
 
7248
     {
 
7249
@@ -199,7 +199,7 @@
 
7250
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7251
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7252
       retarray->offset = 0;
 
7253
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7254
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7255
     }
 
7256
   else
 
7257
     {
 
7258
@@ -367,7 +367,7 @@
 
7259
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7260
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7261
       retarray->offset = 0;
 
7262
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7263
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7264
     }
 
7265
   else if (unlikely (compile_options.bounds_check))
 
7266
     {
 
7267
Index: libgfortran/generated/matmul_c8.c
 
7268
===================================================================
 
7269
--- a/src/libgfortran/generated/matmul_c8.c     (.../tags/gcc_4_8_3_release)
 
7270
+++ b/src/libgfortran/generated/matmul_c8.c     (.../branches/gcc-4_8-branch)
 
7271
@@ -124,7 +124,7 @@
 
7272
         }
 
7273
 
 
7274
       retarray->base_addr
 
7275
-       = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) retarray));
 
7276
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_8));
 
7277
       retarray->offset = 0;
 
7278
     }
 
7279
     else if (unlikely (compile_options.bounds_check))
 
7280
Index: libgfortran/generated/minloc1_16_r10.c
 
7281
===================================================================
 
7282
--- a/src/libgfortran/generated/minloc1_16_r10.c        (.../tags/gcc_4_8_3_release)
 
7283
+++ b/src/libgfortran/generated/minloc1_16_r10.c        (.../branches/gcc-4_8-branch)
 
7284
@@ -98,10 +98,9 @@
 
7285
       retarray->offset = 0;
 
7286
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7287
 
 
7288
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7289
-                  * extent[rank-1];
 
7290
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7291
 
 
7292
-      retarray->base_addr = xmalloc (alloc_size);
 
7293
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
7294
       if (alloc_size == 0)
 
7295
        {
 
7296
          /* Make sure we have a zero-sized array.  */
 
7297
@@ -294,8 +293,7 @@
 
7298
 
 
7299
        }
 
7300
 
 
7301
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7302
-                  * extent[rank-1];
 
7303
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7304
 
 
7305
       retarray->offset = 0;
 
7306
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7307
@@ -307,7 +305,7 @@
 
7308
          return;
 
7309
        }
 
7310
       else
 
7311
-       retarray->base_addr = xmalloc (alloc_size);
 
7312
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
7313
 
 
7314
     }
 
7315
   else
 
7316
@@ -485,8 +483,7 @@
 
7317
       retarray->offset = 0;
 
7318
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7319
 
 
7320
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7321
-                  * extent[rank-1];
 
7322
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7323
 
 
7324
       if (alloc_size == 0)
 
7325
        {
 
7326
@@ -495,7 +492,7 @@
 
7327
          return;
 
7328
        }
 
7329
       else
 
7330
-       retarray->base_addr = xmalloc (alloc_size);
 
7331
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
7332
     }
 
7333
   else
 
7334
     {
 
7335
Index: libgfortran/generated/sum_i2.c
 
7336
===================================================================
 
7337
--- a/src/libgfortran/generated/sum_i2.c        (.../tags/gcc_4_8_3_release)
 
7338
+++ b/src/libgfortran/generated/sum_i2.c        (.../branches/gcc-4_8-branch)
 
7339
@@ -97,10 +97,9 @@
 
7340
       retarray->offset = 0;
 
7341
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7342
 
 
7343
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7344
-                  * extent[rank-1];
 
7345
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7346
 
 
7347
-      retarray->base_addr = xmalloc (alloc_size);
 
7348
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
7349
       if (alloc_size == 0)
 
7350
        {
 
7351
          /* Make sure we have a zero-sized array.  */
 
7352
@@ -272,8 +271,7 @@
 
7353
 
 
7354
        }
 
7355
 
 
7356
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7357
-                  * extent[rank-1];
 
7358
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7359
 
 
7360
       retarray->offset = 0;
 
7361
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7362
@@ -285,7 +283,7 @@
 
7363
          return;
 
7364
        }
 
7365
       else
 
7366
-       retarray->base_addr = xmalloc (alloc_size);
 
7367
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
7368
 
 
7369
     }
 
7370
   else
 
7371
@@ -430,8 +428,7 @@
 
7372
       retarray->offset = 0;
 
7373
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7374
 
 
7375
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7376
-                  * extent[rank-1];
 
7377
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7378
 
 
7379
       if (alloc_size == 0)
 
7380
        {
 
7381
@@ -440,7 +437,7 @@
 
7382
          return;
 
7383
        }
 
7384
       else
 
7385
-       retarray->base_addr = xmalloc (alloc_size);
 
7386
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
7387
     }
 
7388
   else
 
7389
     {
 
7390
Index: libgfortran/generated/iparity_i16.c
 
7391
===================================================================
 
7392
--- a/src/libgfortran/generated/iparity_i16.c   (.../tags/gcc_4_8_3_release)
 
7393
+++ b/src/libgfortran/generated/iparity_i16.c   (.../branches/gcc-4_8-branch)
 
7394
@@ -97,10 +97,9 @@
 
7395
       retarray->offset = 0;
 
7396
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7397
 
 
7398
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7399
-                  * extent[rank-1];
 
7400
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7401
 
 
7402
-      retarray->base_addr = xmalloc (alloc_size);
 
7403
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
7404
       if (alloc_size == 0)
 
7405
        {
 
7406
          /* Make sure we have a zero-sized array.  */
 
7407
@@ -272,8 +271,7 @@
 
7408
 
 
7409
        }
 
7410
 
 
7411
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7412
-                  * extent[rank-1];
 
7413
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7414
 
 
7415
       retarray->offset = 0;
 
7416
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7417
@@ -285,7 +283,7 @@
 
7418
          return;
 
7419
        }
 
7420
       else
 
7421
-       retarray->base_addr = xmalloc (alloc_size);
 
7422
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
7423
 
 
7424
     }
 
7425
   else
 
7426
@@ -430,8 +428,7 @@
 
7427
       retarray->offset = 0;
 
7428
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7429
 
 
7430
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7431
-                  * extent[rank-1];
 
7432
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7433
 
 
7434
       if (alloc_size == 0)
 
7435
        {
 
7436
@@ -440,7 +437,7 @@
 
7437
          return;
 
7438
        }
 
7439
       else
 
7440
-       retarray->base_addr = xmalloc (alloc_size);
 
7441
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
7442
     }
 
7443
   else
 
7444
     {
 
7445
Index: libgfortran/generated/minloc0_16_i1.c
 
7446
===================================================================
 
7447
--- a/src/libgfortran/generated/minloc0_16_i1.c (.../tags/gcc_4_8_3_release)
 
7448
+++ b/src/libgfortran/generated/minloc0_16_i1.c (.../branches/gcc-4_8-branch)
 
7449
@@ -58,7 +58,7 @@
 
7450
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7451
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7452
       retarray->offset = 0;
 
7453
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
7454
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
7455
     }
 
7456
   else
 
7457
     {
 
7458
@@ -199,7 +199,7 @@
 
7459
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7460
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7461
       retarray->offset = 0;
 
7462
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
7463
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
7464
     }
 
7465
   else
 
7466
     {
 
7467
@@ -367,7 +367,7 @@
 
7468
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7469
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7470
       retarray->offset = 0;
 
7471
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
7472
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
7473
     }
 
7474
   else if (unlikely (compile_options.bounds_check))
 
7475
     {
 
7476
Index: libgfortran/generated/reshape_c16.c
 
7477
===================================================================
 
7478
--- a/src/libgfortran/generated/reshape_c16.c   (.../tags/gcc_4_8_3_release)
 
7479
+++ b/src/libgfortran/generated/reshape_c16.c   (.../branches/gcc-4_8-branch)
 
7480
@@ -111,11 +111,11 @@
 
7481
       ret->offset = 0;
 
7482
 
 
7483
       if (unlikely (rs < 1))
 
7484
-        alloc_size = 1;
 
7485
+        alloc_size = 0;
 
7486
       else
 
7487
-        alloc_size = rs * sizeof (GFC_COMPLEX_16);
 
7488
+        alloc_size = rs;
 
7489
 
 
7490
-      ret->base_addr = xmalloc (alloc_size);
 
7491
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
7492
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
7493
     }
 
7494
 
 
7495
Index: libgfortran/generated/pack_c4.c
 
7496
===================================================================
 
7497
--- a/src/libgfortran/generated/pack_c4.c       (.../tags/gcc_4_8_3_release)
 
7498
+++ b/src/libgfortran/generated/pack_c4.c       (.../branches/gcc-4_8-branch)
 
7499
@@ -167,8 +167,8 @@
 
7500
 
 
7501
          ret->offset = 0;
 
7502
 
 
7503
-         /* xmalloc allocates a single byte for zero size.  */
 
7504
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * total);
 
7505
+         /* xmallocarray allocates a single byte for zero size.  */
 
7506
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_4));
 
7507
 
 
7508
          if (total == 0)
 
7509
            return;
 
7510
Index: libgfortran/generated/parity_l4.c
 
7511
===================================================================
 
7512
--- a/src/libgfortran/generated/parity_l4.c     (.../tags/gcc_4_8_3_release)
 
7513
+++ b/src/libgfortran/generated/parity_l4.c     (.../branches/gcc-4_8-branch)
 
7514
@@ -98,10 +98,9 @@
 
7515
       retarray->offset = 0;
 
7516
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7517
 
 
7518
-      alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7519
-                  * extent[rank-1];
 
7520
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7521
 
 
7522
-      retarray->base_addr = xmalloc (alloc_size);
 
7523
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
 
7524
       if (alloc_size == 0)
 
7525
        {
 
7526
          /* Make sure we have a zero-sized array.  */
 
7527
Index: libgfortran/generated/spread_i2.c
 
7528
===================================================================
 
7529
--- a/src/libgfortran/generated/spread_i2.c     (.../tags/gcc_4_8_3_release)
 
7530
+++ b/src/libgfortran/generated/spread_i2.c     (.../branches/gcc-4_8-branch)
 
7531
@@ -101,8 +101,8 @@
 
7532
        }
 
7533
       ret->offset = 0;
 
7534
 
 
7535
-      /* xmalloc allocates a single byte for zero size.  */
 
7536
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_2));
 
7537
+      /* xmallocarray allocates a single byte for zero size.  */
 
7538
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_2));
 
7539
       if (rs <= 0)
 
7540
         return;
 
7541
     }
 
7542
@@ -244,7 +244,7 @@
 
7543
 
 
7544
   if (ret->base_addr == NULL)
 
7545
     {
 
7546
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_2));
 
7547
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_2));
 
7548
       ret->offset = 0;
 
7549
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
7550
     }
 
7551
Index: libgfortran/generated/any_l4.c
 
7552
===================================================================
 
7553
--- a/src/libgfortran/generated/any_l4.c        (.../tags/gcc_4_8_3_release)
 
7554
+++ b/src/libgfortran/generated/any_l4.c        (.../branches/gcc-4_8-branch)
 
7555
@@ -101,8 +101,7 @@
 
7556
       retarray->offset = 0;
 
7557
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7558
 
 
7559
-      alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7560
-                  * extent[rank-1];
 
7561
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7562
 
 
7563
       if (alloc_size == 0)
 
7564
        {
 
7565
@@ -111,7 +110,7 @@
 
7566
          return;
 
7567
        }
 
7568
       else
 
7569
-       retarray->base_addr = xmalloc (alloc_size);
 
7570
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
 
7571
     }
 
7572
   else
 
7573
     {
 
7574
Index: libgfortran/generated/maxloc1_4_i8.c
 
7575
===================================================================
 
7576
--- a/src/libgfortran/generated/maxloc1_4_i8.c  (.../tags/gcc_4_8_3_release)
 
7577
+++ b/src/libgfortran/generated/maxloc1_4_i8.c  (.../branches/gcc-4_8-branch)
 
7578
@@ -98,10 +98,9 @@
 
7579
       retarray->offset = 0;
 
7580
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7581
 
 
7582
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7583
-                  * extent[rank-1];
 
7584
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7585
 
 
7586
-      retarray->base_addr = xmalloc (alloc_size);
 
7587
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7588
       if (alloc_size == 0)
 
7589
        {
 
7590
          /* Make sure we have a zero-sized array.  */
 
7591
@@ -294,8 +293,7 @@
 
7592
 
 
7593
        }
 
7594
 
 
7595
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7596
-                  * extent[rank-1];
 
7597
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7598
 
 
7599
       retarray->offset = 0;
 
7600
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7601
@@ -307,7 +305,7 @@
 
7602
          return;
 
7603
        }
 
7604
       else
 
7605
-       retarray->base_addr = xmalloc (alloc_size);
 
7606
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7607
 
 
7608
     }
 
7609
   else
 
7610
@@ -485,8 +483,7 @@
 
7611
       retarray->offset = 0;
 
7612
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7613
 
 
7614
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7615
-                  * extent[rank-1];
 
7616
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7617
 
 
7618
       if (alloc_size == 0)
 
7619
        {
 
7620
@@ -495,7 +492,7 @@
 
7621
          return;
 
7622
        }
 
7623
       else
 
7624
-       retarray->base_addr = xmalloc (alloc_size);
 
7625
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7626
     }
 
7627
   else
 
7628
     {
 
7629
Index: libgfortran/generated/maxloc0_8_r4.c
 
7630
===================================================================
 
7631
--- a/src/libgfortran/generated/maxloc0_8_r4.c  (.../tags/gcc_4_8_3_release)
 
7632
+++ b/src/libgfortran/generated/maxloc0_8_r4.c  (.../branches/gcc-4_8-branch)
 
7633
@@ -58,7 +58,7 @@
 
7634
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7635
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7636
       retarray->offset = 0;
 
7637
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7638
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7639
     }
 
7640
   else
 
7641
     {
 
7642
@@ -199,7 +199,7 @@
 
7643
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7644
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7645
       retarray->offset = 0;
 
7646
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7647
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7648
     }
 
7649
   else
 
7650
     {
 
7651
@@ -367,7 +367,7 @@
 
7652
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7653
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7654
       retarray->offset = 0;
 
7655
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7656
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7657
     }
 
7658
   else if (unlikely (compile_options.bounds_check))
 
7659
     {
 
7660
Index: libgfortran/generated/maxloc1_4_i16.c
 
7661
===================================================================
 
7662
--- a/src/libgfortran/generated/maxloc1_4_i16.c (.../tags/gcc_4_8_3_release)
 
7663
+++ b/src/libgfortran/generated/maxloc1_4_i16.c (.../branches/gcc-4_8-branch)
 
7664
@@ -98,10 +98,9 @@
 
7665
       retarray->offset = 0;
 
7666
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7667
 
 
7668
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7669
-                  * extent[rank-1];
 
7670
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7671
 
 
7672
-      retarray->base_addr = xmalloc (alloc_size);
 
7673
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7674
       if (alloc_size == 0)
 
7675
        {
 
7676
          /* Make sure we have a zero-sized array.  */
 
7677
@@ -294,8 +293,7 @@
 
7678
 
 
7679
        }
 
7680
 
 
7681
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7682
-                  * extent[rank-1];
 
7683
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7684
 
 
7685
       retarray->offset = 0;
 
7686
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7687
@@ -307,7 +305,7 @@
 
7688
          return;
 
7689
        }
 
7690
       else
 
7691
-       retarray->base_addr = xmalloc (alloc_size);
 
7692
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7693
 
 
7694
     }
 
7695
   else
 
7696
@@ -485,8 +483,7 @@
 
7697
       retarray->offset = 0;
 
7698
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7699
 
 
7700
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7701
-                  * extent[rank-1];
 
7702
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7703
 
 
7704
       if (alloc_size == 0)
 
7705
        {
 
7706
@@ -495,7 +492,7 @@
 
7707
          return;
 
7708
        }
 
7709
       else
 
7710
-       retarray->base_addr = xmalloc (alloc_size);
 
7711
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7712
     }
 
7713
   else
 
7714
     {
 
7715
Index: libgfortran/generated/minloc0_4_r10.c
 
7716
===================================================================
 
7717
--- a/src/libgfortran/generated/minloc0_4_r10.c (.../tags/gcc_4_8_3_release)
 
7718
+++ b/src/libgfortran/generated/minloc0_4_r10.c (.../branches/gcc-4_8-branch)
 
7719
@@ -58,7 +58,7 @@
 
7720
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7721
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7722
       retarray->offset = 0;
 
7723
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
7724
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
7725
     }
 
7726
   else
 
7727
     {
 
7728
@@ -199,7 +199,7 @@
 
7729
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7730
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7731
       retarray->offset = 0;
 
7732
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
7733
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
7734
     }
 
7735
   else
 
7736
     {
 
7737
@@ -367,7 +367,7 @@
 
7738
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7739
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7740
       retarray->offset = 0;
 
7741
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
7742
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
7743
     }
 
7744
   else if (unlikely (compile_options.bounds_check))
 
7745
     {
 
7746
Index: libgfortran/generated/minloc0_8_i16.c
 
7747
===================================================================
 
7748
--- a/src/libgfortran/generated/minloc0_8_i16.c (.../tags/gcc_4_8_3_release)
 
7749
+++ b/src/libgfortran/generated/minloc0_8_i16.c (.../branches/gcc-4_8-branch)
 
7750
@@ -58,7 +58,7 @@
 
7751
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7752
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7753
       retarray->offset = 0;
 
7754
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7755
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7756
     }
 
7757
   else
 
7758
     {
 
7759
@@ -199,7 +199,7 @@
 
7760
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7761
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7762
       retarray->offset = 0;
 
7763
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7764
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7765
     }
 
7766
   else
 
7767
     {
 
7768
@@ -367,7 +367,7 @@
 
7769
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7770
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7771
       retarray->offset = 0;
 
7772
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
7773
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
7774
     }
 
7775
   else if (unlikely (compile_options.bounds_check))
 
7776
     {
 
7777
Index: libgfortran/generated/minloc1_8_r10.c
 
7778
===================================================================
 
7779
--- a/src/libgfortran/generated/minloc1_8_r10.c (.../tags/gcc_4_8_3_release)
 
7780
+++ b/src/libgfortran/generated/minloc1_8_r10.c (.../branches/gcc-4_8-branch)
 
7781
@@ -98,10 +98,9 @@
 
7782
       retarray->offset = 0;
 
7783
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7784
 
 
7785
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7786
-                  * extent[rank-1];
 
7787
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7788
 
 
7789
-      retarray->base_addr = xmalloc (alloc_size);
 
7790
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
7791
       if (alloc_size == 0)
 
7792
        {
 
7793
          /* Make sure we have a zero-sized array.  */
 
7794
@@ -294,8 +293,7 @@
 
7795
 
 
7796
        }
 
7797
 
 
7798
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7799
-                  * extent[rank-1];
 
7800
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7801
 
 
7802
       retarray->offset = 0;
 
7803
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7804
@@ -307,7 +305,7 @@
 
7805
          return;
 
7806
        }
 
7807
       else
 
7808
-       retarray->base_addr = xmalloc (alloc_size);
 
7809
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
7810
 
 
7811
     }
 
7812
   else
 
7813
@@ -485,8 +483,7 @@
 
7814
       retarray->offset = 0;
 
7815
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7816
 
 
7817
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7818
-                  * extent[rank-1];
 
7819
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7820
 
 
7821
       if (alloc_size == 0)
 
7822
        {
 
7823
@@ -495,7 +492,7 @@
 
7824
          return;
 
7825
        }
 
7826
       else
 
7827
-       retarray->base_addr = xmalloc (alloc_size);
 
7828
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
7829
     }
 
7830
   else
 
7831
     {
 
7832
Index: libgfortran/generated/minloc0_16_r4.c
 
7833
===================================================================
 
7834
--- a/src/libgfortran/generated/minloc0_16_r4.c (.../tags/gcc_4_8_3_release)
 
7835
+++ b/src/libgfortran/generated/minloc0_16_r4.c (.../branches/gcc-4_8-branch)
 
7836
@@ -58,7 +58,7 @@
 
7837
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7838
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7839
       retarray->offset = 0;
 
7840
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
7841
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
7842
     }
 
7843
   else
 
7844
     {
 
7845
@@ -199,7 +199,7 @@
 
7846
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
7847
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7848
       retarray->offset = 0;
 
7849
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
7850
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
7851
     }
 
7852
   else
 
7853
     {
 
7854
@@ -367,7 +367,7 @@
 
7855
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
7856
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
7857
       retarray->offset = 0;
 
7858
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
7859
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
7860
     }
 
7861
   else if (unlikely (compile_options.bounds_check))
 
7862
     {
 
7863
Index: libgfortran/generated/product_i4.c
 
7864
===================================================================
 
7865
--- a/src/libgfortran/generated/product_i4.c    (.../tags/gcc_4_8_3_release)
 
7866
+++ b/src/libgfortran/generated/product_i4.c    (.../branches/gcc-4_8-branch)
 
7867
@@ -97,10 +97,9 @@
 
7868
       retarray->offset = 0;
 
7869
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7870
 
 
7871
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7872
-                  * extent[rank-1];
 
7873
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7874
 
 
7875
-      retarray->base_addr = xmalloc (alloc_size);
 
7876
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7877
       if (alloc_size == 0)
 
7878
        {
 
7879
          /* Make sure we have a zero-sized array.  */
 
7880
@@ -272,8 +271,7 @@
 
7881
 
 
7882
        }
 
7883
 
 
7884
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7885
-                  * extent[rank-1];
 
7886
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7887
 
 
7888
       retarray->offset = 0;
 
7889
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7890
@@ -285,7 +283,7 @@
 
7891
          return;
 
7892
        }
 
7893
       else
 
7894
-       retarray->base_addr = xmalloc (alloc_size);
 
7895
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7896
 
 
7897
     }
 
7898
   else
 
7899
@@ -430,8 +428,7 @@
 
7900
       retarray->offset = 0;
 
7901
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7902
 
 
7903
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7904
-                  * extent[rank-1];
 
7905
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7906
 
 
7907
       if (alloc_size == 0)
 
7908
        {
 
7909
@@ -440,7 +437,7 @@
 
7910
          return;
 
7911
        }
 
7912
       else
 
7913
-       retarray->base_addr = xmalloc (alloc_size);
 
7914
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
7915
     }
 
7916
   else
 
7917
     {
 
7918
Index: libgfortran/generated/sum_c16.c
 
7919
===================================================================
 
7920
--- a/src/libgfortran/generated/sum_c16.c       (.../tags/gcc_4_8_3_release)
 
7921
+++ b/src/libgfortran/generated/sum_c16.c       (.../branches/gcc-4_8-branch)
 
7922
@@ -97,10 +97,9 @@
 
7923
       retarray->offset = 0;
 
7924
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7925
 
 
7926
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7927
-                  * extent[rank-1];
 
7928
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7929
 
 
7930
-      retarray->base_addr = xmalloc (alloc_size);
 
7931
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
7932
       if (alloc_size == 0)
 
7933
        {
 
7934
          /* Make sure we have a zero-sized array.  */
 
7935
@@ -272,8 +271,7 @@
 
7936
 
 
7937
        }
 
7938
 
 
7939
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7940
-                  * extent[rank-1];
 
7941
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7942
 
 
7943
       retarray->offset = 0;
 
7944
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7945
@@ -285,7 +283,7 @@
 
7946
          return;
 
7947
        }
 
7948
       else
 
7949
-       retarray->base_addr = xmalloc (alloc_size);
 
7950
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
7951
 
 
7952
     }
 
7953
   else
 
7954
@@ -430,8 +428,7 @@
 
7955
       retarray->offset = 0;
 
7956
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7957
 
 
7958
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7959
-                  * extent[rank-1];
 
7960
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7961
 
 
7962
       if (alloc_size == 0)
 
7963
        {
 
7964
@@ -440,7 +437,7 @@
 
7965
          return;
 
7966
        }
 
7967
       else
 
7968
-       retarray->base_addr = xmalloc (alloc_size);
 
7969
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
7970
     }
 
7971
   else
 
7972
     {
 
7973
Index: libgfortran/generated/transpose_c10.c
 
7974
===================================================================
 
7975
--- a/src/libgfortran/generated/transpose_c10.c (.../tags/gcc_4_8_3_release)
 
7976
+++ b/src/libgfortran/generated/transpose_c10.c (.../branches/gcc-4_8-branch)
 
7977
@@ -60,7 +60,8 @@
 
7978
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
7979
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
7980
 
 
7981
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret));
 
7982
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
7983
+                                     sizeof (GFC_COMPLEX_10));
 
7984
       ret->offset = 0;
 
7985
     } else if (unlikely (compile_options.bounds_check))
 
7986
     {
 
7987
Index: libgfortran/generated/maxloc1_16_r8.c
 
7988
===================================================================
 
7989
--- a/src/libgfortran/generated/maxloc1_16_r8.c (.../tags/gcc_4_8_3_release)
 
7990
+++ b/src/libgfortran/generated/maxloc1_16_r8.c (.../branches/gcc-4_8-branch)
 
7991
@@ -98,10 +98,9 @@
 
7992
       retarray->offset = 0;
 
7993
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
7994
 
 
7995
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
7996
-                  * extent[rank-1];
 
7997
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
7998
 
 
7999
-      retarray->base_addr = xmalloc (alloc_size);
 
8000
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
8001
       if (alloc_size == 0)
 
8002
        {
 
8003
          /* Make sure we have a zero-sized array.  */
 
8004
@@ -294,8 +293,7 @@
 
8005
 
 
8006
        }
 
8007
 
 
8008
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8009
-                  * extent[rank-1];
 
8010
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8011
 
 
8012
       retarray->offset = 0;
 
8013
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8014
@@ -307,7 +305,7 @@
 
8015
          return;
 
8016
        }
 
8017
       else
 
8018
-       retarray->base_addr = xmalloc (alloc_size);
 
8019
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
8020
 
 
8021
     }
 
8022
   else
 
8023
@@ -485,8 +483,7 @@
 
8024
       retarray->offset = 0;
 
8025
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8026
 
 
8027
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8028
-                  * extent[rank-1];
 
8029
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8030
 
 
8031
       if (alloc_size == 0)
 
8032
        {
 
8033
@@ -495,7 +492,7 @@
 
8034
          return;
 
8035
        }
 
8036
       else
 
8037
-       retarray->base_addr = xmalloc (alloc_size);
 
8038
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
8039
     }
 
8040
   else
 
8041
     {
 
8042
Index: libgfortran/generated/transpose_r4.c
 
8043
===================================================================
 
8044
--- a/src/libgfortran/generated/transpose_r4.c  (.../tags/gcc_4_8_3_release)
 
8045
+++ b/src/libgfortran/generated/transpose_r4.c  (.../branches/gcc-4_8-branch)
 
8046
@@ -60,7 +60,8 @@
 
8047
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
8048
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
8049
 
 
8050
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) ret));
 
8051
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
8052
+                                     sizeof (GFC_REAL_4));
 
8053
       ret->offset = 0;
 
8054
     } else if (unlikely (compile_options.bounds_check))
 
8055
     {
 
8056
Index: libgfortran/generated/cshift1_4.c
 
8057
===================================================================
 
8058
--- a/src/libgfortran/generated/cshift1_4.c     (.../tags/gcc_4_8_3_release)
 
8059
+++ b/src/libgfortran/generated/cshift1_4.c     (.../branches/gcc-4_8-branch)
 
8060
@@ -80,7 +80,7 @@
 
8061
     {
 
8062
       int i;
 
8063
 
 
8064
-      ret->base_addr = xmalloc (size * arraysize);
 
8065
+      ret->base_addr = xmallocarray (arraysize, size);
 
8066
       ret->offset = 0;
 
8067
       ret->dtype = array->dtype;
 
8068
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
8069
Index: libgfortran/generated/maxloc0_8_i2.c
 
8070
===================================================================
 
8071
--- a/src/libgfortran/generated/maxloc0_8_i2.c  (.../tags/gcc_4_8_3_release)
 
8072
+++ b/src/libgfortran/generated/maxloc0_8_i2.c  (.../branches/gcc-4_8-branch)
 
8073
@@ -58,7 +58,7 @@
 
8074
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8075
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8076
       retarray->offset = 0;
 
8077
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
8078
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
8079
     }
 
8080
   else
 
8081
     {
 
8082
@@ -199,7 +199,7 @@
 
8083
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
8084
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8085
       retarray->offset = 0;
 
8086
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
8087
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
8088
     }
 
8089
   else
 
8090
     {
 
8091
@@ -367,7 +367,7 @@
 
8092
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8093
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8094
       retarray->offset = 0;
 
8095
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
8096
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
8097
     }
 
8098
   else if (unlikely (compile_options.bounds_check))
 
8099
     {
 
8100
Index: libgfortran/generated/count_8_l.c
 
8101
===================================================================
 
8102
--- a/src/libgfortran/generated/count_8_l.c     (.../tags/gcc_4_8_3_release)
 
8103
+++ b/src/libgfortran/generated/count_8_l.c     (.../branches/gcc-4_8-branch)
 
8104
@@ -101,8 +101,7 @@
 
8105
       retarray->offset = 0;
 
8106
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8107
 
 
8108
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8109
-                  * extent[rank-1];
 
8110
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8111
 
 
8112
       if (alloc_size == 0)
 
8113
        {
 
8114
@@ -111,7 +110,7 @@
 
8115
          return;
 
8116
        }
 
8117
       else
 
8118
-       retarray->base_addr = xmalloc (alloc_size);
 
8119
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
8120
     }
 
8121
   else
 
8122
     {
 
8123
Index: libgfortran/generated/in_pack_i4.c
 
8124
===================================================================
 
8125
--- a/src/libgfortran/generated/in_pack_i4.c    (.../tags/gcc_4_8_3_release)
 
8126
+++ b/src/libgfortran/generated/in_pack_i4.c    (.../branches/gcc-4_8-branch)
 
8127
@@ -76,7 +76,7 @@
 
8128
     return source->base_addr;
 
8129
 
 
8130
   /* Allocate storage for the destination.  */
 
8131
-  destptr = (GFC_INTEGER_4 *)xmalloc (ssize * sizeof (GFC_INTEGER_4));
 
8132
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_4));
 
8133
   dest = destptr;
 
8134
   src = source->base_addr;
 
8135
   stride0 = stride[0];
 
8136
Index: libgfortran/generated/minloc0_16_i2.c
 
8137
===================================================================
 
8138
--- a/src/libgfortran/generated/minloc0_16_i2.c (.../tags/gcc_4_8_3_release)
 
8139
+++ b/src/libgfortran/generated/minloc0_16_i2.c (.../branches/gcc-4_8-branch)
 
8140
@@ -58,7 +58,7 @@
 
8141
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8142
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8143
       retarray->offset = 0;
 
8144
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
8145
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
8146
     }
 
8147
   else
 
8148
     {
 
8149
@@ -199,7 +199,7 @@
 
8150
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
8151
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8152
       retarray->offset = 0;
 
8153
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
8154
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
8155
     }
 
8156
   else
 
8157
     {
 
8158
@@ -367,7 +367,7 @@
 
8159
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8160
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8161
       retarray->offset = 0;
 
8162
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
8163
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
8164
     }
 
8165
   else if (unlikely (compile_options.bounds_check))
 
8166
     {
 
8167
Index: libgfortran/generated/minloc1_8_r8.c
 
8168
===================================================================
 
8169
--- a/src/libgfortran/generated/minloc1_8_r8.c  (.../tags/gcc_4_8_3_release)
 
8170
+++ b/src/libgfortran/generated/minloc1_8_r8.c  (.../branches/gcc-4_8-branch)
 
8171
@@ -98,10 +98,9 @@
 
8172
       retarray->offset = 0;
 
8173
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8174
 
 
8175
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8176
-                  * extent[rank-1];
 
8177
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8178
 
 
8179
-      retarray->base_addr = xmalloc (alloc_size);
 
8180
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
8181
       if (alloc_size == 0)
 
8182
        {
 
8183
          /* Make sure we have a zero-sized array.  */
 
8184
@@ -294,8 +293,7 @@
 
8185
 
 
8186
        }
 
8187
 
 
8188
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8189
-                  * extent[rank-1];
 
8190
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8191
 
 
8192
       retarray->offset = 0;
 
8193
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8194
@@ -307,7 +305,7 @@
 
8195
          return;
 
8196
        }
 
8197
       else
 
8198
-       retarray->base_addr = xmalloc (alloc_size);
 
8199
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
8200
 
 
8201
     }
 
8202
   else
 
8203
@@ -485,8 +483,7 @@
 
8204
       retarray->offset = 0;
 
8205
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8206
 
 
8207
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8208
-                  * extent[rank-1];
 
8209
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8210
 
 
8211
       if (alloc_size == 0)
 
8212
        {
 
8213
@@ -495,7 +492,7 @@
 
8214
          return;
 
8215
        }
 
8216
       else
 
8217
-       retarray->base_addr = xmalloc (alloc_size);
 
8218
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
8219
     }
 
8220
   else
 
8221
     {
 
8222
Index: libgfortran/generated/matmul_c16.c
 
8223
===================================================================
 
8224
--- a/src/libgfortran/generated/matmul_c16.c    (.../tags/gcc_4_8_3_release)
 
8225
+++ b/src/libgfortran/generated/matmul_c16.c    (.../branches/gcc-4_8-branch)
 
8226
@@ -124,7 +124,7 @@
 
8227
         }
 
8228
 
 
8229
       retarray->base_addr
 
8230
-       = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) retarray));
 
8231
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_16));
 
8232
       retarray->offset = 0;
 
8233
     }
 
8234
     else if (unlikely (compile_options.bounds_check))
 
8235
Index: libgfortran/generated/minval_i1.c
 
8236
===================================================================
 
8237
--- a/src/libgfortran/generated/minval_i1.c     (.../tags/gcc_4_8_3_release)
 
8238
+++ b/src/libgfortran/generated/minval_i1.c     (.../branches/gcc-4_8-branch)
 
8239
@@ -97,10 +97,9 @@
 
8240
       retarray->offset = 0;
 
8241
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8242
 
 
8243
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8244
-                  * extent[rank-1];
 
8245
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8246
 
 
8247
-      retarray->base_addr = xmalloc (alloc_size);
 
8248
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
8249
       if (alloc_size == 0)
 
8250
        {
 
8251
          /* Make sure we have a zero-sized array.  */
 
8252
@@ -286,8 +285,7 @@
 
8253
 
 
8254
        }
 
8255
 
 
8256
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8257
-                  * extent[rank-1];
 
8258
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8259
 
 
8260
       retarray->offset = 0;
 
8261
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8262
@@ -299,7 +297,7 @@
 
8263
          return;
 
8264
        }
 
8265
       else
 
8266
-       retarray->base_addr = xmalloc (alloc_size);
 
8267
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
8268
 
 
8269
     }
 
8270
   else
 
8271
@@ -472,8 +470,7 @@
 
8272
       retarray->offset = 0;
 
8273
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8274
 
 
8275
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8276
-                  * extent[rank-1];
 
8277
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8278
 
 
8279
       if (alloc_size == 0)
 
8280
        {
 
8281
@@ -482,7 +479,7 @@
 
8282
          return;
 
8283
        }
 
8284
       else
 
8285
-       retarray->base_addr = xmalloc (alloc_size);
 
8286
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
8287
     }
 
8288
   else
 
8289
     {
 
8290
Index: libgfortran/generated/shape_i16.c
 
8291
===================================================================
 
8292
--- a/src/libgfortran/generated/shape_i16.c     (.../tags/gcc_4_8_3_release)
 
8293
+++ b/src/libgfortran/generated/shape_i16.c     (.../branches/gcc-4_8-branch)
 
8294
@@ -49,7 +49,7 @@
 
8295
     {
 
8296
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
 
8297
       ret->offset = 0;
 
8298
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
8299
+      ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
8300
     }
 
8301
 
 
8302
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
8303
Index: libgfortran/generated/iany_i4.c
 
8304
===================================================================
 
8305
--- a/src/libgfortran/generated/iany_i4.c       (.../tags/gcc_4_8_3_release)
 
8306
+++ b/src/libgfortran/generated/iany_i4.c       (.../branches/gcc-4_8-branch)
 
8307
@@ -97,10 +97,9 @@
 
8308
       retarray->offset = 0;
 
8309
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8310
 
 
8311
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8312
-                  * extent[rank-1];
 
8313
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8314
 
 
8315
-      retarray->base_addr = xmalloc (alloc_size);
 
8316
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8317
       if (alloc_size == 0)
 
8318
        {
 
8319
          /* Make sure we have a zero-sized array.  */
 
8320
@@ -272,8 +271,7 @@
 
8321
 
 
8322
        }
 
8323
 
 
8324
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8325
-                  * extent[rank-1];
 
8326
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8327
 
 
8328
       retarray->offset = 0;
 
8329
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8330
@@ -285,7 +283,7 @@
 
8331
          return;
 
8332
        }
 
8333
       else
 
8334
-       retarray->base_addr = xmalloc (alloc_size);
 
8335
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8336
 
 
8337
     }
 
8338
   else
 
8339
@@ -430,8 +428,7 @@
 
8340
       retarray->offset = 0;
 
8341
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8342
 
 
8343
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8344
-                  * extent[rank-1];
 
8345
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8346
 
 
8347
       if (alloc_size == 0)
 
8348
        {
 
8349
@@ -440,7 +437,7 @@
 
8350
          return;
 
8351
        }
 
8352
       else
 
8353
-       retarray->base_addr = xmalloc (alloc_size);
 
8354
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8355
     }
 
8356
   else
 
8357
     {
 
8358
Index: libgfortran/generated/minloc0_16_r16.c
 
8359
===================================================================
 
8360
--- a/src/libgfortran/generated/minloc0_16_r16.c        (.../tags/gcc_4_8_3_release)
 
8361
+++ b/src/libgfortran/generated/minloc0_16_r16.c        (.../branches/gcc-4_8-branch)
 
8362
@@ -58,7 +58,7 @@
 
8363
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8364
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8365
       retarray->offset = 0;
 
8366
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
8367
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
8368
     }
 
8369
   else
 
8370
     {
 
8371
@@ -199,7 +199,7 @@
 
8372
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
8373
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8374
       retarray->offset = 0;
 
8375
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
8376
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
8377
     }
 
8378
   else
 
8379
     {
 
8380
@@ -367,7 +367,7 @@
 
8381
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8382
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8383
       retarray->offset = 0;
 
8384
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
8385
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
8386
     }
 
8387
   else if (unlikely (compile_options.bounds_check))
 
8388
     {
 
8389
Index: libgfortran/generated/product_i16.c
 
8390
===================================================================
 
8391
--- a/src/libgfortran/generated/product_i16.c   (.../tags/gcc_4_8_3_release)
 
8392
+++ b/src/libgfortran/generated/product_i16.c   (.../branches/gcc-4_8-branch)
 
8393
@@ -97,10 +97,9 @@
 
8394
       retarray->offset = 0;
 
8395
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8396
 
 
8397
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8398
-                  * extent[rank-1];
 
8399
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8400
 
 
8401
-      retarray->base_addr = xmalloc (alloc_size);
 
8402
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
8403
       if (alloc_size == 0)
 
8404
        {
 
8405
          /* Make sure we have a zero-sized array.  */
 
8406
@@ -272,8 +271,7 @@
 
8407
 
 
8408
        }
 
8409
 
 
8410
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8411
-                  * extent[rank-1];
 
8412
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8413
 
 
8414
       retarray->offset = 0;
 
8415
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8416
@@ -285,7 +283,7 @@
 
8417
          return;
 
8418
        }
 
8419
       else
 
8420
-       retarray->base_addr = xmalloc (alloc_size);
 
8421
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
8422
 
 
8423
     }
 
8424
   else
 
8425
@@ -430,8 +428,7 @@
 
8426
       retarray->offset = 0;
 
8427
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8428
 
 
8429
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8430
-                  * extent[rank-1];
 
8431
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8432
 
 
8433
       if (alloc_size == 0)
 
8434
        {
 
8435
@@ -440,7 +437,7 @@
 
8436
          return;
 
8437
        }
 
8438
       else
 
8439
-       retarray->base_addr = xmalloc (alloc_size);
 
8440
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
8441
     }
 
8442
   else
 
8443
     {
 
8444
Index: libgfortran/generated/unpack_i1.c
 
8445
===================================================================
 
8446
--- a/src/libgfortran/generated/unpack_i1.c     (.../tags/gcc_4_8_3_release)
 
8447
+++ b/src/libgfortran/generated/unpack_i1.c     (.../branches/gcc-4_8-branch)
 
8448
@@ -99,7 +99,7 @@
 
8449
          rs *= extent[n];
 
8450
        }
 
8451
       ret->offset = 0;
 
8452
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1));
 
8453
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1));
 
8454
     }
 
8455
   else
 
8456
     {
 
8457
@@ -244,7 +244,7 @@
 
8458
          rs *= extent[n];
 
8459
        }
 
8460
       ret->offset = 0;
 
8461
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1));
 
8462
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1));
 
8463
     }
 
8464
   else
 
8465
     {
 
8466
Index: libgfortran/generated/minloc0_4_i4.c
 
8467
===================================================================
 
8468
--- a/src/libgfortran/generated/minloc0_4_i4.c  (.../tags/gcc_4_8_3_release)
 
8469
+++ b/src/libgfortran/generated/minloc0_4_i4.c  (.../branches/gcc-4_8-branch)
 
8470
@@ -58,7 +58,7 @@
 
8471
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8472
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8473
       retarray->offset = 0;
 
8474
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
8475
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
8476
     }
 
8477
   else
 
8478
     {
 
8479
@@ -199,7 +199,7 @@
 
8480
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
8481
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8482
       retarray->offset = 0;
 
8483
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
8484
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
8485
     }
 
8486
   else
 
8487
     {
 
8488
@@ -367,7 +367,7 @@
 
8489
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
8490
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
8491
       retarray->offset = 0;
 
8492
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
8493
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
8494
     }
 
8495
   else if (unlikely (compile_options.bounds_check))
 
8496
     {
 
8497
Index: libgfortran/generated/matmul_i1.c
 
8498
===================================================================
 
8499
--- a/src/libgfortran/generated/matmul_i1.c     (.../tags/gcc_4_8_3_release)
 
8500
+++ b/src/libgfortran/generated/matmul_i1.c     (.../branches/gcc-4_8-branch)
 
8501
@@ -124,7 +124,7 @@
 
8502
         }
 
8503
 
 
8504
       retarray->base_addr
 
8505
-       = xmalloc (sizeof (GFC_INTEGER_1) * size0 ((array_t *) retarray));
 
8506
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_1));
 
8507
       retarray->offset = 0;
 
8508
     }
 
8509
     else if (unlikely (compile_options.bounds_check))
 
8510
Index: libgfortran/generated/minval_r4.c
 
8511
===================================================================
 
8512
--- a/src/libgfortran/generated/minval_r4.c     (.../tags/gcc_4_8_3_release)
 
8513
+++ b/src/libgfortran/generated/minval_r4.c     (.../branches/gcc-4_8-branch)
 
8514
@@ -97,10 +97,9 @@
 
8515
       retarray->offset = 0;
 
8516
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8517
 
 
8518
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8519
-                  * extent[rank-1];
 
8520
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8521
 
 
8522
-      retarray->base_addr = xmalloc (alloc_size);
 
8523
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
8524
       if (alloc_size == 0)
 
8525
        {
 
8526
          /* Make sure we have a zero-sized array.  */
 
8527
@@ -286,8 +285,7 @@
 
8528
 
 
8529
        }
 
8530
 
 
8531
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8532
-                  * extent[rank-1];
 
8533
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8534
 
 
8535
       retarray->offset = 0;
 
8536
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8537
@@ -299,7 +297,7 @@
 
8538
          return;
 
8539
        }
 
8540
       else
 
8541
-       retarray->base_addr = xmalloc (alloc_size);
 
8542
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
8543
 
 
8544
     }
 
8545
   else
 
8546
@@ -472,8 +470,7 @@
 
8547
       retarray->offset = 0;
 
8548
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8549
 
 
8550
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8551
-                  * extent[rank-1];
 
8552
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8553
 
 
8554
       if (alloc_size == 0)
 
8555
        {
 
8556
@@ -482,7 +479,7 @@
 
8557
          return;
 
8558
        }
 
8559
       else
 
8560
-       retarray->base_addr = xmalloc (alloc_size);
 
8561
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
8562
     }
 
8563
   else
 
8564
     {
 
8565
Index: libgfortran/generated/spread_i16.c
 
8566
===================================================================
 
8567
--- a/src/libgfortran/generated/spread_i16.c    (.../tags/gcc_4_8_3_release)
 
8568
+++ b/src/libgfortran/generated/spread_i16.c    (.../branches/gcc-4_8-branch)
 
8569
@@ -101,8 +101,8 @@
 
8570
        }
 
8571
       ret->offset = 0;
 
8572
 
 
8573
-      /* xmalloc allocates a single byte for zero size.  */
 
8574
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_16));
 
8575
+      /* xmallocarray allocates a single byte for zero size.  */
 
8576
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_16));
 
8577
       if (rs <= 0)
 
8578
         return;
 
8579
     }
 
8580
@@ -244,7 +244,7 @@
 
8581
 
 
8582
   if (ret->base_addr == NULL)
 
8583
     {
 
8584
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_16));
 
8585
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_16));
 
8586
       ret->offset = 0;
 
8587
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
8588
     }
 
8589
Index: libgfortran/generated/sum_i4.c
 
8590
===================================================================
 
8591
--- a/src/libgfortran/generated/sum_i4.c        (.../tags/gcc_4_8_3_release)
 
8592
+++ b/src/libgfortran/generated/sum_i4.c        (.../branches/gcc-4_8-branch)
 
8593
@@ -97,10 +97,9 @@
 
8594
       retarray->offset = 0;
 
8595
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8596
 
 
8597
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8598
-                  * extent[rank-1];
 
8599
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8600
 
 
8601
-      retarray->base_addr = xmalloc (alloc_size);
 
8602
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8603
       if (alloc_size == 0)
 
8604
        {
 
8605
          /* Make sure we have a zero-sized array.  */
 
8606
@@ -272,8 +271,7 @@
 
8607
 
 
8608
        }
 
8609
 
 
8610
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8611
-                  * extent[rank-1];
 
8612
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8613
 
 
8614
       retarray->offset = 0;
 
8615
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8616
@@ -285,7 +283,7 @@
 
8617
          return;
 
8618
        }
 
8619
       else
 
8620
-       retarray->base_addr = xmalloc (alloc_size);
 
8621
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8622
 
 
8623
     }
 
8624
   else
 
8625
@@ -430,8 +428,7 @@
 
8626
       retarray->offset = 0;
 
8627
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8628
 
 
8629
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8630
-                  * extent[rank-1];
 
8631
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8632
 
 
8633
       if (alloc_size == 0)
 
8634
        {
 
8635
@@ -440,7 +437,7 @@
 
8636
          return;
 
8637
        }
 
8638
       else
 
8639
-       retarray->base_addr = xmalloc (alloc_size);
 
8640
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8641
     }
 
8642
   else
 
8643
     {
 
8644
Index: libgfortran/generated/unpack_r10.c
 
8645
===================================================================
 
8646
--- a/src/libgfortran/generated/unpack_r10.c    (.../tags/gcc_4_8_3_release)
 
8647
+++ b/src/libgfortran/generated/unpack_r10.c    (.../branches/gcc-4_8-branch)
 
8648
@@ -99,7 +99,7 @@
 
8649
          rs *= extent[n];
 
8650
        }
 
8651
       ret->offset = 0;
 
8652
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10));
 
8653
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10));
 
8654
     }
 
8655
   else
 
8656
     {
 
8657
@@ -244,7 +244,7 @@
 
8658
          rs *= extent[n];
 
8659
        }
 
8660
       ret->offset = 0;
 
8661
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10));
 
8662
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10));
 
8663
     }
 
8664
   else
 
8665
     {
 
8666
Index: libgfortran/generated/bessel_r16.c
 
8667
===================================================================
 
8668
--- a/src/libgfortran/generated/bessel_r16.c    (.../tags/gcc_4_8_3_release)
 
8669
+++ b/src/libgfortran/generated/bessel_r16.c    (.../branches/gcc-4_8-branch)
 
8670
@@ -59,7 +59,7 @@
 
8671
     {
 
8672
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
8673
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
8674
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size);
 
8675
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16));
 
8676
       ret->offset = 0;
 
8677
     }
 
8678
 
 
8679
@@ -126,7 +126,7 @@
 
8680
     {
 
8681
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
8682
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
8683
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size);
 
8684
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16));
 
8685
       ret->offset = 0;
 
8686
     }
 
8687
 
 
8688
Index: libgfortran/generated/norm2_r8.c
 
8689
===================================================================
 
8690
--- a/src/libgfortran/generated/norm2_r8.c      (.../tags/gcc_4_8_3_release)
 
8691
+++ b/src/libgfortran/generated/norm2_r8.c      (.../branches/gcc-4_8-branch)
 
8692
@@ -101,10 +101,9 @@
 
8693
       retarray->offset = 0;
 
8694
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8695
 
 
8696
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8697
-                  * extent[rank-1];
 
8698
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8699
 
 
8700
-      retarray->base_addr = xmalloc (alloc_size);
 
8701
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
8702
       if (alloc_size == 0)
 
8703
        {
 
8704
          /* Make sure we have a zero-sized array.  */
 
8705
Index: libgfortran/generated/spread_i4.c
 
8706
===================================================================
 
8707
--- a/src/libgfortran/generated/spread_i4.c     (.../tags/gcc_4_8_3_release)
 
8708
+++ b/src/libgfortran/generated/spread_i4.c     (.../branches/gcc-4_8-branch)
 
8709
@@ -101,8 +101,8 @@
 
8710
        }
 
8711
       ret->offset = 0;
 
8712
 
 
8713
-      /* xmalloc allocates a single byte for zero size.  */
 
8714
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_4));
 
8715
+      /* xmallocarray allocates a single byte for zero size.  */
 
8716
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_4));
 
8717
       if (rs <= 0)
 
8718
         return;
 
8719
     }
 
8720
@@ -244,7 +244,7 @@
 
8721
 
 
8722
   if (ret->base_addr == NULL)
 
8723
     {
 
8724
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_4));
 
8725
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_4));
 
8726
       ret->offset = 0;
 
8727
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
8728
     }
 
8729
Index: libgfortran/generated/eoshift3_8.c
 
8730
===================================================================
 
8731
--- a/src/libgfortran/generated/eoshift3_8.c    (.../tags/gcc_4_8_3_release)
 
8732
+++ b/src/libgfortran/generated/eoshift3_8.c    (.../branches/gcc-4_8-branch)
 
8733
@@ -89,7 +89,7 @@
 
8734
     {
 
8735
       int i;
 
8736
 
 
8737
-      ret->base_addr = xmalloc (size * arraysize);
 
8738
+      ret->base_addr = xmallocarray (arraysize, size);
 
8739
       ret->offset = 0;
 
8740
       ret->dtype = array->dtype;
 
8741
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
8742
@@ -107,8 +107,8 @@
 
8743
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
8744
 
 
8745
         }
 
8746
-      /* xmalloc allocates a single byte for zero size.  */
 
8747
-      ret->base_addr = xmalloc (size * arraysize);
 
8748
+      /* xmallocarray allocates a single byte for zero size.  */
 
8749
+      ret->base_addr = xmallocarray (arraysize, size);
 
8750
 
 
8751
     }
 
8752
   else if (unlikely (compile_options.bounds_check))
 
8753
Index: libgfortran/generated/minloc1_4_i1.c
 
8754
===================================================================
 
8755
--- a/src/libgfortran/generated/minloc1_4_i1.c  (.../tags/gcc_4_8_3_release)
 
8756
+++ b/src/libgfortran/generated/minloc1_4_i1.c  (.../branches/gcc-4_8-branch)
 
8757
@@ -98,10 +98,9 @@
 
8758
       retarray->offset = 0;
 
8759
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8760
 
 
8761
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8762
-                  * extent[rank-1];
 
8763
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8764
 
 
8765
-      retarray->base_addr = xmalloc (alloc_size);
 
8766
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8767
       if (alloc_size == 0)
 
8768
        {
 
8769
          /* Make sure we have a zero-sized array.  */
 
8770
@@ -294,8 +293,7 @@
 
8771
 
 
8772
        }
 
8773
 
 
8774
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8775
-                  * extent[rank-1];
 
8776
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8777
 
 
8778
       retarray->offset = 0;
 
8779
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8780
@@ -307,7 +305,7 @@
 
8781
          return;
 
8782
        }
 
8783
       else
 
8784
-       retarray->base_addr = xmalloc (alloc_size);
 
8785
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8786
 
 
8787
     }
 
8788
   else
 
8789
@@ -485,8 +483,7 @@
 
8790
       retarray->offset = 0;
 
8791
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8792
 
 
8793
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8794
-                  * extent[rank-1];
 
8795
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8796
 
 
8797
       if (alloc_size == 0)
 
8798
        {
 
8799
@@ -495,7 +492,7 @@
 
8800
          return;
 
8801
        }
 
8802
       else
 
8803
-       retarray->base_addr = xmalloc (alloc_size);
 
8804
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
8805
     }
 
8806
   else
 
8807
     {
 
8808
Index: libgfortran/generated/minval_i2.c
 
8809
===================================================================
 
8810
--- a/src/libgfortran/generated/minval_i2.c     (.../tags/gcc_4_8_3_release)
 
8811
+++ b/src/libgfortran/generated/minval_i2.c     (.../branches/gcc-4_8-branch)
 
8812
@@ -97,10 +97,9 @@
 
8813
       retarray->offset = 0;
 
8814
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8815
 
 
8816
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8817
-                  * extent[rank-1];
 
8818
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8819
 
 
8820
-      retarray->base_addr = xmalloc (alloc_size);
 
8821
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
8822
       if (alloc_size == 0)
 
8823
        {
 
8824
          /* Make sure we have a zero-sized array.  */
 
8825
@@ -286,8 +285,7 @@
 
8826
 
 
8827
        }
 
8828
 
 
8829
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8830
-                  * extent[rank-1];
 
8831
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8832
 
 
8833
       retarray->offset = 0;
 
8834
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8835
@@ -299,7 +297,7 @@
 
8836
          return;
 
8837
        }
 
8838
       else
 
8839
-       retarray->base_addr = xmalloc (alloc_size);
 
8840
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
8841
 
 
8842
     }
 
8843
   else
 
8844
@@ -472,8 +470,7 @@
 
8845
       retarray->offset = 0;
 
8846
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8847
 
 
8848
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8849
-                  * extent[rank-1];
 
8850
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8851
 
 
8852
       if (alloc_size == 0)
 
8853
        {
 
8854
@@ -482,7 +479,7 @@
 
8855
          return;
 
8856
        }
 
8857
       else
 
8858
-       retarray->base_addr = xmalloc (alloc_size);
 
8859
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
8860
     }
 
8861
   else
 
8862
     {
 
8863
Index: libgfortran/generated/bessel_r8.c
 
8864
===================================================================
 
8865
--- a/src/libgfortran/generated/bessel_r8.c     (.../tags/gcc_4_8_3_release)
 
8866
+++ b/src/libgfortran/generated/bessel_r8.c     (.../branches/gcc-4_8-branch)
 
8867
@@ -55,7 +55,7 @@
 
8868
     {
 
8869
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
8870
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
8871
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size);
 
8872
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8));
 
8873
       ret->offset = 0;
 
8874
     }
 
8875
 
 
8876
@@ -122,7 +122,7 @@
 
8877
     {
 
8878
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
8879
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
8880
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size);
 
8881
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8));
 
8882
       ret->offset = 0;
 
8883
     }
 
8884
 
 
8885
Index: libgfortran/generated/unpack_r4.c
 
8886
===================================================================
 
8887
--- a/src/libgfortran/generated/unpack_r4.c     (.../tags/gcc_4_8_3_release)
 
8888
+++ b/src/libgfortran/generated/unpack_r4.c     (.../branches/gcc-4_8-branch)
 
8889
@@ -99,7 +99,7 @@
 
8890
          rs *= extent[n];
 
8891
        }
 
8892
       ret->offset = 0;
 
8893
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4));
 
8894
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4));
 
8895
     }
 
8896
   else
 
8897
     {
 
8898
@@ -244,7 +244,7 @@
 
8899
          rs *= extent[n];
 
8900
        }
 
8901
       ret->offset = 0;
 
8902
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4));
 
8903
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4));
 
8904
     }
 
8905
   else
 
8906
     {
 
8907
Index: libgfortran/generated/product_r8.c
 
8908
===================================================================
 
8909
--- a/src/libgfortran/generated/product_r8.c    (.../tags/gcc_4_8_3_release)
 
8910
+++ b/src/libgfortran/generated/product_r8.c    (.../branches/gcc-4_8-branch)
 
8911
@@ -97,10 +97,9 @@
 
8912
       retarray->offset = 0;
 
8913
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8914
 
 
8915
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8916
-                  * extent[rank-1];
 
8917
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8918
 
 
8919
-      retarray->base_addr = xmalloc (alloc_size);
 
8920
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
8921
       if (alloc_size == 0)
 
8922
        {
 
8923
          /* Make sure we have a zero-sized array.  */
 
8924
@@ -272,8 +271,7 @@
 
8925
 
 
8926
        }
 
8927
 
 
8928
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8929
-                  * extent[rank-1];
 
8930
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8931
 
 
8932
       retarray->offset = 0;
 
8933
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8934
@@ -285,7 +283,7 @@
 
8935
          return;
 
8936
        }
 
8937
       else
 
8938
-       retarray->base_addr = xmalloc (alloc_size);
 
8939
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
8940
 
 
8941
     }
 
8942
   else
 
8943
@@ -430,8 +428,7 @@
 
8944
       retarray->offset = 0;
 
8945
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
8946
 
 
8947
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
8948
-                  * extent[rank-1];
 
8949
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
8950
 
 
8951
       if (alloc_size == 0)
 
8952
        {
 
8953
@@ -440,7 +437,7 @@
 
8954
          return;
 
8955
        }
 
8956
       else
 
8957
-       retarray->base_addr = xmalloc (alloc_size);
 
8958
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
8959
     }
 
8960
   else
 
8961
     {
 
8962
Index: libgfortran/generated/matmul_r4.c
 
8963
===================================================================
 
8964
--- a/src/libgfortran/generated/matmul_r4.c     (.../tags/gcc_4_8_3_release)
 
8965
+++ b/src/libgfortran/generated/matmul_r4.c     (.../branches/gcc-4_8-branch)
 
8966
@@ -124,7 +124,7 @@
 
8967
         }
 
8968
 
 
8969
       retarray->base_addr
 
8970
-       = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) retarray));
 
8971
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_4));
 
8972
       retarray->offset = 0;
 
8973
     }
 
8974
     else if (unlikely (compile_options.bounds_check))
 
8975
Index: libgfortran/generated/unpack_i2.c
 
8976
===================================================================
 
8977
--- a/src/libgfortran/generated/unpack_i2.c     (.../tags/gcc_4_8_3_release)
 
8978
+++ b/src/libgfortran/generated/unpack_i2.c     (.../branches/gcc-4_8-branch)
 
8979
@@ -99,7 +99,7 @@
 
8980
          rs *= extent[n];
 
8981
        }
 
8982
       ret->offset = 0;
 
8983
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2));
 
8984
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2));
 
8985
     }
 
8986
   else
 
8987
     {
 
8988
@@ -244,7 +244,7 @@
 
8989
          rs *= extent[n];
 
8990
        }
 
8991
       ret->offset = 0;
 
8992
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2));
 
8993
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2));
 
8994
     }
 
8995
   else
 
8996
     {
 
8997
Index: libgfortran/generated/in_pack_r8.c
 
8998
===================================================================
 
8999
--- a/src/libgfortran/generated/in_pack_r8.c    (.../tags/gcc_4_8_3_release)
 
9000
+++ b/src/libgfortran/generated/in_pack_r8.c    (.../branches/gcc-4_8-branch)
 
9001
@@ -76,7 +76,7 @@
 
9002
     return source->base_addr;
 
9003
 
 
9004
   /* Allocate storage for the destination.  */
 
9005
-  destptr = (GFC_REAL_8 *)xmalloc (ssize * sizeof (GFC_REAL_8));
 
9006
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_8));
 
9007
   dest = destptr;
 
9008
   src = source->base_addr;
 
9009
   stride0 = stride[0];
 
9010
Index: libgfortran/generated/maxloc1_4_r16.c
 
9011
===================================================================
 
9012
--- a/src/libgfortran/generated/maxloc1_4_r16.c (.../tags/gcc_4_8_3_release)
 
9013
+++ b/src/libgfortran/generated/maxloc1_4_r16.c (.../branches/gcc-4_8-branch)
 
9014
@@ -98,10 +98,9 @@
 
9015
       retarray->offset = 0;
 
9016
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9017
 
 
9018
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9019
-                  * extent[rank-1];
 
9020
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9021
 
 
9022
-      retarray->base_addr = xmalloc (alloc_size);
 
9023
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9024
       if (alloc_size == 0)
 
9025
        {
 
9026
          /* Make sure we have a zero-sized array.  */
 
9027
@@ -294,8 +293,7 @@
 
9028
 
 
9029
        }
 
9030
 
 
9031
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9032
-                  * extent[rank-1];
 
9033
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9034
 
 
9035
       retarray->offset = 0;
 
9036
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9037
@@ -307,7 +305,7 @@
 
9038
          return;
 
9039
        }
 
9040
       else
 
9041
-       retarray->base_addr = xmalloc (alloc_size);
 
9042
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9043
 
 
9044
     }
 
9045
   else
 
9046
@@ -485,8 +483,7 @@
 
9047
       retarray->offset = 0;
 
9048
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9049
 
 
9050
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9051
-                  * extent[rank-1];
 
9052
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9053
 
 
9054
       if (alloc_size == 0)
 
9055
        {
 
9056
@@ -495,7 +492,7 @@
 
9057
          return;
 
9058
        }
 
9059
       else
 
9060
-       retarray->base_addr = xmalloc (alloc_size);
 
9061
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9062
     }
 
9063
   else
 
9064
     {
 
9065
Index: libgfortran/generated/minloc0_8_r16.c
 
9066
===================================================================
 
9067
--- a/src/libgfortran/generated/minloc0_8_r16.c (.../tags/gcc_4_8_3_release)
 
9068
+++ b/src/libgfortran/generated/minloc0_8_r16.c (.../branches/gcc-4_8-branch)
 
9069
@@ -58,7 +58,7 @@
 
9070
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9071
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9072
       retarray->offset = 0;
 
9073
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
9074
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
9075
     }
 
9076
   else
 
9077
     {
 
9078
@@ -199,7 +199,7 @@
 
9079
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
9080
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9081
       retarray->offset = 0;
 
9082
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
9083
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
9084
     }
 
9085
   else
 
9086
     {
 
9087
@@ -367,7 +367,7 @@
 
9088
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9089
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9090
       retarray->offset = 0;
 
9091
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
9092
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
9093
     }
 
9094
   else if (unlikely (compile_options.bounds_check))
 
9095
     {
 
9096
Index: libgfortran/generated/reshape_c8.c
 
9097
===================================================================
 
9098
--- a/src/libgfortran/generated/reshape_c8.c    (.../tags/gcc_4_8_3_release)
 
9099
+++ b/src/libgfortran/generated/reshape_c8.c    (.../branches/gcc-4_8-branch)
 
9100
@@ -111,11 +111,11 @@
 
9101
       ret->offset = 0;
 
9102
 
 
9103
       if (unlikely (rs < 1))
 
9104
-        alloc_size = 1;
 
9105
+        alloc_size = 0;
 
9106
       else
 
9107
-        alloc_size = rs * sizeof (GFC_COMPLEX_8);
 
9108
+        alloc_size = rs;
 
9109
 
 
9110
-      ret->base_addr = xmalloc (alloc_size);
 
9111
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
9112
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
9113
     }
 
9114
 
 
9115
Index: libgfortran/generated/iparity_i8.c
 
9116
===================================================================
 
9117
--- a/src/libgfortran/generated/iparity_i8.c    (.../tags/gcc_4_8_3_release)
 
9118
+++ b/src/libgfortran/generated/iparity_i8.c    (.../branches/gcc-4_8-branch)
 
9119
@@ -97,10 +97,9 @@
 
9120
       retarray->offset = 0;
 
9121
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9122
 
 
9123
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9124
-                  * extent[rank-1];
 
9125
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9126
 
 
9127
-      retarray->base_addr = xmalloc (alloc_size);
 
9128
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9129
       if (alloc_size == 0)
 
9130
        {
 
9131
          /* Make sure we have a zero-sized array.  */
 
9132
@@ -272,8 +271,7 @@
 
9133
 
 
9134
        }
 
9135
 
 
9136
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9137
-                  * extent[rank-1];
 
9138
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9139
 
 
9140
       retarray->offset = 0;
 
9141
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9142
@@ -285,7 +283,7 @@
 
9143
          return;
 
9144
        }
 
9145
       else
 
9146
-       retarray->base_addr = xmalloc (alloc_size);
 
9147
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9148
 
 
9149
     }
 
9150
   else
 
9151
@@ -430,8 +428,7 @@
 
9152
       retarray->offset = 0;
 
9153
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9154
 
 
9155
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9156
-                  * extent[rank-1];
 
9157
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9158
 
 
9159
       if (alloc_size == 0)
 
9160
        {
 
9161
@@ -440,7 +437,7 @@
 
9162
          return;
 
9163
        }
 
9164
       else
 
9165
-       retarray->base_addr = xmalloc (alloc_size);
 
9166
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9167
     }
 
9168
   else
 
9169
     {
 
9170
Index: libgfortran/generated/count_1_l.c
 
9171
===================================================================
 
9172
--- a/src/libgfortran/generated/count_1_l.c     (.../tags/gcc_4_8_3_release)
 
9173
+++ b/src/libgfortran/generated/count_1_l.c     (.../branches/gcc-4_8-branch)
 
9174
@@ -101,8 +101,7 @@
 
9175
       retarray->offset = 0;
 
9176
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9177
 
 
9178
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9179
-                  * extent[rank-1];
 
9180
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9181
 
 
9182
       if (alloc_size == 0)
 
9183
        {
 
9184
@@ -111,7 +110,7 @@
 
9185
          return;
 
9186
        }
 
9187
       else
 
9188
-       retarray->base_addr = xmalloc (alloc_size);
 
9189
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
9190
     }
 
9191
   else
 
9192
     {
 
9193
Index: libgfortran/generated/maxloc0_8_i4.c
 
9194
===================================================================
 
9195
--- a/src/libgfortran/generated/maxloc0_8_i4.c  (.../tags/gcc_4_8_3_release)
 
9196
+++ b/src/libgfortran/generated/maxloc0_8_i4.c  (.../branches/gcc-4_8-branch)
 
9197
@@ -58,7 +58,7 @@
 
9198
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9199
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9200
       retarray->offset = 0;
 
9201
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
9202
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
9203
     }
 
9204
   else
 
9205
     {
 
9206
@@ -199,7 +199,7 @@
 
9207
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
9208
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9209
       retarray->offset = 0;
 
9210
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
9211
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
9212
     }
 
9213
   else
 
9214
     {
 
9215
@@ -367,7 +367,7 @@
 
9216
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9217
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9218
       retarray->offset = 0;
 
9219
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
9220
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
9221
     }
 
9222
   else if (unlikely (compile_options.bounds_check))
 
9223
     {
 
9224
Index: libgfortran/generated/matmul_i2.c
 
9225
===================================================================
 
9226
--- a/src/libgfortran/generated/matmul_i2.c     (.../tags/gcc_4_8_3_release)
 
9227
+++ b/src/libgfortran/generated/matmul_i2.c     (.../branches/gcc-4_8-branch)
 
9228
@@ -124,7 +124,7 @@
 
9229
         }
 
9230
 
 
9231
       retarray->base_addr
 
9232
-       = xmalloc (sizeof (GFC_INTEGER_2) * size0 ((array_t *) retarray));
 
9233
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_2));
 
9234
       retarray->offset = 0;
 
9235
     }
 
9236
     else if (unlikely (compile_options.bounds_check))
 
9237
Index: libgfortran/generated/minloc1_4_r4.c
 
9238
===================================================================
 
9239
--- a/src/libgfortran/generated/minloc1_4_r4.c  (.../tags/gcc_4_8_3_release)
 
9240
+++ b/src/libgfortran/generated/minloc1_4_r4.c  (.../branches/gcc-4_8-branch)
 
9241
@@ -98,10 +98,9 @@
 
9242
       retarray->offset = 0;
 
9243
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9244
 
 
9245
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9246
-                  * extent[rank-1];
 
9247
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9248
 
 
9249
-      retarray->base_addr = xmalloc (alloc_size);
 
9250
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9251
       if (alloc_size == 0)
 
9252
        {
 
9253
          /* Make sure we have a zero-sized array.  */
 
9254
@@ -294,8 +293,7 @@
 
9255
 
 
9256
        }
 
9257
 
 
9258
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9259
-                  * extent[rank-1];
 
9260
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9261
 
 
9262
       retarray->offset = 0;
 
9263
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9264
@@ -307,7 +305,7 @@
 
9265
          return;
 
9266
        }
 
9267
       else
 
9268
-       retarray->base_addr = xmalloc (alloc_size);
 
9269
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9270
 
 
9271
     }
 
9272
   else
 
9273
@@ -485,8 +483,7 @@
 
9274
       retarray->offset = 0;
 
9275
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9276
 
 
9277
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9278
-                  * extent[rank-1];
 
9279
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9280
 
 
9281
       if (alloc_size == 0)
 
9282
        {
 
9283
@@ -495,7 +492,7 @@
 
9284
          return;
 
9285
        }
 
9286
       else
 
9287
-       retarray->base_addr = xmalloc (alloc_size);
 
9288
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9289
     }
 
9290
   else
 
9291
     {
 
9292
Index: libgfortran/generated/transpose_i16.c
 
9293
===================================================================
 
9294
--- a/src/libgfortran/generated/transpose_i16.c (.../tags/gcc_4_8_3_release)
 
9295
+++ b/src/libgfortran/generated/transpose_i16.c (.../branches/gcc-4_8-branch)
 
9296
@@ -60,7 +60,8 @@
 
9297
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
9298
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
9299
 
 
9300
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret));
 
9301
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
9302
+                                     sizeof (GFC_INTEGER_16));
 
9303
       ret->offset = 0;
 
9304
     } else if (unlikely (compile_options.bounds_check))
 
9305
     {
 
9306
Index: libgfortran/generated/minloc0_16_i4.c
 
9307
===================================================================
 
9308
--- a/src/libgfortran/generated/minloc0_16_i4.c (.../tags/gcc_4_8_3_release)
 
9309
+++ b/src/libgfortran/generated/minloc0_16_i4.c (.../branches/gcc-4_8-branch)
 
9310
@@ -58,7 +58,7 @@
 
9311
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9312
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9313
       retarray->offset = 0;
 
9314
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
9315
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
9316
     }
 
9317
   else
 
9318
     {
 
9319
@@ -199,7 +199,7 @@
 
9320
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
9321
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9322
       retarray->offset = 0;
 
9323
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
9324
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
9325
     }
 
9326
   else
 
9327
     {
 
9328
@@ -367,7 +367,7 @@
 
9329
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9330
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9331
       retarray->offset = 0;
 
9332
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
9333
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
9334
     }
 
9335
   else if (unlikely (compile_options.bounds_check))
 
9336
     {
 
9337
Index: libgfortran/generated/transpose_i4.c
 
9338
===================================================================
 
9339
--- a/src/libgfortran/generated/transpose_i4.c  (.../tags/gcc_4_8_3_release)
 
9340
+++ b/src/libgfortran/generated/transpose_i4.c  (.../branches/gcc-4_8-branch)
 
9341
@@ -60,7 +60,8 @@
 
9342
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
9343
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
9344
 
 
9345
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) ret));
 
9346
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
9347
+                                     sizeof (GFC_INTEGER_4));
 
9348
       ret->offset = 0;
 
9349
     } else if (unlikely (compile_options.bounds_check))
 
9350
     {
 
9351
Index: libgfortran/generated/maxloc1_16_i8.c
 
9352
===================================================================
 
9353
--- a/src/libgfortran/generated/maxloc1_16_i8.c (.../tags/gcc_4_8_3_release)
 
9354
+++ b/src/libgfortran/generated/maxloc1_16_i8.c (.../branches/gcc-4_8-branch)
 
9355
@@ -98,10 +98,9 @@
 
9356
       retarray->offset = 0;
 
9357
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9358
 
 
9359
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9360
-                  * extent[rank-1];
 
9361
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9362
 
 
9363
-      retarray->base_addr = xmalloc (alloc_size);
 
9364
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9365
       if (alloc_size == 0)
 
9366
        {
 
9367
          /* Make sure we have a zero-sized array.  */
 
9368
@@ -294,8 +293,7 @@
 
9369
 
 
9370
        }
 
9371
 
 
9372
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9373
-                  * extent[rank-1];
 
9374
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9375
 
 
9376
       retarray->offset = 0;
 
9377
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9378
@@ -307,7 +305,7 @@
 
9379
          return;
 
9380
        }
 
9381
       else
 
9382
-       retarray->base_addr = xmalloc (alloc_size);
 
9383
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9384
 
 
9385
     }
 
9386
   else
 
9387
@@ -485,8 +483,7 @@
 
9388
       retarray->offset = 0;
 
9389
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9390
 
 
9391
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9392
-                  * extent[rank-1];
 
9393
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9394
 
 
9395
       if (alloc_size == 0)
 
9396
        {
 
9397
@@ -495,7 +492,7 @@
 
9398
          return;
 
9399
        }
 
9400
       else
 
9401
-       retarray->base_addr = xmalloc (alloc_size);
 
9402
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9403
     }
 
9404
   else
 
9405
     {
 
9406
Index: libgfortran/generated/minloc1_4_i2.c
 
9407
===================================================================
 
9408
--- a/src/libgfortran/generated/minloc1_4_i2.c  (.../tags/gcc_4_8_3_release)
 
9409
+++ b/src/libgfortran/generated/minloc1_4_i2.c  (.../branches/gcc-4_8-branch)
 
9410
@@ -98,10 +98,9 @@
 
9411
       retarray->offset = 0;
 
9412
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9413
 
 
9414
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9415
-                  * extent[rank-1];
 
9416
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9417
 
 
9418
-      retarray->base_addr = xmalloc (alloc_size);
 
9419
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9420
       if (alloc_size == 0)
 
9421
        {
 
9422
          /* Make sure we have a zero-sized array.  */
 
9423
@@ -294,8 +293,7 @@
 
9424
 
 
9425
        }
 
9426
 
 
9427
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9428
-                  * extent[rank-1];
 
9429
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9430
 
 
9431
       retarray->offset = 0;
 
9432
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9433
@@ -307,7 +305,7 @@
 
9434
          return;
 
9435
        }
 
9436
       else
 
9437
-       retarray->base_addr = xmalloc (alloc_size);
 
9438
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9439
 
 
9440
     }
 
9441
   else
 
9442
@@ -485,8 +483,7 @@
 
9443
       retarray->offset = 0;
 
9444
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9445
 
 
9446
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9447
-                  * extent[rank-1];
 
9448
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9449
 
 
9450
       if (alloc_size == 0)
 
9451
        {
 
9452
@@ -495,7 +492,7 @@
 
9453
          return;
 
9454
        }
 
9455
       else
 
9456
-       retarray->base_addr = xmalloc (alloc_size);
 
9457
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
9458
     }
 
9459
   else
 
9460
     {
 
9461
Index: libgfortran/generated/matmul_l16.c
 
9462
===================================================================
 
9463
--- a/src/libgfortran/generated/matmul_l16.c    (.../tags/gcc_4_8_3_release)
 
9464
+++ b/src/libgfortran/generated/matmul_l16.c    (.../branches/gcc-4_8-branch)
 
9465
@@ -88,7 +88,7 @@
 
9466
         }
 
9467
           
 
9468
       retarray->base_addr
 
9469
-       = xmalloc (sizeof (GFC_LOGICAL_16) * size0 ((array_t *) retarray));
 
9470
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_16));
 
9471
       retarray->offset = 0;
 
9472
     }
 
9473
     else if (unlikely (compile_options.bounds_check))
 
9474
Index: libgfortran/generated/maxloc1_8_i1.c
 
9475
===================================================================
 
9476
--- a/src/libgfortran/generated/maxloc1_8_i1.c  (.../tags/gcc_4_8_3_release)
 
9477
+++ b/src/libgfortran/generated/maxloc1_8_i1.c  (.../branches/gcc-4_8-branch)
 
9478
@@ -98,10 +98,9 @@
 
9479
       retarray->offset = 0;
 
9480
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9481
 
 
9482
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9483
-                  * extent[rank-1];
 
9484
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9485
 
 
9486
-      retarray->base_addr = xmalloc (alloc_size);
 
9487
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9488
       if (alloc_size == 0)
 
9489
        {
 
9490
          /* Make sure we have a zero-sized array.  */
 
9491
@@ -294,8 +293,7 @@
 
9492
 
 
9493
        }
 
9494
 
 
9495
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9496
-                  * extent[rank-1];
 
9497
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9498
 
 
9499
       retarray->offset = 0;
 
9500
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9501
@@ -307,7 +305,7 @@
 
9502
          return;
 
9503
        }
 
9504
       else
 
9505
-       retarray->base_addr = xmalloc (alloc_size);
 
9506
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9507
 
 
9508
     }
 
9509
   else
 
9510
@@ -485,8 +483,7 @@
 
9511
       retarray->offset = 0;
 
9512
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9513
 
 
9514
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9515
-                  * extent[rank-1];
 
9516
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9517
 
 
9518
       if (alloc_size == 0)
 
9519
        {
 
9520
@@ -495,7 +492,7 @@
 
9521
          return;
 
9522
        }
 
9523
       else
 
9524
-       retarray->base_addr = xmalloc (alloc_size);
 
9525
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9526
     }
 
9527
   else
 
9528
     {
 
9529
Index: libgfortran/generated/minloc1_8_i8.c
 
9530
===================================================================
 
9531
--- a/src/libgfortran/generated/minloc1_8_i8.c  (.../tags/gcc_4_8_3_release)
 
9532
+++ b/src/libgfortran/generated/minloc1_8_i8.c  (.../branches/gcc-4_8-branch)
 
9533
@@ -98,10 +98,9 @@
 
9534
       retarray->offset = 0;
 
9535
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9536
 
 
9537
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9538
-                  * extent[rank-1];
 
9539
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9540
 
 
9541
-      retarray->base_addr = xmalloc (alloc_size);
 
9542
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9543
       if (alloc_size == 0)
 
9544
        {
 
9545
          /* Make sure we have a zero-sized array.  */
 
9546
@@ -294,8 +293,7 @@
 
9547
 
 
9548
        }
 
9549
 
 
9550
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9551
-                  * extent[rank-1];
 
9552
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9553
 
 
9554
       retarray->offset = 0;
 
9555
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9556
@@ -307,7 +305,7 @@
 
9557
          return;
 
9558
        }
 
9559
       else
 
9560
-       retarray->base_addr = xmalloc (alloc_size);
 
9561
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9562
 
 
9563
     }
 
9564
   else
 
9565
@@ -485,8 +483,7 @@
 
9566
       retarray->offset = 0;
 
9567
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9568
 
 
9569
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9570
-                  * extent[rank-1];
 
9571
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9572
 
 
9573
       if (alloc_size == 0)
 
9574
        {
 
9575
@@ -495,7 +492,7 @@
 
9576
          return;
 
9577
        }
 
9578
       else
 
9579
-       retarray->base_addr = xmalloc (alloc_size);
 
9580
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9581
     }
 
9582
   else
 
9583
     {
 
9584
Index: libgfortran/generated/minloc0_4_r8.c
 
9585
===================================================================
 
9586
--- a/src/libgfortran/generated/minloc0_4_r8.c  (.../tags/gcc_4_8_3_release)
 
9587
+++ b/src/libgfortran/generated/minloc0_4_r8.c  (.../branches/gcc-4_8-branch)
 
9588
@@ -58,7 +58,7 @@
 
9589
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9590
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9591
       retarray->offset = 0;
 
9592
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
9593
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
9594
     }
 
9595
   else
 
9596
     {
 
9597
@@ -199,7 +199,7 @@
 
9598
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
9599
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9600
       retarray->offset = 0;
 
9601
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
9602
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
9603
     }
 
9604
   else
 
9605
     {
 
9606
@@ -367,7 +367,7 @@
 
9607
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
9608
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
9609
       retarray->offset = 0;
 
9610
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
9611
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
9612
     }
 
9613
   else if (unlikely (compile_options.bounds_check))
 
9614
     {
 
9615
Index: libgfortran/generated/product_r16.c
 
9616
===================================================================
 
9617
--- a/src/libgfortran/generated/product_r16.c   (.../tags/gcc_4_8_3_release)
 
9618
+++ b/src/libgfortran/generated/product_r16.c   (.../branches/gcc-4_8-branch)
 
9619
@@ -97,10 +97,9 @@
 
9620
       retarray->offset = 0;
 
9621
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9622
 
 
9623
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9624
-                  * extent[rank-1];
 
9625
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9626
 
 
9627
-      retarray->base_addr = xmalloc (alloc_size);
 
9628
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
9629
       if (alloc_size == 0)
 
9630
        {
 
9631
          /* Make sure we have a zero-sized array.  */
 
9632
@@ -272,8 +271,7 @@
 
9633
 
 
9634
        }
 
9635
 
 
9636
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9637
-                  * extent[rank-1];
 
9638
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9639
 
 
9640
       retarray->offset = 0;
 
9641
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9642
@@ -285,7 +283,7 @@
 
9643
          return;
 
9644
        }
 
9645
       else
 
9646
-       retarray->base_addr = xmalloc (alloc_size);
 
9647
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
9648
 
 
9649
     }
 
9650
   else
 
9651
@@ -430,8 +428,7 @@
 
9652
       retarray->offset = 0;
 
9653
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9654
 
 
9655
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9656
-                  * extent[rank-1];
 
9657
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9658
 
 
9659
       if (alloc_size == 0)
 
9660
        {
 
9661
@@ -440,7 +437,7 @@
 
9662
          return;
 
9663
        }
 
9664
       else
 
9665
-       retarray->base_addr = xmalloc (alloc_size);
 
9666
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
9667
     }
 
9668
   else
 
9669
     {
 
9670
Index: libgfortran/generated/sum_r8.c
 
9671
===================================================================
 
9672
--- a/src/libgfortran/generated/sum_r8.c        (.../tags/gcc_4_8_3_release)
 
9673
+++ b/src/libgfortran/generated/sum_r8.c        (.../branches/gcc-4_8-branch)
 
9674
@@ -97,10 +97,9 @@
 
9675
       retarray->offset = 0;
 
9676
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9677
 
 
9678
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9679
-                  * extent[rank-1];
 
9680
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9681
 
 
9682
-      retarray->base_addr = xmalloc (alloc_size);
 
9683
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
9684
       if (alloc_size == 0)
 
9685
        {
 
9686
          /* Make sure we have a zero-sized array.  */
 
9687
@@ -272,8 +271,7 @@
 
9688
 
 
9689
        }
 
9690
 
 
9691
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9692
-                  * extent[rank-1];
 
9693
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9694
 
 
9695
       retarray->offset = 0;
 
9696
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9697
@@ -285,7 +283,7 @@
 
9698
          return;
 
9699
        }
 
9700
       else
 
9701
-       retarray->base_addr = xmalloc (alloc_size);
 
9702
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
9703
 
 
9704
     }
 
9705
   else
 
9706
@@ -430,8 +428,7 @@
 
9707
       retarray->offset = 0;
 
9708
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9709
 
 
9710
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9711
-                  * extent[rank-1];
 
9712
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9713
 
 
9714
       if (alloc_size == 0)
 
9715
        {
 
9716
@@ -440,7 +437,7 @@
 
9717
          return;
 
9718
        }
 
9719
       else
 
9720
-       retarray->base_addr = xmalloc (alloc_size);
 
9721
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
9722
     }
 
9723
   else
 
9724
     {
 
9725
Index: libgfortran/generated/norm2_r10.c
 
9726
===================================================================
 
9727
--- a/src/libgfortran/generated/norm2_r10.c     (.../tags/gcc_4_8_3_release)
 
9728
+++ b/src/libgfortran/generated/norm2_r10.c     (.../branches/gcc-4_8-branch)
 
9729
@@ -101,10 +101,9 @@
 
9730
       retarray->offset = 0;
 
9731
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9732
 
 
9733
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9734
-                  * extent[rank-1];
 
9735
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9736
 
 
9737
-      retarray->base_addr = xmalloc (alloc_size);
 
9738
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
9739
       if (alloc_size == 0)
 
9740
        {
 
9741
          /* Make sure we have a zero-sized array.  */
 
9742
Index: libgfortran/generated/unpack_c10.c
 
9743
===================================================================
 
9744
--- a/src/libgfortran/generated/unpack_c10.c    (.../tags/gcc_4_8_3_release)
 
9745
+++ b/src/libgfortran/generated/unpack_c10.c    (.../branches/gcc-4_8-branch)
 
9746
@@ -99,7 +99,7 @@
 
9747
          rs *= extent[n];
 
9748
        }
 
9749
       ret->offset = 0;
 
9750
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10));
 
9751
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10));
 
9752
     }
 
9753
   else
 
9754
     {
 
9755
@@ -244,7 +244,7 @@
 
9756
          rs *= extent[n];
 
9757
        }
 
9758
       ret->offset = 0;
 
9759
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10));
 
9760
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10));
 
9761
     }
 
9762
   else
 
9763
     {
 
9764
Index: libgfortran/generated/spread_r8.c
 
9765
===================================================================
 
9766
--- a/src/libgfortran/generated/spread_r8.c     (.../tags/gcc_4_8_3_release)
 
9767
+++ b/src/libgfortran/generated/spread_r8.c     (.../branches/gcc-4_8-branch)
 
9768
@@ -101,8 +101,8 @@
 
9769
        }
 
9770
       ret->offset = 0;
 
9771
 
 
9772
-      /* xmalloc allocates a single byte for zero size.  */
 
9773
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_8));
 
9774
+      /* xmallocarray allocates a single byte for zero size.  */
 
9775
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_8));
 
9776
       if (rs <= 0)
 
9777
         return;
 
9778
     }
 
9779
@@ -244,7 +244,7 @@
 
9780
 
 
9781
   if (ret->base_addr == NULL)
 
9782
     {
 
9783
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_8));
 
9784
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_8));
 
9785
       ret->offset = 0;
 
9786
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
9787
     }
 
9788
Index: libgfortran/generated/minloc1_16_i16.c
 
9789
===================================================================
 
9790
--- a/src/libgfortran/generated/minloc1_16_i16.c        (.../tags/gcc_4_8_3_release)
 
9791
+++ b/src/libgfortran/generated/minloc1_16_i16.c        (.../branches/gcc-4_8-branch)
 
9792
@@ -98,10 +98,9 @@
 
9793
       retarray->offset = 0;
 
9794
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9795
 
 
9796
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9797
-                  * extent[rank-1];
 
9798
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9799
 
 
9800
-      retarray->base_addr = xmalloc (alloc_size);
 
9801
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9802
       if (alloc_size == 0)
 
9803
        {
 
9804
          /* Make sure we have a zero-sized array.  */
 
9805
@@ -294,8 +293,7 @@
 
9806
 
 
9807
        }
 
9808
 
 
9809
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9810
-                  * extent[rank-1];
 
9811
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9812
 
 
9813
       retarray->offset = 0;
 
9814
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9815
@@ -307,7 +305,7 @@
 
9816
          return;
 
9817
        }
 
9818
       else
 
9819
-       retarray->base_addr = xmalloc (alloc_size);
 
9820
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9821
 
 
9822
     }
 
9823
   else
 
9824
@@ -485,8 +483,7 @@
 
9825
       retarray->offset = 0;
 
9826
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9827
 
 
9828
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9829
-                  * extent[rank-1];
 
9830
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9831
 
 
9832
       if (alloc_size == 0)
 
9833
        {
 
9834
@@ -495,7 +492,7 @@
 
9835
          return;
 
9836
        }
 
9837
       else
 
9838
-       retarray->base_addr = xmalloc (alloc_size);
 
9839
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9840
     }
 
9841
   else
 
9842
     {
 
9843
Index: libgfortran/generated/maxloc1_8_r4.c
 
9844
===================================================================
 
9845
--- a/src/libgfortran/generated/maxloc1_8_r4.c  (.../tags/gcc_4_8_3_release)
 
9846
+++ b/src/libgfortran/generated/maxloc1_8_r4.c  (.../branches/gcc-4_8-branch)
 
9847
@@ -98,10 +98,9 @@
 
9848
       retarray->offset = 0;
 
9849
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9850
 
 
9851
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9852
-                  * extent[rank-1];
 
9853
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9854
 
 
9855
-      retarray->base_addr = xmalloc (alloc_size);
 
9856
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9857
       if (alloc_size == 0)
 
9858
        {
 
9859
          /* Make sure we have a zero-sized array.  */
 
9860
@@ -294,8 +293,7 @@
 
9861
 
 
9862
        }
 
9863
 
 
9864
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9865
-                  * extent[rank-1];
 
9866
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9867
 
 
9868
       retarray->offset = 0;
 
9869
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9870
@@ -307,7 +305,7 @@
 
9871
          return;
 
9872
        }
 
9873
       else
 
9874
-       retarray->base_addr = xmalloc (alloc_size);
 
9875
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9876
 
 
9877
     }
 
9878
   else
 
9879
@@ -485,8 +483,7 @@
 
9880
       retarray->offset = 0;
 
9881
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9882
 
 
9883
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9884
-                  * extent[rank-1];
 
9885
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9886
 
 
9887
       if (alloc_size == 0)
 
9888
        {
 
9889
@@ -495,7 +492,7 @@
 
9890
          return;
 
9891
        }
 
9892
       else
 
9893
-       retarray->base_addr = xmalloc (alloc_size);
 
9894
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
9895
     }
 
9896
   else
 
9897
     {
 
9898
Index: libgfortran/generated/minloc1_16_i1.c
 
9899
===================================================================
 
9900
--- a/src/libgfortran/generated/minloc1_16_i1.c (.../tags/gcc_4_8_3_release)
 
9901
+++ b/src/libgfortran/generated/minloc1_16_i1.c (.../branches/gcc-4_8-branch)
 
9902
@@ -98,10 +98,9 @@
 
9903
       retarray->offset = 0;
 
9904
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9905
 
 
9906
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9907
-                  * extent[rank-1];
 
9908
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9909
 
 
9910
-      retarray->base_addr = xmalloc (alloc_size);
 
9911
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9912
       if (alloc_size == 0)
 
9913
        {
 
9914
          /* Make sure we have a zero-sized array.  */
 
9915
@@ -294,8 +293,7 @@
 
9916
 
 
9917
        }
 
9918
 
 
9919
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9920
-                  * extent[rank-1];
 
9921
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9922
 
 
9923
       retarray->offset = 0;
 
9924
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9925
@@ -307,7 +305,7 @@
 
9926
          return;
 
9927
        }
 
9928
       else
 
9929
-       retarray->base_addr = xmalloc (alloc_size);
 
9930
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9931
 
 
9932
     }
 
9933
   else
 
9934
@@ -485,8 +483,7 @@
 
9935
       retarray->offset = 0;
 
9936
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9937
 
 
9938
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
9939
-                  * extent[rank-1];
 
9940
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
9941
 
 
9942
       if (alloc_size == 0)
 
9943
        {
 
9944
@@ -495,7 +492,7 @@
 
9945
          return;
 
9946
        }
 
9947
       else
 
9948
-       retarray->base_addr = xmalloc (alloc_size);
 
9949
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
9950
     }
 
9951
   else
 
9952
     {
 
9953
Index: libgfortran/generated/spread_r16.c
 
9954
===================================================================
 
9955
--- a/src/libgfortran/generated/spread_r16.c    (.../tags/gcc_4_8_3_release)
 
9956
+++ b/src/libgfortran/generated/spread_r16.c    (.../branches/gcc-4_8-branch)
 
9957
@@ -101,8 +101,8 @@
 
9958
        }
 
9959
       ret->offset = 0;
 
9960
 
 
9961
-      /* xmalloc allocates a single byte for zero size.  */
 
9962
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_16));
 
9963
+      /* xmallocarray allocates a single byte for zero size.  */
 
9964
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_16));
 
9965
       if (rs <= 0)
 
9966
         return;
 
9967
     }
 
9968
@@ -244,7 +244,7 @@
 
9969
 
 
9970
   if (ret->base_addr == NULL)
 
9971
     {
 
9972
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_16));
 
9973
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_16));
 
9974
       ret->offset = 0;
 
9975
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
9976
     }
 
9977
Index: libgfortran/generated/pack_c8.c
 
9978
===================================================================
 
9979
--- a/src/libgfortran/generated/pack_c8.c       (.../tags/gcc_4_8_3_release)
 
9980
+++ b/src/libgfortran/generated/pack_c8.c       (.../branches/gcc-4_8-branch)
 
9981
@@ -167,8 +167,8 @@
 
9982
 
 
9983
          ret->offset = 0;
 
9984
 
 
9985
-         /* xmalloc allocates a single byte for zero size.  */
 
9986
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * total);
 
9987
+         /* xmallocarray allocates a single byte for zero size.  */
 
9988
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_8));
 
9989
 
 
9990
          if (total == 0)
 
9991
            return;
 
9992
Index: libgfortran/generated/minval_r10.c
 
9993
===================================================================
 
9994
--- a/src/libgfortran/generated/minval_r10.c    (.../tags/gcc_4_8_3_release)
 
9995
+++ b/src/libgfortran/generated/minval_r10.c    (.../branches/gcc-4_8-branch)
 
9996
@@ -97,10 +97,9 @@
 
9997
       retarray->offset = 0;
 
9998
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
9999
 
 
10000
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10001
-                  * extent[rank-1];
 
10002
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10003
 
 
10004
-      retarray->base_addr = xmalloc (alloc_size);
 
10005
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
10006
       if (alloc_size == 0)
 
10007
        {
 
10008
          /* Make sure we have a zero-sized array.  */
 
10009
@@ -286,8 +285,7 @@
 
10010
 
 
10011
        }
 
10012
 
 
10013
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10014
-                  * extent[rank-1];
 
10015
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10016
 
 
10017
       retarray->offset = 0;
 
10018
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10019
@@ -299,7 +297,7 @@
 
10020
          return;
 
10021
        }
 
10022
       else
 
10023
-       retarray->base_addr = xmalloc (alloc_size);
 
10024
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
10025
 
 
10026
     }
 
10027
   else
 
10028
@@ -472,8 +470,7 @@
 
10029
       retarray->offset = 0;
 
10030
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10031
 
 
10032
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10033
-                  * extent[rank-1];
 
10034
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10035
 
 
10036
       if (alloc_size == 0)
 
10037
        {
 
10038
@@ -482,7 +479,7 @@
 
10039
          return;
 
10040
        }
 
10041
       else
 
10042
-       retarray->base_addr = xmalloc (alloc_size);
 
10043
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
10044
     }
 
10045
   else
 
10046
     {
 
10047
Index: libgfortran/generated/parity_l8.c
 
10048
===================================================================
 
10049
--- a/src/libgfortran/generated/parity_l8.c     (.../tags/gcc_4_8_3_release)
 
10050
+++ b/src/libgfortran/generated/parity_l8.c     (.../branches/gcc-4_8-branch)
 
10051
@@ -98,10 +98,9 @@
 
10052
       retarray->offset = 0;
 
10053
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10054
 
 
10055
-      alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10056
-                  * extent[rank-1];
 
10057
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10058
 
 
10059
-      retarray->base_addr = xmalloc (alloc_size);
 
10060
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
 
10061
       if (alloc_size == 0)
 
10062
        {
 
10063
          /* Make sure we have a zero-sized array.  */
 
10064
Index: libgfortran/generated/minval_i4.c
 
10065
===================================================================
 
10066
--- a/src/libgfortran/generated/minval_i4.c     (.../tags/gcc_4_8_3_release)
 
10067
+++ b/src/libgfortran/generated/minval_i4.c     (.../branches/gcc-4_8-branch)
 
10068
@@ -97,10 +97,9 @@
 
10069
       retarray->offset = 0;
 
10070
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10071
 
 
10072
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10073
-                  * extent[rank-1];
 
10074
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10075
 
 
10076
-      retarray->base_addr = xmalloc (alloc_size);
 
10077
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10078
       if (alloc_size == 0)
 
10079
        {
 
10080
          /* Make sure we have a zero-sized array.  */
 
10081
@@ -286,8 +285,7 @@
 
10082
 
 
10083
        }
 
10084
 
 
10085
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10086
-                  * extent[rank-1];
 
10087
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10088
 
 
10089
       retarray->offset = 0;
 
10090
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10091
@@ -299,7 +297,7 @@
 
10092
          return;
 
10093
        }
 
10094
       else
 
10095
-       retarray->base_addr = xmalloc (alloc_size);
 
10096
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10097
 
 
10098
     }
 
10099
   else
 
10100
@@ -472,8 +470,7 @@
 
10101
       retarray->offset = 0;
 
10102
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10103
 
 
10104
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10105
-                  * extent[rank-1];
 
10106
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10107
 
 
10108
       if (alloc_size == 0)
 
10109
        {
 
10110
@@ -482,7 +479,7 @@
 
10111
          return;
 
10112
        }
 
10113
       else
 
10114
-       retarray->base_addr = xmalloc (alloc_size);
 
10115
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10116
     }
 
10117
   else
 
10118
     {
 
10119
Index: libgfortran/generated/maxloc1_8_i2.c
 
10120
===================================================================
 
10121
--- a/src/libgfortran/generated/maxloc1_8_i2.c  (.../tags/gcc_4_8_3_release)
 
10122
+++ b/src/libgfortran/generated/maxloc1_8_i2.c  (.../branches/gcc-4_8-branch)
 
10123
@@ -98,10 +98,9 @@
 
10124
       retarray->offset = 0;
 
10125
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10126
 
 
10127
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10128
-                  * extent[rank-1];
 
10129
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10130
 
 
10131
-      retarray->base_addr = xmalloc (alloc_size);
 
10132
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10133
       if (alloc_size == 0)
 
10134
        {
 
10135
          /* Make sure we have a zero-sized array.  */
 
10136
@@ -294,8 +293,7 @@
 
10137
 
 
10138
        }
 
10139
 
 
10140
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10141
-                  * extent[rank-1];
 
10142
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10143
 
 
10144
       retarray->offset = 0;
 
10145
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10146
@@ -307,7 +305,7 @@
 
10147
          return;
 
10148
        }
 
10149
       else
 
10150
-       retarray->base_addr = xmalloc (alloc_size);
 
10151
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10152
 
 
10153
     }
 
10154
   else
 
10155
@@ -485,8 +483,7 @@
 
10156
       retarray->offset = 0;
 
10157
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10158
 
 
10159
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10160
-                  * extent[rank-1];
 
10161
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10162
 
 
10163
       if (alloc_size == 0)
 
10164
        {
 
10165
@@ -495,7 +492,7 @@
 
10166
          return;
 
10167
        }
 
10168
       else
 
10169
-       retarray->base_addr = xmalloc (alloc_size);
 
10170
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10171
     }
 
10172
   else
 
10173
     {
 
10174
Index: libgfortran/generated/any_l8.c
 
10175
===================================================================
 
10176
--- a/src/libgfortran/generated/any_l8.c        (.../tags/gcc_4_8_3_release)
 
10177
+++ b/src/libgfortran/generated/any_l8.c        (.../branches/gcc-4_8-branch)
 
10178
@@ -101,8 +101,7 @@
 
10179
       retarray->offset = 0;
 
10180
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10181
 
 
10182
-      alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10183
-                  * extent[rank-1];
 
10184
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10185
 
 
10186
       if (alloc_size == 0)
 
10187
        {
 
10188
@@ -111,7 +110,7 @@
 
10189
          return;
 
10190
        }
 
10191
       else
 
10192
-       retarray->base_addr = xmalloc (alloc_size);
 
10193
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
 
10194
     }
 
10195
   else
 
10196
     {
 
10197
Index: libgfortran/generated/maxloc0_16_r10.c
 
10198
===================================================================
 
10199
--- a/src/libgfortran/generated/maxloc0_16_r10.c        (.../tags/gcc_4_8_3_release)
 
10200
+++ b/src/libgfortran/generated/maxloc0_16_r10.c        (.../branches/gcc-4_8-branch)
 
10201
@@ -58,7 +58,7 @@
 
10202
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10203
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10204
       retarray->offset = 0;
 
10205
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
10206
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
10207
     }
 
10208
   else
 
10209
     {
 
10210
@@ -199,7 +199,7 @@
 
10211
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
10212
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10213
       retarray->offset = 0;
 
10214
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
10215
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
10216
     }
 
10217
   else
 
10218
     {
 
10219
@@ -367,7 +367,7 @@
 
10220
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10221
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10222
       retarray->offset = 0;
 
10223
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
10224
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
10225
     }
 
10226
   else if (unlikely (compile_options.bounds_check))
 
10227
     {
 
10228
Index: libgfortran/generated/minloc0_4_i16.c
 
10229
===================================================================
 
10230
--- a/src/libgfortran/generated/minloc0_4_i16.c (.../tags/gcc_4_8_3_release)
 
10231
+++ b/src/libgfortran/generated/minloc0_4_i16.c (.../branches/gcc-4_8-branch)
 
10232
@@ -58,7 +58,7 @@
 
10233
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10234
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10235
       retarray->offset = 0;
 
10236
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
10237
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
10238
     }
 
10239
   else
 
10240
     {
 
10241
@@ -199,7 +199,7 @@
 
10242
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
10243
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10244
       retarray->offset = 0;
 
10245
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
10246
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
10247
     }
 
10248
   else
 
10249
     {
 
10250
@@ -367,7 +367,7 @@
 
10251
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10252
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10253
       retarray->offset = 0;
 
10254
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
10255
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
10256
     }
 
10257
   else if (unlikely (compile_options.bounds_check))
 
10258
     {
 
10259
Index: libgfortran/generated/maxloc0_8_r8.c
 
10260
===================================================================
 
10261
--- a/src/libgfortran/generated/maxloc0_8_r8.c  (.../tags/gcc_4_8_3_release)
 
10262
+++ b/src/libgfortran/generated/maxloc0_8_r8.c  (.../branches/gcc-4_8-branch)
 
10263
@@ -58,7 +58,7 @@
 
10264
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10265
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10266
       retarray->offset = 0;
 
10267
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
10268
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
10269
     }
 
10270
   else
 
10271
     {
 
10272
@@ -199,7 +199,7 @@
 
10273
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
10274
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10275
       retarray->offset = 0;
 
10276
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
10277
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
10278
     }
 
10279
   else
 
10280
     {
 
10281
@@ -367,7 +367,7 @@
 
10282
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10283
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10284
       retarray->offset = 0;
 
10285
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
10286
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
10287
     }
 
10288
   else if (unlikely (compile_options.bounds_check))
 
10289
     {
 
10290
Index: libgfortran/generated/minloc1_4_r10.c
 
10291
===================================================================
 
10292
--- a/src/libgfortran/generated/minloc1_4_r10.c (.../tags/gcc_4_8_3_release)
 
10293
+++ b/src/libgfortran/generated/minloc1_4_r10.c (.../branches/gcc-4_8-branch)
 
10294
@@ -98,10 +98,9 @@
 
10295
       retarray->offset = 0;
 
10296
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10297
 
 
10298
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10299
-                  * extent[rank-1];
 
10300
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10301
 
 
10302
-      retarray->base_addr = xmalloc (alloc_size);
 
10303
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10304
       if (alloc_size == 0)
 
10305
        {
 
10306
          /* Make sure we have a zero-sized array.  */
 
10307
@@ -294,8 +293,7 @@
 
10308
 
 
10309
        }
 
10310
 
 
10311
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10312
-                  * extent[rank-1];
 
10313
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10314
 
 
10315
       retarray->offset = 0;
 
10316
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10317
@@ -307,7 +305,7 @@
 
10318
          return;
 
10319
        }
 
10320
       else
 
10321
-       retarray->base_addr = xmalloc (alloc_size);
 
10322
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10323
 
 
10324
     }
 
10325
   else
 
10326
@@ -485,8 +483,7 @@
 
10327
       retarray->offset = 0;
 
10328
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10329
 
 
10330
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10331
-                  * extent[rank-1];
 
10332
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10333
 
 
10334
       if (alloc_size == 0)
 
10335
        {
 
10336
@@ -495,7 +492,7 @@
 
10337
          return;
 
10338
        }
 
10339
       else
 
10340
-       retarray->base_addr = xmalloc (alloc_size);
 
10341
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10342
     }
 
10343
   else
 
10344
     {
 
10345
Index: libgfortran/generated/minloc1_8_i16.c
 
10346
===================================================================
 
10347
--- a/src/libgfortran/generated/minloc1_8_i16.c (.../tags/gcc_4_8_3_release)
 
10348
+++ b/src/libgfortran/generated/minloc1_8_i16.c (.../branches/gcc-4_8-branch)
 
10349
@@ -98,10 +98,9 @@
 
10350
       retarray->offset = 0;
 
10351
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10352
 
 
10353
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10354
-                  * extent[rank-1];
 
10355
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10356
 
 
10357
-      retarray->base_addr = xmalloc (alloc_size);
 
10358
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10359
       if (alloc_size == 0)
 
10360
        {
 
10361
          /* Make sure we have a zero-sized array.  */
 
10362
@@ -294,8 +293,7 @@
 
10363
 
 
10364
        }
 
10365
 
 
10366
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10367
-                  * extent[rank-1];
 
10368
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10369
 
 
10370
       retarray->offset = 0;
 
10371
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10372
@@ -307,7 +305,7 @@
 
10373
          return;
 
10374
        }
 
10375
       else
 
10376
-       retarray->base_addr = xmalloc (alloc_size);
 
10377
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10378
 
 
10379
     }
 
10380
   else
 
10381
@@ -485,8 +483,7 @@
 
10382
       retarray->offset = 0;
 
10383
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10384
 
 
10385
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10386
-                  * extent[rank-1];
 
10387
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10388
 
 
10389
       if (alloc_size == 0)
 
10390
        {
 
10391
@@ -495,7 +492,7 @@
 
10392
          return;
 
10393
        }
 
10394
       else
 
10395
-       retarray->base_addr = xmalloc (alloc_size);
 
10396
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10397
     }
 
10398
   else
 
10399
     {
 
10400
Index: libgfortran/generated/maxloc0_8_r10.c
 
10401
===================================================================
 
10402
--- a/src/libgfortran/generated/maxloc0_8_r10.c (.../tags/gcc_4_8_3_release)
 
10403
+++ b/src/libgfortran/generated/maxloc0_8_r10.c (.../branches/gcc-4_8-branch)
 
10404
@@ -58,7 +58,7 @@
 
10405
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10406
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10407
       retarray->offset = 0;
 
10408
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
10409
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
10410
     }
 
10411
   else
 
10412
     {
 
10413
@@ -199,7 +199,7 @@
 
10414
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
10415
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10416
       retarray->offset = 0;
 
10417
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
10418
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
10419
     }
 
10420
   else
 
10421
     {
 
10422
@@ -367,7 +367,7 @@
 
10423
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10424
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10425
       retarray->offset = 0;
 
10426
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
10427
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
10428
     }
 
10429
   else if (unlikely (compile_options.bounds_check))
 
10430
     {
 
10431
Index: libgfortran/generated/unpack_i4.c
 
10432
===================================================================
 
10433
--- a/src/libgfortran/generated/unpack_i4.c     (.../tags/gcc_4_8_3_release)
 
10434
+++ b/src/libgfortran/generated/unpack_i4.c     (.../branches/gcc-4_8-branch)
 
10435
@@ -99,7 +99,7 @@
 
10436
          rs *= extent[n];
 
10437
        }
 
10438
       ret->offset = 0;
 
10439
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4));
 
10440
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4));
 
10441
     }
 
10442
   else
 
10443
     {
 
10444
@@ -244,7 +244,7 @@
 
10445
          rs *= extent[n];
 
10446
        }
 
10447
       ret->offset = 0;
 
10448
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4));
 
10449
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4));
 
10450
     }
 
10451
   else
 
10452
     {
 
10453
Index: libgfortran/generated/minloc1_16_r4.c
 
10454
===================================================================
 
10455
--- a/src/libgfortran/generated/minloc1_16_r4.c (.../tags/gcc_4_8_3_release)
 
10456
+++ b/src/libgfortran/generated/minloc1_16_r4.c (.../branches/gcc-4_8-branch)
 
10457
@@ -98,10 +98,9 @@
 
10458
       retarray->offset = 0;
 
10459
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10460
 
 
10461
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10462
-                  * extent[rank-1];
 
10463
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10464
 
 
10465
-      retarray->base_addr = xmalloc (alloc_size);
 
10466
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
10467
       if (alloc_size == 0)
 
10468
        {
 
10469
          /* Make sure we have a zero-sized array.  */
 
10470
@@ -294,8 +293,7 @@
 
10471
 
 
10472
        }
 
10473
 
 
10474
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10475
-                  * extent[rank-1];
 
10476
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10477
 
 
10478
       retarray->offset = 0;
 
10479
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10480
@@ -307,7 +305,7 @@
 
10481
          return;
 
10482
        }
 
10483
       else
 
10484
-       retarray->base_addr = xmalloc (alloc_size);
 
10485
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
10486
 
 
10487
     }
 
10488
   else
 
10489
@@ -485,8 +483,7 @@
 
10490
       retarray->offset = 0;
 
10491
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10492
 
 
10493
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10494
-                  * extent[rank-1];
 
10495
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10496
 
 
10497
       if (alloc_size == 0)
 
10498
        {
 
10499
@@ -495,7 +492,7 @@
 
10500
          return;
 
10501
        }
 
10502
       else
 
10503
-       retarray->base_addr = xmalloc (alloc_size);
 
10504
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
10505
     }
 
10506
   else
 
10507
     {
 
10508
Index: libgfortran/generated/product_i8.c
 
10509
===================================================================
 
10510
--- a/src/libgfortran/generated/product_i8.c    (.../tags/gcc_4_8_3_release)
 
10511
+++ b/src/libgfortran/generated/product_i8.c    (.../branches/gcc-4_8-branch)
 
10512
@@ -97,10 +97,9 @@
 
10513
       retarray->offset = 0;
 
10514
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10515
 
 
10516
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10517
-                  * extent[rank-1];
 
10518
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10519
 
 
10520
-      retarray->base_addr = xmalloc (alloc_size);
 
10521
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10522
       if (alloc_size == 0)
 
10523
        {
 
10524
          /* Make sure we have a zero-sized array.  */
 
10525
@@ -272,8 +271,7 @@
 
10526
 
 
10527
        }
 
10528
 
 
10529
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10530
-                  * extent[rank-1];
 
10531
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10532
 
 
10533
       retarray->offset = 0;
 
10534
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10535
@@ -285,7 +283,7 @@
 
10536
          return;
 
10537
        }
 
10538
       else
 
10539
-       retarray->base_addr = xmalloc (alloc_size);
 
10540
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10541
 
 
10542
     }
 
10543
   else
 
10544
@@ -430,8 +428,7 @@
 
10545
       retarray->offset = 0;
 
10546
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10547
 
 
10548
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10549
-                  * extent[rank-1];
 
10550
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10551
 
 
10552
       if (alloc_size == 0)
 
10553
        {
 
10554
@@ -440,7 +437,7 @@
 
10555
          return;
 
10556
        }
 
10557
       else
 
10558
-       retarray->base_addr = xmalloc (alloc_size);
 
10559
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10560
     }
 
10561
   else
 
10562
     {
 
10563
Index: libgfortran/generated/minloc0_16_r8.c
 
10564
===================================================================
 
10565
--- a/src/libgfortran/generated/minloc0_16_r8.c (.../tags/gcc_4_8_3_release)
 
10566
+++ b/src/libgfortran/generated/minloc0_16_r8.c (.../branches/gcc-4_8-branch)
 
10567
@@ -58,7 +58,7 @@
 
10568
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10569
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10570
       retarray->offset = 0;
 
10571
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
10572
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
10573
     }
 
10574
   else
 
10575
     {
 
10576
@@ -199,7 +199,7 @@
 
10577
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
10578
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10579
       retarray->offset = 0;
 
10580
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
10581
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
10582
     }
 
10583
   else
 
10584
     {
 
10585
@@ -367,7 +367,7 @@
 
10586
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
10587
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
10588
       retarray->offset = 0;
 
10589
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
10590
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
10591
     }
 
10592
   else if (unlikely (compile_options.bounds_check))
 
10593
     {
 
10594
Index: libgfortran/generated/count_2_l.c
 
10595
===================================================================
 
10596
--- a/src/libgfortran/generated/count_2_l.c     (.../tags/gcc_4_8_3_release)
 
10597
+++ b/src/libgfortran/generated/count_2_l.c     (.../branches/gcc-4_8-branch)
 
10598
@@ -101,8 +101,7 @@
 
10599
       retarray->offset = 0;
 
10600
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10601
 
 
10602
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10603
-                  * extent[rank-1];
 
10604
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10605
 
 
10606
       if (alloc_size == 0)
 
10607
        {
 
10608
@@ -111,7 +110,7 @@
 
10609
          return;
 
10610
        }
 
10611
       else
 
10612
-       retarray->base_addr = xmalloc (alloc_size);
 
10613
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
10614
     }
 
10615
   else
 
10616
     {
 
10617
Index: libgfortran/generated/transpose_r8.c
 
10618
===================================================================
 
10619
--- a/src/libgfortran/generated/transpose_r8.c  (.../tags/gcc_4_8_3_release)
 
10620
+++ b/src/libgfortran/generated/transpose_r8.c  (.../branches/gcc-4_8-branch)
 
10621
@@ -60,7 +60,8 @@
 
10622
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
10623
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
10624
 
 
10625
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) ret));
 
10626
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
10627
+                                     sizeof (GFC_REAL_8));
 
10628
       ret->offset = 0;
 
10629
     } else if (unlikely (compile_options.bounds_check))
 
10630
     {
 
10631
Index: libgfortran/generated/cshift1_8.c
 
10632
===================================================================
 
10633
--- a/src/libgfortran/generated/cshift1_8.c     (.../tags/gcc_4_8_3_release)
 
10634
+++ b/src/libgfortran/generated/cshift1_8.c     (.../branches/gcc-4_8-branch)
 
10635
@@ -80,7 +80,7 @@
 
10636
     {
 
10637
       int i;
 
10638
 
 
10639
-      ret->base_addr = xmalloc (size * arraysize);
 
10640
+      ret->base_addr = xmallocarray (arraysize, size);
 
10641
       ret->offset = 0;
 
10642
       ret->dtype = array->dtype;
 
10643
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
10644
Index: libgfortran/generated/matmul_i4.c
 
10645
===================================================================
 
10646
--- a/src/libgfortran/generated/matmul_i4.c     (.../tags/gcc_4_8_3_release)
 
10647
+++ b/src/libgfortran/generated/matmul_i4.c     (.../branches/gcc-4_8-branch)
 
10648
@@ -124,7 +124,7 @@
 
10649
         }
 
10650
 
 
10651
       retarray->base_addr
 
10652
-       = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) retarray));
 
10653
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_4));
 
10654
       retarray->offset = 0;
 
10655
     }
 
10656
     else if (unlikely (compile_options.bounds_check))
 
10657
Index: libgfortran/generated/pack_r10.c
 
10658
===================================================================
 
10659
--- a/src/libgfortran/generated/pack_r10.c      (.../tags/gcc_4_8_3_release)
 
10660
+++ b/src/libgfortran/generated/pack_r10.c      (.../branches/gcc-4_8-branch)
 
10661
@@ -167,8 +167,8 @@
 
10662
 
 
10663
          ret->offset = 0;
 
10664
 
 
10665
-         /* xmalloc allocates a single byte for zero size.  */
 
10666
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * total);
 
10667
+         /* xmallocarray allocates a single byte for zero size.  */
 
10668
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_10));
 
10669
 
 
10670
          if (total == 0)
 
10671
            return;
 
10672
Index: libgfortran/generated/minloc1_16_i2.c
 
10673
===================================================================
 
10674
--- a/src/libgfortran/generated/minloc1_16_i2.c (.../tags/gcc_4_8_3_release)
 
10675
+++ b/src/libgfortran/generated/minloc1_16_i2.c (.../branches/gcc-4_8-branch)
 
10676
@@ -98,10 +98,9 @@
 
10677
       retarray->offset = 0;
 
10678
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10679
 
 
10680
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10681
-                  * extent[rank-1];
 
10682
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10683
 
 
10684
-      retarray->base_addr = xmalloc (alloc_size);
 
10685
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
10686
       if (alloc_size == 0)
 
10687
        {
 
10688
          /* Make sure we have a zero-sized array.  */
 
10689
@@ -294,8 +293,7 @@
 
10690
 
 
10691
        }
 
10692
 
 
10693
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10694
-                  * extent[rank-1];
 
10695
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10696
 
 
10697
       retarray->offset = 0;
 
10698
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10699
@@ -307,7 +305,7 @@
 
10700
          return;
 
10701
        }
 
10702
       else
 
10703
-       retarray->base_addr = xmalloc (alloc_size);
 
10704
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
10705
 
 
10706
     }
 
10707
   else
 
10708
@@ -485,8 +483,7 @@
 
10709
       retarray->offset = 0;
 
10710
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10711
 
 
10712
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10713
-                  * extent[rank-1];
 
10714
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10715
 
 
10716
       if (alloc_size == 0)
 
10717
        {
 
10718
@@ -495,7 +492,7 @@
 
10719
          return;
 
10720
        }
 
10721
       else
 
10722
-       retarray->base_addr = xmalloc (alloc_size);
 
10723
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
10724
     }
 
10725
   else
 
10726
     {
 
10727
Index: libgfortran/generated/in_pack_i8.c
 
10728
===================================================================
 
10729
--- a/src/libgfortran/generated/in_pack_i8.c    (.../tags/gcc_4_8_3_release)
 
10730
+++ b/src/libgfortran/generated/in_pack_i8.c    (.../branches/gcc-4_8-branch)
 
10731
@@ -76,7 +76,7 @@
 
10732
     return source->base_addr;
 
10733
 
 
10734
   /* Allocate storage for the destination.  */
 
10735
-  destptr = (GFC_INTEGER_8 *)xmalloc (ssize * sizeof (GFC_INTEGER_8));
 
10736
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_8));
 
10737
   dest = destptr;
 
10738
   src = source->base_addr;
 
10739
   stride0 = stride[0];
 
10740
Index: libgfortran/generated/transpose_r16.c
 
10741
===================================================================
 
10742
--- a/src/libgfortran/generated/transpose_r16.c (.../tags/gcc_4_8_3_release)
 
10743
+++ b/src/libgfortran/generated/transpose_r16.c (.../branches/gcc-4_8-branch)
 
10744
@@ -60,7 +60,8 @@
 
10745
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
10746
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
10747
 
 
10748
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) ret));
 
10749
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
10750
+                                     sizeof (GFC_REAL_16));
 
10751
       ret->offset = 0;
 
10752
     } else if (unlikely (compile_options.bounds_check))
 
10753
     {
 
10754
Index: libgfortran/generated/minloc1_4_i4.c
 
10755
===================================================================
 
10756
--- a/src/libgfortran/generated/minloc1_4_i4.c  (.../tags/gcc_4_8_3_release)
 
10757
+++ b/src/libgfortran/generated/minloc1_4_i4.c  (.../branches/gcc-4_8-branch)
 
10758
@@ -98,10 +98,9 @@
 
10759
       retarray->offset = 0;
 
10760
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10761
 
 
10762
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10763
-                  * extent[rank-1];
 
10764
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10765
 
 
10766
-      retarray->base_addr = xmalloc (alloc_size);
 
10767
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10768
       if (alloc_size == 0)
 
10769
        {
 
10770
          /* Make sure we have a zero-sized array.  */
 
10771
@@ -294,8 +293,7 @@
 
10772
 
 
10773
        }
 
10774
 
 
10775
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10776
-                  * extent[rank-1];
 
10777
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10778
 
 
10779
       retarray->offset = 0;
 
10780
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10781
@@ -307,7 +305,7 @@
 
10782
          return;
 
10783
        }
 
10784
       else
 
10785
-       retarray->base_addr = xmalloc (alloc_size);
 
10786
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10787
 
 
10788
     }
 
10789
   else
 
10790
@@ -485,8 +483,7 @@
 
10791
       retarray->offset = 0;
 
10792
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10793
 
 
10794
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10795
-                  * extent[rank-1];
 
10796
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10797
 
 
10798
       if (alloc_size == 0)
 
10799
        {
 
10800
@@ -495,7 +492,7 @@
 
10801
          return;
 
10802
        }
 
10803
       else
 
10804
-       retarray->base_addr = xmalloc (alloc_size);
 
10805
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
10806
     }
 
10807
   else
 
10808
     {
 
10809
Index: libgfortran/generated/maxval_i1.c
 
10810
===================================================================
 
10811
--- a/src/libgfortran/generated/maxval_i1.c     (.../tags/gcc_4_8_3_release)
 
10812
+++ b/src/libgfortran/generated/maxval_i1.c     (.../branches/gcc-4_8-branch)
 
10813
@@ -97,10 +97,9 @@
 
10814
       retarray->offset = 0;
 
10815
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10816
 
 
10817
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10818
-                  * extent[rank-1];
 
10819
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10820
 
 
10821
-      retarray->base_addr = xmalloc (alloc_size);
 
10822
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
10823
       if (alloc_size == 0)
 
10824
        {
 
10825
          /* Make sure we have a zero-sized array.  */
 
10826
@@ -286,8 +285,7 @@
 
10827
 
 
10828
        }
 
10829
 
 
10830
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10831
-                  * extent[rank-1];
 
10832
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10833
 
 
10834
       retarray->offset = 0;
 
10835
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10836
@@ -299,7 +297,7 @@
 
10837
          return;
 
10838
        }
 
10839
       else
 
10840
-       retarray->base_addr = xmalloc (alloc_size);
 
10841
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
10842
 
 
10843
     }
 
10844
   else
 
10845
@@ -472,8 +470,7 @@
 
10846
       retarray->offset = 0;
 
10847
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10848
 
 
10849
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10850
-                  * extent[rank-1];
 
10851
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10852
 
 
10853
       if (alloc_size == 0)
 
10854
        {
 
10855
@@ -482,7 +479,7 @@
 
10856
          return;
 
10857
        }
 
10858
       else
 
10859
-       retarray->base_addr = xmalloc (alloc_size);
 
10860
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
10861
     }
 
10862
   else
 
10863
     {
 
10864
Index: libgfortran/generated/product_c16.c
 
10865
===================================================================
 
10866
--- a/src/libgfortran/generated/product_c16.c   (.../tags/gcc_4_8_3_release)
 
10867
+++ b/src/libgfortran/generated/product_c16.c   (.../branches/gcc-4_8-branch)
 
10868
@@ -97,10 +97,9 @@
 
10869
       retarray->offset = 0;
 
10870
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10871
 
 
10872
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10873
-                  * extent[rank-1];
 
10874
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10875
 
 
10876
-      retarray->base_addr = xmalloc (alloc_size);
 
10877
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
10878
       if (alloc_size == 0)
 
10879
        {
 
10880
          /* Make sure we have a zero-sized array.  */
 
10881
@@ -272,8 +271,7 @@
 
10882
 
 
10883
        }
 
10884
 
 
10885
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10886
-                  * extent[rank-1];
 
10887
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10888
 
 
10889
       retarray->offset = 0;
 
10890
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10891
@@ -285,7 +283,7 @@
 
10892
          return;
 
10893
        }
 
10894
       else
 
10895
-       retarray->base_addr = xmalloc (alloc_size);
 
10896
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
10897
 
 
10898
     }
 
10899
   else
 
10900
@@ -430,8 +428,7 @@
 
10901
       retarray->offset = 0;
 
10902
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10903
 
 
10904
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10905
-                  * extent[rank-1];
 
10906
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10907
 
 
10908
       if (alloc_size == 0)
 
10909
        {
 
10910
@@ -440,7 +437,7 @@
 
10911
          return;
 
10912
        }
 
10913
       else
 
10914
-       retarray->base_addr = xmalloc (alloc_size);
 
10915
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
10916
     }
 
10917
   else
 
10918
     {
 
10919
Index: libgfortran/generated/reshape_r4.c
 
10920
===================================================================
 
10921
--- a/src/libgfortran/generated/reshape_r4.c    (.../tags/gcc_4_8_3_release)
 
10922
+++ b/src/libgfortran/generated/reshape_r4.c    (.../branches/gcc-4_8-branch)
 
10923
@@ -111,11 +111,11 @@
 
10924
       ret->offset = 0;
 
10925
 
 
10926
       if (unlikely (rs < 1))
 
10927
-        alloc_size = 1;
 
10928
+        alloc_size = 0;
 
10929
       else
 
10930
-        alloc_size = rs * sizeof (GFC_REAL_4);
 
10931
+        alloc_size = rs;
 
10932
 
 
10933
-      ret->base_addr = xmalloc (alloc_size);
 
10934
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
10935
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
10936
     }
 
10937
 
 
10938
Index: libgfortran/generated/iany_i8.c
 
10939
===================================================================
 
10940
--- a/src/libgfortran/generated/iany_i8.c       (.../tags/gcc_4_8_3_release)
 
10941
+++ b/src/libgfortran/generated/iany_i8.c       (.../branches/gcc-4_8-branch)
 
10942
@@ -97,10 +97,9 @@
 
10943
       retarray->offset = 0;
 
10944
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10945
 
 
10946
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10947
-                  * extent[rank-1];
 
10948
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10949
 
 
10950
-      retarray->base_addr = xmalloc (alloc_size);
 
10951
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10952
       if (alloc_size == 0)
 
10953
        {
 
10954
          /* Make sure we have a zero-sized array.  */
 
10955
@@ -272,8 +271,7 @@
 
10956
 
 
10957
        }
 
10958
 
 
10959
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10960
-                  * extent[rank-1];
 
10961
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10962
 
 
10963
       retarray->offset = 0;
 
10964
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10965
@@ -285,7 +283,7 @@
 
10966
          return;
 
10967
        }
 
10968
       else
 
10969
-       retarray->base_addr = xmalloc (alloc_size);
 
10970
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10971
 
 
10972
     }
 
10973
   else
 
10974
@@ -430,8 +428,7 @@
 
10975
       retarray->offset = 0;
 
10976
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
10977
 
 
10978
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
10979
-                  * extent[rank-1];
 
10980
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
10981
 
 
10982
       if (alloc_size == 0)
 
10983
        {
 
10984
@@ -440,7 +437,7 @@
 
10985
          return;
 
10986
        }
 
10987
       else
 
10988
-       retarray->base_addr = xmalloc (alloc_size);
 
10989
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
10990
     }
 
10991
   else
 
10992
     {
 
10993
Index: libgfortran/generated/cshift1_16.c
 
10994
===================================================================
 
10995
--- a/src/libgfortran/generated/cshift1_16.c    (.../tags/gcc_4_8_3_release)
 
10996
+++ b/src/libgfortran/generated/cshift1_16.c    (.../branches/gcc-4_8-branch)
 
10997
@@ -80,7 +80,7 @@
 
10998
     {
 
10999
       int i;
 
11000
 
 
11001
-      ret->base_addr = xmalloc (size * arraysize);
 
11002
+      ret->base_addr = xmallocarray (arraysize, size);
 
11003
       ret->offset = 0;
 
11004
       ret->dtype = array->dtype;
 
11005
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
11006
Index: libgfortran/generated/maxloc0_4_i1.c
 
11007
===================================================================
 
11008
--- a/src/libgfortran/generated/maxloc0_4_i1.c  (.../tags/gcc_4_8_3_release)
 
11009
+++ b/src/libgfortran/generated/maxloc0_4_i1.c  (.../branches/gcc-4_8-branch)
 
11010
@@ -58,7 +58,7 @@
 
11011
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11012
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11013
       retarray->offset = 0;
 
11014
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11015
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11016
     }
 
11017
   else
 
11018
     {
 
11019
@@ -199,7 +199,7 @@
 
11020
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
11021
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11022
       retarray->offset = 0;
 
11023
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11024
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11025
     }
 
11026
   else
 
11027
     {
 
11028
@@ -367,7 +367,7 @@
 
11029
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11030
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11031
       retarray->offset = 0;
 
11032
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11033
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11034
     }
 
11035
   else if (unlikely (compile_options.bounds_check))
 
11036
     {
 
11037
Index: libgfortran/generated/minloc0_4_i8.c
 
11038
===================================================================
 
11039
--- a/src/libgfortran/generated/minloc0_4_i8.c  (.../tags/gcc_4_8_3_release)
 
11040
+++ b/src/libgfortran/generated/minloc0_4_i8.c  (.../branches/gcc-4_8-branch)
 
11041
@@ -58,7 +58,7 @@
 
11042
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11043
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11044
       retarray->offset = 0;
 
11045
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11046
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11047
     }
 
11048
   else
 
11049
     {
 
11050
@@ -199,7 +199,7 @@
 
11051
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
11052
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11053
       retarray->offset = 0;
 
11054
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11055
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11056
     }
 
11057
   else
 
11058
     {
 
11059
@@ -367,7 +367,7 @@
 
11060
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11061
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11062
       retarray->offset = 0;
 
11063
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11064
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11065
     }
 
11066
   else if (unlikely (compile_options.bounds_check))
 
11067
     {
 
11068
Index: libgfortran/generated/spread_c16.c
 
11069
===================================================================
 
11070
--- a/src/libgfortran/generated/spread_c16.c    (.../tags/gcc_4_8_3_release)
 
11071
+++ b/src/libgfortran/generated/spread_c16.c    (.../branches/gcc-4_8-branch)
 
11072
@@ -101,8 +101,8 @@
 
11073
        }
 
11074
       ret->offset = 0;
 
11075
 
 
11076
-      /* xmalloc allocates a single byte for zero size.  */
 
11077
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_16));
 
11078
+      /* xmallocarray allocates a single byte for zero size.  */
 
11079
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_16));
 
11080
       if (rs <= 0)
 
11081
         return;
 
11082
     }
 
11083
@@ -244,7 +244,7 @@
 
11084
 
 
11085
   if (ret->base_addr == NULL)
 
11086
     {
 
11087
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_16));
 
11088
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_16));
 
11089
       ret->offset = 0;
 
11090
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
11091
     }
 
11092
Index: libgfortran/generated/maxval_r4.c
 
11093
===================================================================
 
11094
--- a/src/libgfortran/generated/maxval_r4.c     (.../tags/gcc_4_8_3_release)
 
11095
+++ b/src/libgfortran/generated/maxval_r4.c     (.../branches/gcc-4_8-branch)
 
11096
@@ -97,10 +97,9 @@
 
11097
       retarray->offset = 0;
 
11098
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11099
 
 
11100
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11101
-                  * extent[rank-1];
 
11102
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11103
 
 
11104
-      retarray->base_addr = xmalloc (alloc_size);
 
11105
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
11106
       if (alloc_size == 0)
 
11107
        {
 
11108
          /* Make sure we have a zero-sized array.  */
 
11109
@@ -286,8 +285,7 @@
 
11110
 
 
11111
        }
 
11112
 
 
11113
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11114
-                  * extent[rank-1];
 
11115
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11116
 
 
11117
       retarray->offset = 0;
 
11118
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11119
@@ -299,7 +297,7 @@
 
11120
          return;
 
11121
        }
 
11122
       else
 
11123
-       retarray->base_addr = xmalloc (alloc_size);
 
11124
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
11125
 
 
11126
     }
 
11127
   else
 
11128
@@ -472,8 +470,7 @@
 
11129
       retarray->offset = 0;
 
11130
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11131
 
 
11132
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11133
-                  * extent[rank-1];
 
11134
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11135
 
 
11136
       if (alloc_size == 0)
 
11137
        {
 
11138
@@ -482,7 +479,7 @@
 
11139
          return;
 
11140
        }
 
11141
       else
 
11142
-       retarray->base_addr = xmalloc (alloc_size);
 
11143
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
11144
     }
 
11145
   else
 
11146
     {
 
11147
Index: libgfortran/generated/minval_r8.c
 
11148
===================================================================
 
11149
--- a/src/libgfortran/generated/minval_r8.c     (.../tags/gcc_4_8_3_release)
 
11150
+++ b/src/libgfortran/generated/minval_r8.c     (.../branches/gcc-4_8-branch)
 
11151
@@ -97,10 +97,9 @@
 
11152
       retarray->offset = 0;
 
11153
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11154
 
 
11155
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11156
-                  * extent[rank-1];
 
11157
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11158
 
 
11159
-      retarray->base_addr = xmalloc (alloc_size);
 
11160
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
11161
       if (alloc_size == 0)
 
11162
        {
 
11163
          /* Make sure we have a zero-sized array.  */
 
11164
@@ -286,8 +285,7 @@
 
11165
 
 
11166
        }
 
11167
 
 
11168
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11169
-                  * extent[rank-1];
 
11170
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11171
 
 
11172
       retarray->offset = 0;
 
11173
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11174
@@ -299,7 +297,7 @@
 
11175
          return;
 
11176
        }
 
11177
       else
 
11178
-       retarray->base_addr = xmalloc (alloc_size);
 
11179
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
11180
 
 
11181
     }
 
11182
   else
 
11183
@@ -472,8 +470,7 @@
 
11184
       retarray->offset = 0;
 
11185
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11186
 
 
11187
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11188
-                  * extent[rank-1];
 
11189
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11190
 
 
11191
       if (alloc_size == 0)
 
11192
        {
 
11193
@@ -482,7 +479,7 @@
 
11194
          return;
 
11195
        }
 
11196
       else
 
11197
-       retarray->base_addr = xmalloc (alloc_size);
 
11198
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
11199
     }
 
11200
   else
 
11201
     {
 
11202
Index: libgfortran/generated/minloc1_16_r16.c
 
11203
===================================================================
 
11204
--- a/src/libgfortran/generated/minloc1_16_r16.c        (.../tags/gcc_4_8_3_release)
 
11205
+++ b/src/libgfortran/generated/minloc1_16_r16.c        (.../branches/gcc-4_8-branch)
 
11206
@@ -98,10 +98,9 @@
 
11207
       retarray->offset = 0;
 
11208
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11209
 
 
11210
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11211
-                  * extent[rank-1];
 
11212
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11213
 
 
11214
-      retarray->base_addr = xmalloc (alloc_size);
 
11215
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
11216
       if (alloc_size == 0)
 
11217
        {
 
11218
          /* Make sure we have a zero-sized array.  */
 
11219
@@ -294,8 +293,7 @@
 
11220
 
 
11221
        }
 
11222
 
 
11223
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11224
-                  * extent[rank-1];
 
11225
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11226
 
 
11227
       retarray->offset = 0;
 
11228
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11229
@@ -307,7 +305,7 @@
 
11230
          return;
 
11231
        }
 
11232
       else
 
11233
-       retarray->base_addr = xmalloc (alloc_size);
 
11234
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
11235
 
 
11236
     }
 
11237
   else
 
11238
@@ -485,8 +483,7 @@
 
11239
       retarray->offset = 0;
 
11240
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11241
 
 
11242
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11243
-                  * extent[rank-1];
 
11244
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11245
 
 
11246
       if (alloc_size == 0)
 
11247
        {
 
11248
@@ -495,7 +492,7 @@
 
11249
          return;
 
11250
        }
 
11251
       else
 
11252
-       retarray->base_addr = xmalloc (alloc_size);
 
11253
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
11254
     }
 
11255
   else
 
11256
     {
 
11257
Index: libgfortran/generated/unpack_i16.c
 
11258
===================================================================
 
11259
--- a/src/libgfortran/generated/unpack_i16.c    (.../tags/gcc_4_8_3_release)
 
11260
+++ b/src/libgfortran/generated/unpack_i16.c    (.../branches/gcc-4_8-branch)
 
11261
@@ -99,7 +99,7 @@
 
11262
          rs *= extent[n];
 
11263
        }
 
11264
       ret->offset = 0;
 
11265
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16));
 
11266
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16));
 
11267
     }
 
11268
   else
 
11269
     {
 
11270
@@ -244,7 +244,7 @@
 
11271
          rs *= extent[n];
 
11272
        }
 
11273
       ret->offset = 0;
 
11274
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16));
 
11275
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16));
 
11276
     }
 
11277
   else
 
11278
     {
 
11279
Index: libgfortran/generated/sum_i8.c
 
11280
===================================================================
 
11281
--- a/src/libgfortran/generated/sum_i8.c        (.../tags/gcc_4_8_3_release)
 
11282
+++ b/src/libgfortran/generated/sum_i8.c        (.../branches/gcc-4_8-branch)
 
11283
@@ -97,10 +97,9 @@
 
11284
       retarray->offset = 0;
 
11285
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11286
 
 
11287
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11288
-                  * extent[rank-1];
 
11289
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11290
 
 
11291
-      retarray->base_addr = xmalloc (alloc_size);
 
11292
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11293
       if (alloc_size == 0)
 
11294
        {
 
11295
          /* Make sure we have a zero-sized array.  */
 
11296
@@ -272,8 +271,7 @@
 
11297
 
 
11298
        }
 
11299
 
 
11300
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11301
-                  * extent[rank-1];
 
11302
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11303
 
 
11304
       retarray->offset = 0;
 
11305
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11306
@@ -285,7 +283,7 @@
 
11307
          return;
 
11308
        }
 
11309
       else
 
11310
-       retarray->base_addr = xmalloc (alloc_size);
 
11311
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11312
 
 
11313
     }
 
11314
   else
 
11315
@@ -430,8 +428,7 @@
 
11316
       retarray->offset = 0;
 
11317
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11318
 
 
11319
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11320
-                  * extent[rank-1];
 
11321
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11322
 
 
11323
       if (alloc_size == 0)
 
11324
        {
 
11325
@@ -440,7 +437,7 @@
 
11326
          return;
 
11327
        }
 
11328
       else
 
11329
-       retarray->base_addr = xmalloc (alloc_size);
 
11330
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11331
     }
 
11332
   else
 
11333
     {
 
11334
Index: libgfortran/generated/pack_i1.c
 
11335
===================================================================
 
11336
--- a/src/libgfortran/generated/pack_i1.c       (.../tags/gcc_4_8_3_release)
 
11337
+++ b/src/libgfortran/generated/pack_i1.c       (.../branches/gcc-4_8-branch)
 
11338
@@ -167,8 +167,8 @@
 
11339
 
 
11340
          ret->offset = 0;
 
11341
 
 
11342
-         /* xmalloc allocates a single byte for zero size.  */
 
11343
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_1) * total);
 
11344
+         /* xmallocarray allocates a single byte for zero size.  */
 
11345
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_1));
 
11346
 
 
11347
          if (total == 0)
 
11348
            return;
 
11349
Index: libgfortran/generated/any_l16.c
 
11350
===================================================================
 
11351
--- a/src/libgfortran/generated/any_l16.c       (.../tags/gcc_4_8_3_release)
 
11352
+++ b/src/libgfortran/generated/any_l16.c       (.../branches/gcc-4_8-branch)
 
11353
@@ -101,8 +101,7 @@
 
11354
       retarray->offset = 0;
 
11355
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11356
 
 
11357
-      alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11358
-                  * extent[rank-1];
 
11359
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11360
 
 
11361
       if (alloc_size == 0)
 
11362
        {
 
11363
@@ -111,7 +110,7 @@
 
11364
          return;
 
11365
        }
 
11366
       else
 
11367
-       retarray->base_addr = xmalloc (alloc_size);
 
11368
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
 
11369
     }
 
11370
   else
 
11371
     {
 
11372
Index: libgfortran/generated/spread_i8.c
 
11373
===================================================================
 
11374
--- a/src/libgfortran/generated/spread_i8.c     (.../tags/gcc_4_8_3_release)
 
11375
+++ b/src/libgfortran/generated/spread_i8.c     (.../branches/gcc-4_8-branch)
 
11376
@@ -101,8 +101,8 @@
 
11377
        }
 
11378
       ret->offset = 0;
 
11379
 
 
11380
-      /* xmalloc allocates a single byte for zero size.  */
 
11381
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_8));
 
11382
+      /* xmallocarray allocates a single byte for zero size.  */
 
11383
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_8));
 
11384
       if (rs <= 0)
 
11385
         return;
 
11386
     }
 
11387
@@ -244,7 +244,7 @@
 
11388
 
 
11389
   if (ret->base_addr == NULL)
 
11390
     {
 
11391
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_8));
 
11392
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_8));
 
11393
       ret->offset = 0;
 
11394
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
11395
     }
 
11396
Index: libgfortran/generated/maxval_i2.c
 
11397
===================================================================
 
11398
--- a/src/libgfortran/generated/maxval_i2.c     (.../tags/gcc_4_8_3_release)
 
11399
+++ b/src/libgfortran/generated/maxval_i2.c     (.../branches/gcc-4_8-branch)
 
11400
@@ -97,10 +97,9 @@
 
11401
       retarray->offset = 0;
 
11402
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11403
 
 
11404
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11405
-                  * extent[rank-1];
 
11406
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11407
 
 
11408
-      retarray->base_addr = xmalloc (alloc_size);
 
11409
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
11410
       if (alloc_size == 0)
 
11411
        {
 
11412
          /* Make sure we have a zero-sized array.  */
 
11413
@@ -286,8 +285,7 @@
 
11414
 
 
11415
        }
 
11416
 
 
11417
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11418
-                  * extent[rank-1];
 
11419
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11420
 
 
11421
       retarray->offset = 0;
 
11422
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11423
@@ -299,7 +297,7 @@
 
11424
          return;
 
11425
        }
 
11426
       else
 
11427
-       retarray->base_addr = xmalloc (alloc_size);
 
11428
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
11429
 
 
11430
     }
 
11431
   else
 
11432
@@ -472,8 +470,7 @@
 
11433
       retarray->offset = 0;
 
11434
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11435
 
 
11436
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11437
-                  * extent[rank-1];
 
11438
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11439
 
 
11440
       if (alloc_size == 0)
 
11441
        {
 
11442
@@ -482,7 +479,7 @@
 
11443
          return;
 
11444
        }
 
11445
       else
 
11446
-       retarray->base_addr = xmalloc (alloc_size);
 
11447
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
11448
     }
 
11449
   else
 
11450
     {
 
11451
Index: libgfortran/generated/maxloc1_8_i4.c
 
11452
===================================================================
 
11453
--- a/src/libgfortran/generated/maxloc1_8_i4.c  (.../tags/gcc_4_8_3_release)
 
11454
+++ b/src/libgfortran/generated/maxloc1_8_i4.c  (.../branches/gcc-4_8-branch)
 
11455
@@ -98,10 +98,9 @@
 
11456
       retarray->offset = 0;
 
11457
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11458
 
 
11459
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11460
-                  * extent[rank-1];
 
11461
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11462
 
 
11463
-      retarray->base_addr = xmalloc (alloc_size);
 
11464
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11465
       if (alloc_size == 0)
 
11466
        {
 
11467
          /* Make sure we have a zero-sized array.  */
 
11468
@@ -294,8 +293,7 @@
 
11469
 
 
11470
        }
 
11471
 
 
11472
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11473
-                  * extent[rank-1];
 
11474
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11475
 
 
11476
       retarray->offset = 0;
 
11477
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11478
@@ -307,7 +305,7 @@
 
11479
          return;
 
11480
        }
 
11481
       else
 
11482
-       retarray->base_addr = xmalloc (alloc_size);
 
11483
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11484
 
 
11485
     }
 
11486
   else
 
11487
@@ -485,8 +483,7 @@
 
11488
       retarray->offset = 0;
 
11489
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11490
 
 
11491
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11492
-                  * extent[rank-1];
 
11493
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11494
 
 
11495
       if (alloc_size == 0)
 
11496
        {
 
11497
@@ -495,7 +492,7 @@
 
11498
          return;
 
11499
        }
 
11500
       else
 
11501
-       retarray->base_addr = xmalloc (alloc_size);
 
11502
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11503
     }
 
11504
   else
 
11505
     {
 
11506
Index: libgfortran/generated/unpack_r8.c
 
11507
===================================================================
 
11508
--- a/src/libgfortran/generated/unpack_r8.c     (.../tags/gcc_4_8_3_release)
 
11509
+++ b/src/libgfortran/generated/unpack_r8.c     (.../branches/gcc-4_8-branch)
 
11510
@@ -99,7 +99,7 @@
 
11511
          rs *= extent[n];
 
11512
        }
 
11513
       ret->offset = 0;
 
11514
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8));
 
11515
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8));
 
11516
     }
 
11517
   else
 
11518
     {
 
11519
@@ -244,7 +244,7 @@
 
11520
          rs *= extent[n];
 
11521
        }
 
11522
       ret->offset = 0;
 
11523
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8));
 
11524
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8));
 
11525
     }
 
11526
   else
 
11527
     {
 
11528
Index: libgfortran/generated/maxloc0_4_r4.c
 
11529
===================================================================
 
11530
--- a/src/libgfortran/generated/maxloc0_4_r4.c  (.../tags/gcc_4_8_3_release)
 
11531
+++ b/src/libgfortran/generated/maxloc0_4_r4.c  (.../branches/gcc-4_8-branch)
 
11532
@@ -58,7 +58,7 @@
 
11533
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11534
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11535
       retarray->offset = 0;
 
11536
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11537
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11538
     }
 
11539
   else
 
11540
     {
 
11541
@@ -199,7 +199,7 @@
 
11542
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
11543
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11544
       retarray->offset = 0;
 
11545
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11546
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11547
     }
 
11548
   else
 
11549
     {
 
11550
@@ -367,7 +367,7 @@
 
11551
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11552
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11553
       retarray->offset = 0;
 
11554
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11555
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11556
     }
 
11557
   else if (unlikely (compile_options.bounds_check))
 
11558
     {
 
11559
Index: libgfortran/generated/all_l1.c
 
11560
===================================================================
 
11561
--- a/src/libgfortran/generated/all_l1.c        (.../tags/gcc_4_8_3_release)
 
11562
+++ b/src/libgfortran/generated/all_l1.c        (.../branches/gcc-4_8-branch)
 
11563
@@ -101,8 +101,7 @@
 
11564
       retarray->offset = 0;
 
11565
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11566
 
 
11567
-      alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11568
-                  * extent[rank-1];
 
11569
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11570
 
 
11571
       if (alloc_size == 0)
 
11572
        {
 
11573
@@ -111,7 +110,7 @@
 
11574
          return;
 
11575
        }
 
11576
       else
 
11577
-       retarray->base_addr = xmalloc (alloc_size);
 
11578
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
 
11579
     }
 
11580
   else
 
11581
     {
 
11582
Index: libgfortran/generated/matmul_r8.c
 
11583
===================================================================
 
11584
--- a/src/libgfortran/generated/matmul_r8.c     (.../tags/gcc_4_8_3_release)
 
11585
+++ b/src/libgfortran/generated/matmul_r8.c     (.../branches/gcc-4_8-branch)
 
11586
@@ -124,7 +124,7 @@
 
11587
         }
 
11588
 
 
11589
       retarray->base_addr
 
11590
-       = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) retarray));
 
11591
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_8));
 
11592
       retarray->offset = 0;
 
11593
     }
 
11594
     else if (unlikely (compile_options.bounds_check))
 
11595
Index: libgfortran/generated/minloc0_4_r16.c
 
11596
===================================================================
 
11597
--- a/src/libgfortran/generated/minloc0_4_r16.c (.../tags/gcc_4_8_3_release)
 
11598
+++ b/src/libgfortran/generated/minloc0_4_r16.c (.../branches/gcc-4_8-branch)
 
11599
@@ -58,7 +58,7 @@
 
11600
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11601
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11602
       retarray->offset = 0;
 
11603
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11604
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11605
     }
 
11606
   else
 
11607
     {
 
11608
@@ -199,7 +199,7 @@
 
11609
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
11610
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11611
       retarray->offset = 0;
 
11612
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11613
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11614
     }
 
11615
   else
 
11616
     {
 
11617
@@ -367,7 +367,7 @@
 
11618
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11619
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11620
       retarray->offset = 0;
 
11621
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11622
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11623
     }
 
11624
   else if (unlikely (compile_options.bounds_check))
 
11625
     {
 
11626
Index: libgfortran/generated/maxloc0_4_i2.c
 
11627
===================================================================
 
11628
--- a/src/libgfortran/generated/maxloc0_4_i2.c  (.../tags/gcc_4_8_3_release)
 
11629
+++ b/src/libgfortran/generated/maxloc0_4_i2.c  (.../branches/gcc-4_8-branch)
 
11630
@@ -58,7 +58,7 @@
 
11631
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11632
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11633
       retarray->offset = 0;
 
11634
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11635
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11636
     }
 
11637
   else
 
11638
     {
 
11639
@@ -199,7 +199,7 @@
 
11640
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
11641
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11642
       retarray->offset = 0;
 
11643
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11644
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11645
     }
 
11646
   else
 
11647
     {
 
11648
@@ -367,7 +367,7 @@
 
11649
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11650
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11651
       retarray->offset = 0;
 
11652
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
11653
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
11654
     }
 
11655
   else if (unlikely (compile_options.bounds_check))
 
11656
     {
 
11657
Index: libgfortran/generated/minloc1_8_r16.c
 
11658
===================================================================
 
11659
--- a/src/libgfortran/generated/minloc1_8_r16.c (.../tags/gcc_4_8_3_release)
 
11660
+++ b/src/libgfortran/generated/minloc1_8_r16.c (.../branches/gcc-4_8-branch)
 
11661
@@ -98,10 +98,9 @@
 
11662
       retarray->offset = 0;
 
11663
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11664
 
 
11665
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11666
-                  * extent[rank-1];
 
11667
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11668
 
 
11669
-      retarray->base_addr = xmalloc (alloc_size);
 
11670
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11671
       if (alloc_size == 0)
 
11672
        {
 
11673
          /* Make sure we have a zero-sized array.  */
 
11674
@@ -294,8 +293,7 @@
 
11675
 
 
11676
        }
 
11677
 
 
11678
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11679
-                  * extent[rank-1];
 
11680
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11681
 
 
11682
       retarray->offset = 0;
 
11683
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11684
@@ -307,7 +305,7 @@
 
11685
          return;
 
11686
        }
 
11687
       else
 
11688
-       retarray->base_addr = xmalloc (alloc_size);
 
11689
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11690
 
 
11691
     }
 
11692
   else
 
11693
@@ -485,8 +483,7 @@
 
11694
       retarray->offset = 0;
 
11695
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11696
 
 
11697
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11698
-                  * extent[rank-1];
 
11699
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11700
 
 
11701
       if (alloc_size == 0)
 
11702
        {
 
11703
@@ -495,7 +492,7 @@
 
11704
          return;
 
11705
        }
 
11706
       else
 
11707
-       retarray->base_addr = xmalloc (alloc_size);
 
11708
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
11709
     }
 
11710
   else
 
11711
     {
 
11712
Index: libgfortran/generated/pack_c10.c
 
11713
===================================================================
 
11714
--- a/src/libgfortran/generated/pack_c10.c      (.../tags/gcc_4_8_3_release)
 
11715
+++ b/src/libgfortran/generated/pack_c10.c      (.../branches/gcc-4_8-branch)
 
11716
@@ -167,8 +167,8 @@
 
11717
 
 
11718
          ret->offset = 0;
 
11719
 
 
11720
-         /* xmalloc allocates a single byte for zero size.  */
 
11721
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * total);
 
11722
+         /* xmallocarray allocates a single byte for zero size.  */
 
11723
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_10));
 
11724
 
 
11725
          if (total == 0)
 
11726
            return;
 
11727
Index: libgfortran/generated/pack_r4.c
 
11728
===================================================================
 
11729
--- a/src/libgfortran/generated/pack_r4.c       (.../tags/gcc_4_8_3_release)
 
11730
+++ b/src/libgfortran/generated/pack_r4.c       (.../branches/gcc-4_8-branch)
 
11731
@@ -167,8 +167,8 @@
 
11732
 
 
11733
          ret->offset = 0;
 
11734
 
 
11735
-         /* xmalloc allocates a single byte for zero size.  */
 
11736
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * total);
 
11737
+         /* xmallocarray allocates a single byte for zero size.  */
 
11738
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_4));
 
11739
 
 
11740
          if (total == 0)
 
11741
            return;
 
11742
Index: libgfortran/generated/transpose_c16.c
 
11743
===================================================================
 
11744
--- a/src/libgfortran/generated/transpose_c16.c (.../tags/gcc_4_8_3_release)
 
11745
+++ b/src/libgfortran/generated/transpose_c16.c (.../branches/gcc-4_8-branch)
 
11746
@@ -60,7 +60,8 @@
 
11747
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
11748
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
11749
 
 
11750
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret));
 
11751
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
11752
+                                     sizeof (GFC_COMPLEX_16));
 
11753
       ret->offset = 0;
 
11754
     } else if (unlikely (compile_options.bounds_check))
 
11755
     {
 
11756
Index: libgfortran/generated/maxloc0_8_i8.c
 
11757
===================================================================
 
11758
--- a/src/libgfortran/generated/maxloc0_8_i8.c  (.../tags/gcc_4_8_3_release)
 
11759
+++ b/src/libgfortran/generated/maxloc0_8_i8.c  (.../branches/gcc-4_8-branch)
 
11760
@@ -58,7 +58,7 @@
 
11761
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11762
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11763
       retarray->offset = 0;
 
11764
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
11765
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
11766
     }
 
11767
   else
 
11768
     {
 
11769
@@ -199,7 +199,7 @@
 
11770
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
11771
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11772
       retarray->offset = 0;
 
11773
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
11774
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
11775
     }
 
11776
   else
 
11777
     {
 
11778
@@ -367,7 +367,7 @@
 
11779
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11780
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11781
       retarray->offset = 0;
 
11782
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
11783
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
11784
     }
 
11785
   else if (unlikely (compile_options.bounds_check))
 
11786
     {
 
11787
Index: libgfortran/generated/minloc1_4_r8.c
 
11788
===================================================================
 
11789
--- a/src/libgfortran/generated/minloc1_4_r8.c  (.../tags/gcc_4_8_3_release)
 
11790
+++ b/src/libgfortran/generated/minloc1_4_r8.c  (.../branches/gcc-4_8-branch)
 
11791
@@ -98,10 +98,9 @@
 
11792
       retarray->offset = 0;
 
11793
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11794
 
 
11795
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11796
-                  * extent[rank-1];
 
11797
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11798
 
 
11799
-      retarray->base_addr = xmalloc (alloc_size);
 
11800
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
11801
       if (alloc_size == 0)
 
11802
        {
 
11803
          /* Make sure we have a zero-sized array.  */
 
11804
@@ -294,8 +293,7 @@
 
11805
 
 
11806
        }
 
11807
 
 
11808
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11809
-                  * extent[rank-1];
 
11810
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11811
 
 
11812
       retarray->offset = 0;
 
11813
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11814
@@ -307,7 +305,7 @@
 
11815
          return;
 
11816
        }
 
11817
       else
 
11818
-       retarray->base_addr = xmalloc (alloc_size);
 
11819
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
11820
 
 
11821
     }
 
11822
   else
 
11823
@@ -485,8 +483,7 @@
 
11824
       retarray->offset = 0;
 
11825
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11826
 
 
11827
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11828
-                  * extent[rank-1];
 
11829
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11830
 
 
11831
       if (alloc_size == 0)
 
11832
        {
 
11833
@@ -495,7 +492,7 @@
 
11834
          return;
 
11835
        }
 
11836
       else
 
11837
-       retarray->base_addr = xmalloc (alloc_size);
 
11838
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
11839
     }
 
11840
   else
 
11841
     {
 
11842
Index: libgfortran/generated/minloc1_16_i4.c
 
11843
===================================================================
 
11844
--- a/src/libgfortran/generated/minloc1_16_i4.c (.../tags/gcc_4_8_3_release)
 
11845
+++ b/src/libgfortran/generated/minloc1_16_i4.c (.../branches/gcc-4_8-branch)
 
11846
@@ -98,10 +98,9 @@
 
11847
       retarray->offset = 0;
 
11848
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11849
 
 
11850
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11851
-                  * extent[rank-1];
 
11852
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11853
 
 
11854
-      retarray->base_addr = xmalloc (alloc_size);
 
11855
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
11856
       if (alloc_size == 0)
 
11857
        {
 
11858
          /* Make sure we have a zero-sized array.  */
 
11859
@@ -294,8 +293,7 @@
 
11860
 
 
11861
        }
 
11862
 
 
11863
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11864
-                  * extent[rank-1];
 
11865
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11866
 
 
11867
       retarray->offset = 0;
 
11868
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11869
@@ -307,7 +305,7 @@
 
11870
          return;
 
11871
        }
 
11872
       else
 
11873
-       retarray->base_addr = xmalloc (alloc_size);
 
11874
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
11875
 
 
11876
     }
 
11877
   else
 
11878
@@ -485,8 +483,7 @@
 
11879
       retarray->offset = 0;
 
11880
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11881
 
 
11882
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11883
-                  * extent[rank-1];
 
11884
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11885
 
 
11886
       if (alloc_size == 0)
 
11887
        {
 
11888
@@ -495,7 +492,7 @@
 
11889
          return;
 
11890
        }
 
11891
       else
 
11892
-       retarray->base_addr = xmalloc (alloc_size);
 
11893
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
11894
     }
 
11895
   else
 
11896
     {
 
11897
Index: libgfortran/generated/minloc0_16_i8.c
 
11898
===================================================================
 
11899
--- a/src/libgfortran/generated/minloc0_16_i8.c (.../tags/gcc_4_8_3_release)
 
11900
+++ b/src/libgfortran/generated/minloc0_16_i8.c (.../branches/gcc-4_8-branch)
 
11901
@@ -58,7 +58,7 @@
 
11902
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11903
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11904
       retarray->offset = 0;
 
11905
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
11906
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
11907
     }
 
11908
   else
 
11909
     {
 
11910
@@ -199,7 +199,7 @@
 
11911
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
11912
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11913
       retarray->offset = 0;
 
11914
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
11915
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
11916
     }
 
11917
   else
 
11918
     {
 
11919
@@ -367,7 +367,7 @@
 
11920
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
11921
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
11922
       retarray->offset = 0;
 
11923
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
11924
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
11925
     }
 
11926
   else if (unlikely (compile_options.bounds_check))
 
11927
     {
 
11928
Index: libgfortran/generated/pack_i2.c
 
11929
===================================================================
 
11930
--- a/src/libgfortran/generated/pack_i2.c       (.../tags/gcc_4_8_3_release)
 
11931
+++ b/src/libgfortran/generated/pack_i2.c       (.../branches/gcc-4_8-branch)
 
11932
@@ -167,8 +167,8 @@
 
11933
 
 
11934
          ret->offset = 0;
 
11935
 
 
11936
-         /* xmalloc allocates a single byte for zero size.  */
 
11937
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_2) * total);
 
11938
+         /* xmallocarray allocates a single byte for zero size.  */
 
11939
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_2));
 
11940
 
 
11941
          if (total == 0)
 
11942
            return;
 
11943
Index: libgfortran/generated/transpose_i8.c
 
11944
===================================================================
 
11945
--- a/src/libgfortran/generated/transpose_i8.c  (.../tags/gcc_4_8_3_release)
 
11946
+++ b/src/libgfortran/generated/transpose_i8.c  (.../branches/gcc-4_8-branch)
 
11947
@@ -60,7 +60,8 @@
 
11948
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
11949
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
11950
 
 
11951
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) ret));
 
11952
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
11953
+                                     sizeof (GFC_INTEGER_8));
 
11954
       ret->offset = 0;
 
11955
     } else if (unlikely (compile_options.bounds_check))
 
11956
     {
 
11957
Index: libgfortran/generated/eoshift1_16.c
 
11958
===================================================================
 
11959
--- a/src/libgfortran/generated/eoshift1_16.c   (.../tags/gcc_4_8_3_release)
 
11960
+++ b/src/libgfortran/generated/eoshift1_16.c   (.../branches/gcc-4_8-branch)
 
11961
@@ -105,8 +105,8 @@
 
11962
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
11963
 
 
11964
         }
 
11965
-      /* xmalloc allocates a single byte for zero size.  */
 
11966
-      ret->base_addr = xmalloc (size * arraysize);
 
11967
+      /* xmallocarray allocates a single byte for zero size.  */
 
11968
+      ret->base_addr = xmallocarray (arraysize, size);
 
11969
 
 
11970
     }
 
11971
   else if (unlikely (compile_options.bounds_check))
 
11972
Index: libgfortran/generated/all_l2.c
 
11973
===================================================================
 
11974
--- a/src/libgfortran/generated/all_l2.c        (.../tags/gcc_4_8_3_release)
 
11975
+++ b/src/libgfortran/generated/all_l2.c        (.../branches/gcc-4_8-branch)
 
11976
@@ -101,8 +101,7 @@
 
11977
       retarray->offset = 0;
 
11978
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
11979
 
 
11980
-      alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
11981
-                  * extent[rank-1];
 
11982
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
11983
 
 
11984
       if (alloc_size == 0)
 
11985
        {
 
11986
@@ -111,7 +110,7 @@
 
11987
          return;
 
11988
        }
 
11989
       else
 
11990
-       retarray->base_addr = xmalloc (alloc_size);
 
11991
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
 
11992
     }
 
11993
   else
 
11994
     {
 
11995
Index: libgfortran/generated/product_c4.c
 
11996
===================================================================
 
11997
--- a/src/libgfortran/generated/product_c4.c    (.../tags/gcc_4_8_3_release)
 
11998
+++ b/src/libgfortran/generated/product_c4.c    (.../branches/gcc-4_8-branch)
 
11999
@@ -97,10 +97,9 @@
 
12000
       retarray->offset = 0;
 
12001
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12002
 
 
12003
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12004
-                  * extent[rank-1];
 
12005
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12006
 
 
12007
-      retarray->base_addr = xmalloc (alloc_size);
 
12008
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
12009
       if (alloc_size == 0)
 
12010
        {
 
12011
          /* Make sure we have a zero-sized array.  */
 
12012
@@ -272,8 +271,7 @@
 
12013
 
 
12014
        }
 
12015
 
 
12016
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12017
-                  * extent[rank-1];
 
12018
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12019
 
 
12020
       retarray->offset = 0;
 
12021
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12022
@@ -285,7 +283,7 @@
 
12023
          return;
 
12024
        }
 
12025
       else
 
12026
-       retarray->base_addr = xmalloc (alloc_size);
 
12027
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
12028
 
 
12029
     }
 
12030
   else
 
12031
@@ -430,8 +428,7 @@
 
12032
       retarray->offset = 0;
 
12033
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12034
 
 
12035
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12036
-                  * extent[rank-1];
 
12037
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12038
 
 
12039
       if (alloc_size == 0)
 
12040
        {
 
12041
@@ -440,7 +437,7 @@
 
12042
          return;
 
12043
        }
 
12044
       else
 
12045
-       retarray->base_addr = xmalloc (alloc_size);
 
12046
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
12047
     }
 
12048
   else
 
12049
     {
 
12050
Index: libgfortran/generated/iall_i1.c
 
12051
===================================================================
 
12052
--- a/src/libgfortran/generated/iall_i1.c       (.../tags/gcc_4_8_3_release)
 
12053
+++ b/src/libgfortran/generated/iall_i1.c       (.../branches/gcc-4_8-branch)
 
12054
@@ -97,10 +97,9 @@
 
12055
       retarray->offset = 0;
 
12056
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12057
 
 
12058
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12059
-                  * extent[rank-1];
 
12060
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12061
 
 
12062
-      retarray->base_addr = xmalloc (alloc_size);
 
12063
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
12064
       if (alloc_size == 0)
 
12065
        {
 
12066
          /* Make sure we have a zero-sized array.  */
 
12067
@@ -272,8 +271,7 @@
 
12068
 
 
12069
        }
 
12070
 
 
12071
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12072
-                  * extent[rank-1];
 
12073
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12074
 
 
12075
       retarray->offset = 0;
 
12076
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12077
@@ -285,7 +283,7 @@
 
12078
          return;
 
12079
        }
 
12080
       else
 
12081
-       retarray->base_addr = xmalloc (alloc_size);
 
12082
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
12083
 
 
12084
     }
 
12085
   else
 
12086
@@ -430,8 +428,7 @@
 
12087
       retarray->offset = 0;
 
12088
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12089
 
 
12090
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12091
-                  * extent[rank-1];
 
12092
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12093
 
 
12094
       if (alloc_size == 0)
 
12095
        {
 
12096
@@ -440,7 +437,7 @@
 
12097
          return;
 
12098
        }
 
12099
       else
 
12100
-       retarray->base_addr = xmalloc (alloc_size);
 
12101
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
12102
     }
 
12103
   else
 
12104
     {
 
12105
Index: libgfortran/generated/reshape_i4.c
 
12106
===================================================================
 
12107
--- a/src/libgfortran/generated/reshape_i4.c    (.../tags/gcc_4_8_3_release)
 
12108
+++ b/src/libgfortran/generated/reshape_i4.c    (.../branches/gcc-4_8-branch)
 
12109
@@ -111,11 +111,11 @@
 
12110
       ret->offset = 0;
 
12111
 
 
12112
       if (unlikely (rs < 1))
 
12113
-        alloc_size = 1;
 
12114
+        alloc_size = 0;
 
12115
       else
 
12116
-        alloc_size = rs * sizeof (GFC_INTEGER_4);
 
12117
+        alloc_size = rs;
 
12118
 
 
12119
-      ret->base_addr = xmalloc (alloc_size);
 
12120
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12121
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
12122
     }
 
12123
 
 
12124
Index: libgfortran/generated/in_pack_r10.c
 
12125
===================================================================
 
12126
--- a/src/libgfortran/generated/in_pack_r10.c   (.../tags/gcc_4_8_3_release)
 
12127
+++ b/src/libgfortran/generated/in_pack_r10.c   (.../branches/gcc-4_8-branch)
 
12128
@@ -76,7 +76,7 @@
 
12129
     return source->base_addr;
 
12130
 
 
12131
   /* Allocate storage for the destination.  */
 
12132
-  destptr = (GFC_REAL_10 *)xmalloc (ssize * sizeof (GFC_REAL_10));
 
12133
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_10));
 
12134
   dest = destptr;
 
12135
   src = source->base_addr;
 
12136
   stride0 = stride[0];
 
12137
Index: libgfortran/generated/in_pack_c4.c
 
12138
===================================================================
 
12139
--- a/src/libgfortran/generated/in_pack_c4.c    (.../tags/gcc_4_8_3_release)
 
12140
+++ b/src/libgfortran/generated/in_pack_c4.c    (.../branches/gcc-4_8-branch)
 
12141
@@ -76,7 +76,7 @@
 
12142
     return source->base_addr;
 
12143
 
 
12144
   /* Allocate storage for the destination.  */
 
12145
-  destptr = (GFC_COMPLEX_4 *)xmalloc (ssize * sizeof (GFC_COMPLEX_4));
 
12146
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_4));
 
12147
   dest = destptr;
 
12148
   src = source->base_addr;
 
12149
   stride0 = stride[0];
 
12150
Index: libgfortran/generated/all_l16.c
 
12151
===================================================================
 
12152
--- a/src/libgfortran/generated/all_l16.c       (.../tags/gcc_4_8_3_release)
 
12153
+++ b/src/libgfortran/generated/all_l16.c       (.../branches/gcc-4_8-branch)
 
12154
@@ -101,8 +101,7 @@
 
12155
       retarray->offset = 0;
 
12156
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12157
 
 
12158
-      alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12159
-                  * extent[rank-1];
 
12160
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12161
 
 
12162
       if (alloc_size == 0)
 
12163
        {
 
12164
@@ -111,7 +110,7 @@
 
12165
          return;
 
12166
        }
 
12167
       else
 
12168
-       retarray->base_addr = xmalloc (alloc_size);
 
12169
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
 
12170
     }
 
12171
   else
 
12172
     {
 
12173
Index: libgfortran/generated/maxloc0_16_i1.c
 
12174
===================================================================
 
12175
--- a/src/libgfortran/generated/maxloc0_16_i1.c (.../tags/gcc_4_8_3_release)
 
12176
+++ b/src/libgfortran/generated/maxloc0_16_i1.c (.../branches/gcc-4_8-branch)
 
12177
@@ -58,7 +58,7 @@
 
12178
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12179
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12180
       retarray->offset = 0;
 
12181
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12182
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12183
     }
 
12184
   else
 
12185
     {
 
12186
@@ -199,7 +199,7 @@
 
12187
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
12188
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12189
       retarray->offset = 0;
 
12190
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12191
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12192
     }
 
12193
   else
 
12194
     {
 
12195
@@ -367,7 +367,7 @@
 
12196
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12197
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12198
       retarray->offset = 0;
 
12199
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12200
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12201
     }
 
12202
   else if (unlikely (compile_options.bounds_check))
 
12203
     {
 
12204
Index: libgfortran/generated/maxloc1_8_r8.c
 
12205
===================================================================
 
12206
--- a/src/libgfortran/generated/maxloc1_8_r8.c  (.../tags/gcc_4_8_3_release)
 
12207
+++ b/src/libgfortran/generated/maxloc1_8_r8.c  (.../branches/gcc-4_8-branch)
 
12208
@@ -98,10 +98,9 @@
 
12209
       retarray->offset = 0;
 
12210
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12211
 
 
12212
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12213
-                  * extent[rank-1];
 
12214
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12215
 
 
12216
-      retarray->base_addr = xmalloc (alloc_size);
 
12217
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12218
       if (alloc_size == 0)
 
12219
        {
 
12220
          /* Make sure we have a zero-sized array.  */
 
12221
@@ -294,8 +293,7 @@
 
12222
 
 
12223
        }
 
12224
 
 
12225
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12226
-                  * extent[rank-1];
 
12227
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12228
 
 
12229
       retarray->offset = 0;
 
12230
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12231
@@ -307,7 +305,7 @@
 
12232
          return;
 
12233
        }
 
12234
       else
 
12235
-       retarray->base_addr = xmalloc (alloc_size);
 
12236
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12237
 
 
12238
     }
 
12239
   else
 
12240
@@ -485,8 +483,7 @@
 
12241
       retarray->offset = 0;
 
12242
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12243
 
 
12244
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12245
-                  * extent[rank-1];
 
12246
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12247
 
 
12248
       if (alloc_size == 0)
 
12249
        {
 
12250
@@ -495,7 +492,7 @@
 
12251
          return;
 
12252
        }
 
12253
       else
 
12254
-       retarray->base_addr = xmalloc (alloc_size);
 
12255
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12256
     }
 
12257
   else
 
12258
     {
 
12259
Index: libgfortran/generated/minval_i16.c
 
12260
===================================================================
 
12261
--- a/src/libgfortran/generated/minval_i16.c    (.../tags/gcc_4_8_3_release)
 
12262
+++ b/src/libgfortran/generated/minval_i16.c    (.../branches/gcc-4_8-branch)
 
12263
@@ -97,10 +97,9 @@
 
12264
       retarray->offset = 0;
 
12265
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12266
 
 
12267
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12268
-                  * extent[rank-1];
 
12269
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12270
 
 
12271
-      retarray->base_addr = xmalloc (alloc_size);
 
12272
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
12273
       if (alloc_size == 0)
 
12274
        {
 
12275
          /* Make sure we have a zero-sized array.  */
 
12276
@@ -286,8 +285,7 @@
 
12277
 
 
12278
        }
 
12279
 
 
12280
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12281
-                  * extent[rank-1];
 
12282
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12283
 
 
12284
       retarray->offset = 0;
 
12285
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12286
@@ -299,7 +297,7 @@
 
12287
          return;
 
12288
        }
 
12289
       else
 
12290
-       retarray->base_addr = xmalloc (alloc_size);
 
12291
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
12292
 
 
12293
     }
 
12294
   else
 
12295
@@ -472,8 +470,7 @@
 
12296
       retarray->offset = 0;
 
12297
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12298
 
 
12299
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12300
-                  * extent[rank-1];
 
12301
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12302
 
 
12303
       if (alloc_size == 0)
 
12304
        {
 
12305
@@ -482,7 +479,7 @@
 
12306
          return;
 
12307
        }
 
12308
       else
 
12309
-       retarray->base_addr = xmalloc (alloc_size);
 
12310
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
12311
     }
 
12312
   else
 
12313
     {
 
12314
Index: libgfortran/generated/reshape_r10.c
 
12315
===================================================================
 
12316
--- a/src/libgfortran/generated/reshape_r10.c   (.../tags/gcc_4_8_3_release)
 
12317
+++ b/src/libgfortran/generated/reshape_r10.c   (.../branches/gcc-4_8-branch)
 
12318
@@ -111,11 +111,11 @@
 
12319
       ret->offset = 0;
 
12320
 
 
12321
       if (unlikely (rs < 1))
 
12322
-        alloc_size = 1;
 
12323
+        alloc_size = 0;
 
12324
       else
 
12325
-        alloc_size = rs * sizeof (GFC_REAL_10);
 
12326
+        alloc_size = rs;
 
12327
 
 
12328
-      ret->base_addr = xmalloc (alloc_size);
 
12329
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
12330
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
12331
     }
 
12332
 
 
12333
Index: libgfortran/generated/unpack_r16.c
 
12334
===================================================================
 
12335
--- a/src/libgfortran/generated/unpack_r16.c    (.../tags/gcc_4_8_3_release)
 
12336
+++ b/src/libgfortran/generated/unpack_r16.c    (.../branches/gcc-4_8-branch)
 
12337
@@ -99,7 +99,7 @@
 
12338
          rs *= extent[n];
 
12339
        }
 
12340
       ret->offset = 0;
 
12341
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16));
 
12342
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16));
 
12343
     }
 
12344
   else
 
12345
     {
 
12346
@@ -244,7 +244,7 @@
 
12347
          rs *= extent[n];
 
12348
        }
 
12349
       ret->offset = 0;
 
12350
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16));
 
12351
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16));
 
12352
     }
 
12353
   else
 
12354
     {
 
12355
Index: libgfortran/generated/maxval_i4.c
 
12356
===================================================================
 
12357
--- a/src/libgfortran/generated/maxval_i4.c     (.../tags/gcc_4_8_3_release)
 
12358
+++ b/src/libgfortran/generated/maxval_i4.c     (.../branches/gcc-4_8-branch)
 
12359
@@ -97,10 +97,9 @@
 
12360
       retarray->offset = 0;
 
12361
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12362
 
 
12363
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12364
-                  * extent[rank-1];
 
12365
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12366
 
 
12367
-      retarray->base_addr = xmalloc (alloc_size);
 
12368
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12369
       if (alloc_size == 0)
 
12370
        {
 
12371
          /* Make sure we have a zero-sized array.  */
 
12372
@@ -286,8 +285,7 @@
 
12373
 
 
12374
        }
 
12375
 
 
12376
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12377
-                  * extent[rank-1];
 
12378
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12379
 
 
12380
       retarray->offset = 0;
 
12381
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12382
@@ -299,7 +297,7 @@
 
12383
          return;
 
12384
        }
 
12385
       else
 
12386
-       retarray->base_addr = xmalloc (alloc_size);
 
12387
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12388
 
 
12389
     }
 
12390
   else
 
12391
@@ -472,8 +470,7 @@
 
12392
       retarray->offset = 0;
 
12393
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12394
 
 
12395
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12396
-                  * extent[rank-1];
 
12397
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12398
 
 
12399
       if (alloc_size == 0)
 
12400
        {
 
12401
@@ -482,7 +479,7 @@
 
12402
          return;
 
12403
        }
 
12404
       else
 
12405
-       retarray->base_addr = xmalloc (alloc_size);
 
12406
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12407
     }
 
12408
   else
 
12409
     {
 
12410
Index: libgfortran/generated/minval_i8.c
 
12411
===================================================================
 
12412
--- a/src/libgfortran/generated/minval_i8.c     (.../tags/gcc_4_8_3_release)
 
12413
+++ b/src/libgfortran/generated/minval_i8.c     (.../branches/gcc-4_8-branch)
 
12414
@@ -97,10 +97,9 @@
 
12415
       retarray->offset = 0;
 
12416
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12417
 
 
12418
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12419
-                  * extent[rank-1];
 
12420
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12421
 
 
12422
-      retarray->base_addr = xmalloc (alloc_size);
 
12423
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12424
       if (alloc_size == 0)
 
12425
        {
 
12426
          /* Make sure we have a zero-sized array.  */
 
12427
@@ -286,8 +285,7 @@
 
12428
 
 
12429
        }
 
12430
 
 
12431
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12432
-                  * extent[rank-1];
 
12433
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12434
 
 
12435
       retarray->offset = 0;
 
12436
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12437
@@ -299,7 +297,7 @@
 
12438
          return;
 
12439
        }
 
12440
       else
 
12441
-       retarray->base_addr = xmalloc (alloc_size);
 
12442
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12443
 
 
12444
     }
 
12445
   else
 
12446
@@ -472,8 +470,7 @@
 
12447
       retarray->offset = 0;
 
12448
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12449
 
 
12450
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12451
-                  * extent[rank-1];
 
12452
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12453
 
 
12454
       if (alloc_size == 0)
 
12455
        {
 
12456
@@ -482,7 +479,7 @@
 
12457
          return;
 
12458
        }
 
12459
       else
 
12460
-       retarray->base_addr = xmalloc (alloc_size);
 
12461
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12462
     }
 
12463
   else
 
12464
     {
 
12465
Index: libgfortran/generated/maxloc0_16_i16.c
 
12466
===================================================================
 
12467
--- a/src/libgfortran/generated/maxloc0_16_i16.c        (.../tags/gcc_4_8_3_release)
 
12468
+++ b/src/libgfortran/generated/maxloc0_16_i16.c        (.../branches/gcc-4_8-branch)
 
12469
@@ -58,7 +58,7 @@
 
12470
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12471
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12472
       retarray->offset = 0;
 
12473
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12474
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12475
     }
 
12476
   else
 
12477
     {
 
12478
@@ -199,7 +199,7 @@
 
12479
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
12480
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12481
       retarray->offset = 0;
 
12482
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12483
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12484
     }
 
12485
   else
 
12486
     {
 
12487
@@ -367,7 +367,7 @@
 
12488
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12489
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12490
       retarray->offset = 0;
 
12491
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12492
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12493
     }
 
12494
   else if (unlikely (compile_options.bounds_check))
 
12495
     {
 
12496
Index: libgfortran/generated/shape_i4.c
 
12497
===================================================================
 
12498
--- a/src/libgfortran/generated/shape_i4.c      (.../tags/gcc_4_8_3_release)
 
12499
+++ b/src/libgfortran/generated/shape_i4.c      (.../branches/gcc-4_8-branch)
 
12500
@@ -49,7 +49,7 @@
 
12501
     {
 
12502
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
 
12503
       ret->offset = 0;
 
12504
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
12505
+      ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
12506
     }
 
12507
 
 
12508
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
12509
Index: libgfortran/generated/minloc1_4_i16.c
 
12510
===================================================================
 
12511
--- a/src/libgfortran/generated/minloc1_4_i16.c (.../tags/gcc_4_8_3_release)
 
12512
+++ b/src/libgfortran/generated/minloc1_4_i16.c (.../branches/gcc-4_8-branch)
 
12513
@@ -98,10 +98,9 @@
 
12514
       retarray->offset = 0;
 
12515
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12516
 
 
12517
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12518
-                  * extent[rank-1];
 
12519
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12520
 
 
12521
-      retarray->base_addr = xmalloc (alloc_size);
 
12522
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12523
       if (alloc_size == 0)
 
12524
        {
 
12525
          /* Make sure we have a zero-sized array.  */
 
12526
@@ -294,8 +293,7 @@
 
12527
 
 
12528
        }
 
12529
 
 
12530
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12531
-                  * extent[rank-1];
 
12532
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12533
 
 
12534
       retarray->offset = 0;
 
12535
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12536
@@ -307,7 +305,7 @@
 
12537
          return;
 
12538
        }
 
12539
       else
 
12540
-       retarray->base_addr = xmalloc (alloc_size);
 
12541
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12542
 
 
12543
     }
 
12544
   else
 
12545
@@ -485,8 +483,7 @@
 
12546
       retarray->offset = 0;
 
12547
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12548
 
 
12549
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12550
-                  * extent[rank-1];
 
12551
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12552
 
 
12553
       if (alloc_size == 0)
 
12554
        {
 
12555
@@ -495,7 +492,7 @@
 
12556
          return;
 
12557
        }
 
12558
       else
 
12559
-       retarray->base_addr = xmalloc (alloc_size);
 
12560
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12561
     }
 
12562
   else
 
12563
     {
 
12564
Index: libgfortran/generated/maxloc0_4_r10.c
 
12565
===================================================================
 
12566
--- a/src/libgfortran/generated/maxloc0_4_r10.c (.../tags/gcc_4_8_3_release)
 
12567
+++ b/src/libgfortran/generated/maxloc0_4_r10.c (.../branches/gcc-4_8-branch)
 
12568
@@ -58,7 +58,7 @@
 
12569
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12570
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12571
       retarray->offset = 0;
 
12572
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
12573
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
12574
     }
 
12575
   else
 
12576
     {
 
12577
@@ -199,7 +199,7 @@
 
12578
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
12579
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12580
       retarray->offset = 0;
 
12581
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
12582
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
12583
     }
 
12584
   else
 
12585
     {
 
12586
@@ -367,7 +367,7 @@
 
12587
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12588
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12589
       retarray->offset = 0;
 
12590
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
12591
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
12592
     }
 
12593
   else if (unlikely (compile_options.bounds_check))
 
12594
     {
 
12595
Index: libgfortran/generated/maxloc0_8_i16.c
 
12596
===================================================================
 
12597
--- a/src/libgfortran/generated/maxloc0_8_i16.c (.../tags/gcc_4_8_3_release)
 
12598
+++ b/src/libgfortran/generated/maxloc0_8_i16.c (.../branches/gcc-4_8-branch)
 
12599
@@ -58,7 +58,7 @@
 
12600
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12601
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12602
       retarray->offset = 0;
 
12603
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
12604
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
12605
     }
 
12606
   else
 
12607
     {
 
12608
@@ -199,7 +199,7 @@
 
12609
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
12610
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12611
       retarray->offset = 0;
 
12612
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
12613
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
12614
     }
 
12615
   else
 
12616
     {
 
12617
@@ -367,7 +367,7 @@
 
12618
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12619
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12620
       retarray->offset = 0;
 
12621
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
12622
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
12623
     }
 
12624
   else if (unlikely (compile_options.bounds_check))
 
12625
     {
 
12626
Index: libgfortran/generated/iall_i2.c
 
12627
===================================================================
 
12628
--- a/src/libgfortran/generated/iall_i2.c       (.../tags/gcc_4_8_3_release)
 
12629
+++ b/src/libgfortran/generated/iall_i2.c       (.../branches/gcc-4_8-branch)
 
12630
@@ -97,10 +97,9 @@
 
12631
       retarray->offset = 0;
 
12632
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12633
 
 
12634
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12635
-                  * extent[rank-1];
 
12636
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12637
 
 
12638
-      retarray->base_addr = xmalloc (alloc_size);
 
12639
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
12640
       if (alloc_size == 0)
 
12641
        {
 
12642
          /* Make sure we have a zero-sized array.  */
 
12643
@@ -272,8 +271,7 @@
 
12644
 
 
12645
        }
 
12646
 
 
12647
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12648
-                  * extent[rank-1];
 
12649
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12650
 
 
12651
       retarray->offset = 0;
 
12652
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12653
@@ -285,7 +283,7 @@
 
12654
          return;
 
12655
        }
 
12656
       else
 
12657
-       retarray->base_addr = xmalloc (alloc_size);
 
12658
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
12659
 
 
12660
     }
 
12661
   else
 
12662
@@ -430,8 +428,7 @@
 
12663
       retarray->offset = 0;
 
12664
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12665
 
 
12666
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12667
-                  * extent[rank-1];
 
12668
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12669
 
 
12670
       if (alloc_size == 0)
 
12671
        {
 
12672
@@ -440,7 +437,7 @@
 
12673
          return;
 
12674
        }
 
12675
       else
 
12676
-       retarray->base_addr = xmalloc (alloc_size);
 
12677
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
12678
     }
 
12679
   else
 
12680
     {
 
12681
Index: libgfortran/generated/maxloc1_8_r10.c
 
12682
===================================================================
 
12683
--- a/src/libgfortran/generated/maxloc1_8_r10.c (.../tags/gcc_4_8_3_release)
 
12684
+++ b/src/libgfortran/generated/maxloc1_8_r10.c (.../branches/gcc-4_8-branch)
 
12685
@@ -98,10 +98,9 @@
 
12686
       retarray->offset = 0;
 
12687
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12688
 
 
12689
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12690
-                  * extent[rank-1];
 
12691
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12692
 
 
12693
-      retarray->base_addr = xmalloc (alloc_size);
 
12694
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12695
       if (alloc_size == 0)
 
12696
        {
 
12697
          /* Make sure we have a zero-sized array.  */
 
12698
@@ -294,8 +293,7 @@
 
12699
 
 
12700
        }
 
12701
 
 
12702
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12703
-                  * extent[rank-1];
 
12704
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12705
 
 
12706
       retarray->offset = 0;
 
12707
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12708
@@ -307,7 +305,7 @@
 
12709
          return;
 
12710
        }
 
12711
       else
 
12712
-       retarray->base_addr = xmalloc (alloc_size);
 
12713
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12714
 
 
12715
     }
 
12716
   else
 
12717
@@ -485,8 +483,7 @@
 
12718
       retarray->offset = 0;
 
12719
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12720
 
 
12721
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12722
-                  * extent[rank-1];
 
12723
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12724
 
 
12725
       if (alloc_size == 0)
 
12726
        {
 
12727
@@ -495,7 +492,7 @@
 
12728
          return;
 
12729
        }
 
12730
       else
 
12731
-       retarray->base_addr = xmalloc (alloc_size);
 
12732
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
12733
     }
 
12734
   else
 
12735
     {
 
12736
Index: libgfortran/generated/maxloc0_16_r4.c
 
12737
===================================================================
 
12738
--- a/src/libgfortran/generated/maxloc0_16_r4.c (.../tags/gcc_4_8_3_release)
 
12739
+++ b/src/libgfortran/generated/maxloc0_16_r4.c (.../branches/gcc-4_8-branch)
 
12740
@@ -58,7 +58,7 @@
 
12741
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12742
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12743
       retarray->offset = 0;
 
12744
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12745
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12746
     }
 
12747
   else
 
12748
     {
 
12749
@@ -199,7 +199,7 @@
 
12750
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
12751
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12752
       retarray->offset = 0;
 
12753
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12754
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12755
     }
 
12756
   else
 
12757
     {
 
12758
@@ -367,7 +367,7 @@
 
12759
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12760
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12761
       retarray->offset = 0;
 
12762
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
12763
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
12764
     }
 
12765
   else if (unlikely (compile_options.bounds_check))
 
12766
     {
 
12767
Index: libgfortran/generated/minloc0_8_i1.c
 
12768
===================================================================
 
12769
--- a/src/libgfortran/generated/minloc0_8_i1.c  (.../tags/gcc_4_8_3_release)
 
12770
+++ b/src/libgfortran/generated/minloc0_8_i1.c  (.../branches/gcc-4_8-branch)
 
12771
@@ -58,7 +58,7 @@
 
12772
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12773
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12774
       retarray->offset = 0;
 
12775
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
12776
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
12777
     }
 
12778
   else
 
12779
     {
 
12780
@@ -199,7 +199,7 @@
 
12781
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
12782
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12783
       retarray->offset = 0;
 
12784
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
12785
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
12786
     }
 
12787
   else
 
12788
     {
 
12789
@@ -367,7 +367,7 @@
 
12790
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12791
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12792
       retarray->offset = 0;
 
12793
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
12794
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
12795
     }
 
12796
   else if (unlikely (compile_options.bounds_check))
 
12797
     {
 
12798
Index: libgfortran/generated/minloc1_16_r8.c
 
12799
===================================================================
 
12800
--- a/src/libgfortran/generated/minloc1_16_r8.c (.../tags/gcc_4_8_3_release)
 
12801
+++ b/src/libgfortran/generated/minloc1_16_r8.c (.../branches/gcc-4_8-branch)
 
12802
@@ -98,10 +98,9 @@
 
12803
       retarray->offset = 0;
 
12804
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12805
 
 
12806
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12807
-                  * extent[rank-1];
 
12808
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12809
 
 
12810
-      retarray->base_addr = xmalloc (alloc_size);
 
12811
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
12812
       if (alloc_size == 0)
 
12813
        {
 
12814
          /* Make sure we have a zero-sized array.  */
 
12815
@@ -294,8 +293,7 @@
 
12816
 
 
12817
        }
 
12818
 
 
12819
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12820
-                  * extent[rank-1];
 
12821
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12822
 
 
12823
       retarray->offset = 0;
 
12824
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12825
@@ -307,7 +305,7 @@
 
12826
          return;
 
12827
        }
 
12828
       else
 
12829
-       retarray->base_addr = xmalloc (alloc_size);
 
12830
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
12831
 
 
12832
     }
 
12833
   else
 
12834
@@ -485,8 +483,7 @@
 
12835
       retarray->offset = 0;
 
12836
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12837
 
 
12838
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12839
-                  * extent[rank-1];
 
12840
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12841
 
 
12842
       if (alloc_size == 0)
 
12843
        {
 
12844
@@ -495,7 +492,7 @@
 
12845
          return;
 
12846
        }
 
12847
       else
 
12848
-       retarray->base_addr = xmalloc (alloc_size);
 
12849
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
12850
     }
 
12851
   else
 
12852
     {
 
12853
Index: libgfortran/generated/unpack_i8.c
 
12854
===================================================================
 
12855
--- a/src/libgfortran/generated/unpack_i8.c     (.../tags/gcc_4_8_3_release)
 
12856
+++ b/src/libgfortran/generated/unpack_i8.c     (.../branches/gcc-4_8-branch)
 
12857
@@ -99,7 +99,7 @@
 
12858
          rs *= extent[n];
 
12859
        }
 
12860
       ret->offset = 0;
 
12861
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8));
 
12862
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8));
 
12863
     }
 
12864
   else
 
12865
     {
 
12866
@@ -244,7 +244,7 @@
 
12867
          rs *= extent[n];
 
12868
        }
 
12869
       ret->offset = 0;
 
12870
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8));
 
12871
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8));
 
12872
     }
 
12873
   else
 
12874
     {
 
12875
Index: libgfortran/generated/maxloc0_4_i4.c
 
12876
===================================================================
 
12877
--- a/src/libgfortran/generated/maxloc0_4_i4.c  (.../tags/gcc_4_8_3_release)
 
12878
+++ b/src/libgfortran/generated/maxloc0_4_i4.c  (.../branches/gcc-4_8-branch)
 
12879
@@ -58,7 +58,7 @@
 
12880
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12881
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12882
       retarray->offset = 0;
 
12883
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
12884
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
12885
     }
 
12886
   else
 
12887
     {
 
12888
@@ -199,7 +199,7 @@
 
12889
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
12890
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12891
       retarray->offset = 0;
 
12892
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
12893
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
12894
     }
 
12895
   else
 
12896
     {
 
12897
@@ -367,7 +367,7 @@
 
12898
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
12899
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
12900
       retarray->offset = 0;
 
12901
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
12902
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
12903
     }
 
12904
   else if (unlikely (compile_options.bounds_check))
 
12905
     {
 
12906
Index: libgfortran/generated/count_4_l.c
 
12907
===================================================================
 
12908
--- a/src/libgfortran/generated/count_4_l.c     (.../tags/gcc_4_8_3_release)
 
12909
+++ b/src/libgfortran/generated/count_4_l.c     (.../branches/gcc-4_8-branch)
 
12910
@@ -101,8 +101,7 @@
 
12911
       retarray->offset = 0;
 
12912
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12913
 
 
12914
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12915
-                  * extent[rank-1];
 
12916
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12917
 
 
12918
       if (alloc_size == 0)
 
12919
        {
 
12920
@@ -111,7 +110,7 @@
 
12921
          return;
 
12922
        }
 
12923
       else
 
12924
-       retarray->base_addr = xmalloc (alloc_size);
 
12925
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
12926
     }
 
12927
   else
 
12928
     {
 
12929
Index: libgfortran/generated/sum_r10.c
 
12930
===================================================================
 
12931
--- a/src/libgfortran/generated/sum_r10.c       (.../tags/gcc_4_8_3_release)
 
12932
+++ b/src/libgfortran/generated/sum_r10.c       (.../branches/gcc-4_8-branch)
 
12933
@@ -97,10 +97,9 @@
 
12934
       retarray->offset = 0;
 
12935
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12936
 
 
12937
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12938
-                  * extent[rank-1];
 
12939
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12940
 
 
12941
-      retarray->base_addr = xmalloc (alloc_size);
 
12942
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
12943
       if (alloc_size == 0)
 
12944
        {
 
12945
          /* Make sure we have a zero-sized array.  */
 
12946
@@ -272,8 +271,7 @@
 
12947
 
 
12948
        }
 
12949
 
 
12950
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12951
-                  * extent[rank-1];
 
12952
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12953
 
 
12954
       retarray->offset = 0;
 
12955
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12956
@@ -285,7 +283,7 @@
 
12957
          return;
 
12958
        }
 
12959
       else
 
12960
-       retarray->base_addr = xmalloc (alloc_size);
 
12961
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
12962
 
 
12963
     }
 
12964
   else
 
12965
@@ -430,8 +428,7 @@
 
12966
       retarray->offset = 0;
 
12967
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12968
 
 
12969
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12970
-                  * extent[rank-1];
 
12971
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12972
 
 
12973
       if (alloc_size == 0)
 
12974
        {
 
12975
@@ -440,7 +437,7 @@
 
12976
          return;
 
12977
        }
 
12978
       else
 
12979
-       retarray->base_addr = xmalloc (alloc_size);
 
12980
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
12981
     }
 
12982
   else
 
12983
     {
 
12984
Index: libgfortran/generated/sum_c4.c
 
12985
===================================================================
 
12986
--- a/src/libgfortran/generated/sum_c4.c        (.../tags/gcc_4_8_3_release)
 
12987
+++ b/src/libgfortran/generated/sum_c4.c        (.../branches/gcc-4_8-branch)
 
12988
@@ -97,10 +97,9 @@
 
12989
       retarray->offset = 0;
 
12990
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
12991
 
 
12992
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
12993
-                  * extent[rank-1];
 
12994
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
12995
 
 
12996
-      retarray->base_addr = xmalloc (alloc_size);
 
12997
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
12998
       if (alloc_size == 0)
 
12999
        {
 
13000
          /* Make sure we have a zero-sized array.  */
 
13001
@@ -272,8 +271,7 @@
 
13002
 
 
13003
        }
 
13004
 
 
13005
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13006
-                  * extent[rank-1];
 
13007
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13008
 
 
13009
       retarray->offset = 0;
 
13010
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13011
@@ -285,7 +283,7 @@
 
13012
          return;
 
13013
        }
 
13014
       else
 
13015
-       retarray->base_addr = xmalloc (alloc_size);
 
13016
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
13017
 
 
13018
     }
 
13019
   else
 
13020
@@ -430,8 +428,7 @@
 
13021
       retarray->offset = 0;
 
13022
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13023
 
 
13024
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13025
-                  * extent[rank-1];
 
13026
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13027
 
 
13028
       if (alloc_size == 0)
 
13029
        {
 
13030
@@ -440,7 +437,7 @@
 
13031
          return;
 
13032
        }
 
13033
       else
 
13034
-       retarray->base_addr = xmalloc (alloc_size);
 
13035
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
13036
     }
 
13037
   else
 
13038
     {
 
13039
Index: libgfortran/generated/maxloc1_16_r10.c
 
13040
===================================================================
 
13041
--- a/src/libgfortran/generated/maxloc1_16_r10.c        (.../tags/gcc_4_8_3_release)
 
13042
+++ b/src/libgfortran/generated/maxloc1_16_r10.c        (.../branches/gcc-4_8-branch)
 
13043
@@ -98,10 +98,9 @@
 
13044
       retarray->offset = 0;
 
13045
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13046
 
 
13047
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13048
-                  * extent[rank-1];
 
13049
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13050
 
 
13051
-      retarray->base_addr = xmalloc (alloc_size);
 
13052
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
13053
       if (alloc_size == 0)
 
13054
        {
 
13055
          /* Make sure we have a zero-sized array.  */
 
13056
@@ -294,8 +293,7 @@
 
13057
 
 
13058
        }
 
13059
 
 
13060
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13061
-                  * extent[rank-1];
 
13062
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13063
 
 
13064
       retarray->offset = 0;
 
13065
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13066
@@ -307,7 +305,7 @@
 
13067
          return;
 
13068
        }
 
13069
       else
 
13070
-       retarray->base_addr = xmalloc (alloc_size);
 
13071
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
13072
 
 
13073
     }
 
13074
   else
 
13075
@@ -485,8 +483,7 @@
 
13076
       retarray->offset = 0;
 
13077
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13078
 
 
13079
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13080
-                  * extent[rank-1];
 
13081
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13082
 
 
13083
       if (alloc_size == 0)
 
13084
        {
 
13085
@@ -495,7 +492,7 @@
 
13086
          return;
 
13087
        }
 
13088
       else
 
13089
-       retarray->base_addr = xmalloc (alloc_size);
 
13090
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
13091
     }
 
13092
   else
 
13093
     {
 
13094
Index: libgfortran/generated/pack_i16.c
 
13095
===================================================================
 
13096
--- a/src/libgfortran/generated/pack_i16.c      (.../tags/gcc_4_8_3_release)
 
13097
+++ b/src/libgfortran/generated/pack_i16.c      (.../branches/gcc-4_8-branch)
 
13098
@@ -167,8 +167,8 @@
 
13099
 
 
13100
          ret->offset = 0;
 
13101
 
 
13102
-         /* xmalloc allocates a single byte for zero size.  */
 
13103
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * total);
 
13104
+         /* xmallocarray allocates a single byte for zero size.  */
 
13105
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_16));
 
13106
 
 
13107
          if (total == 0)
 
13108
            return;
 
13109
Index: libgfortran/generated/matmul_i8.c
 
13110
===================================================================
 
13111
--- a/src/libgfortran/generated/matmul_i8.c     (.../tags/gcc_4_8_3_release)
 
13112
+++ b/src/libgfortran/generated/matmul_i8.c     (.../branches/gcc-4_8-branch)
 
13113
@@ -124,7 +124,7 @@
 
13114
         }
 
13115
 
 
13116
       retarray->base_addr
 
13117
-       = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) retarray));
 
13118
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_8));
 
13119
       retarray->offset = 0;
 
13120
     }
 
13121
     else if (unlikely (compile_options.bounds_check))
 
13122
Index: libgfortran/generated/maxloc0_16_i2.c
 
13123
===================================================================
 
13124
--- a/src/libgfortran/generated/maxloc0_16_i2.c (.../tags/gcc_4_8_3_release)
 
13125
+++ b/src/libgfortran/generated/maxloc0_16_i2.c (.../branches/gcc-4_8-branch)
 
13126
@@ -58,7 +58,7 @@
 
13127
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13128
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13129
       retarray->offset = 0;
 
13130
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
13131
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
13132
     }
 
13133
   else
 
13134
     {
 
13135
@@ -199,7 +199,7 @@
 
13136
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
13137
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13138
       retarray->offset = 0;
 
13139
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
13140
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
13141
     }
 
13142
   else
 
13143
     {
 
13144
@@ -367,7 +367,7 @@
 
13145
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13146
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13147
       retarray->offset = 0;
 
13148
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
13149
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
13150
     }
 
13151
   else if (unlikely (compile_options.bounds_check))
 
13152
     {
 
13153
Index: libgfortran/generated/spread_c4.c
 
13154
===================================================================
 
13155
--- a/src/libgfortran/generated/spread_c4.c     (.../tags/gcc_4_8_3_release)
 
13156
+++ b/src/libgfortran/generated/spread_c4.c     (.../branches/gcc-4_8-branch)
 
13157
@@ -101,8 +101,8 @@
 
13158
        }
 
13159
       ret->offset = 0;
 
13160
 
 
13161
-      /* xmalloc allocates a single byte for zero size.  */
 
13162
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_4));
 
13163
+      /* xmallocarray allocates a single byte for zero size.  */
 
13164
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_4));
 
13165
       if (rs <= 0)
 
13166
         return;
 
13167
     }
 
13168
@@ -244,7 +244,7 @@
 
13169
 
 
13170
   if (ret->base_addr == NULL)
 
13171
     {
 
13172
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_4));
 
13173
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_4));
 
13174
       ret->offset = 0;
 
13175
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
13176
     }
 
13177
Index: libgfortran/generated/maxval_r10.c
 
13178
===================================================================
 
13179
--- a/src/libgfortran/generated/maxval_r10.c    (.../tags/gcc_4_8_3_release)
 
13180
+++ b/src/libgfortran/generated/maxval_r10.c    (.../branches/gcc-4_8-branch)
 
13181
@@ -97,10 +97,9 @@
 
13182
       retarray->offset = 0;
 
13183
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13184
 
 
13185
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13186
-                  * extent[rank-1];
 
13187
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13188
 
 
13189
-      retarray->base_addr = xmalloc (alloc_size);
 
13190
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
13191
       if (alloc_size == 0)
 
13192
        {
 
13193
          /* Make sure we have a zero-sized array.  */
 
13194
@@ -286,8 +285,7 @@
 
13195
 
 
13196
        }
 
13197
 
 
13198
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13199
-                  * extent[rank-1];
 
13200
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13201
 
 
13202
       retarray->offset = 0;
 
13203
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13204
@@ -299,7 +297,7 @@
 
13205
          return;
 
13206
        }
 
13207
       else
 
13208
-       retarray->base_addr = xmalloc (alloc_size);
 
13209
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
13210
 
 
13211
     }
 
13212
   else
 
13213
@@ -472,8 +470,7 @@
 
13214
       retarray->offset = 0;
 
13215
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13216
 
 
13217
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13218
-                  * extent[rank-1];
 
13219
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13220
 
 
13221
       if (alloc_size == 0)
 
13222
        {
 
13223
@@ -482,7 +479,7 @@
 
13224
          return;
 
13225
        }
 
13226
       else
 
13227
-       retarray->base_addr = xmalloc (alloc_size);
 
13228
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
13229
     }
 
13230
   else
 
13231
     {
 
13232
Index: libgfortran/generated/pack_i4.c
 
13233
===================================================================
 
13234
--- a/src/libgfortran/generated/pack_i4.c       (.../tags/gcc_4_8_3_release)
 
13235
+++ b/src/libgfortran/generated/pack_i4.c       (.../branches/gcc-4_8-branch)
 
13236
@@ -167,8 +167,8 @@
 
13237
 
 
13238
          ret->offset = 0;
 
13239
 
 
13240
-         /* xmalloc allocates a single byte for zero size.  */
 
13241
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * total);
 
13242
+         /* xmallocarray allocates a single byte for zero size.  */
 
13243
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_4));
 
13244
 
 
13245
          if (total == 0)
 
13246
            return;
 
13247
Index: libgfortran/generated/maxloc1_4_i1.c
 
13248
===================================================================
 
13249
--- a/src/libgfortran/generated/maxloc1_4_i1.c  (.../tags/gcc_4_8_3_release)
 
13250
+++ b/src/libgfortran/generated/maxloc1_4_i1.c  (.../branches/gcc-4_8-branch)
 
13251
@@ -98,10 +98,9 @@
 
13252
       retarray->offset = 0;
 
13253
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13254
 
 
13255
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13256
-                  * extent[rank-1];
 
13257
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13258
 
 
13259
-      retarray->base_addr = xmalloc (alloc_size);
 
13260
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13261
       if (alloc_size == 0)
 
13262
        {
 
13263
          /* Make sure we have a zero-sized array.  */
 
13264
@@ -294,8 +293,7 @@
 
13265
 
 
13266
        }
 
13267
 
 
13268
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13269
-                  * extent[rank-1];
 
13270
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13271
 
 
13272
       retarray->offset = 0;
 
13273
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13274
@@ -307,7 +305,7 @@
 
13275
          return;
 
13276
        }
 
13277
       else
 
13278
-       retarray->base_addr = xmalloc (alloc_size);
 
13279
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13280
 
 
13281
     }
 
13282
   else
 
13283
@@ -485,8 +483,7 @@
 
13284
       retarray->offset = 0;
 
13285
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13286
 
 
13287
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13288
-                  * extent[rank-1];
 
13289
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13290
 
 
13291
       if (alloc_size == 0)
 
13292
        {
 
13293
@@ -495,7 +492,7 @@
 
13294
          return;
 
13295
        }
 
13296
       else
 
13297
-       retarray->base_addr = xmalloc (alloc_size);
 
13298
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13299
     }
 
13300
   else
 
13301
     {
 
13302
Index: libgfortran/generated/matmul_r10.c
 
13303
===================================================================
 
13304
--- a/src/libgfortran/generated/matmul_r10.c    (.../tags/gcc_4_8_3_release)
 
13305
+++ b/src/libgfortran/generated/matmul_r10.c    (.../branches/gcc-4_8-branch)
 
13306
@@ -124,7 +124,7 @@
 
13307
         }
 
13308
 
 
13309
       retarray->base_addr
 
13310
-       = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) retarray));
 
13311
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_10));
 
13312
       retarray->offset = 0;
 
13313
     }
 
13314
     else if (unlikely (compile_options.bounds_check))
 
13315
Index: libgfortran/generated/minloc1_4_i8.c
 
13316
===================================================================
 
13317
--- a/src/libgfortran/generated/minloc1_4_i8.c  (.../tags/gcc_4_8_3_release)
 
13318
+++ b/src/libgfortran/generated/minloc1_4_i8.c  (.../branches/gcc-4_8-branch)
 
13319
@@ -98,10 +98,9 @@
 
13320
       retarray->offset = 0;
 
13321
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13322
 
 
13323
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13324
-                  * extent[rank-1];
 
13325
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13326
 
 
13327
-      retarray->base_addr = xmalloc (alloc_size);
 
13328
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13329
       if (alloc_size == 0)
 
13330
        {
 
13331
          /* Make sure we have a zero-sized array.  */
 
13332
@@ -294,8 +293,7 @@
 
13333
 
 
13334
        }
 
13335
 
 
13336
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13337
-                  * extent[rank-1];
 
13338
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13339
 
 
13340
       retarray->offset = 0;
 
13341
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13342
@@ -307,7 +305,7 @@
 
13343
          return;
 
13344
        }
 
13345
       else
 
13346
-       retarray->base_addr = xmalloc (alloc_size);
 
13347
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13348
 
 
13349
     }
 
13350
   else
 
13351
@@ -485,8 +483,7 @@
 
13352
       retarray->offset = 0;
 
13353
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13354
 
 
13355
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13356
-                  * extent[rank-1];
 
13357
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13358
 
 
13359
       if (alloc_size == 0)
 
13360
        {
 
13361
@@ -495,7 +492,7 @@
 
13362
          return;
 
13363
        }
 
13364
       else
 
13365
-       retarray->base_addr = xmalloc (alloc_size);
 
13366
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13367
     }
 
13368
   else
 
13369
     {
 
13370
Index: libgfortran/generated/minloc0_8_r4.c
 
13371
===================================================================
 
13372
--- a/src/libgfortran/generated/minloc0_8_r4.c  (.../tags/gcc_4_8_3_release)
 
13373
+++ b/src/libgfortran/generated/minloc0_8_r4.c  (.../branches/gcc-4_8-branch)
 
13374
@@ -58,7 +58,7 @@
 
13375
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13376
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13377
       retarray->offset = 0;
 
13378
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
13379
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
13380
     }
 
13381
   else
 
13382
     {
 
13383
@@ -199,7 +199,7 @@
 
13384
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
13385
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13386
       retarray->offset = 0;
 
13387
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
13388
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
13389
     }
 
13390
   else
 
13391
     {
 
13392
@@ -367,7 +367,7 @@
 
13393
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13394
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13395
       retarray->offset = 0;
 
13396
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
13397
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
13398
     }
 
13399
   else if (unlikely (compile_options.bounds_check))
 
13400
     {
 
13401
Index: libgfortran/generated/matmul_l4.c
 
13402
===================================================================
 
13403
--- a/src/libgfortran/generated/matmul_l4.c     (.../tags/gcc_4_8_3_release)
 
13404
+++ b/src/libgfortran/generated/matmul_l4.c     (.../branches/gcc-4_8-branch)
 
13405
@@ -88,7 +88,7 @@
 
13406
         }
 
13407
           
 
13408
       retarray->base_addr
 
13409
-       = xmalloc (sizeof (GFC_LOGICAL_4) * size0 ((array_t *) retarray));
 
13410
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_4));
 
13411
       retarray->offset = 0;
 
13412
     }
 
13413
     else if (unlikely (compile_options.bounds_check))
 
13414
Index: libgfortran/generated/reshape_r8.c
 
13415
===================================================================
 
13416
--- a/src/libgfortran/generated/reshape_r8.c    (.../tags/gcc_4_8_3_release)
 
13417
+++ b/src/libgfortran/generated/reshape_r8.c    (.../branches/gcc-4_8-branch)
 
13418
@@ -111,11 +111,11 @@
 
13419
       ret->offset = 0;
 
13420
 
 
13421
       if (unlikely (rs < 1))
 
13422
-        alloc_size = 1;
 
13423
+        alloc_size = 0;
 
13424
       else
 
13425
-        alloc_size = rs * sizeof (GFC_REAL_8);
 
13426
+        alloc_size = rs;
 
13427
 
 
13428
-      ret->base_addr = xmalloc (alloc_size);
 
13429
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
13430
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
13431
     }
 
13432
 
 
13433
Index: libgfortran/generated/in_pack_c10.c
 
13434
===================================================================
 
13435
--- a/src/libgfortran/generated/in_pack_c10.c   (.../tags/gcc_4_8_3_release)
 
13436
+++ b/src/libgfortran/generated/in_pack_c10.c   (.../branches/gcc-4_8-branch)
 
13437
@@ -76,7 +76,7 @@
 
13438
     return source->base_addr;
 
13439
 
 
13440
   /* Allocate storage for the destination.  */
 
13441
-  destptr = (GFC_COMPLEX_10 *)xmalloc (ssize * sizeof (GFC_COMPLEX_10));
 
13442
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_10));
 
13443
   dest = destptr;
 
13444
   src = source->base_addr;
 
13445
   stride0 = stride[0];
 
13446
Index: libgfortran/generated/all_l4.c
 
13447
===================================================================
 
13448
--- a/src/libgfortran/generated/all_l4.c        (.../tags/gcc_4_8_3_release)
 
13449
+++ b/src/libgfortran/generated/all_l4.c        (.../branches/gcc-4_8-branch)
 
13450
@@ -101,8 +101,7 @@
 
13451
       retarray->offset = 0;
 
13452
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13453
 
 
13454
-      alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13455
-                  * extent[rank-1];
 
13456
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13457
 
 
13458
       if (alloc_size == 0)
 
13459
        {
 
13460
@@ -111,7 +110,7 @@
 
13461
          return;
 
13462
        }
 
13463
       else
 
13464
-       retarray->base_addr = xmalloc (alloc_size);
 
13465
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
 
13466
     }
 
13467
   else
 
13468
     {
 
13469
Index: libgfortran/generated/minloc0_8_i2.c
 
13470
===================================================================
 
13471
--- a/src/libgfortran/generated/minloc0_8_i2.c  (.../tags/gcc_4_8_3_release)
 
13472
+++ b/src/libgfortran/generated/minloc0_8_i2.c  (.../branches/gcc-4_8-branch)
 
13473
@@ -58,7 +58,7 @@
 
13474
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13475
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13476
       retarray->offset = 0;
 
13477
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
13478
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
13479
     }
 
13480
   else
 
13481
     {
 
13482
@@ -199,7 +199,7 @@
 
13483
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
13484
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13485
       retarray->offset = 0;
 
13486
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
13487
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
13488
     }
 
13489
   else
 
13490
     {
 
13491
@@ -367,7 +367,7 @@
 
13492
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13493
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13494
       retarray->offset = 0;
 
13495
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
13496
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
13497
     }
 
13498
   else if (unlikely (compile_options.bounds_check))
 
13499
     {
 
13500
Index: libgfortran/generated/norm2_r16.c
 
13501
===================================================================
 
13502
--- a/src/libgfortran/generated/norm2_r16.c     (.../tags/gcc_4_8_3_release)
 
13503
+++ b/src/libgfortran/generated/norm2_r16.c     (.../branches/gcc-4_8-branch)
 
13504
@@ -105,10 +105,9 @@
 
13505
       retarray->offset = 0;
 
13506
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13507
 
 
13508
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13509
-                  * extent[rank-1];
 
13510
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13511
 
 
13512
-      retarray->base_addr = xmalloc (alloc_size);
 
13513
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
13514
       if (alloc_size == 0)
 
13515
        {
 
13516
          /* Make sure we have a zero-sized array.  */
 
13517
Index: libgfortran/generated/reshape_c10.c
 
13518
===================================================================
 
13519
--- a/src/libgfortran/generated/reshape_c10.c   (.../tags/gcc_4_8_3_release)
 
13520
+++ b/src/libgfortran/generated/reshape_c10.c   (.../branches/gcc-4_8-branch)
 
13521
@@ -111,11 +111,11 @@
 
13522
       ret->offset = 0;
 
13523
 
 
13524
       if (unlikely (rs < 1))
 
13525
-        alloc_size = 1;
 
13526
+        alloc_size = 0;
 
13527
       else
 
13528
-        alloc_size = rs * sizeof (GFC_COMPLEX_10);
 
13529
+        alloc_size = rs;
 
13530
 
 
13531
-      ret->base_addr = xmalloc (alloc_size);
 
13532
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
13533
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
13534
     }
 
13535
 
 
13536
Index: libgfortran/generated/unpack_c16.c
 
13537
===================================================================
 
13538
--- a/src/libgfortran/generated/unpack_c16.c    (.../tags/gcc_4_8_3_release)
 
13539
+++ b/src/libgfortran/generated/unpack_c16.c    (.../branches/gcc-4_8-branch)
 
13540
@@ -99,7 +99,7 @@
 
13541
          rs *= extent[n];
 
13542
        }
 
13543
       ret->offset = 0;
 
13544
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16));
 
13545
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16));
 
13546
     }
 
13547
   else
 
13548
     {
 
13549
@@ -244,7 +244,7 @@
 
13550
          rs *= extent[n];
 
13551
        }
 
13552
       ret->offset = 0;
 
13553
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16));
 
13554
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16));
 
13555
     }
 
13556
   else
 
13557
     {
 
13558
Index: libgfortran/generated/maxloc1_4_r4.c
 
13559
===================================================================
 
13560
--- a/src/libgfortran/generated/maxloc1_4_r4.c  (.../tags/gcc_4_8_3_release)
 
13561
+++ b/src/libgfortran/generated/maxloc1_4_r4.c  (.../branches/gcc-4_8-branch)
 
13562
@@ -98,10 +98,9 @@
 
13563
       retarray->offset = 0;
 
13564
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13565
 
 
13566
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13567
-                  * extent[rank-1];
 
13568
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13569
 
 
13570
-      retarray->base_addr = xmalloc (alloc_size);
 
13571
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13572
       if (alloc_size == 0)
 
13573
        {
 
13574
          /* Make sure we have a zero-sized array.  */
 
13575
@@ -294,8 +293,7 @@
 
13576
 
 
13577
        }
 
13578
 
 
13579
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13580
-                  * extent[rank-1];
 
13581
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13582
 
 
13583
       retarray->offset = 0;
 
13584
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13585
@@ -307,7 +305,7 @@
 
13586
          return;
 
13587
        }
 
13588
       else
 
13589
-       retarray->base_addr = xmalloc (alloc_size);
 
13590
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13591
 
 
13592
     }
 
13593
   else
 
13594
@@ -485,8 +483,7 @@
 
13595
       retarray->offset = 0;
 
13596
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13597
 
 
13598
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13599
-                  * extent[rank-1];
 
13600
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13601
 
 
13602
       if (alloc_size == 0)
 
13603
        {
 
13604
@@ -495,7 +492,7 @@
 
13605
          return;
 
13606
        }
 
13607
       else
 
13608
-       retarray->base_addr = xmalloc (alloc_size);
 
13609
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13610
     }
 
13611
   else
 
13612
     {
 
13613
Index: libgfortran/generated/maxval_r8.c
 
13614
===================================================================
 
13615
--- a/src/libgfortran/generated/maxval_r8.c     (.../tags/gcc_4_8_3_release)
 
13616
+++ b/src/libgfortran/generated/maxval_r8.c     (.../branches/gcc-4_8-branch)
 
13617
@@ -97,10 +97,9 @@
 
13618
       retarray->offset = 0;
 
13619
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13620
 
 
13621
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13622
-                  * extent[rank-1];
 
13623
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13624
 
 
13625
-      retarray->base_addr = xmalloc (alloc_size);
 
13626
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
13627
       if (alloc_size == 0)
 
13628
        {
 
13629
          /* Make sure we have a zero-sized array.  */
 
13630
@@ -286,8 +285,7 @@
 
13631
 
 
13632
        }
 
13633
 
 
13634
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13635
-                  * extent[rank-1];
 
13636
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13637
 
 
13638
       retarray->offset = 0;
 
13639
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13640
@@ -299,7 +297,7 @@
 
13641
          return;
 
13642
        }
 
13643
       else
 
13644
-       retarray->base_addr = xmalloc (alloc_size);
 
13645
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
13646
 
 
13647
     }
 
13648
   else
 
13649
@@ -472,8 +470,7 @@
 
13650
       retarray->offset = 0;
 
13651
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13652
 
 
13653
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13654
-                  * extent[rank-1];
 
13655
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13656
 
 
13657
       if (alloc_size == 0)
 
13658
        {
 
13659
@@ -482,7 +479,7 @@
 
13660
          return;
 
13661
        }
 
13662
       else
 
13663
-       retarray->base_addr = xmalloc (alloc_size);
 
13664
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
13665
     }
 
13666
   else
 
13667
     {
 
13668
Index: libgfortran/generated/transpose_c4.c
 
13669
===================================================================
 
13670
--- a/src/libgfortran/generated/transpose_c4.c  (.../tags/gcc_4_8_3_release)
 
13671
+++ b/src/libgfortran/generated/transpose_c4.c  (.../branches/gcc-4_8-branch)
 
13672
@@ -60,7 +60,8 @@
 
13673
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
 
13674
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
13675
 
 
13676
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) ret));
 
13677
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
 
13678
+                                     sizeof (GFC_COMPLEX_4));
 
13679
       ret->offset = 0;
 
13680
     } else if (unlikely (compile_options.bounds_check))
 
13681
     {
 
13682
Index: libgfortran/generated/eoshift1_4.c
 
13683
===================================================================
 
13684
--- a/src/libgfortran/generated/eoshift1_4.c    (.../tags/gcc_4_8_3_release)
 
13685
+++ b/src/libgfortran/generated/eoshift1_4.c    (.../branches/gcc-4_8-branch)
 
13686
@@ -105,8 +105,8 @@
 
13687
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
13688
 
 
13689
         }
 
13690
-      /* xmalloc allocates a single byte for zero size.  */
 
13691
-      ret->base_addr = xmalloc (size * arraysize);
 
13692
+      /* xmallocarray allocates a single byte for zero size.  */
 
13693
+      ret->base_addr = xmallocarray (arraysize, size);
 
13694
 
 
13695
     }
 
13696
   else if (unlikely (compile_options.bounds_check))
 
13697
Index: libgfortran/generated/minval_r16.c
 
13698
===================================================================
 
13699
--- a/src/libgfortran/generated/minval_r16.c    (.../tags/gcc_4_8_3_release)
 
13700
+++ b/src/libgfortran/generated/minval_r16.c    (.../branches/gcc-4_8-branch)
 
13701
@@ -97,10 +97,9 @@
 
13702
       retarray->offset = 0;
 
13703
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13704
 
 
13705
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13706
-                  * extent[rank-1];
 
13707
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13708
 
 
13709
-      retarray->base_addr = xmalloc (alloc_size);
 
13710
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
13711
       if (alloc_size == 0)
 
13712
        {
 
13713
          /* Make sure we have a zero-sized array.  */
 
13714
@@ -286,8 +285,7 @@
 
13715
 
 
13716
        }
 
13717
 
 
13718
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13719
-                  * extent[rank-1];
 
13720
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13721
 
 
13722
       retarray->offset = 0;
 
13723
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13724
@@ -299,7 +297,7 @@
 
13725
          return;
 
13726
        }
 
13727
       else
 
13728
-       retarray->base_addr = xmalloc (alloc_size);
 
13729
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
13730
 
 
13731
     }
 
13732
   else
 
13733
@@ -472,8 +470,7 @@
 
13734
       retarray->offset = 0;
 
13735
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13736
 
 
13737
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13738
-                  * extent[rank-1];
 
13739
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13740
 
 
13741
       if (alloc_size == 0)
 
13742
        {
 
13743
@@ -482,7 +479,7 @@
 
13744
          return;
 
13745
        }
 
13746
       else
 
13747
-       retarray->base_addr = xmalloc (alloc_size);
 
13748
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
13749
     }
 
13750
   else
 
13751
     {
 
13752
Index: libgfortran/generated/iany_i16.c
 
13753
===================================================================
 
13754
--- a/src/libgfortran/generated/iany_i16.c      (.../tags/gcc_4_8_3_release)
 
13755
+++ b/src/libgfortran/generated/iany_i16.c      (.../branches/gcc-4_8-branch)
 
13756
@@ -97,10 +97,9 @@
 
13757
       retarray->offset = 0;
 
13758
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13759
 
 
13760
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13761
-                  * extent[rank-1];
 
13762
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13763
 
 
13764
-      retarray->base_addr = xmalloc (alloc_size);
 
13765
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
13766
       if (alloc_size == 0)
 
13767
        {
 
13768
          /* Make sure we have a zero-sized array.  */
 
13769
@@ -272,8 +271,7 @@
 
13770
 
 
13771
        }
 
13772
 
 
13773
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13774
-                  * extent[rank-1];
 
13775
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13776
 
 
13777
       retarray->offset = 0;
 
13778
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13779
@@ -285,7 +283,7 @@
 
13780
          return;
 
13781
        }
 
13782
       else
 
13783
-       retarray->base_addr = xmalloc (alloc_size);
 
13784
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
13785
 
 
13786
     }
 
13787
   else
 
13788
@@ -430,8 +428,7 @@
 
13789
       retarray->offset = 0;
 
13790
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13791
 
 
13792
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13793
-                  * extent[rank-1];
 
13794
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13795
 
 
13796
       if (alloc_size == 0)
 
13797
        {
 
13798
@@ -440,7 +437,7 @@
 
13799
          return;
 
13800
        }
 
13801
       else
 
13802
-       retarray->base_addr = xmalloc (alloc_size);
 
13803
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
13804
     }
 
13805
   else
 
13806
     {
 
13807
Index: libgfortran/generated/maxloc1_4_i2.c
 
13808
===================================================================
 
13809
--- a/src/libgfortran/generated/maxloc1_4_i2.c  (.../tags/gcc_4_8_3_release)
 
13810
+++ b/src/libgfortran/generated/maxloc1_4_i2.c  (.../branches/gcc-4_8-branch)
 
13811
@@ -98,10 +98,9 @@
 
13812
       retarray->offset = 0;
 
13813
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13814
 
 
13815
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13816
-                  * extent[rank-1];
 
13817
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13818
 
 
13819
-      retarray->base_addr = xmalloc (alloc_size);
 
13820
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13821
       if (alloc_size == 0)
 
13822
        {
 
13823
          /* Make sure we have a zero-sized array.  */
 
13824
@@ -294,8 +293,7 @@
 
13825
 
 
13826
        }
 
13827
 
 
13828
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13829
-                  * extent[rank-1];
 
13830
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13831
 
 
13832
       retarray->offset = 0;
 
13833
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13834
@@ -307,7 +305,7 @@
 
13835
          return;
 
13836
        }
 
13837
       else
 
13838
-       retarray->base_addr = xmalloc (alloc_size);
 
13839
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13840
 
 
13841
     }
 
13842
   else
 
13843
@@ -485,8 +483,7 @@
 
13844
       retarray->offset = 0;
 
13845
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13846
 
 
13847
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13848
-                  * extent[rank-1];
 
13849
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13850
 
 
13851
       if (alloc_size == 0)
 
13852
        {
 
13853
@@ -495,7 +492,7 @@
 
13854
          return;
 
13855
        }
 
13856
       else
 
13857
-       retarray->base_addr = xmalloc (alloc_size);
 
13858
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
13859
     }
 
13860
   else
 
13861
     {
 
13862
Index: libgfortran/generated/maxloc1_8_i8.c
 
13863
===================================================================
 
13864
--- a/src/libgfortran/generated/maxloc1_8_i8.c  (.../tags/gcc_4_8_3_release)
 
13865
+++ b/src/libgfortran/generated/maxloc1_8_i8.c  (.../branches/gcc-4_8-branch)
 
13866
@@ -98,10 +98,9 @@
 
13867
       retarray->offset = 0;
 
13868
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13869
 
 
13870
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13871
-                  * extent[rank-1];
 
13872
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13873
 
 
13874
-      retarray->base_addr = xmalloc (alloc_size);
 
13875
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
13876
       if (alloc_size == 0)
 
13877
        {
 
13878
          /* Make sure we have a zero-sized array.  */
 
13879
@@ -294,8 +293,7 @@
 
13880
 
 
13881
        }
 
13882
 
 
13883
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13884
-                  * extent[rank-1];
 
13885
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13886
 
 
13887
       retarray->offset = 0;
 
13888
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13889
@@ -307,7 +305,7 @@
 
13890
          return;
 
13891
        }
 
13892
       else
 
13893
-       retarray->base_addr = xmalloc (alloc_size);
 
13894
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
13895
 
 
13896
     }
 
13897
   else
 
13898
@@ -485,8 +483,7 @@
 
13899
       retarray->offset = 0;
 
13900
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13901
 
 
13902
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13903
-                  * extent[rank-1];
 
13904
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13905
 
 
13906
       if (alloc_size == 0)
 
13907
        {
 
13908
@@ -495,7 +492,7 @@
 
13909
          return;
 
13910
        }
 
13911
       else
 
13912
-       retarray->base_addr = xmalloc (alloc_size);
 
13913
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
13914
     }
 
13915
   else
 
13916
     {
 
13917
Index: libgfortran/generated/maxloc0_4_r8.c
 
13918
===================================================================
 
13919
--- a/src/libgfortran/generated/maxloc0_4_r8.c  (.../tags/gcc_4_8_3_release)
 
13920
+++ b/src/libgfortran/generated/maxloc0_4_r8.c  (.../branches/gcc-4_8-branch)
 
13921
@@ -58,7 +58,7 @@
 
13922
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13923
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13924
       retarray->offset = 0;
 
13925
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
13926
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
13927
     }
 
13928
   else
 
13929
     {
 
13930
@@ -199,7 +199,7 @@
 
13931
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
13932
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13933
       retarray->offset = 0;
 
13934
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
13935
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
13936
     }
 
13937
   else
 
13938
     {
 
13939
@@ -367,7 +367,7 @@
 
13940
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13941
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13942
       retarray->offset = 0;
 
13943
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
13944
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
13945
     }
 
13946
   else if (unlikely (compile_options.bounds_check))
 
13947
     {
 
13948
Index: libgfortran/generated/maxloc0_16_r16.c
 
13949
===================================================================
 
13950
--- a/src/libgfortran/generated/maxloc0_16_r16.c        (.../tags/gcc_4_8_3_release)
 
13951
+++ b/src/libgfortran/generated/maxloc0_16_r16.c        (.../branches/gcc-4_8-branch)
 
13952
@@ -58,7 +58,7 @@
 
13953
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13954
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13955
       retarray->offset = 0;
 
13956
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
13957
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
13958
     }
 
13959
   else
 
13960
     {
 
13961
@@ -199,7 +199,7 @@
 
13962
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
13963
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13964
       retarray->offset = 0;
 
13965
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
13966
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
13967
     }
 
13968
   else
 
13969
     {
 
13970
@@ -367,7 +367,7 @@
 
13971
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
13972
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
13973
       retarray->offset = 0;
 
13974
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
13975
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
13976
     }
 
13977
   else if (unlikely (compile_options.bounds_check))
 
13978
     {
 
13979
Index: libgfortran/generated/sum_c10.c
 
13980
===================================================================
 
13981
--- a/src/libgfortran/generated/sum_c10.c       (.../tags/gcc_4_8_3_release)
 
13982
+++ b/src/libgfortran/generated/sum_c10.c       (.../branches/gcc-4_8-branch)
 
13983
@@ -97,10 +97,9 @@
 
13984
       retarray->offset = 0;
 
13985
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
13986
 
 
13987
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
13988
-                  * extent[rank-1];
 
13989
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
13990
 
 
13991
-      retarray->base_addr = xmalloc (alloc_size);
 
13992
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
13993
       if (alloc_size == 0)
 
13994
        {
 
13995
          /* Make sure we have a zero-sized array.  */
 
13996
@@ -272,8 +271,7 @@
 
13997
 
 
13998
        }
 
13999
 
 
14000
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14001
-                  * extent[rank-1];
 
14002
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14003
 
 
14004
       retarray->offset = 0;
 
14005
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14006
@@ -285,7 +283,7 @@
 
14007
          return;
 
14008
        }
 
14009
       else
 
14010
-       retarray->base_addr = xmalloc (alloc_size);
 
14011
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
14012
 
 
14013
     }
 
14014
   else
 
14015
@@ -430,8 +428,7 @@
 
14016
       retarray->offset = 0;
 
14017
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14018
 
 
14019
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14020
-                  * extent[rank-1];
 
14021
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14022
 
 
14023
       if (alloc_size == 0)
 
14024
        {
 
14025
@@ -440,7 +437,7 @@
 
14026
          return;
 
14027
        }
 
14028
       else
 
14029
-       retarray->base_addr = xmalloc (alloc_size);
 
14030
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
14031
     }
 
14032
   else
 
14033
     {
 
14034
Index: libgfortran/generated/iall_i4.c
 
14035
===================================================================
 
14036
--- a/src/libgfortran/generated/iall_i4.c       (.../tags/gcc_4_8_3_release)
 
14037
+++ b/src/libgfortran/generated/iall_i4.c       (.../branches/gcc-4_8-branch)
 
14038
@@ -97,10 +97,9 @@
 
14039
       retarray->offset = 0;
 
14040
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14041
 
 
14042
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14043
-                  * extent[rank-1];
 
14044
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14045
 
 
14046
-      retarray->base_addr = xmalloc (alloc_size);
 
14047
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14048
       if (alloc_size == 0)
 
14049
        {
 
14050
          /* Make sure we have a zero-sized array.  */
 
14051
@@ -272,8 +271,7 @@
 
14052
 
 
14053
        }
 
14054
 
 
14055
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14056
-                  * extent[rank-1];
 
14057
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14058
 
 
14059
       retarray->offset = 0;
 
14060
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14061
@@ -285,7 +283,7 @@
 
14062
          return;
 
14063
        }
 
14064
       else
 
14065
-       retarray->base_addr = xmalloc (alloc_size);
 
14066
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14067
 
 
14068
     }
 
14069
   else
 
14070
@@ -430,8 +428,7 @@
 
14071
       retarray->offset = 0;
 
14072
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14073
 
 
14074
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14075
-                  * extent[rank-1];
 
14076
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14077
 
 
14078
       if (alloc_size == 0)
 
14079
        {
 
14080
@@ -440,7 +437,7 @@
 
14081
          return;
 
14082
        }
 
14083
       else
 
14084
-       retarray->base_addr = xmalloc (alloc_size);
 
14085
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14086
     }
 
14087
   else
 
14088
     {
 
14089
Index: libgfortran/generated/minloc1_4_r16.c
 
14090
===================================================================
 
14091
--- a/src/libgfortran/generated/minloc1_4_r16.c (.../tags/gcc_4_8_3_release)
 
14092
+++ b/src/libgfortran/generated/minloc1_4_r16.c (.../branches/gcc-4_8-branch)
 
14093
@@ -98,10 +98,9 @@
 
14094
       retarray->offset = 0;
 
14095
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14096
 
 
14097
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14098
-                  * extent[rank-1];
 
14099
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14100
 
 
14101
-      retarray->base_addr = xmalloc (alloc_size);
 
14102
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14103
       if (alloc_size == 0)
 
14104
        {
 
14105
          /* Make sure we have a zero-sized array.  */
 
14106
@@ -294,8 +293,7 @@
 
14107
 
 
14108
        }
 
14109
 
 
14110
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14111
-                  * extent[rank-1];
 
14112
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14113
 
 
14114
       retarray->offset = 0;
 
14115
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14116
@@ -307,7 +305,7 @@
 
14117
          return;
 
14118
        }
 
14119
       else
 
14120
-       retarray->base_addr = xmalloc (alloc_size);
 
14121
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14122
 
 
14123
     }
 
14124
   else
 
14125
@@ -485,8 +483,7 @@
 
14126
       retarray->offset = 0;
 
14127
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14128
 
 
14129
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14130
-                  * extent[rank-1];
 
14131
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14132
 
 
14133
       if (alloc_size == 0)
 
14134
        {
 
14135
@@ -495,7 +492,7 @@
 
14136
          return;
 
14137
        }
 
14138
       else
 
14139
-       retarray->base_addr = xmalloc (alloc_size);
 
14140
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14141
     }
 
14142
   else
 
14143
     {
 
14144
Index: libgfortran/generated/maxloc0_8_r16.c
 
14145
===================================================================
 
14146
--- a/src/libgfortran/generated/maxloc0_8_r16.c (.../tags/gcc_4_8_3_release)
 
14147
+++ b/src/libgfortran/generated/maxloc0_8_r16.c (.../branches/gcc-4_8-branch)
 
14148
@@ -58,7 +58,7 @@
 
14149
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14150
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14151
       retarray->offset = 0;
 
14152
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
14153
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
14154
     }
 
14155
   else
 
14156
     {
 
14157
@@ -199,7 +199,7 @@
 
14158
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
14159
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14160
       retarray->offset = 0;
 
14161
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
14162
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
14163
     }
 
14164
   else
 
14165
     {
 
14166
@@ -367,7 +367,7 @@
 
14167
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14168
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14169
       retarray->offset = 0;
 
14170
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
14171
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
14172
     }
 
14173
   else if (unlikely (compile_options.bounds_check))
 
14174
     {
 
14175
Index: libgfortran/generated/pack_r8.c
 
14176
===================================================================
 
14177
--- a/src/libgfortran/generated/pack_r8.c       (.../tags/gcc_4_8_3_release)
 
14178
+++ b/src/libgfortran/generated/pack_r8.c       (.../branches/gcc-4_8-branch)
 
14179
@@ -167,8 +167,8 @@
 
14180
 
 
14181
          ret->offset = 0;
 
14182
 
 
14183
-         /* xmalloc allocates a single byte for zero size.  */
 
14184
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * total);
 
14185
+         /* xmallocarray allocates a single byte for zero size.  */
 
14186
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_8));
 
14187
 
 
14188
          if (total == 0)
 
14189
            return;
 
14190
Index: libgfortran/generated/matmul_c10.c
 
14191
===================================================================
 
14192
--- a/src/libgfortran/generated/matmul_c10.c    (.../tags/gcc_4_8_3_release)
 
14193
+++ b/src/libgfortran/generated/matmul_c10.c    (.../branches/gcc-4_8-branch)
 
14194
@@ -124,7 +124,7 @@
 
14195
         }
 
14196
 
 
14197
       retarray->base_addr
 
14198
-       = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) retarray));
 
14199
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_10));
 
14200
       retarray->offset = 0;
 
14201
     }
 
14202
     else if (unlikely (compile_options.bounds_check))
 
14203
Index: libgfortran/generated/maxloc0_16_i4.c
 
14204
===================================================================
 
14205
--- a/src/libgfortran/generated/maxloc0_16_i4.c (.../tags/gcc_4_8_3_release)
 
14206
+++ b/src/libgfortran/generated/maxloc0_16_i4.c (.../branches/gcc-4_8-branch)
 
14207
@@ -58,7 +58,7 @@
 
14208
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14209
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14210
       retarray->offset = 0;
 
14211
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
14212
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
14213
     }
 
14214
   else
 
14215
     {
 
14216
@@ -199,7 +199,7 @@
 
14217
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
14218
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14219
       retarray->offset = 0;
 
14220
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
14221
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
14222
     }
 
14223
   else
 
14224
     {
 
14225
@@ -367,7 +367,7 @@
 
14226
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14227
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14228
       retarray->offset = 0;
 
14229
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
14230
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
14231
     }
 
14232
   else if (unlikely (compile_options.bounds_check))
 
14233
     {
 
14234
Index: libgfortran/generated/pack_r16.c
 
14235
===================================================================
 
14236
--- a/src/libgfortran/generated/pack_r16.c      (.../tags/gcc_4_8_3_release)
 
14237
+++ b/src/libgfortran/generated/pack_r16.c      (.../branches/gcc-4_8-branch)
 
14238
@@ -167,8 +167,8 @@
 
14239
 
 
14240
          ret->offset = 0;
 
14241
 
 
14242
-         /* xmalloc allocates a single byte for zero size.  */
 
14243
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * total);
 
14244
+         /* xmallocarray allocates a single byte for zero size.  */
 
14245
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_16));
 
14246
 
 
14247
          if (total == 0)
 
14248
            return;
 
14249
Index: libgfortran/generated/minloc1_16_i8.c
 
14250
===================================================================
 
14251
--- a/src/libgfortran/generated/minloc1_16_i8.c (.../tags/gcc_4_8_3_release)
 
14252
+++ b/src/libgfortran/generated/minloc1_16_i8.c (.../branches/gcc-4_8-branch)
 
14253
@@ -98,10 +98,9 @@
 
14254
       retarray->offset = 0;
 
14255
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14256
 
 
14257
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14258
-                  * extent[rank-1];
 
14259
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14260
 
 
14261
-      retarray->base_addr = xmalloc (alloc_size);
 
14262
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14263
       if (alloc_size == 0)
 
14264
        {
 
14265
          /* Make sure we have a zero-sized array.  */
 
14266
@@ -294,8 +293,7 @@
 
14267
 
 
14268
        }
 
14269
 
 
14270
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14271
-                  * extent[rank-1];
 
14272
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14273
 
 
14274
       retarray->offset = 0;
 
14275
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14276
@@ -307,7 +305,7 @@
 
14277
          return;
 
14278
        }
 
14279
       else
 
14280
-       retarray->base_addr = xmalloc (alloc_size);
 
14281
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14282
 
 
14283
     }
 
14284
   else
 
14285
@@ -485,8 +483,7 @@
 
14286
       retarray->offset = 0;
 
14287
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14288
 
 
14289
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14290
-                  * extent[rank-1];
 
14291
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14292
 
 
14293
       if (alloc_size == 0)
 
14294
        {
 
14295
@@ -495,7 +492,7 @@
 
14296
          return;
 
14297
        }
 
14298
       else
 
14299
-       retarray->base_addr = xmalloc (alloc_size);
 
14300
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14301
     }
 
14302
   else
 
14303
     {
 
14304
Index: libgfortran/generated/minloc0_16_r10.c
 
14305
===================================================================
 
14306
--- a/src/libgfortran/generated/minloc0_16_r10.c        (.../tags/gcc_4_8_3_release)
 
14307
+++ b/src/libgfortran/generated/minloc0_16_r10.c        (.../branches/gcc-4_8-branch)
 
14308
@@ -58,7 +58,7 @@
 
14309
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14310
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14311
       retarray->offset = 0;
 
14312
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
14313
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
14314
     }
 
14315
   else
 
14316
     {
 
14317
@@ -199,7 +199,7 @@
 
14318
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
14319
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14320
       retarray->offset = 0;
 
14321
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
14322
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
14323
     }
 
14324
   else
 
14325
     {
 
14326
@@ -367,7 +367,7 @@
 
14327
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14328
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14329
       retarray->offset = 0;
 
14330
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
14331
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
14332
     }
 
14333
   else if (unlikely (compile_options.bounds_check))
 
14334
     {
 
14335
Index: libgfortran/generated/unpack_c4.c
 
14336
===================================================================
 
14337
--- a/src/libgfortran/generated/unpack_c4.c     (.../tags/gcc_4_8_3_release)
 
14338
+++ b/src/libgfortran/generated/unpack_c4.c     (.../branches/gcc-4_8-branch)
 
14339
@@ -99,7 +99,7 @@
 
14340
          rs *= extent[n];
 
14341
        }
 
14342
       ret->offset = 0;
 
14343
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4));
 
14344
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4));
 
14345
     }
 
14346
   else
 
14347
     {
 
14348
@@ -244,7 +244,7 @@
 
14349
          rs *= extent[n];
 
14350
        }
 
14351
       ret->offset = 0;
 
14352
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4));
 
14353
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4));
 
14354
     }
 
14355
   else
 
14356
     {
 
14357
Index: libgfortran/generated/iparity_i1.c
 
14358
===================================================================
 
14359
--- a/src/libgfortran/generated/iparity_i1.c    (.../tags/gcc_4_8_3_release)
 
14360
+++ b/src/libgfortran/generated/iparity_i1.c    (.../branches/gcc-4_8-branch)
 
14361
@@ -97,10 +97,9 @@
 
14362
       retarray->offset = 0;
 
14363
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14364
 
 
14365
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14366
-                  * extent[rank-1];
 
14367
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14368
 
 
14369
-      retarray->base_addr = xmalloc (alloc_size);
 
14370
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
14371
       if (alloc_size == 0)
 
14372
        {
 
14373
          /* Make sure we have a zero-sized array.  */
 
14374
@@ -272,8 +271,7 @@
 
14375
 
 
14376
        }
 
14377
 
 
14378
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14379
-                  * extent[rank-1];
 
14380
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14381
 
 
14382
       retarray->offset = 0;
 
14383
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14384
@@ -285,7 +283,7 @@
 
14385
          return;
 
14386
        }
 
14387
       else
 
14388
-       retarray->base_addr = xmalloc (alloc_size);
 
14389
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
14390
 
 
14391
     }
 
14392
   else
 
14393
@@ -430,8 +428,7 @@
 
14394
       retarray->offset = 0;
 
14395
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14396
 
 
14397
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14398
-                  * extent[rank-1];
 
14399
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14400
 
 
14401
       if (alloc_size == 0)
 
14402
        {
 
14403
@@ -440,7 +437,7 @@
 
14404
          return;
 
14405
        }
 
14406
       else
 
14407
-       retarray->base_addr = xmalloc (alloc_size);
 
14408
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
14409
     }
 
14410
   else
 
14411
     {
 
14412
Index: libgfortran/generated/product_c8.c
 
14413
===================================================================
 
14414
--- a/src/libgfortran/generated/product_c8.c    (.../tags/gcc_4_8_3_release)
 
14415
+++ b/src/libgfortran/generated/product_c8.c    (.../branches/gcc-4_8-branch)
 
14416
@@ -97,10 +97,9 @@
 
14417
       retarray->offset = 0;
 
14418
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14419
 
 
14420
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14421
-                  * extent[rank-1];
 
14422
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14423
 
 
14424
-      retarray->base_addr = xmalloc (alloc_size);
 
14425
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
14426
       if (alloc_size == 0)
 
14427
        {
 
14428
          /* Make sure we have a zero-sized array.  */
 
14429
@@ -272,8 +271,7 @@
 
14430
 
 
14431
        }
 
14432
 
 
14433
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14434
-                  * extent[rank-1];
 
14435
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14436
 
 
14437
       retarray->offset = 0;
 
14438
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14439
@@ -285,7 +283,7 @@
 
14440
          return;
 
14441
        }
 
14442
       else
 
14443
-       retarray->base_addr = xmalloc (alloc_size);
 
14444
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
14445
 
 
14446
     }
 
14447
   else
 
14448
@@ -430,8 +428,7 @@
 
14449
       retarray->offset = 0;
 
14450
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14451
 
 
14452
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14453
-                  * extent[rank-1];
 
14454
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14455
 
 
14456
       if (alloc_size == 0)
 
14457
        {
 
14458
@@ -440,7 +437,7 @@
 
14459
          return;
 
14460
        }
 
14461
       else
 
14462
-       retarray->base_addr = xmalloc (alloc_size);
 
14463
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
14464
     }
 
14465
   else
 
14466
     {
 
14467
Index: libgfortran/generated/in_pack_i16.c
 
14468
===================================================================
 
14469
--- a/src/libgfortran/generated/in_pack_i16.c   (.../tags/gcc_4_8_3_release)
 
14470
+++ b/src/libgfortran/generated/in_pack_i16.c   (.../branches/gcc-4_8-branch)
 
14471
@@ -76,7 +76,7 @@
 
14472
     return source->base_addr;
 
14473
 
 
14474
   /* Allocate storage for the destination.  */
 
14475
-  destptr = (GFC_INTEGER_16 *)xmalloc (ssize * sizeof (GFC_INTEGER_16));
 
14476
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_16));
 
14477
   dest = destptr;
 
14478
   src = source->base_addr;
 
14479
   stride0 = stride[0];
 
14480
Index: libgfortran/generated/minloc0_8_i4.c
 
14481
===================================================================
 
14482
--- a/src/libgfortran/generated/minloc0_8_i4.c  (.../tags/gcc_4_8_3_release)
 
14483
+++ b/src/libgfortran/generated/minloc0_8_i4.c  (.../branches/gcc-4_8-branch)
 
14484
@@ -58,7 +58,7 @@
 
14485
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14486
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14487
       retarray->offset = 0;
 
14488
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
14489
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
14490
     }
 
14491
   else
 
14492
     {
 
14493
@@ -199,7 +199,7 @@
 
14494
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
14495
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14496
       retarray->offset = 0;
 
14497
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
14498
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
14499
     }
 
14500
   else
 
14501
     {
 
14502
@@ -367,7 +367,7 @@
 
14503
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14504
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14505
       retarray->offset = 0;
 
14506
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
14507
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
14508
     }
 
14509
   else if (unlikely (compile_options.bounds_check))
 
14510
     {
 
14511
Index: libgfortran/generated/matmul_c4.c
 
14512
===================================================================
 
14513
--- a/src/libgfortran/generated/matmul_c4.c     (.../tags/gcc_4_8_3_release)
 
14514
+++ b/src/libgfortran/generated/matmul_c4.c     (.../branches/gcc-4_8-branch)
 
14515
@@ -124,7 +124,7 @@
 
14516
         }
 
14517
 
 
14518
       retarray->base_addr
 
14519
-       = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) retarray));
 
14520
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_4));
 
14521
       retarray->offset = 0;
 
14522
     }
 
14523
     else if (unlikely (compile_options.bounds_check))
 
14524
Index: libgfortran/generated/reshape_i8.c
 
14525
===================================================================
 
14526
--- a/src/libgfortran/generated/reshape_i8.c    (.../tags/gcc_4_8_3_release)
 
14527
+++ b/src/libgfortran/generated/reshape_i8.c    (.../branches/gcc-4_8-branch)
 
14528
@@ -111,11 +111,11 @@
 
14529
       ret->offset = 0;
 
14530
 
 
14531
       if (unlikely (rs < 1))
 
14532
-        alloc_size = 1;
 
14533
+        alloc_size = 0;
 
14534
       else
 
14535
-        alloc_size = rs * sizeof (GFC_INTEGER_8);
 
14536
+        alloc_size = rs;
 
14537
 
 
14538
-      ret->base_addr = xmalloc (alloc_size);
 
14539
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
14540
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
14541
     }
 
14542
 
 
14543
Index: libgfortran/generated/in_pack_c8.c
 
14544
===================================================================
 
14545
--- a/src/libgfortran/generated/in_pack_c8.c    (.../tags/gcc_4_8_3_release)
 
14546
+++ b/src/libgfortran/generated/in_pack_c8.c    (.../branches/gcc-4_8-branch)
 
14547
@@ -76,7 +76,7 @@
 
14548
     return source->base_addr;
 
14549
 
 
14550
   /* Allocate storage for the destination.  */
 
14551
-  destptr = (GFC_COMPLEX_8 *)xmalloc (ssize * sizeof (GFC_COMPLEX_8));
 
14552
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_8));
 
14553
   dest = destptr;
 
14554
   src = source->base_addr;
 
14555
   stride0 = stride[0];
 
14556
Index: libgfortran/generated/bessel_r10.c
 
14557
===================================================================
 
14558
--- a/src/libgfortran/generated/bessel_r10.c    (.../tags/gcc_4_8_3_release)
 
14559
+++ b/src/libgfortran/generated/bessel_r10.c    (.../branches/gcc-4_8-branch)
 
14560
@@ -55,7 +55,7 @@
 
14561
     {
 
14562
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
14563
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
14564
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size);
 
14565
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10));
 
14566
       ret->offset = 0;
 
14567
     }
 
14568
 
 
14569
@@ -122,7 +122,7 @@
 
14570
     {
 
14571
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
 
14572
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
 
14573
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size);
 
14574
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10));
 
14575
       ret->offset = 0;
 
14576
     }
 
14577
 
 
14578
Index: libgfortran/generated/iall_i16.c
 
14579
===================================================================
 
14580
--- a/src/libgfortran/generated/iall_i16.c      (.../tags/gcc_4_8_3_release)
 
14581
+++ b/src/libgfortran/generated/iall_i16.c      (.../branches/gcc-4_8-branch)
 
14582
@@ -97,10 +97,9 @@
 
14583
       retarray->offset = 0;
 
14584
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14585
 
 
14586
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14587
-                  * extent[rank-1];
 
14588
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14589
 
 
14590
-      retarray->base_addr = xmalloc (alloc_size);
 
14591
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14592
       if (alloc_size == 0)
 
14593
        {
 
14594
          /* Make sure we have a zero-sized array.  */
 
14595
@@ -272,8 +271,7 @@
 
14596
 
 
14597
        }
 
14598
 
 
14599
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14600
-                  * extent[rank-1];
 
14601
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14602
 
 
14603
       retarray->offset = 0;
 
14604
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14605
@@ -285,7 +283,7 @@
 
14606
          return;
 
14607
        }
 
14608
       else
 
14609
-       retarray->base_addr = xmalloc (alloc_size);
 
14610
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14611
 
 
14612
     }
 
14613
   else
 
14614
@@ -430,8 +428,7 @@
 
14615
       retarray->offset = 0;
 
14616
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14617
 
 
14618
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14619
-                  * extent[rank-1];
 
14620
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14621
 
 
14622
       if (alloc_size == 0)
 
14623
        {
 
14624
@@ -440,7 +437,7 @@
 
14625
          return;
 
14626
        }
 
14627
       else
 
14628
-       retarray->base_addr = xmalloc (alloc_size);
 
14629
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14630
     }
 
14631
   else
 
14632
     {
 
14633
Index: libgfortran/generated/maxloc1_16_i1.c
 
14634
===================================================================
 
14635
--- a/src/libgfortran/generated/maxloc1_16_i1.c (.../tags/gcc_4_8_3_release)
 
14636
+++ b/src/libgfortran/generated/maxloc1_16_i1.c (.../branches/gcc-4_8-branch)
 
14637
@@ -98,10 +98,9 @@
 
14638
       retarray->offset = 0;
 
14639
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14640
 
 
14641
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14642
-                  * extent[rank-1];
 
14643
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14644
 
 
14645
-      retarray->base_addr = xmalloc (alloc_size);
 
14646
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14647
       if (alloc_size == 0)
 
14648
        {
 
14649
          /* Make sure we have a zero-sized array.  */
 
14650
@@ -294,8 +293,7 @@
 
14651
 
 
14652
        }
 
14653
 
 
14654
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14655
-                  * extent[rank-1];
 
14656
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14657
 
 
14658
       retarray->offset = 0;
 
14659
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14660
@@ -307,7 +305,7 @@
 
14661
          return;
 
14662
        }
 
14663
       else
 
14664
-       retarray->base_addr = xmalloc (alloc_size);
 
14665
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14666
 
 
14667
     }
 
14668
   else
 
14669
@@ -485,8 +483,7 @@
 
14670
       retarray->offset = 0;
 
14671
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14672
 
 
14673
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14674
-                  * extent[rank-1];
 
14675
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14676
 
 
14677
       if (alloc_size == 0)
 
14678
        {
 
14679
@@ -495,7 +492,7 @@
 
14680
          return;
 
14681
        }
 
14682
       else
 
14683
-       retarray->base_addr = xmalloc (alloc_size);
 
14684
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14685
     }
 
14686
   else
 
14687
     {
 
14688
Index: libgfortran/generated/reshape_i16.c
 
14689
===================================================================
 
14690
--- a/src/libgfortran/generated/reshape_i16.c   (.../tags/gcc_4_8_3_release)
 
14691
+++ b/src/libgfortran/generated/reshape_i16.c   (.../branches/gcc-4_8-branch)
 
14692
@@ -111,11 +111,11 @@
 
14693
       ret->offset = 0;
 
14694
 
 
14695
       if (unlikely (rs < 1))
 
14696
-        alloc_size = 1;
 
14697
+        alloc_size = 0;
 
14698
       else
 
14699
-        alloc_size = rs * sizeof (GFC_INTEGER_16);
 
14700
+        alloc_size = rs;
 
14701
 
 
14702
-      ret->base_addr = xmalloc (alloc_size);
 
14703
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14704
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
 
14705
     }
 
14706
 
 
14707
Index: libgfortran/generated/count_16_l.c
 
14708
===================================================================
 
14709
--- a/src/libgfortran/generated/count_16_l.c    (.../tags/gcc_4_8_3_release)
 
14710
+++ b/src/libgfortran/generated/count_16_l.c    (.../branches/gcc-4_8-branch)
 
14711
@@ -101,8 +101,7 @@
 
14712
       retarray->offset = 0;
 
14713
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14714
 
 
14715
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14716
-                  * extent[rank-1];
 
14717
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14718
 
 
14719
       if (alloc_size == 0)
 
14720
        {
 
14721
@@ -111,7 +110,7 @@
 
14722
          return;
 
14723
        }
 
14724
       else
 
14725
-       retarray->base_addr = xmalloc (alloc_size);
 
14726
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
14727
     }
 
14728
   else
 
14729
     {
 
14730
Index: libgfortran/generated/minloc1_8_i1.c
 
14731
===================================================================
 
14732
--- a/src/libgfortran/generated/minloc1_8_i1.c  (.../tags/gcc_4_8_3_release)
 
14733
+++ b/src/libgfortran/generated/minloc1_8_i1.c  (.../branches/gcc-4_8-branch)
 
14734
@@ -98,10 +98,9 @@
 
14735
       retarray->offset = 0;
 
14736
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14737
 
 
14738
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14739
-                  * extent[rank-1];
 
14740
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14741
 
 
14742
-      retarray->base_addr = xmalloc (alloc_size);
 
14743
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
14744
       if (alloc_size == 0)
 
14745
        {
 
14746
          /* Make sure we have a zero-sized array.  */
 
14747
@@ -294,8 +293,7 @@
 
14748
 
 
14749
        }
 
14750
 
 
14751
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14752
-                  * extent[rank-1];
 
14753
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14754
 
 
14755
       retarray->offset = 0;
 
14756
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14757
@@ -307,7 +305,7 @@
 
14758
          return;
 
14759
        }
 
14760
       else
 
14761
-       retarray->base_addr = xmalloc (alloc_size);
 
14762
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
14763
 
 
14764
     }
 
14765
   else
 
14766
@@ -485,8 +483,7 @@
 
14767
       retarray->offset = 0;
 
14768
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14769
 
 
14770
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14771
-                  * extent[rank-1];
 
14772
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14773
 
 
14774
       if (alloc_size == 0)
 
14775
        {
 
14776
@@ -495,7 +492,7 @@
 
14777
          return;
 
14778
        }
 
14779
       else
 
14780
-       retarray->base_addr = xmalloc (alloc_size);
 
14781
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
14782
     }
 
14783
   else
 
14784
     {
 
14785
Index: libgfortran/generated/maxloc1_4_i4.c
 
14786
===================================================================
 
14787
--- a/src/libgfortran/generated/maxloc1_4_i4.c  (.../tags/gcc_4_8_3_release)
 
14788
+++ b/src/libgfortran/generated/maxloc1_4_i4.c  (.../branches/gcc-4_8-branch)
 
14789
@@ -98,10 +98,9 @@
 
14790
       retarray->offset = 0;
 
14791
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14792
 
 
14793
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14794
-                  * extent[rank-1];
 
14795
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14796
 
 
14797
-      retarray->base_addr = xmalloc (alloc_size);
 
14798
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14799
       if (alloc_size == 0)
 
14800
        {
 
14801
          /* Make sure we have a zero-sized array.  */
 
14802
@@ -294,8 +293,7 @@
 
14803
 
 
14804
        }
 
14805
 
 
14806
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14807
-                  * extent[rank-1];
 
14808
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14809
 
 
14810
       retarray->offset = 0;
 
14811
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14812
@@ -307,7 +305,7 @@
 
14813
          return;
 
14814
        }
 
14815
       else
 
14816
-       retarray->base_addr = xmalloc (alloc_size);
 
14817
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14818
 
 
14819
     }
 
14820
   else
 
14821
@@ -485,8 +483,7 @@
 
14822
       retarray->offset = 0;
 
14823
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14824
 
 
14825
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14826
-                  * extent[rank-1];
 
14827
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14828
 
 
14829
       if (alloc_size == 0)
 
14830
        {
 
14831
@@ -495,7 +492,7 @@
 
14832
          return;
 
14833
        }
 
14834
       else
 
14835
-       retarray->base_addr = xmalloc (alloc_size);
 
14836
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14837
     }
 
14838
   else
 
14839
     {
 
14840
Index: libgfortran/generated/maxval_i8.c
 
14841
===================================================================
 
14842
--- a/src/libgfortran/generated/maxval_i8.c     (.../tags/gcc_4_8_3_release)
 
14843
+++ b/src/libgfortran/generated/maxval_i8.c     (.../branches/gcc-4_8-branch)
 
14844
@@ -97,10 +97,9 @@
 
14845
       retarray->offset = 0;
 
14846
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14847
 
 
14848
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14849
-                  * extent[rank-1];
 
14850
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14851
 
 
14852
-      retarray->base_addr = xmalloc (alloc_size);
 
14853
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
14854
       if (alloc_size == 0)
 
14855
        {
 
14856
          /* Make sure we have a zero-sized array.  */
 
14857
@@ -286,8 +285,7 @@
 
14858
 
 
14859
        }
 
14860
 
 
14861
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14862
-                  * extent[rank-1];
 
14863
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14864
 
 
14865
       retarray->offset = 0;
 
14866
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14867
@@ -299,7 +297,7 @@
 
14868
          return;
 
14869
        }
 
14870
       else
 
14871
-       retarray->base_addr = xmalloc (alloc_size);
 
14872
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
14873
 
 
14874
     }
 
14875
   else
 
14876
@@ -472,8 +470,7 @@
 
14877
       retarray->offset = 0;
 
14878
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14879
 
 
14880
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14881
-                  * extent[rank-1];
 
14882
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14883
 
 
14884
       if (alloc_size == 0)
 
14885
        {
 
14886
@@ -482,7 +479,7 @@
 
14887
          return;
 
14888
        }
 
14889
       else
 
14890
-       retarray->base_addr = xmalloc (alloc_size);
 
14891
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
14892
     }
 
14893
   else
 
14894
     {
 
14895
Index: libgfortran/generated/eoshift3_16.c
 
14896
===================================================================
 
14897
--- a/src/libgfortran/generated/eoshift3_16.c   (.../tags/gcc_4_8_3_release)
 
14898
+++ b/src/libgfortran/generated/eoshift3_16.c   (.../branches/gcc-4_8-branch)
 
14899
@@ -89,7 +89,7 @@
 
14900
     {
 
14901
       int i;
 
14902
 
 
14903
-      ret->base_addr = xmalloc (size * arraysize);
 
14904
+      ret->base_addr = xmallocarray (arraysize, size);
 
14905
       ret->offset = 0;
 
14906
       ret->dtype = array->dtype;
 
14907
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
 
14908
@@ -107,8 +107,8 @@
 
14909
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
14910
 
 
14911
         }
 
14912
-      /* xmalloc allocates a single byte for zero size.  */
 
14913
-      ret->base_addr = xmalloc (size * arraysize);
 
14914
+      /* xmallocarray allocates a single byte for zero size.  */
 
14915
+      ret->base_addr = xmallocarray (arraysize, size);
 
14916
 
 
14917
     }
 
14918
   else if (unlikely (compile_options.bounds_check))
 
14919
Index: libgfortran/generated/shape_i8.c
 
14920
===================================================================
 
14921
--- a/src/libgfortran/generated/shape_i8.c      (.../tags/gcc_4_8_3_release)
 
14922
+++ b/src/libgfortran/generated/shape_i8.c      (.../branches/gcc-4_8-branch)
 
14923
@@ -49,7 +49,7 @@
 
14924
     {
 
14925
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
 
14926
       ret->offset = 0;
 
14927
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
14928
+      ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
14929
     }
 
14930
 
 
14931
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
 
14932
Index: libgfortran/generated/maxloc0_4_i16.c
 
14933
===================================================================
 
14934
--- a/src/libgfortran/generated/maxloc0_4_i16.c (.../tags/gcc_4_8_3_release)
 
14935
+++ b/src/libgfortran/generated/maxloc0_4_i16.c (.../branches/gcc-4_8-branch)
 
14936
@@ -58,7 +58,7 @@
 
14937
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14938
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14939
       retarray->offset = 0;
 
14940
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
14941
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
14942
     }
 
14943
   else
 
14944
     {
 
14945
@@ -199,7 +199,7 @@
 
14946
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
14947
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14948
       retarray->offset = 0;
 
14949
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
14950
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
14951
     }
 
14952
   else
 
14953
     {
 
14954
@@ -367,7 +367,7 @@
 
14955
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
14956
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
14957
       retarray->offset = 0;
 
14958
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
14959
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
14960
     }
 
14961
   else if (unlikely (compile_options.bounds_check))
 
14962
     {
 
14963
Index: libgfortran/generated/maxloc1_4_r10.c
 
14964
===================================================================
 
14965
--- a/src/libgfortran/generated/maxloc1_4_r10.c (.../tags/gcc_4_8_3_release)
 
14966
+++ b/src/libgfortran/generated/maxloc1_4_r10.c (.../branches/gcc-4_8-branch)
 
14967
@@ -98,10 +98,9 @@
 
14968
       retarray->offset = 0;
 
14969
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14970
 
 
14971
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14972
-                  * extent[rank-1];
 
14973
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14974
 
 
14975
-      retarray->base_addr = xmalloc (alloc_size);
 
14976
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14977
       if (alloc_size == 0)
 
14978
        {
 
14979
          /* Make sure we have a zero-sized array.  */
 
14980
@@ -294,8 +293,7 @@
 
14981
 
 
14982
        }
 
14983
 
 
14984
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
14985
-                  * extent[rank-1];
 
14986
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
14987
 
 
14988
       retarray->offset = 0;
 
14989
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
14990
@@ -307,7 +305,7 @@
 
14991
          return;
 
14992
        }
 
14993
       else
 
14994
-       retarray->base_addr = xmalloc (alloc_size);
 
14995
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
14996
 
 
14997
     }
 
14998
   else
 
14999
@@ -485,8 +483,7 @@
 
15000
       retarray->offset = 0;
 
15001
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15002
 
 
15003
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15004
-                  * extent[rank-1];
 
15005
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15006
 
 
15007
       if (alloc_size == 0)
 
15008
        {
 
15009
@@ -495,7 +492,7 @@
 
15010
          return;
 
15011
        }
 
15012
       else
 
15013
-       retarray->base_addr = xmalloc (alloc_size);
 
15014
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
15015
     }
 
15016
   else
 
15017
     {
 
15018
Index: libgfortran/generated/maxloc1_8_i16.c
 
15019
===================================================================
 
15020
--- a/src/libgfortran/generated/maxloc1_8_i16.c (.../tags/gcc_4_8_3_release)
 
15021
+++ b/src/libgfortran/generated/maxloc1_8_i16.c (.../branches/gcc-4_8-branch)
 
15022
@@ -98,10 +98,9 @@
 
15023
       retarray->offset = 0;
 
15024
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15025
 
 
15026
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15027
-                  * extent[rank-1];
 
15028
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15029
 
 
15030
-      retarray->base_addr = xmalloc (alloc_size);
 
15031
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15032
       if (alloc_size == 0)
 
15033
        {
 
15034
          /* Make sure we have a zero-sized array.  */
 
15035
@@ -294,8 +293,7 @@
 
15036
 
 
15037
        }
 
15038
 
 
15039
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15040
-                  * extent[rank-1];
 
15041
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15042
 
 
15043
       retarray->offset = 0;
 
15044
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15045
@@ -307,7 +305,7 @@
 
15046
          return;
 
15047
        }
 
15048
       else
 
15049
-       retarray->base_addr = xmalloc (alloc_size);
 
15050
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15051
 
 
15052
     }
 
15053
   else
 
15054
@@ -485,8 +483,7 @@
 
15055
       retarray->offset = 0;
 
15056
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15057
 
 
15058
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15059
-                  * extent[rank-1];
 
15060
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15061
 
 
15062
       if (alloc_size == 0)
 
15063
        {
 
15064
@@ -495,7 +492,7 @@
 
15065
          return;
 
15066
        }
 
15067
       else
 
15068
-       retarray->base_addr = xmalloc (alloc_size);
 
15069
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15070
     }
 
15071
   else
 
15072
     {
 
15073
Index: libgfortran/generated/minloc0_8_r10.c
 
15074
===================================================================
 
15075
--- a/src/libgfortran/generated/minloc0_8_r10.c (.../tags/gcc_4_8_3_release)
 
15076
+++ b/src/libgfortran/generated/minloc0_8_r10.c (.../branches/gcc-4_8-branch)
 
15077
@@ -58,7 +58,7 @@
 
15078
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15079
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15080
       retarray->offset = 0;
 
15081
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
15082
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
15083
     }
 
15084
   else
 
15085
     {
 
15086
@@ -199,7 +199,7 @@
 
15087
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
15088
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15089
       retarray->offset = 0;
 
15090
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
15091
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
15092
     }
 
15093
   else
 
15094
     {
 
15095
@@ -367,7 +367,7 @@
 
15096
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15097
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15098
       retarray->offset = 0;
 
15099
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
15100
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
15101
     }
 
15102
   else if (unlikely (compile_options.bounds_check))
 
15103
     {
 
15104
Index: libgfortran/generated/iparity_i2.c
 
15105
===================================================================
 
15106
--- a/src/libgfortran/generated/iparity_i2.c    (.../tags/gcc_4_8_3_release)
 
15107
+++ b/src/libgfortran/generated/iparity_i2.c    (.../branches/gcc-4_8-branch)
 
15108
@@ -97,10 +97,9 @@
 
15109
       retarray->offset = 0;
 
15110
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15111
 
 
15112
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15113
-                  * extent[rank-1];
 
15114
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15115
 
 
15116
-      retarray->base_addr = xmalloc (alloc_size);
 
15117
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
15118
       if (alloc_size == 0)
 
15119
        {
 
15120
          /* Make sure we have a zero-sized array.  */
 
15121
@@ -272,8 +271,7 @@
 
15122
 
 
15123
        }
 
15124
 
 
15125
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15126
-                  * extent[rank-1];
 
15127
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15128
 
 
15129
       retarray->offset = 0;
 
15130
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15131
@@ -285,7 +283,7 @@
 
15132
          return;
 
15133
        }
 
15134
       else
 
15135
-       retarray->base_addr = xmalloc (alloc_size);
 
15136
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
15137
 
 
15138
     }
 
15139
   else
 
15140
@@ -430,8 +428,7 @@
 
15141
       retarray->offset = 0;
 
15142
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15143
 
 
15144
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15145
-                  * extent[rank-1];
 
15146
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15147
 
 
15148
       if (alloc_size == 0)
 
15149
        {
 
15150
@@ -440,7 +437,7 @@
 
15151
          return;
 
15152
        }
 
15153
       else
 
15154
-       retarray->base_addr = xmalloc (alloc_size);
 
15155
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
15156
     }
 
15157
   else
 
15158
     {
 
15159
Index: libgfortran/generated/maxloc1_16_r4.c
 
15160
===================================================================
 
15161
--- a/src/libgfortran/generated/maxloc1_16_r4.c (.../tags/gcc_4_8_3_release)
 
15162
+++ b/src/libgfortran/generated/maxloc1_16_r4.c (.../branches/gcc-4_8-branch)
 
15163
@@ -98,10 +98,9 @@
 
15164
       retarray->offset = 0;
 
15165
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15166
 
 
15167
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15168
-                  * extent[rank-1];
 
15169
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15170
 
 
15171
-      retarray->base_addr = xmalloc (alloc_size);
 
15172
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15173
       if (alloc_size == 0)
 
15174
        {
 
15175
          /* Make sure we have a zero-sized array.  */
 
15176
@@ -294,8 +293,7 @@
 
15177
 
 
15178
        }
 
15179
 
 
15180
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15181
-                  * extent[rank-1];
 
15182
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15183
 
 
15184
       retarray->offset = 0;
 
15185
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15186
@@ -307,7 +305,7 @@
 
15187
          return;
 
15188
        }
 
15189
       else
 
15190
-       retarray->base_addr = xmalloc (alloc_size);
 
15191
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15192
 
 
15193
     }
 
15194
   else
 
15195
@@ -485,8 +483,7 @@
 
15196
       retarray->offset = 0;
 
15197
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15198
 
 
15199
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15200
-                  * extent[rank-1];
 
15201
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15202
 
 
15203
       if (alloc_size == 0)
 
15204
        {
 
15205
@@ -495,7 +492,7 @@
 
15206
          return;
 
15207
        }
 
15208
       else
 
15209
-       retarray->base_addr = xmalloc (alloc_size);
 
15210
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15211
     }
 
15212
   else
 
15213
     {
 
15214
Index: libgfortran/generated/maxloc0_16_r8.c
 
15215
===================================================================
 
15216
--- a/src/libgfortran/generated/maxloc0_16_r8.c (.../tags/gcc_4_8_3_release)
 
15217
+++ b/src/libgfortran/generated/maxloc0_16_r8.c (.../branches/gcc-4_8-branch)
 
15218
@@ -58,7 +58,7 @@
 
15219
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15220
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15221
       retarray->offset = 0;
 
15222
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
15223
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
15224
     }
 
15225
   else
 
15226
     {
 
15227
@@ -199,7 +199,7 @@
 
15228
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
15229
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15230
       retarray->offset = 0;
 
15231
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
15232
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
15233
     }
 
15234
   else
 
15235
     {
 
15236
@@ -367,7 +367,7 @@
 
15237
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15238
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15239
       retarray->offset = 0;
 
15240
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
 
15241
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
 
15242
     }
 
15243
   else if (unlikely (compile_options.bounds_check))
 
15244
     {
 
15245
Index: libgfortran/generated/sum_i16.c
 
15246
===================================================================
 
15247
--- a/src/libgfortran/generated/sum_i16.c       (.../tags/gcc_4_8_3_release)
 
15248
+++ b/src/libgfortran/generated/sum_i16.c       (.../branches/gcc-4_8-branch)
 
15249
@@ -97,10 +97,9 @@
 
15250
       retarray->offset = 0;
 
15251
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15252
 
 
15253
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15254
-                  * extent[rank-1];
 
15255
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15256
 
 
15257
-      retarray->base_addr = xmalloc (alloc_size);
 
15258
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15259
       if (alloc_size == 0)
 
15260
        {
 
15261
          /* Make sure we have a zero-sized array.  */
 
15262
@@ -272,8 +271,7 @@
 
15263
 
 
15264
        }
 
15265
 
 
15266
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15267
-                  * extent[rank-1];
 
15268
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15269
 
 
15270
       retarray->offset = 0;
 
15271
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15272
@@ -285,7 +283,7 @@
 
15273
          return;
 
15274
        }
 
15275
       else
 
15276
-       retarray->base_addr = xmalloc (alloc_size);
 
15277
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15278
 
 
15279
     }
 
15280
   else
 
15281
@@ -430,8 +428,7 @@
 
15282
       retarray->offset = 0;
 
15283
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15284
 
 
15285
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15286
-                  * extent[rank-1];
 
15287
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15288
 
 
15289
       if (alloc_size == 0)
 
15290
        {
 
15291
@@ -440,7 +437,7 @@
 
15292
          return;
 
15293
        }
 
15294
       else
 
15295
-       retarray->base_addr = xmalloc (alloc_size);
 
15296
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15297
     }
 
15298
   else
 
15299
     {
 
15300
Index: libgfortran/generated/maxloc0_4_i8.c
 
15301
===================================================================
 
15302
--- a/src/libgfortran/generated/maxloc0_4_i8.c  (.../tags/gcc_4_8_3_release)
 
15303
+++ b/src/libgfortran/generated/maxloc0_4_i8.c  (.../branches/gcc-4_8-branch)
 
15304
@@ -58,7 +58,7 @@
 
15305
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15306
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15307
       retarray->offset = 0;
 
15308
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
15309
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
15310
     }
 
15311
   else
 
15312
     {
 
15313
@@ -199,7 +199,7 @@
 
15314
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
15315
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15316
       retarray->offset = 0;
 
15317
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
15318
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
15319
     }
 
15320
   else
 
15321
     {
 
15322
@@ -367,7 +367,7 @@
 
15323
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15324
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15325
       retarray->offset = 0;
 
15326
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
 
15327
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
 
15328
     }
 
15329
   else if (unlikely (compile_options.bounds_check))
 
15330
     {
 
15331
Index: libgfortran/generated/pack_c16.c
 
15332
===================================================================
 
15333
--- a/src/libgfortran/generated/pack_c16.c      (.../tags/gcc_4_8_3_release)
 
15334
+++ b/src/libgfortran/generated/pack_c16.c      (.../branches/gcc-4_8-branch)
 
15335
@@ -167,8 +167,8 @@
 
15336
 
 
15337
          ret->offset = 0;
 
15338
 
 
15339
-         /* xmalloc allocates a single byte for zero size.  */
 
15340
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * total);
 
15341
+         /* xmallocarray allocates a single byte for zero size.  */
 
15342
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_16));
 
15343
 
 
15344
          if (total == 0)
 
15345
            return;
 
15346
Index: libgfortran/generated/maxloc1_16_i16.c
 
15347
===================================================================
 
15348
--- a/src/libgfortran/generated/maxloc1_16_i16.c        (.../tags/gcc_4_8_3_release)
 
15349
+++ b/src/libgfortran/generated/maxloc1_16_i16.c        (.../branches/gcc-4_8-branch)
 
15350
@@ -98,10 +98,9 @@
 
15351
       retarray->offset = 0;
 
15352
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15353
 
 
15354
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15355
-                  * extent[rank-1];
 
15356
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15357
 
 
15358
-      retarray->base_addr = xmalloc (alloc_size);
 
15359
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15360
       if (alloc_size == 0)
 
15361
        {
 
15362
          /* Make sure we have a zero-sized array.  */
 
15363
@@ -294,8 +293,7 @@
 
15364
 
 
15365
        }
 
15366
 
 
15367
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15368
-                  * extent[rank-1];
 
15369
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15370
 
 
15371
       retarray->offset = 0;
 
15372
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15373
@@ -307,7 +305,7 @@
 
15374
          return;
 
15375
        }
 
15376
       else
 
15377
-       retarray->base_addr = xmalloc (alloc_size);
 
15378
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15379
 
 
15380
     }
 
15381
   else
 
15382
@@ -485,8 +483,7 @@
 
15383
       retarray->offset = 0;
 
15384
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15385
 
 
15386
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15387
-                  * extent[rank-1];
 
15388
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15389
 
 
15390
       if (alloc_size == 0)
 
15391
        {
 
15392
@@ -495,7 +492,7 @@
 
15393
          return;
 
15394
        }
 
15395
       else
 
15396
-       retarray->base_addr = xmalloc (alloc_size);
 
15397
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15398
     }
 
15399
   else
 
15400
     {
 
15401
Index: libgfortran/generated/minloc1_8_r4.c
 
15402
===================================================================
 
15403
--- a/src/libgfortran/generated/minloc1_8_r4.c  (.../tags/gcc_4_8_3_release)
 
15404
+++ b/src/libgfortran/generated/minloc1_8_r4.c  (.../branches/gcc-4_8-branch)
 
15405
@@ -98,10 +98,9 @@
 
15406
       retarray->offset = 0;
 
15407
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15408
 
 
15409
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15410
-                  * extent[rank-1];
 
15411
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15412
 
 
15413
-      retarray->base_addr = xmalloc (alloc_size);
 
15414
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15415
       if (alloc_size == 0)
 
15416
        {
 
15417
          /* Make sure we have a zero-sized array.  */
 
15418
@@ -294,8 +293,7 @@
 
15419
 
 
15420
        }
 
15421
 
 
15422
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15423
-                  * extent[rank-1];
 
15424
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15425
 
 
15426
       retarray->offset = 0;
 
15427
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15428
@@ -307,7 +305,7 @@
 
15429
          return;
 
15430
        }
 
15431
       else
 
15432
-       retarray->base_addr = xmalloc (alloc_size);
 
15433
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15434
 
 
15435
     }
 
15436
   else
 
15437
@@ -485,8 +483,7 @@
 
15438
       retarray->offset = 0;
 
15439
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15440
 
 
15441
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15442
-                  * extent[rank-1];
 
15443
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15444
 
 
15445
       if (alloc_size == 0)
 
15446
        {
 
15447
@@ -495,7 +492,7 @@
 
15448
          return;
 
15449
        }
 
15450
       else
 
15451
-       retarray->base_addr = xmalloc (alloc_size);
 
15452
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15453
     }
 
15454
   else
 
15455
     {
 
15456
Index: libgfortran/generated/sum_c8.c
 
15457
===================================================================
 
15458
--- a/src/libgfortran/generated/sum_c8.c        (.../tags/gcc_4_8_3_release)
 
15459
+++ b/src/libgfortran/generated/sum_c8.c        (.../branches/gcc-4_8-branch)
 
15460
@@ -97,10 +97,9 @@
 
15461
       retarray->offset = 0;
 
15462
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15463
 
 
15464
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15465
-                  * extent[rank-1];
 
15466
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15467
 
 
15468
-      retarray->base_addr = xmalloc (alloc_size);
 
15469
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
15470
       if (alloc_size == 0)
 
15471
        {
 
15472
          /* Make sure we have a zero-sized array.  */
 
15473
@@ -272,8 +271,7 @@
 
15474
 
 
15475
        }
 
15476
 
 
15477
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15478
-                  * extent[rank-1];
 
15479
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15480
 
 
15481
       retarray->offset = 0;
 
15482
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15483
@@ -285,7 +283,7 @@
 
15484
          return;
 
15485
        }
 
15486
       else
 
15487
-       retarray->base_addr = xmalloc (alloc_size);
 
15488
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
15489
 
 
15490
     }
 
15491
   else
 
15492
@@ -430,8 +428,7 @@
 
15493
       retarray->offset = 0;
 
15494
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15495
 
 
15496
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15497
-                  * extent[rank-1];
 
15498
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15499
 
 
15500
       if (alloc_size == 0)
 
15501
        {
 
15502
@@ -440,7 +437,7 @@
 
15503
          return;
 
15504
        }
 
15505
       else
 
15506
-       retarray->base_addr = xmalloc (alloc_size);
 
15507
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
15508
     }
 
15509
   else
 
15510
     {
 
15511
Index: libgfortran/generated/maxloc1_16_i2.c
 
15512
===================================================================
 
15513
--- a/src/libgfortran/generated/maxloc1_16_i2.c (.../tags/gcc_4_8_3_release)
 
15514
+++ b/src/libgfortran/generated/maxloc1_16_i2.c (.../branches/gcc-4_8-branch)
 
15515
@@ -98,10 +98,9 @@
 
15516
       retarray->offset = 0;
 
15517
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15518
 
 
15519
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15520
-                  * extent[rank-1];
 
15521
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15522
 
 
15523
-      retarray->base_addr = xmalloc (alloc_size);
 
15524
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15525
       if (alloc_size == 0)
 
15526
        {
 
15527
          /* Make sure we have a zero-sized array.  */
 
15528
@@ -294,8 +293,7 @@
 
15529
 
 
15530
        }
 
15531
 
 
15532
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15533
-                  * extent[rank-1];
 
15534
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15535
 
 
15536
       retarray->offset = 0;
 
15537
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15538
@@ -307,7 +305,7 @@
 
15539
          return;
 
15540
        }
 
15541
       else
 
15542
-       retarray->base_addr = xmalloc (alloc_size);
 
15543
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15544
 
 
15545
     }
 
15546
   else
 
15547
@@ -485,8 +483,7 @@
 
15548
       retarray->offset = 0;
 
15549
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15550
 
 
15551
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15552
-                  * extent[rank-1];
 
15553
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15554
 
 
15555
       if (alloc_size == 0)
 
15556
        {
 
15557
@@ -495,7 +492,7 @@
 
15558
          return;
 
15559
        }
 
15560
       else
 
15561
-       retarray->base_addr = xmalloc (alloc_size);
 
15562
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15563
     }
 
15564
   else
 
15565
     {
 
15566
Index: libgfortran/generated/parity_l1.c
 
15567
===================================================================
 
15568
--- a/src/libgfortran/generated/parity_l1.c     (.../tags/gcc_4_8_3_release)
 
15569
+++ b/src/libgfortran/generated/parity_l1.c     (.../branches/gcc-4_8-branch)
 
15570
@@ -98,10 +98,9 @@
 
15571
       retarray->offset = 0;
 
15572
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15573
 
 
15574
-      alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15575
-                  * extent[rank-1];
 
15576
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15577
 
 
15578
-      retarray->base_addr = xmalloc (alloc_size);
 
15579
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
 
15580
       if (alloc_size == 0)
 
15581
        {
 
15582
          /* Make sure we have a zero-sized array.  */
 
15583
Index: libgfortran/generated/maxval_i16.c
 
15584
===================================================================
 
15585
--- a/src/libgfortran/generated/maxval_i16.c    (.../tags/gcc_4_8_3_release)
 
15586
+++ b/src/libgfortran/generated/maxval_i16.c    (.../branches/gcc-4_8-branch)
 
15587
@@ -97,10 +97,9 @@
 
15588
       retarray->offset = 0;
 
15589
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15590
 
 
15591
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15592
-                  * extent[rank-1];
 
15593
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15594
 
 
15595
-      retarray->base_addr = xmalloc (alloc_size);
 
15596
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15597
       if (alloc_size == 0)
 
15598
        {
 
15599
          /* Make sure we have a zero-sized array.  */
 
15600
@@ -286,8 +285,7 @@
 
15601
 
 
15602
        }
 
15603
 
 
15604
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15605
-                  * extent[rank-1];
 
15606
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15607
 
 
15608
       retarray->offset = 0;
 
15609
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15610
@@ -299,7 +297,7 @@
 
15611
          return;
 
15612
        }
 
15613
       else
 
15614
-       retarray->base_addr = xmalloc (alloc_size);
 
15615
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15616
 
 
15617
     }
 
15618
   else
 
15619
@@ -472,8 +470,7 @@
 
15620
       retarray->offset = 0;
 
15621
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15622
 
 
15623
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15624
-                  * extent[rank-1];
 
15625
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15626
 
 
15627
       if (alloc_size == 0)
 
15628
        {
 
15629
@@ -482,7 +479,7 @@
 
15630
          return;
 
15631
        }
 
15632
       else
 
15633
-       retarray->base_addr = xmalloc (alloc_size);
 
15634
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
15635
     }
 
15636
   else
 
15637
     {
 
15638
Index: libgfortran/generated/spread_c8.c
 
15639
===================================================================
 
15640
--- a/src/libgfortran/generated/spread_c8.c     (.../tags/gcc_4_8_3_release)
 
15641
+++ b/src/libgfortran/generated/spread_c8.c     (.../branches/gcc-4_8-branch)
 
15642
@@ -101,8 +101,8 @@
 
15643
        }
 
15644
       ret->offset = 0;
 
15645
 
 
15646
-      /* xmalloc allocates a single byte for zero size.  */
 
15647
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_8));
 
15648
+      /* xmallocarray allocates a single byte for zero size.  */
 
15649
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_8));
 
15650
       if (rs <= 0)
 
15651
         return;
 
15652
     }
 
15653
@@ -244,7 +244,7 @@
 
15654
 
 
15655
   if (ret->base_addr == NULL)
 
15656
     {
 
15657
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_8));
 
15658
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_8));
 
15659
       ret->offset = 0;
 
15660
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
 
15661
     }
 
15662
Index: libgfortran/generated/matmul_i16.c
 
15663
===================================================================
 
15664
--- a/src/libgfortran/generated/matmul_i16.c    (.../tags/gcc_4_8_3_release)
 
15665
+++ b/src/libgfortran/generated/matmul_i16.c    (.../branches/gcc-4_8-branch)
 
15666
@@ -124,7 +124,7 @@
 
15667
         }
 
15668
 
 
15669
       retarray->base_addr
 
15670
-       = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) retarray));
 
15671
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_16));
 
15672
       retarray->offset = 0;
 
15673
     }
 
15674
     else if (unlikely (compile_options.bounds_check))
 
15675
Index: libgfortran/generated/pack_i8.c
 
15676
===================================================================
 
15677
--- a/src/libgfortran/generated/pack_i8.c       (.../tags/gcc_4_8_3_release)
 
15678
+++ b/src/libgfortran/generated/pack_i8.c       (.../branches/gcc-4_8-branch)
 
15679
@@ -167,8 +167,8 @@
 
15680
 
 
15681
          ret->offset = 0;
 
15682
 
 
15683
-         /* xmalloc allocates a single byte for zero size.  */
 
15684
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * total);
 
15685
+         /* xmallocarray allocates a single byte for zero size.  */
 
15686
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_8));
 
15687
 
 
15688
          if (total == 0)
 
15689
            return;
 
15690
Index: libgfortran/generated/any_l1.c
 
15691
===================================================================
 
15692
--- a/src/libgfortran/generated/any_l1.c        (.../tags/gcc_4_8_3_release)
 
15693
+++ b/src/libgfortran/generated/any_l1.c        (.../branches/gcc-4_8-branch)
 
15694
@@ -101,8 +101,7 @@
 
15695
       retarray->offset = 0;
 
15696
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15697
 
 
15698
-      alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15699
-                  * extent[rank-1];
 
15700
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15701
 
 
15702
       if (alloc_size == 0)
 
15703
        {
 
15704
@@ -111,7 +110,7 @@
 
15705
          return;
 
15706
        }
 
15707
       else
 
15708
-       retarray->base_addr = xmalloc (alloc_size);
 
15709
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
 
15710
     }
 
15711
   else
 
15712
     {
 
15713
Index: libgfortran/generated/minloc1_8_i2.c
 
15714
===================================================================
 
15715
--- a/src/libgfortran/generated/minloc1_8_i2.c  (.../tags/gcc_4_8_3_release)
 
15716
+++ b/src/libgfortran/generated/minloc1_8_i2.c  (.../branches/gcc-4_8-branch)
 
15717
@@ -98,10 +98,9 @@
 
15718
       retarray->offset = 0;
 
15719
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15720
 
 
15721
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15722
-                  * extent[rank-1];
 
15723
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15724
 
 
15725
-      retarray->base_addr = xmalloc (alloc_size);
 
15726
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15727
       if (alloc_size == 0)
 
15728
        {
 
15729
          /* Make sure we have a zero-sized array.  */
 
15730
@@ -294,8 +293,7 @@
 
15731
 
 
15732
        }
 
15733
 
 
15734
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15735
-                  * extent[rank-1];
 
15736
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15737
 
 
15738
       retarray->offset = 0;
 
15739
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15740
@@ -307,7 +305,7 @@
 
15741
          return;
 
15742
        }
 
15743
       else
 
15744
-       retarray->base_addr = xmalloc (alloc_size);
 
15745
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15746
 
 
15747
     }
 
15748
   else
 
15749
@@ -485,8 +483,7 @@
 
15750
       retarray->offset = 0;
 
15751
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15752
 
 
15753
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15754
-                  * extent[rank-1];
 
15755
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15756
 
 
15757
       if (alloc_size == 0)
 
15758
        {
 
15759
@@ -495,7 +492,7 @@
 
15760
          return;
 
15761
        }
 
15762
       else
 
15763
-       retarray->base_addr = xmalloc (alloc_size);
 
15764
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
15765
     }
 
15766
   else
 
15767
     {
 
15768
Index: libgfortran/generated/minloc0_8_r8.c
 
15769
===================================================================
 
15770
--- a/src/libgfortran/generated/minloc0_8_r8.c  (.../tags/gcc_4_8_3_release)
 
15771
+++ b/src/libgfortran/generated/minloc0_8_r8.c  (.../branches/gcc-4_8-branch)
 
15772
@@ -58,7 +58,7 @@
 
15773
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15774
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15775
       retarray->offset = 0;
 
15776
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
15777
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
15778
     }
 
15779
   else
 
15780
     {
 
15781
@@ -199,7 +199,7 @@
 
15782
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
 
15783
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15784
       retarray->offset = 0;
 
15785
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
15786
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
15787
     }
 
15788
   else
 
15789
     {
 
15790
@@ -367,7 +367,7 @@
 
15791
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
 
15792
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
 
15793
       retarray->offset = 0;
 
15794
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
 
15795
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
 
15796
     }
 
15797
   else if (unlikely (compile_options.bounds_check))
 
15798
     {
 
15799
Index: libgfortran/generated/matmul_l8.c
 
15800
===================================================================
 
15801
--- a/src/libgfortran/generated/matmul_l8.c     (.../tags/gcc_4_8_3_release)
 
15802
+++ b/src/libgfortran/generated/matmul_l8.c     (.../branches/gcc-4_8-branch)
 
15803
@@ -88,7 +88,7 @@
 
15804
         }
 
15805
           
 
15806
       retarray->base_addr
 
15807
-       = xmalloc (sizeof (GFC_LOGICAL_8) * size0 ((array_t *) retarray));
 
15808
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_8));
 
15809
       retarray->offset = 0;
 
15810
     }
 
15811
     else if (unlikely (compile_options.bounds_check))
 
15812
Index: libgfortran/generated/product_r10.c
 
15813
===================================================================
 
15814
--- a/src/libgfortran/generated/product_r10.c   (.../tags/gcc_4_8_3_release)
 
15815
+++ b/src/libgfortran/generated/product_r10.c   (.../branches/gcc-4_8-branch)
 
15816
@@ -97,10 +97,9 @@
 
15817
       retarray->offset = 0;
 
15818
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15819
 
 
15820
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15821
-                  * extent[rank-1];
 
15822
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15823
 
 
15824
-      retarray->base_addr = xmalloc (alloc_size);
 
15825
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
15826
       if (alloc_size == 0)
 
15827
        {
 
15828
          /* Make sure we have a zero-sized array.  */
 
15829
@@ -272,8 +271,7 @@
 
15830
 
 
15831
        }
 
15832
 
 
15833
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15834
-                  * extent[rank-1];
 
15835
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15836
 
 
15837
       retarray->offset = 0;
 
15838
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15839
@@ -285,7 +283,7 @@
 
15840
          return;
 
15841
        }
 
15842
       else
 
15843
-       retarray->base_addr = xmalloc (alloc_size);
 
15844
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
15845
 
 
15846
     }
 
15847
   else
 
15848
@@ -430,8 +428,7 @@
 
15849
       retarray->offset = 0;
 
15850
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15851
 
 
15852
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15853
-                  * extent[rank-1];
 
15854
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15855
 
 
15856
       if (alloc_size == 0)
 
15857
        {
 
15858
@@ -440,7 +437,7 @@
 
15859
          return;
 
15860
        }
 
15861
       else
 
15862
-       retarray->base_addr = xmalloc (alloc_size);
 
15863
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
15864
     }
 
15865
   else
 
15866
     {
 
15867
Index: libgfortran/generated/product_i1.c
 
15868
===================================================================
 
15869
--- a/src/libgfortran/generated/product_i1.c    (.../tags/gcc_4_8_3_release)
 
15870
+++ b/src/libgfortran/generated/product_i1.c    (.../branches/gcc-4_8-branch)
 
15871
@@ -97,10 +97,9 @@
 
15872
       retarray->offset = 0;
 
15873
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15874
 
 
15875
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15876
-                  * extent[rank-1];
 
15877
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15878
 
 
15879
-      retarray->base_addr = xmalloc (alloc_size);
 
15880
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
15881
       if (alloc_size == 0)
 
15882
        {
 
15883
          /* Make sure we have a zero-sized array.  */
 
15884
@@ -272,8 +271,7 @@
 
15885
 
 
15886
        }
 
15887
 
 
15888
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15889
-                  * extent[rank-1];
 
15890
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15891
 
 
15892
       retarray->offset = 0;
 
15893
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15894
@@ -285,7 +283,7 @@
 
15895
          return;
 
15896
        }
 
15897
       else
 
15898
-       retarray->base_addr = xmalloc (alloc_size);
 
15899
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
15900
 
 
15901
     }
 
15902
   else
 
15903
@@ -430,8 +428,7 @@
 
15904
       retarray->offset = 0;
 
15905
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15906
 
 
15907
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15908
-                  * extent[rank-1];
 
15909
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15910
 
 
15911
       if (alloc_size == 0)
 
15912
        {
 
15913
@@ -440,7 +437,7 @@
 
15914
          return;
 
15915
        }
 
15916
       else
 
15917
-       retarray->base_addr = xmalloc (alloc_size);
 
15918
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
15919
     }
 
15920
   else
 
15921
     {
 
15922
Index: libgfortran/generated/all_l8.c
 
15923
===================================================================
 
15924
--- a/src/libgfortran/generated/all_l8.c        (.../tags/gcc_4_8_3_release)
 
15925
+++ b/src/libgfortran/generated/all_l8.c        (.../branches/gcc-4_8-branch)
 
15926
@@ -101,8 +101,7 @@
 
15927
       retarray->offset = 0;
 
15928
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
15929
 
 
15930
-      alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
 
15931
-                  * extent[rank-1];
 
15932
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
15933
 
 
15934
       if (alloc_size == 0)
 
15935
        {
 
15936
@@ -111,7 +110,7 @@
 
15937
          return;
 
15938
        }
 
15939
       else
 
15940
-       retarray->base_addr = xmalloc (alloc_size);
 
15941
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
 
15942
     }
 
15943
   else
 
15944
     {
 
15945
Index: libgfortran/generated/in_pack_r16.c
 
15946
===================================================================
 
15947
--- a/src/libgfortran/generated/in_pack_r16.c   (.../tags/gcc_4_8_3_release)
 
15948
+++ b/src/libgfortran/generated/in_pack_r16.c   (.../branches/gcc-4_8-branch)
 
15949
@@ -76,7 +76,7 @@
 
15950
     return source->base_addr;
 
15951
 
 
15952
   /* Allocate storage for the destination.  */
 
15953
-  destptr = (GFC_REAL_16 *)xmalloc (ssize * sizeof (GFC_REAL_16));
 
15954
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_16));
 
15955
   dest = destptr;
 
15956
   src = source->base_addr;
 
15957
   stride0 = stride[0];
 
15958
Index: libgfortran/generated/in_pack_i1.c
 
15959
===================================================================
 
15960
--- a/src/libgfortran/generated/in_pack_i1.c    (.../tags/gcc_4_8_3_release)
 
15961
+++ b/src/libgfortran/generated/in_pack_i1.c    (.../branches/gcc-4_8-branch)
 
15962
@@ -76,7 +76,7 @@
 
15963
     return source->base_addr;
 
15964
 
 
15965
   /* Allocate storage for the destination.  */
 
15966
-  destptr = (GFC_INTEGER_1 *)xmalloc (ssize * sizeof (GFC_INTEGER_1));
 
15967
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_1));
 
15968
   dest = destptr;
 
15969
   src = source->base_addr;
 
15970
   stride0 = stride[0];
 
15971
Index: libgfortran/libgfortran.h
 
15972
===================================================================
 
15973
--- a/src/libgfortran/libgfortran.h     (.../tags/gcc_4_8_3_release)
 
15974
+++ b/src/libgfortran/libgfortran.h     (.../branches/gcc-4_8-branch)
 
15975
@@ -751,6 +751,9 @@
 
15976
 extern void *xmalloc (size_t) __attribute__ ((malloc));
 
15977
 internal_proto(xmalloc);
 
15978
 
 
15979
+extern void *xmallocarray (size_t, size_t) __attribute__ ((malloc));
 
15980
+internal_proto(xmallocarray);
 
15981
+
 
15982
 extern void *xcalloc (size_t, size_t) __attribute__ ((malloc));
 
15983
 internal_proto(xcalloc);
 
15984
 
 
15985
Index: libgfortran/io/list_read.c
 
15986
===================================================================
 
15987
--- a/src/libgfortran/io/list_read.c    (.../tags/gcc_4_8_3_release)
 
15988
+++ b/src/libgfortran/io/list_read.c    (.../branches/gcc-4_8-branch)
 
15989
@@ -2354,7 +2354,7 @@
 
15990
 {
 
15991
   index_type len = strlen (nl->var_name) + 1;
 
15992
   int dim;
 
15993
-  char * ext_name = (char*)xmalloc (len + 1);
 
15994
+  char * ext_name = xmalloc (len + 1);
 
15995
   memcpy (ext_name, nl->var_name, len-1);
 
15996
   memcpy (ext_name + len - 1, "%", 2);
 
15997
   for (nl = nl->next; nl; nl = nl->next)
 
15998
Index: libgfortran/io/unit.c
 
15999
===================================================================
 
16000
--- a/src/libgfortran/io/unit.c (.../tags/gcc_4_8_3_release)
 
16001
+++ b/src/libgfortran/io/unit.c (.../branches/gcc-4_8-branch)
 
16002
@@ -455,7 +455,7 @@
 
16003
     {
 
16004
       iunit->rank = GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc);
 
16005
       iunit->ls = (array_loop_spec *)
 
16006
-       xmalloc (iunit->rank * sizeof (array_loop_spec));
 
16007
+       xmallocarray (iunit->rank, sizeof (array_loop_spec));
 
16008
       dtp->internal_unit_len *=
 
16009
        init_loop_spec (dtp->internal_unit_desc, iunit->ls, &start_record);
 
16010
 
 
16011
Index: libgfortran/io/unix.c
 
16012
===================================================================
 
16013
--- a/src/libgfortran/io/unix.c (.../tags/gcc_4_8_3_release)
 
16014
+++ b/src/libgfortran/io/unix.c (.../branches/gcc-4_8-branch)
 
16015
@@ -407,7 +407,9 @@
 
16016
 {
 
16017
   int retval;
 
16018
   
 
16019
-  if (s->fd != STDOUT_FILENO
 
16020
+  if (s->fd == -1)
 
16021
+    retval = -1;
 
16022
+  else if (s->fd != STDOUT_FILENO
 
16023
       && s->fd != STDERR_FILENO
 
16024
       && s->fd != STDIN_FILENO)
 
16025
     retval = close (s->fd);
 
16026
@@ -983,7 +985,15 @@
 
16027
 
 
16028
   /* Get the current length of the file. */
 
16029
 
 
16030
-  fstat (fd, &statbuf);
 
16031
+  if (fstat (fd, &statbuf) == -1)
 
16032
+    {
 
16033
+      s->st_dev = s->st_ino = -1;
 
16034
+      s->file_length = 0;
 
16035
+      if (errno == EBADF)
 
16036
+       s->fd = -1;
 
16037
+      raw_init (s);
 
16038
+      return (stream *) s;
 
16039
+    }
 
16040
 
 
16041
   s->st_dev = statbuf.st_dev;
 
16042
   s->st_ino = statbuf.st_ino;
 
16043
Index: libgfortran/io/transfer.c
 
16044
===================================================================
 
16045
--- a/src/libgfortran/io/transfer.c     (.../tags/gcc_4_8_3_release)
 
16046
+++ b/src/libgfortran/io/transfer.c     (.../branches/gcc-4_8-branch)
 
16047
@@ -3776,9 +3776,9 @@
 
16048
   if (nml->var_rank > 0)
 
16049
     {
 
16050
       nml->dim = (descriptor_dimension*)
 
16051
-                  xmalloc (nml->var_rank * sizeof (descriptor_dimension));
 
16052
+       xmallocarray (nml->var_rank, sizeof (descriptor_dimension));
 
16053
       nml->ls = (array_loop_spec*)
 
16054
-                 xmalloc (nml->var_rank * sizeof (array_loop_spec));
 
16055
+       xmallocarray (nml->var_rank, sizeof (array_loop_spec));
 
16056
     }
 
16057
   else
 
16058
     {
 
16059
Index: libgfortran/io/write.c
 
16060
===================================================================
 
16061
--- a/src/libgfortran/io/write.c        (.../tags/gcc_4_8_3_release)
 
16062
+++ b/src/libgfortran/io/write.c        (.../branches/gcc-4_8-branch)
 
16063
@@ -1863,7 +1863,7 @@
 
16064
              base_var_name_len = base ? strlen (base->var_name) : 0;
 
16065
              ext_name_len = base_name_len + base_var_name_len 
 
16066
                + strlen (obj->var_name) + obj->var_rank * NML_DIGITS + 1;
 
16067
-             ext_name = (char*)xmalloc (ext_name_len);
 
16068
+             ext_name = xmalloc (ext_name_len);
 
16069
 
 
16070
              memcpy (ext_name, base_name, base_name_len);
 
16071
              clen = strlen (obj->var_name + base_var_name_len);
 
16072
@@ -1892,7 +1892,7 @@
 
16073
              /* Now obj_name.  */
 
16074
 
 
16075
              obj_name_len = strlen (obj->var_name) + 1;
 
16076
-             obj_name = xmalloc (obj_name_len+1);
 
16077
+             obj_name = xmalloc (obj_name_len + 1);
 
16078
              memcpy (obj_name, obj->var_name, obj_name_len-1);
 
16079
              memcpy (obj_name + obj_name_len-1, "%", 2);
 
16080
 
 
16081
Index: .
 
16082
===================================================================
 
16083
--- a/src/.     (.../tags/gcc_4_8_3_release)
 
16084
+++ b/src/.     (.../branches/gcc-4_8-branch)
 
16085
 
 
16086
Property changes on: .
 
16087
___________________________________________________________________
 
16088
Modified: svn:mergeinfo
 
16089
   Merged /trunk:r211733