From 73f608b1f67e6e0bea392424f49d12b57607b3d2 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Wed, 5 Nov 2014 11:12:01 +0000 Subject: [PATCH] - updated --- gcc-branch.diff | 24106 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 24106 insertions(+) create mode 100644 gcc-branch.diff diff --git a/gcc-branch.diff b/gcc-branch.diff new file mode 100644 index 0000000..9ac75af --- /dev/null +++ b/gcc-branch.diff @@ -0,0 +1,24106 @@ +Index: libstdc++-v3/python/libstdcxx/v6/printers.py +=================================================================== +--- libstdc++-v3/python/libstdcxx/v6/printers.py (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/python/libstdcxx/v6/printers.py (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,4 +1,4 @@ +-# Pretty-printers for libstc++. ++# Pretty-printers for libstdc++. + + # Copyright (C) 2008-2013 Free Software Foundation, Inc. + +@@ -18,7 +18,51 @@ + import gdb + import itertools + import re ++import sys + ++### Python 2 + Python 3 compatibility code ++ ++# Resources about compatibility: ++# ++# * : Documentation of the "six" module ++ ++# FIXME: The handling of e.g. std::basic_string (at least on char) ++# probably needs updating to work with Python 3's new string rules. ++# ++# In particular, Python 3 has a separate type (called byte) for ++# bytestrings, and a special b"" syntax for the byte literals; the old ++# str() type has been redefined to always store Unicode text. ++# ++# We probably can't do much about this until this GDB PR is addressed: ++# ++ ++if sys.version_info[0] > 2: ++ ### Python 3 stuff ++ Iterator = object ++ # Python 3 folds these into the normal functions. ++ imap = map ++ izip = zip ++ # Also, int subsumes long ++ long = int ++else: ++ ### Python 2 stuff ++ class Iterator: ++ """Compatibility mixin for iterators ++ ++ Instead of writing next() methods for iterators, write ++ __next__() methods and use this mixin to make them work in ++ Python 2 as well as Python 3. ++ ++ Idea stolen from the "six" documentation: ++ ++ """ ++ ++ def next(self): ++ return self.__next__() ++ ++ # In Python 2, we still need these from itertools ++ from itertools import imap, izip ++ + # Try to use the new-style pretty-printing if available. + _use_gdb_pp = True + try: +@@ -51,7 +95,7 @@ + # anything fancier here. + field = typ.fields()[0] + if not field.is_base_class: +- raise ValueError, "Cannot find type %s::%s" % (str(orig), name) ++ raise ValueError("Cannot find type %s::%s" % (str(orig), name)) + typ = field.type + + class SharedPointerPrinter: +@@ -87,7 +131,7 @@ + class StdListPrinter: + "Print a std::list" + +- class _iterator: ++ class _iterator(Iterator): + def __init__(self, nodetype, head): + self.nodetype = nodetype + self.base = head['_M_next'] +@@ -97,7 +141,7 @@ + def __iter__(self): + return self + +- def next(self): ++ def __next__(self): + if self.base == self.head: + raise StopIteration + elt = self.base.cast(self.nodetype).dereference() +@@ -135,7 +179,7 @@ + class StdSlistPrinter: + "Print a __gnu_cxx::slist" + +- class _iterator: ++ class _iterator(Iterator): + def __init__(self, nodetype, head): + self.nodetype = nodetype + self.base = head['_M_head']['_M_next'] +@@ -144,7 +188,7 @@ + def __iter__(self): + return self + +- def next(self): ++ def __next__(self): + if self.base == 0: + raise StopIteration + elt = self.base.cast(self.nodetype).dereference() +@@ -180,7 +224,7 @@ + class StdVectorPrinter: + "Print a std::vector" + +- class _iterator: ++ class _iterator(Iterator): + def __init__ (self, start, finish, bitvec): + self.bitvec = bitvec + if bitvec: +@@ -198,7 +242,7 @@ + def __iter__(self): + return self + +- def next(self): ++ def __next__(self): + count = self.count + self.count = self.count + 1 + if self.bitvec: +@@ -265,7 +309,7 @@ + class StdTuplePrinter: + "Print a std::tuple" + +- class _iterator: ++ class _iterator(Iterator): + def __init__ (self, head): + self.head = head + +@@ -276,13 +320,13 @@ + # Set the actual head to the first pair. + self.head = self.head.cast (nodes[0].type) + elif len (nodes) != 0: +- raise ValueError, "Top of tuple tree does not consist of a single node." ++ raise ValueError("Top of tuple tree does not consist of a single node.") + self.count = 0 + + def __iter__ (self): + return self + +- def next (self): ++ def __next__ (self): + nodes = self.head.type.fields () + # Check for further recursions in the inheritance tree. + if len (nodes) == 0: +@@ -289,7 +333,7 @@ + raise StopIteration + # Check that this iteration has an expected structure. + if len (nodes) != 2: +- raise ValueError, "Cannot parse more than 2 nodes in a tuple tree." ++ raise ValueError("Cannot parse more than 2 nodes in a tuple tree.") + + # - Left node is the next recursion parent. + # - Right node is the actual class contained in the tuple. +@@ -341,7 +385,7 @@ + return self.visualizer.display_hint () + return None + +-class RbtreeIterator: ++class RbtreeIterator(Iterator): + def __init__(self, rbtree): + self.size = rbtree['_M_t']['_M_impl']['_M_node_count'] + self.node = rbtree['_M_t']['_M_impl']['_M_header']['_M_left'] +@@ -353,7 +397,7 @@ + def __len__(self): + return int (self.size) + +- def next(self): ++ def __next__(self): + if self.count == self.size: + raise StopIteration + result = self.node +@@ -405,7 +449,7 @@ + "Print a std::map or std::multimap" + + # Turn an RbtreeIterator into a pretty-print iterator. +- class _iter: ++ class _iter(Iterator): + def __init__(self, rbiter, type): + self.rbiter = rbiter + self.count = 0 +@@ -414,9 +458,9 @@ + def __iter__(self): + return self + +- def next(self): ++ def __next__(self): + if self.count % 2 == 0: +- n = self.rbiter.next() ++ n = next(self.rbiter) + n = n.cast(self.type).dereference()['_M_value_field'] + self.pair = n + item = n['first'] +@@ -447,7 +491,7 @@ + "Print a std::set or std::multiset" + + # Turn an RbtreeIterator into a pretty-print iterator. +- class _iter: ++ class _iter(Iterator): + def __init__(self, rbiter, type): + self.rbiter = rbiter + self.count = 0 +@@ -456,8 +500,8 @@ + def __iter__(self): + return self + +- def next(self): +- item = self.rbiter.next() ++ def __next__(self): ++ item = next(self.rbiter) + item = item.cast(self.type).dereference()['_M_value_field'] + # FIXME: this is weird ... what to do? + # Maybe a 'set' display hint? +@@ -522,7 +566,7 @@ + class StdDequePrinter: + "Print a std::deque" + +- class _iter: ++ class _iter(Iterator): + def __init__(self, node, start, end, last, buffer_size): + self.node = node + self.p = start +@@ -534,7 +578,7 @@ + def __iter__(self): + return self + +- def next(self): ++ def __next__(self): + if self.p == self.last: + raise StopIteration + +@@ -619,7 +663,7 @@ + def display_hint (self): + return 'string' + +-class Tr1HashtableIterator: ++class Tr1HashtableIterator(Iterator): + def __init__ (self, hash): + self.node = hash['_M_bbegin']['_M_node']['_M_nxt'] + self.node_type = find_type(hash.type, '__node_type').pointer() +@@ -627,7 +671,7 @@ + def __iter__ (self): + return self + +- def next (self): ++ def __next__ (self): + if self.node == 0: + raise StopIteration + node = self.node.cast(self.node_type) +@@ -655,8 +699,8 @@ + return '[%d]' % i + + def children (self): +- counter = itertools.imap (self.format_count, itertools.count()) +- return itertools.izip (counter, Tr1HashtableIterator (self.hashtable())) ++ counter = imap (self.format_count, itertools.count()) ++ return izip (counter, Tr1HashtableIterator (self.hashtable())) + + class Tr1UnorderedMapPrinter: + "Print a tr1::unordered_map" +@@ -688,11 +732,11 @@ + return '[%d]' % i + + def children (self): +- counter = itertools.imap (self.format_count, itertools.count()) ++ counter = imap (self.format_count, itertools.count()) + # Map over the hash table and flatten the result. +- data = self.flatten (itertools.imap (self.format_one, Tr1HashtableIterator (self.hashtable()))) ++ data = self.flatten (imap (self.format_one, Tr1HashtableIterator (self.hashtable()))) + # Zip the two iterators together. +- return itertools.izip (counter, data) ++ return izip (counter, data) + + def display_hint (self): + return 'map' +@@ -700,7 +744,7 @@ + class StdForwardListPrinter: + "Print a std::forward_list" + +- class _iterator: ++ class _iterator(Iterator): + def __init__(self, nodetype, head): + self.nodetype = nodetype + self.base = head['_M_next'] +@@ -709,7 +753,7 @@ + def __iter__(self): + return self + +- def next(self): ++ def __next__(self): + if self.base == 0: + raise StopIteration + elt = self.base.cast(self.nodetype).dereference() +@@ -764,7 +808,7 @@ + # A small sanity check. + # FIXME + if not self.compiled_rx.match(name + '<>'): +- raise ValueError, 'libstdc++ programming error: "%s" does not match' % name ++ raise ValueError('libstdc++ programming error: "%s" does not match' % name) + printer = RxPrinter(name, function) + self.subprinters.append(printer) + self.lookup[name] = printer +Index: libstdc++-v3/scripts/run_doxygen +=================================================================== +--- libstdc++-v3/scripts/run_doxygen (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/scripts/run_doxygen (.../branches/gcc-4_8-branch) (revision 217117) +@@ -193,8 +193,15 @@ + if $do_latex; then + cd ${outdir}/${mode} + +- # Also drop in the header file and style sheet +- doxygen -w latex header.tex doxygen.sty ++ # Grrr, Doxygen 1.8.x changed the -w latex options. ++ need_footer=`doxygen -h | sed -n -e '/-w latex/s=.*footer.*=true=p'` ++ ++ # Also drop in the header file (maybe footer file) and style sheet ++ if $need_footer; then ++ doxygen -w latex header.tex footer.tex doxygen.sty ++ else ++ doxygen -w latex header.tex doxygen.sty ++ fi + + echo :: + echo :: LaTeX pages begin with +Index: libstdc++-v3/doc/xml/manual/containers.xml +=================================================================== +--- libstdc++-v3/doc/xml/manual/containers.xml (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/xml/manual/containers.xml (.../branches/gcc-4_8-branch) (revision 217117) +@@ -25,8 +25,9 @@ +
list::size() is O(n) + + +- Yes it is, and that's okay. This is a decision that we preserved +- when we imported SGI's STL implementation. The following is ++ Yes it is, and that was okay until the 2011 edition of the C++ standard. ++ In future GCC will change it to O(1) but O(N) was a decision that we ++ preserved when we imported SGI's STL implementation. The following is + quoted from their FAQ: + +
+@@ -72,26 +73,6 @@ +
+ + +-
vector +- +- +- +- +-
Space Overhead Management +- +- +- In this +- message to the list, Daniel Kostecky announced work on an +- alternate form of std::vector that would support +- hints on the number of elements to be over-allocated. The design +- was also described, along with possible implementation choices. +- +- +- The first two alpha releases were announced here +- and here. +- +- +-
+ + + +Index: libstdc++-v3/doc/xml/manual/status_cxx2011.xml +=================================================================== +--- libstdc++-v3/doc/xml/manual/status_cxx2011.xml (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/xml/manual/status_cxx2011.xml (.../branches/gcc-4_8-branch) (revision 217117) +@@ -226,10 +226,12 @@ + + + ++ + 18.8.6 + nested_exception +- Y +- ++ Partial ++ Follows an earlier C++0x draft, not the final specification. ++ + + + 18.9 +@@ -612,10 +614,11 @@ + + + ++ + 20.6.12.4 + uninitialized_fill_n +- Y +- ++ Partial ++ Returns void. + + + 20.6.13 +@@ -1119,10 +1122,13 @@ + + + ++ + 21.4 + Class template basic_string +- Y +- ++ Partial ++ Non-conforming Copy-On-Write implementation. ++ Missing getline overloads for rvalue streams. ++ + + + 21.5 +@@ -1190,10 +1196,11 @@ + + + ++ + 22.3.3.1 + Character classification +- Y +- ++ Partial ++ Missing isblank. + + + 22.3.3.2 +@@ -1272,16 +1279,18 @@ + + + ++ + 22.4.5.1 + Class template time_get +- Y +- ++ Partial ++ Missing get and do_get + + ++ + 22.4.5.2 + Class template time_get_byname +- Y +- ++ Partial ++ Likewise + + + 22.4.5.3 +@@ -1434,8 +1443,10 @@ + 23.3.5 + Class template list + Partial +- insert and erase members do not +- take const_iterator arguments (N2350). ++ O(N) size. ++ insert and erase members do not ++ take const_iterator arguments (N2350). ++ + + + +@@ -1650,10 +1661,11 @@ + + + ++ + 25.3 + Mutating sequence operations +- Y +- ++ Partial ++ rotate returns void. + + + 25.4 +@@ -2060,10 +2072,13 @@ + + + ++ + 26.8 + C Library +- Y +- ++ Partial ++ <ctgmath> doesn't include ++ <ccomplex> ++ + + + +@@ -2143,6 +2158,7 @@ + Missing move and swap operations on basic_ios. + Missing io_errc and iostream_category. + ios_base::failure is not derived from system_error. ++ Missing ios_base::hexfloat. + + + +Index: libstdc++-v3/doc/html/index.html +=================================================================== +--- libstdc++-v3/doc/html/index.html (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/html/index.html (.../branches/gcc-4_8-branch) (revision 217117) +@@ -43,7 +43,7 @@ +
Locales
locale
Requirements
Design
Implementation
Interacting with "C" locales
Future
Facets
ctype
Implementation
Specializations
Future
codecvt
Requirements
Design
wchar_t Size
Support for Unicode
Other Issues
Implementation
Use
Future
messages
Requirements
Design
Implementation
Models
The GNU Model
Use
Future
9. + Containers + +-
Sequences
list
list::size() is O(n)
vector
Space Overhead Management
Associative
Insertion Hints
bitset
Size Variable
Type String
Unordered Associative
Hash Code
Hash Code Caching Policy
Interacting with C
Containers vs. Arrays
10. ++
Sequences
list
list::size() is O(n)
Associative
Insertion Hints
bitset
Size Variable
Type String
Unordered Associative
Hash Code
Hash Code Caching Policy
Interacting with C
Containers vs. Arrays
10. + Iterators + +
Predefined
Iterators vs. Pointers
One Past the End
11. +@@ -162,4 +162,4 @@ + +
D. + GNU General Public License version 3 +-
E. GNU Free Documentation License
The GNU C++ Library API Reference
Frequently Asked Questions
+\ No newline at end of file ++
E. GNU Free Documentation License
The GNU C++ Library API Reference
Frequently Asked Questions
+Index: libstdc++-v3/doc/html/manual/status.html +=================================================================== +--- libstdc++-v3/doc/html/manual/status.html (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/html/manual/status.html (.../branches/gcc-4_8-branch) (revision 217117) +@@ -165,7 +165,8 @@ + set_new_handler is not thread-safe. + 18.7Type identification  18.7.1Class type_infoY 18.7.2Class bad_castY 18.7.3Class bad_typeidY 18.8Exception handling  18.8.1Class exceptionY 18.8.2Class bad_exceptionY 18.8.3Abnormal terminationPartialMissing get_terminate. + set_terminate is not thread-safe. +- 18.8.4uncaught_exceptionY 18.8.5Exception PropagationY 18.8.6nested_exceptionY 18.9Initializer lists  18.9.1Initializer list constructorsY 18.9.2Initializer list accessY 18.9.3Initializer list range accessY 18.10Other runtime supportY  ++ 18.8.4uncaught_exceptionY 18.8.5Exception PropagationY 18.8.6nested_exceptionPartialFollows an earlier C++0x draft, not the final specification. ++ 18.9Initializer lists  18.9.1Initializer list constructorsY 18.9.2Initializer list accessY 18.9.3Initializer list range accessY 18.10Other runtime supportY  + 19 + + Diagnostics +@@ -173,7 +174,7 @@ + 20 + + General utilities +- 20.1General  20.2Utility components  20.2.1OperatorsY 20.2.2SwapY 20.2.3forward and move helpersY 20.2.4Function template declvalY 20.3Pairs  20.3.1In general  20.3.2Class template pairY 20.3.3Specialized algorithmsY 20.3.4Tuple-like access to pairY 20.3.5Piecewise constructionY 20.4Tuples  20.4.1In general  20.4.2Class template tuple  20.4.2.1ConstructionY 20.4.2.2AssignmentY 20.4.2.3SwapY 20.4.2.4Tuple creation functionsY 20.4.2.5Tuple helper classesY 20.4.2.6Element accessY 20.4.2.7Relational operatorsY 20.4.2.8Tuple traitsY 20.4.2.9Tuple specialized algorithmsY 20.5Class template bitsetY 20.5.1bitset constructorsY 20.5.2bitset membersY 20.5.3bitset hash supportY 20.5.4bitset operatorsY 20.6Memory  20.6.1In general  20.6.2Header <memory> synopsis  20.6.3Pointer traitsY 20.6.4Pointer safetyPartial 20.6.5AlignN 20.6.6Allocator argument tagY 20.6.7uses_allocatorY 20.6.8Allocator traitsY 20.6.9The default allocatorY 20.6.10Raw storage iteratorY 20.6.11Temporary buffersY 20.6.12Specialized algorithms  20.6.12.1addressofY 20.6.12.2uninitialized_copyY 20.6.12.3uninitialized_fillY 20.6.12.4uninitialized_fill_nY 20.6.13C libraryY 20.7Smart pointers  20.7.1Class template unique_ptrY 20.7.2Shared-ownership pointersY 20.7.2.1Class bad_weak_ptrY 20.7.2.2Class template shared_ptrY ++ 20.1General  20.2Utility components  20.2.1OperatorsY 20.2.2SwapY 20.2.3forward and move helpersY 20.2.4Function template declvalY 20.3Pairs  20.3.1In general  20.3.2Class template pairY 20.3.3Specialized algorithmsY 20.3.4Tuple-like access to pairY 20.3.5Piecewise constructionY 20.4Tuples  20.4.1In general  20.4.2Class template tuple  20.4.2.1ConstructionY 20.4.2.2AssignmentY 20.4.2.3SwapY 20.4.2.4Tuple creation functionsY 20.4.2.5Tuple helper classesY 20.4.2.6Element accessY 20.4.2.7Relational operatorsY 20.4.2.8Tuple traitsY 20.4.2.9Tuple specialized algorithmsY 20.5Class template bitsetY 20.5.1bitset constructorsY 20.5.2bitset membersY 20.5.3bitset hash supportY 20.5.4bitset operatorsY 20.6Memory  20.6.1In general  20.6.2Header <memory> synopsis  20.6.3Pointer traitsY 20.6.4Pointer safetyPartial 20.6.5AlignN 20.6.6Allocator argument tagY 20.6.7uses_allocatorY 20.6.8Allocator traitsY 20.6.9The default allocatorY 20.6.10Raw storage iteratorY 20.6.11Temporary buffersY 20.6.12Specialized algorithms  20.6.12.1addressofY 20.6.12.2uninitialized_copyY 20.6.12.3uninitialized_fillY 20.6.12.4uninitialized_fill_nPartialReturns void.20.6.13C libraryY 20.7Smart pointers  20.7.1Class template unique_ptrY 20.7.2Shared-ownership pointersY 20.7.2.1Class bad_weak_ptrY 20.7.2.2Class template shared_ptrY +

+ Uses code from + boost::shared_ptr. +@@ -187,14 +188,16 @@ + 21 + + Strings +- 21.1GeneralY 21.2Character traits  21.2.1Character traits requirementsY 21.2.2traits typedefsY 21.2.3char_traits specializations  21.2.3.1struct char_traits<char>PartialMissing constexpr21.2.3.2struct char_traits<char16_t>PartialMissing constexpr21.2.3.3struct char_traits<char32_t>Y 21.2.3.4struct char_traits<wchar_t>Y 21.3String classesY 21.4Class template basic_stringY 21.5Numeric ConversionsY 21.6Hash supportY 21.7Null-terminated sequence utilitiesPartialC library dependency. ++ 21.1GeneralY 21.2Character traits  21.2.1Character traits requirementsY 21.2.2traits typedefsY 21.2.3char_traits specializations  21.2.3.1struct char_traits<char>PartialMissing constexpr21.2.3.2struct char_traits<char16_t>PartialMissing constexpr21.2.3.3struct char_traits<char32_t>Y 21.2.3.4struct char_traits<wchar_t>Y 21.3String classesY 21.4Class template basic_stringPartialNon-conforming Copy-On-Write implementation. ++ Missing getline overloads for rvalue streams. ++ 21.5Numeric ConversionsY 21.6Hash supportY 21.7Null-terminated sequence utilitiesPartialC library dependency. + Missing <cuchar> + + 22 + + Localization +- 22.1GeneralY 22.2Header <locale> synopsisY 22.3Locales  22.3.1Class localeY 22.3.2locale globalsY 22.3.3Convenience interfaces  22.3.3.1Character classificationY 22.3.3.2Conversions  22.3.3.2.1Character conversionsY 22.3.3.2.2string conversionsN 22.3.3.2.3Buffer conversionsN 22.4Standard locale categories  22.4.1The ctype categoryPartialMissing codecvt<char16_t> and +- codecvt<char32_t>22.4.2The numeric category  22.4.2.1num_getY 22.4.2.2num_putY 22.4.3The numeric punctuation facetY 22.4.4The collate categoryY 22.4.5The time category  22.4.5.1Class template time_getY 22.4.5.2Class template time_get_bynameY 22.4.5.3Class template time_putY 22.4.5.3Class template time_put_bynameY 22.4.6The monetary category  22.4.6.1Class template money_getY 22.4.6.2Class template money_putY 22.4.6.3Class template money_punctY 22.4.6.4Class template money_punct_bynameY 22.4.7The message retrieval categoryY 22.4.8Program-defined facetsY 22.5Standard code conversion facetsN 22.6C Library LocalesY  ++ 22.1GeneralY 22.2Header <locale> synopsisY 22.3Locales  22.3.1Class localeY 22.3.2locale globalsY 22.3.3Convenience interfaces  22.3.3.1Character classificationPartialMissing isblank.22.3.3.2Conversions  22.3.3.2.1Character conversionsY 22.3.3.2.2string conversionsN 22.3.3.2.3Buffer conversionsN 22.4Standard locale categories  22.4.1The ctype categoryPartialMissing codecvt<char16_t> and ++ codecvt<char32_t>22.4.2The numeric category  22.4.2.1num_getY 22.4.2.2num_putY 22.4.3The numeric punctuation facetY 22.4.4The collate categoryY 22.4.5The time category  22.4.5.1Class template time_getPartialMissing get and do_get22.4.5.2Class template time_get_bynamePartialLikewise22.4.5.3Class template time_putY 22.4.5.3Class template time_put_bynameY 22.4.6The monetary category  22.4.6.1Class template money_getY 22.4.6.2Class template money_putY 22.4.6.3Class template money_punctY 22.4.6.4Class template money_punct_bynameY 22.4.7The message retrieval categoryY 22.4.8Program-defined facetsY 22.5Standard code conversion facetsN 22.6C Library LocalesY  + 23 + + Containers +@@ -201,8 +204,10 @@ + 23.1General  23.2Container requirements  23.2.1General container requirementsPartialOnly vector and forward_list + meet the requirements + relating to allocator use and propagation.23.2.2Container data racesY 23.2.3Sequence containersY 23.2.4Associative containersY 23.2.5Unordered associative containersY 23.3Sequence containers  23.3.2Class template arrayY 23.3.3Class template dequePartialinsert and erase members do not +- take const_iterator arguments (N2350).23.3.4Class template forward_listY 23.3.5Class template listPartialinsert and erase members do not +- take const_iterator arguments (N2350).23.3.6Class template vectorPartialinsert and erase members do not ++ take const_iterator arguments (N2350).23.3.4Class template forward_listY 23.3.5Class template listPartialO(N) size. ++ insert and erase members do not ++ take const_iterator arguments (N2350). ++ 23.3.6Class template vectorPartialinsert and erase members do not + take const_iterator arguments (N2350).23.3.7Class vector<bool>Partialinsert and erase members do not + take const_iterator arguments (N2350).23.4Associative containers  23.4.4Class template mapY 23.4.5Class template multimapY 23.4.6Class template setY 23.4.7Class template multisetY 23.5Unordered associative containers  23.5.4Class template unordered_mapY 23.5.5Class template unordered_multimapY 23.5.6Class template unordered_setY 23.5.7Class template unordered_multisetY 23.6Container adaptors  23.6.1Class template queueY 23.6.2Class template priority_queueY 23.6.3Class template stackY  + 24 +@@ -212,11 +217,13 @@ + 25 + + Algorithms +- 25.1General  25.2Non-modifying sequence operationsY 25.3Mutating sequence operationsY 25.4Sorting and related operationsY 25.5C library algorithmsY  ++ 25.1General  25.2Non-modifying sequence operationsY 25.3Mutating sequence operationsPartialrotate returns void.25.4Sorting and related operationsY 25.5C library algorithmsY  + 26 + + Numerics +- 26.1GeneralY 26.2Numeric type requirementsY 26.3The floating-point environmentY 26.4Complex numbersPartialMissing constexpr26.5Random number generation  26.5.1Requirements  26.5.2Header <random> synopsis  26.5.3Random number engine class templates  26.5.3.1Class template linear_congruential_engineYMissing constexpr26.5.3.2Class template mersenne_twister_engineYMissing constexpr26.5.3.3Class template subtract_with_carry_engineYMissing constexpr26.5.4Random number engine adaptor class templates  26.5.4.2Class template discard_block_engineYMissing constexpr26.5.4.3Class template independent_bits_engineYMissing constexpr26.5.4.4Class template shuffle_order_engineYMissing constexpr26.5.5Engines and engine adaptors with predefined parametersY 26.5.6Class random_deviceYMissing constexpr26.5.7Utilities  26.5.7.1Class seed_seqY 26.5.7.2Function template generate_canonicalY 26.5.8Random number distribution class templates  26.5.8.2Uniform distributions  26.5.8.2.1Class template uniform_int_distributionY 26.5.8.2.2Class template uniform_real_distributionY 26.5.8.3Bernoulli distributions  26.5.8.3.1Class bernoulli_distributionY 26.5.8.3.2Class template binomial_distributionY 26.5.8.3.3Class template geometric_distributionY 26.5.8.3.4Class template negative_binomial_distributionY 26.5.8.4Poisson distributions  26.5.8.4.1Class template poisson_distributionY 26.5.8.4.2Class template exponential_distributionY 26.5.8.4.3Class template gamma_distributionY 26.5.8.4.4Class template weibull_distributionY 26.5.8.4.5Class template extreme_value_distributionY 26.5.8.5Normal distributions  26.5.8.5.1Class template normal_distributionY 26.5.8.5.2Class template lognormal_distributionY 26.5.8.5.3Class template chi_squared_distributionY 26.5.8.5.4Class template cauchy_distributionY 26.5.8.5.5Class template fisher_f_distributionY 26.5.8.5.6Class template student_t_distributionY 26.5.8.6Sampling distributions  26.5.8.6.1Class template discrete_distributionY 26.5.8.6.2Class template piecewise_constant_distributionY 26.5.8.6.3Class template piecewise_linear_distributionY 26.6Numeric arrays  26.6.1Header <valarray> synopsisY 26.6.2Class template valarrayY 26.6.3valarray non-member operationsY 26.6.4Class sliceY 26.6.5Class template slice_arrayY 26.6.6The gslice classY 26.6.7Class template gslice_arrayY 26.6.8Class template mask_arrayY 26.6.9Class template indirect_arrayY 26.6.10valarray range accessY 26.7Generalized numeric operations  26.7.1Header <numeric> synopsisY 26.7.2accumulateY 26.7.3inner_productY 26.7.4partial_sumY 26.7.5adjacent_differenceY 26.7.6iotaY 26.8C LibraryY  ++ 26.1GeneralY 26.2Numeric type requirementsY 26.3The floating-point environmentY 26.4Complex numbersPartialMissing constexpr26.5Random number generation  26.5.1Requirements  26.5.2Header <random> synopsis  26.5.3Random number engine class templates  26.5.3.1Class template linear_congruential_engineYMissing constexpr26.5.3.2Class template mersenne_twister_engineYMissing constexpr26.5.3.3Class template subtract_with_carry_engineYMissing constexpr26.5.4Random number engine adaptor class templates  26.5.4.2Class template discard_block_engineYMissing constexpr26.5.4.3Class template independent_bits_engineYMissing constexpr26.5.4.4Class template shuffle_order_engineYMissing constexpr26.5.5Engines and engine adaptors with predefined parametersY 26.5.6Class random_deviceYMissing constexpr26.5.7Utilities  26.5.7.1Class seed_seqY 26.5.7.2Function template generate_canonicalY 26.5.8Random number distribution class templates  26.5.8.2Uniform distributions  26.5.8.2.1Class template uniform_int_distributionY 26.5.8.2.2Class template uniform_real_distributionY 26.5.8.3Bernoulli distributions  26.5.8.3.1Class bernoulli_distributionY 26.5.8.3.2Class template binomial_distributionY 26.5.8.3.3Class template geometric_distributionY 26.5.8.3.4Class template negative_binomial_distributionY 26.5.8.4Poisson distributions  26.5.8.4.1Class template poisson_distributionY 26.5.8.4.2Class template exponential_distributionY 26.5.8.4.3Class template gamma_distributionY 26.5.8.4.4Class template weibull_distributionY 26.5.8.4.5Class template extreme_value_distributionY 26.5.8.5Normal distributions  26.5.8.5.1Class template normal_distributionY 26.5.8.5.2Class template lognormal_distributionY 26.5.8.5.3Class template chi_squared_distributionY 26.5.8.5.4Class template cauchy_distributionY 26.5.8.5.5Class template fisher_f_distributionY 26.5.8.5.6Class template student_t_distributionY 26.5.8.6Sampling distributions  26.5.8.6.1Class template discrete_distributionY 26.5.8.6.2Class template piecewise_constant_distributionY 26.5.8.6.3Class template piecewise_linear_distributionY 26.6Numeric arrays  26.6.1Header <valarray> synopsisY 26.6.2Class template valarrayY 26.6.3valarray non-member operationsY 26.6.4Class sliceY 26.6.5Class template slice_arrayY 26.6.6The gslice classY 26.6.7Class template gslice_arrayY 26.6.8Class template mask_arrayY 26.6.9Class template indirect_arrayY 26.6.10valarray range accessY 26.7Generalized numeric operations  26.7.1Header <numeric> synopsisY 26.7.2accumulateY 26.7.3inner_productY 26.7.4partial_sumY 26.7.5adjacent_differenceY 26.7.6iotaY 26.8C LibraryPartial<ctgmath> doesn't include ++ <ccomplex> ++ + 27 + + Input/output library +@@ -224,6 +231,7 @@ + Missing move and swap operations on basic_ios. + Missing io_errc and iostream_category. + ios_base::failure is not derived from system_error. ++ Missing ios_base::hexfloat. + 27.6Stream buffersY 27.7Formatting and manipulatorsPartial + Missing move and swap operations + Missing get_time and put_time manipulators. +Index: libstdc++-v3/doc/html/manual/abi.html +=================================================================== +--- libstdc++-v3/doc/html/manual/abi.html (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/html/manual/abi.html (.../branches/gcc-4_8-branch) (revision 217117) +@@ -96,7 +96,7 @@ + definitions, where the version definition is the maximum for a + particular release. Labels are cumulative. If a particular release + is not listed, it has the same version labels as the preceding +- release.

This corresponds to the mapfile: gcc/libgcc-std.ver

  • GCC 3.0.0: GCC_3.0

  • GCC 3.3.0: GCC_3.3

  • GCC 3.3.1: GCC_3.3.1

  • GCC 3.3.2: GCC_3.3.2

  • GCC 3.3.4: GCC_3.3.4

  • GCC 3.4.0: GCC_3.4

  • GCC 3.4.2: GCC_3.4.2

  • GCC 3.4.4: GCC_3.4.4

  • GCC 4.0.0: GCC_4.0.0

  • GCC 4.1.0: GCC_4.1.0

  • GCC 4.2.0: GCC_4.2.0

  • GCC 4.3.0: GCC_4.3.0

  • GCC 4.4.0: GCC_4.4.0

  • GCC 4.5.0: GCC_4.5.0

  • GCC 4.6.0: GCC_4.6.0

  • GCC 4.7.0: GCC_4.7.0

  • ++ release.

    This corresponds to the mapfile: gcc/libgcc-std.ver

    • GCC 3.0.0: GCC_3.0

    • GCC 3.3.0: GCC_3.3

    • GCC 3.3.1: GCC_3.3.1

    • GCC 3.3.2: GCC_3.3.2

    • GCC 3.3.4: GCC_3.3.4

    • GCC 3.4.0: GCC_3.4

    • GCC 3.4.2: GCC_3.4.2

    • GCC 3.4.4: GCC_3.4.4

    • GCC 4.0.0: GCC_4.0.0

    • GCC 4.1.0: GCC_4.1.0

    • GCC 4.2.0: GCC_4.2.0

    • GCC 4.3.0: GCC_4.3.0

    • GCC 4.4.0: GCC_4.4.0

    • GCC 4.5.0: GCC_4.5.0

    • GCC 4.6.0: GCC_4.6.0

    • GCC 4.7.0: GCC_4.7.0

    • GCC 4.8.0: GCC_4.8.0

  • + Release versioning on the libstdc++.so binary, implemented in + the same way as the libgcc_s.so binary above. Listed is the + filename: DT_SONAME can be deduced from +@@ -111,7 +111,7 @@ + has the same filename and DT_SONAME as the + preceding release. +

    It is versioned as follows: +-

    • GCC 3.0.0: libstdc++.so.3.0.0

    • GCC 3.0.1: libstdc++.so.3.0.1

    • GCC 3.0.2: libstdc++.so.3.0.2

    • GCC 3.0.3: libstdc++.so.3.0.2 (See Note 1)

    • GCC 3.0.4: libstdc++.so.3.0.4

    • GCC 3.1.0: libstdc++.so.4.0.0 (Incompatible with previous)

    • GCC 3.1.1: libstdc++.so.4.0.1

    • GCC 3.2.0: libstdc++.so.5.0.0 (Incompatible with previous)

    • GCC 3.2.1: libstdc++.so.5.0.1

    • GCC 3.2.2: libstdc++.so.5.0.2

    • GCC 3.2.3: libstdc++.so.5.0.3 (See Note 2)

    • GCC 3.3.0: libstdc++.so.5.0.4

    • GCC 3.3.1: libstdc++.so.5.0.5

    • GCC 3.4.0: libstdc++.so.6.0.0 (Incompatible with previous)

    • GCC 3.4.1: libstdc++.so.6.0.1

    • GCC 3.4.2: libstdc++.so.6.0.2

    • GCC 3.4.3: libstdc++.so.6.0.3

    • GCC 4.0.0: libstdc++.so.6.0.4

    • GCC 4.0.1: libstdc++.so.6.0.5

    • GCC 4.0.2: libstdc++.so.6.0.6

    • GCC 4.0.3: libstdc++.so.6.0.7

    • GCC 4.1.0: libstdc++.so.6.0.7

    • GCC 4.1.1: libstdc++.so.6.0.8

    • GCC 4.2.0: libstdc++.so.6.0.9

    • GCC 4.2.1: libstdc++.so.6.0.9 (See Note 3)

    • GCC 4.2.2: libstdc++.so.6.0.9

    • GCC 4.3.0: libstdc++.so.6.0.10

    • GCC 4.4.0: libstdc++.so.6.0.11

    • GCC 4.4.1: libstdc++.so.6.0.12

    • GCC 4.4.2: libstdc++.so.6.0.13

    • GCC 4.5.0: libstdc++.so.6.0.14

    • GCC 4.6.0: libstdc++.so.6.0.15

    • GCC 4.6.1: libstdc++.so.6.0.16

    • GCC 4.7.0: libstdc++.so.6.0.17

    • GCC 4.8.0: libstdc++.so.6.0.18

    ++

    • GCC 3.0.0: libstdc++.so.3.0.0

    • GCC 3.0.1: libstdc++.so.3.0.1

    • GCC 3.0.2: libstdc++.so.3.0.2

    • GCC 3.0.3: libstdc++.so.3.0.2 (See Note 1)

    • GCC 3.0.4: libstdc++.so.3.0.4

    • GCC 3.1.0: libstdc++.so.4.0.0 (Incompatible with previous)

    • GCC 3.1.1: libstdc++.so.4.0.1

    • GCC 3.2.0: libstdc++.so.5.0.0 (Incompatible with previous)

    • GCC 3.2.1: libstdc++.so.5.0.1

    • GCC 3.2.2: libstdc++.so.5.0.2

    • GCC 3.2.3: libstdc++.so.5.0.3 (See Note 2)

    • GCC 3.3.0: libstdc++.so.5.0.4

    • GCC 3.3.1: libstdc++.so.5.0.5

    • GCC 3.4.0: libstdc++.so.6.0.0 (Incompatible with previous)

    • GCC 3.4.1: libstdc++.so.6.0.1

    • GCC 3.4.2: libstdc++.so.6.0.2

    • GCC 3.4.3: libstdc++.so.6.0.3

    • GCC 4.0.0: libstdc++.so.6.0.4

    • GCC 4.0.1: libstdc++.so.6.0.5

    • GCC 4.0.2: libstdc++.so.6.0.6

    • GCC 4.0.3: libstdc++.so.6.0.7

    • GCC 4.1.0: libstdc++.so.6.0.7

    • GCC 4.1.1: libstdc++.so.6.0.8

    • GCC 4.2.0: libstdc++.so.6.0.9

    • GCC 4.2.1: libstdc++.so.6.0.9 (See Note 3)

    • GCC 4.2.2: libstdc++.so.6.0.9

    • GCC 4.3.0: libstdc++.so.6.0.10

    • GCC 4.4.0: libstdc++.so.6.0.11

    • GCC 4.4.1: libstdc++.so.6.0.12

    • GCC 4.4.2: libstdc++.so.6.0.13

    • GCC 4.5.0: libstdc++.so.6.0.14

    • GCC 4.6.0: libstdc++.so.6.0.15

    • GCC 4.6.1: libstdc++.so.6.0.16

    • GCC 4.7.0: libstdc++.so.6.0.17

    • GCC 4.8.0: libstdc++.so.6.0.18

    • GCC 4.8.3: libstdc++.so.6.0.19

    + Note 1: Error should be libstdc++.so.3.0.3. +

    + Note 2: Not strictly required. +@@ -129,7 +129,7 @@ + GLIBCPP_3.2 for symbols that were introduced in the GCC 3.2.0 + release.) If a particular release is not listed, it has the same + version labels as the preceding release. +-

    • GCC 3.0.0: (Error, not versioned)

    • GCC 3.0.1: (Error, not versioned)

    • GCC 3.0.2: (Error, not versioned)

    • GCC 3.0.3: (Error, not versioned)

    • GCC 3.0.4: (Error, not versioned)

    • GCC 3.1.0: GLIBCPP_3.1, CXXABI_1

    • GCC 3.1.1: GLIBCPP_3.1, CXXABI_1

    • GCC 3.2.0: GLIBCPP_3.2, CXXABI_1.2

    • GCC 3.2.1: GLIBCPP_3.2.1, CXXABI_1.2

    • GCC 3.2.2: GLIBCPP_3.2.2, CXXABI_1.2

    • GCC 3.2.3: GLIBCPP_3.2.2, CXXABI_1.2

    • GCC 3.3.0: GLIBCPP_3.2.2, CXXABI_1.2.1

    • GCC 3.3.1: GLIBCPP_3.2.3, CXXABI_1.2.1

    • GCC 3.3.2: GLIBCPP_3.2.3, CXXABI_1.2.1

    • GCC 3.3.3: GLIBCPP_3.2.3, CXXABI_1.2.1

    • GCC 3.4.0: GLIBCXX_3.4, CXXABI_1.3

    • GCC 3.4.1: GLIBCXX_3.4.1, CXXABI_1.3

    • GCC 3.4.2: GLIBCXX_3.4.2

    • GCC 3.4.3: GLIBCXX_3.4.3

    • GCC 4.0.0: GLIBCXX_3.4.4, CXXABI_1.3.1

    • GCC 4.0.1: GLIBCXX_3.4.5

    • GCC 4.0.2: GLIBCXX_3.4.6

    • GCC 4.0.3: GLIBCXX_3.4.7

    • GCC 4.1.1: GLIBCXX_3.4.8

    • GCC 4.2.0: GLIBCXX_3.4.9

    • GCC 4.3.0: GLIBCXX_3.4.10, CXXABI_1.3.2

    • GCC 4.4.0: GLIBCXX_3.4.11, CXXABI_1.3.3

    • GCC 4.4.1: GLIBCXX_3.4.12, CXXABI_1.3.3

    • GCC 4.4.2: GLIBCXX_3.4.13, CXXABI_1.3.3

    • GCC 4.5.0: GLIBCXX_3.4.14, CXXABI_1.3.4

    • GCC 4.6.0: GLIBCXX_3.4.15, CXXABI_1.3.5

    • GCC 4.6.1: GLIBCXX_3.4.16, CXXABI_1.3.5

    • GCC 4.7.0: GLIBCXX_3.4.17, CXXABI_1.3.6

    • GCC 4.8.0: GLIBCXX_3.4.18, CXXABI_1.3.7

  • Incremental bumping of a compiler pre-defined macro, ++

    • GCC 3.0.0: (Error, not versioned)

    • GCC 3.0.1: (Error, not versioned)

    • GCC 3.0.2: (Error, not versioned)

    • GCC 3.0.3: (Error, not versioned)

    • GCC 3.0.4: (Error, not versioned)

    • GCC 3.1.0: GLIBCPP_3.1, CXXABI_1

    • GCC 3.1.1: GLIBCPP_3.1, CXXABI_1

    • GCC 3.2.0: GLIBCPP_3.2, CXXABI_1.2

    • GCC 3.2.1: GLIBCPP_3.2.1, CXXABI_1.2

    • GCC 3.2.2: GLIBCPP_3.2.2, CXXABI_1.2

    • GCC 3.2.3: GLIBCPP_3.2.2, CXXABI_1.2

    • GCC 3.3.0: GLIBCPP_3.2.2, CXXABI_1.2.1

    • GCC 3.3.1: GLIBCPP_3.2.3, CXXABI_1.2.1

    • GCC 3.3.2: GLIBCPP_3.2.3, CXXABI_1.2.1

    • GCC 3.3.3: GLIBCPP_3.2.3, CXXABI_1.2.1

    • GCC 3.4.0: GLIBCXX_3.4, CXXABI_1.3

    • GCC 3.4.1: GLIBCXX_3.4.1, CXXABI_1.3

    • GCC 3.4.2: GLIBCXX_3.4.2

    • GCC 3.4.3: GLIBCXX_3.4.3

    • GCC 4.0.0: GLIBCXX_3.4.4, CXXABI_1.3.1

    • GCC 4.0.1: GLIBCXX_3.4.5

    • GCC 4.0.2: GLIBCXX_3.4.6

    • GCC 4.0.3: GLIBCXX_3.4.7

    • GCC 4.1.1: GLIBCXX_3.4.8

    • GCC 4.2.0: GLIBCXX_3.4.9

    • GCC 4.3.0: GLIBCXX_3.4.10, CXXABI_1.3.2

    • GCC 4.4.0: GLIBCXX_3.4.11, CXXABI_1.3.3

    • GCC 4.4.1: GLIBCXX_3.4.12, CXXABI_1.3.3

    • GCC 4.4.2: GLIBCXX_3.4.13, CXXABI_1.3.3

    • GCC 4.5.0: GLIBCXX_3.4.14, CXXABI_1.3.4

    • GCC 4.6.0: GLIBCXX_3.4.15, CXXABI_1.3.5

    • GCC 4.6.1: GLIBCXX_3.4.16, CXXABI_1.3.5

    • GCC 4.7.0: GLIBCXX_3.4.17, CXXABI_1.3.6

    • GCC 4.8.0: GLIBCXX_3.4.18, CXXABI_1.3.7

    • GCC 4.8.3: GLIBCXX_3.4.19, CXXABI_1.3.7

  • Incremental bumping of a compiler pre-defined macro, + __GXX_ABI_VERSION. This macro is defined as the version of the + compiler v3 ABI, with g++ 3.0 being version 100. This macro will + be automatically defined whenever g++ is used (the curious can +Index: libstdc++-v3/doc/html/manual/std_contents.html +=================================================================== +--- libstdc++-v3/doc/html/manual/std_contents.html (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/html/manual/std_contents.html (.../branches/gcc-4_8-branch) (revision 217117) +@@ -21,7 +21,7 @@ +

    Locales
    locale
    Requirements
    Design
    Implementation
    Interacting with "C" locales
    Future
    Facets
    ctype
    Implementation
    Specializations
    Future
    codecvt
    Requirements
    Design
    wchar_t Size
    Support for Unicode
    Other Issues
    Implementation
    Use
    Future
    messages
    Requirements
    Design
    Implementation
    Models
    The GNU Model
    Use
    Future
    9. + Containers + +-
    Sequences
    list
    list::size() is O(n)
    vector
    Space Overhead Management
    Associative
    Insertion Hints
    bitset
    Size Variable
    Type String
    Unordered Associative
    Hash Code
    Hash Code Caching Policy
    Interacting with C
    Containers vs. Arrays
    10. ++
    Sequences
    list
    list::size() is O(n)
    Associative
    Insertion Hints
    bitset
    Size Variable
    Type String
    Unordered Associative
    Hash Code
    Hash Code Caching Policy
    Interacting with C
    Containers vs. Arrays
    10. + Iterators + +
    Predefined
    Iterators vs. Pointers
    One Past the End
    11. +@@ -42,4 +42,4 @@ +
    API Reference
    +\ No newline at end of file ++ +Index: libstdc++-v3/doc/html/manual/containers.html +=================================================================== +--- libstdc++-v3/doc/html/manual/containers.html (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/html/manual/containers.html (.../branches/gcc-4_8-branch) (revision 217117) +@@ -7,9 +7,10 @@ +  Next

    Chapter 9.  + Containers + +-

    Sequences

    list

    list::size() is O(n)

    +- Yes it is, and that's okay. This is a decision that we preserved +- when we imported SGI's STL implementation. The following is ++

    Sequences

    list

    list::size() is O(n)

    ++ Yes it is, and that was okay until the 2011 edition of the C++ standard. ++ In future GCC will change it to O(1) but O(N) was a decision that we ++ preserved when we imported SGI's STL implementation. The following is + quoted from their FAQ: +

    + The size() member function, for list and slist, takes time +@@ -41,14 +42,4 @@ +

    + 	 if (L.empty())
    + 	     ...
    +-	 

    vector

    +-

    Space Overhead Management

    +- In this +- message to the list, Daniel Kostecky announced work on an +- alternate form of std::vector that would support +- hints on the number of elements to be over-allocated. The design +- was also described, along with possible implementation choices. +-

    +- The first two alpha releases were announced here +- and here. +-

    +\ No newline at end of file ++ +Index: libstdc++-v3/doc/html/manual/index.html +=================================================================== +--- libstdc++-v3/doc/html/manual/index.html (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/doc/html/manual/index.html (.../branches/gcc-4_8-branch) (revision 217117) +@@ -24,7 +24,7 @@ +
    Locales
    locale
    Requirements
    Design
    Implementation
    Interacting with "C" locales
    Future
    Facets
    ctype
    Implementation
    Specializations
    Future
    codecvt
    Requirements
    Design
    wchar_t Size
    Support for Unicode
    Other Issues
    Implementation
    Use
    Future
    messages
    Requirements
    Design
    Implementation
    Models
    The GNU Model
    Use
    Future
    9. + Containers + +-
    Sequences
    list
    list::size() is O(n)
    vector
    Space Overhead Management
    Associative
    Insertion Hints
    bitset
    Size Variable
    Type String
    Unordered Associative
    Hash Code
    Hash Code Caching Policy
    Interacting with C
    Containers vs. Arrays
    10. ++
    Sequences
    list
    list::size() is O(n)
    Associative
    Insertion Hints
    bitset
    Size Variable
    Type String
    Unordered Associative
    Hash Code
    Hash Code Caching Policy
    Interacting with C
    Containers vs. Arrays
    10. + Iterators + +
    Predefined
    Iterators vs. Pointers
    One Past the End
    11. +@@ -160,4 +160,4 @@ +
    +\ No newline at end of file ++ +Index: libstdc++-v3/include/std/future +=================================================================== +--- libstdc++-v3/include/std/future (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/include/std/future (.../branches/gcc-4_8-branch) (revision 217117) +@@ -351,12 +351,14 @@ + void + _M_set_result(function<_Ptr_type()> __res, bool __ignore_failure = false) + { +- bool __set = __ignore_failure; ++ bool __set = false; + // all calls to this function are serialized, + // side-effects of invoking __res only happen once + call_once(_M_once, &_State_base::_M_do_set, this, ref(__res), + ref(__set)); +- if (!__set) ++ if (__set) ++ _M_cond.notify_all(); ++ else if (!__ignore_failure) + __throw_future_error(int(future_errc::promise_already_satisfied)); + } + +@@ -471,7 +473,6 @@ + lock_guard __lock(_M_mutex); + _M_result.swap(__res); + } +- _M_cond.notify_all(); + __set = true; + } + +@@ -983,22 +984,25 @@ + void + set_value(const _Res& __r) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this, __r); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + + void + set_value(_Res&& __r) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this, std::move(__r)); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + + void + set_exception(exception_ptr __p) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(__p, this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + }; + +@@ -1081,15 +1085,17 @@ + void + set_value(_Res& __r) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this, __r); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + + void + set_exception(exception_ptr __p) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(__p, this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + }; + +@@ -1166,8 +1172,9 @@ + void + set_exception(exception_ptr __p) + { ++ auto __future = _M_future; + auto __setter = _State::__setter(__p, this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + }; + +@@ -1193,8 +1200,9 @@ + inline void + promise::set_value() + { ++ auto __future = _M_future; + auto __setter = _State::__setter(this); +- _M_future->_M_set_result(std::move(__setter)); ++ __future->_M_set_result(std::move(__setter)); + } + + +Index: libstdc++-v3/include/ext/rope +=================================================================== +--- libstdc++-v3/include/ext/rope (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/include/ext/rope (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1544,7 +1544,7 @@ + typedef typename _Base::allocator_type allocator_type; + using _Base::_M_tree_ptr; + using _Base::get_allocator; +- using _Base::_M_get_allocator; ++ using _Base::_M_get_allocator; + typedef __GC_CONST _CharT* _Cstrptr; + + static _CharT _S_empty_c_str[1]; +@@ -1876,8 +1876,9 @@ + const allocator_type& __a = allocator_type()) + : _Base(__a) + { +- this->_M_tree_ptr = (0 == __len) ? +- 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a); ++ this->_M_tree_ptr = (0 == __len) ++ ? 0 ++ : _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator()); + } + + rope(const rope& __x, const allocator_type& __a = allocator_type()) +Index: libstdc++-v3/include/bits/stl_tree.h +=================================================================== +--- libstdc++-v3/include/bits/stl_tree.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/include/bits/stl_tree.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -510,11 +510,11 @@ + + _Link_type + _M_end() +- { return static_cast<_Link_type>(&this->_M_impl._M_header); } ++ { return reinterpret_cast<_Link_type>(&this->_M_impl._M_header); } + + _Const_Link_type + _M_end() const +- { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); } ++ { return reinterpret_cast<_Const_Link_type>(&this->_M_impl._M_header); } + + static const_reference + _S_value(_Const_Link_type __x) +Index: libstdc++-v3/include/tr2/bool_set +=================================================================== +--- libstdc++-v3/include/tr2/bool_set (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/include/tr2/bool_set (.../branches/gcc-4_8-branch) (revision 217117) +@@ -44,7 +44,7 @@ + * bool_set + * + * See N2136, Bool_set: multi-valued logic +- * by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion. ++ * by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion. + * + * The implicit conversion to bool is slippery! I may use the new + * explicit conversion. This has been specialized in the language +Index: libstdc++-v3/ChangeLog +=================================================================== +--- libstdc++-v3/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,96 @@ ++2014-10-15 Jason Merrill ++ ++ * libsupc++/dyncast.cc (__dynamic_cast): Handle mid-destruction ++ dynamic_cast more gracefully. ++ ++2014-10-14 Kai Tietz ++ ++ PR libstdc++/57440 ++ * config/os/mingw32/os_defines.h (_GTHREAD_USE_MUTEX_INIT_FUNC): ++ Define to avoid leak. ++ * config/os/mingw32-w64/os_defines.h: Likewise. ++ ++2014-10-03 Jonathan Wakely ++ ++ PR libstdc++/63449 ++ * doc/xml/manual/containers.xml: Remove outdated section. Update ++ std::list notes. ++ * doc/html/*: Regenerate. ++ ++2014-10-01 Jonathan Wakely ++ ++ * doc/xml/manual/status_cxx2011.xml: Corrections. ++ * doc/html/manual/status.html: Regenerate. ++ ++2014-08-28 Samuel Bronson ++ ++ Backport r212453 from trunk ++ 2014-07-11 Samuel Bronson ++ Matthias Klose ++ ++ PR libstdc++/58962 ++ * python/libstdcxx/v6/printers.py: Port to Python 2+3 ++ (imap): New compat function. ++ (izip): Likewise. ++ (Iterator): New mixin to allow writing iterators in Python 3 style ++ regardless of which version we're running on. ++ [Python3] (long) New compat alias for "int". ++ * testsuite/lib/gdb-test.exp: Port to Python 2+3 (print syntax) ++ ++ Backport r210625 from trunk ++ 2014-05-19 Jonathan Wakely ++ ++ * python/libstdcxx/v6/printers.py: Use Python3 raise syntax. ++ ++2014-08-26 John David Anglin ++ ++ * config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update. ++ ++2014-08-26 Jonathan Wakely ++ ++ * doc/xml/manual/status_cxx2011.xml: Correct status table. ++ * doc/html/manual/*: Regenerate. ++ ++2014-08-04 Jonathan Wakely ++ ++ Backported from mainline ++ 2014-07-29 Jonathan Wakely ++ ++ PR libstdc++/61946 ++ * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool, ++ const allocator_type&)): Pass non-const allocator to ++ _S_new_RopeFunction. ++ * testsuite/ext/rope/61946.cc: New. ++ ++2014-08-04 Zifei Tong ++ ++ * libsupc++/atexit_thread.cc (HAVE___CXA_THREAD_ATEXIT_IMPL): Add ++ _GLIBCXX_ prefix to macro. ++ ++2014-06-03 Jonathan Wakely ++ ++ Backport from mainline ++ 2014-04-15 Jonathan Wakely ++ ++ PR libstdc++/60734 ++ * include/bits/stl_tree.h (_Rb_tree::_M_end): Fix invalid cast. ++ ++ Backport from mainline ++ 2014-05-16 Jonathan Wakely ++ ++ PR libstdc++/60966 ++ * include/std/future (__future_base::_State_baseV2::_M_set_result): ++ Signal condition variable after call_once returns. ++ (__future_base::_State_baseV2::_M_do_set): Do not signal here. ++ (promise::set_value, promise::set_exception): Increment the reference ++ count on the shared state until the function returns. ++ * testsuite/30_threads/promise/60966.cc: New. ++ ++2014-05-29 Jonathan Wakely ++ ++ * include/tr2/bool_set: Use UTF-8 for accented characters. ++ * scripts/run_doxygen: Handle Doxygen 1.8.x change. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libstdc++-v3/libsupc++/atexit_thread.cc +=================================================================== +--- libstdc++-v3/libsupc++/atexit_thread.cc (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/libsupc++/atexit_thread.cc (.../branches/gcc-4_8-branch) (revision 217117) +@@ -26,7 +26,7 @@ + #include + #include "bits/gthr.h" + +-#if HAVE___CXA_THREAD_ATEXIT_IMPL ++#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL + + extern "C" int __cxa_thread_atexit_impl (void (*func) (void *), + void *arg, void *d); +@@ -38,7 +38,7 @@ + return __cxa_thread_atexit_impl (dtor, obj, dso_handle); + } + +-#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */ ++#else /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ + + namespace { + // One element in a singly-linked stack of cleanups. +@@ -142,4 +142,4 @@ + return 0; + } + +-#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */ ++#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ +Index: libstdc++-v3/libsupc++/dyncast.cc +=================================================================== +--- libstdc++-v3/libsupc++/dyncast.cc (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/libsupc++/dyncast.cc (.../branches/gcc-4_8-branch) (revision 217117) +@@ -55,6 +55,18 @@ + adjust_pointer (src_ptr, prefix->whole_object); + const __class_type_info *whole_type = prefix->whole_type; + __class_type_info::__dyncast_result result; ++ ++ // If the whole object vptr doesn't refer to the whole object type, we're ++ // in the middle of constructing a primary base, and src is a separate ++ // base. This has undefined behavior and we can't find anything outside ++ // of the base we're actually constructing, so fail now rather than ++ // segfault later trying to use a vbase offset that doesn't exist. ++ const void *whole_vtable = *static_cast (whole_ptr); ++ const vtable_prefix *whole_prefix = ++ adjust_pointer (whole_vtable, ++ -offsetof (vtable_prefix, origin)); ++ if (whole_prefix->whole_type != whole_type) ++ return NULL; + + whole_type->__do_dyncast (src2dst, __class_type_info::__contained_public, + dst_type, whole_ptr, src_type, src_ptr, result); +Index: libstdc++-v3/testsuite/30_threads/promise/60966.cc +=================================================================== +--- libstdc++-v3/testsuite/30_threads/promise/60966.cc (.../tags/gcc_4_8_3_release) (revision 0) ++++ libstdc++-v3/testsuite/30_threads/promise/60966.cc (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,67 @@ ++// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } ++// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } ++// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } ++// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } ++// { dg-require-cstdint "" } ++// { dg-require-gthreads "" } ++// { dg-require-atomic-builtins "" } ++ ++// Copyright (C) 2014 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 3, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING3. If not see ++// . ++ ++// libstdc++/60966 ++// This test hangs if std::promise::~promise() destroys the ++// shared state before std::promise::set_value() finishes using it. ++ ++#include ++#include ++#include ++ ++const int THREADS = 10; ++ ++void run_task(std::promise* pr) ++{ ++ std::this_thread::sleep_for(std::chrono::milliseconds(100)); ++ pr->set_value(); ++} ++ ++int main() ++{ ++ std::vector*> tasks(THREADS); ++ std::vector threads(THREADS); ++ std::vector> futures(THREADS); ++ ++ for (int i = 0; i < THREADS; ++i) ++ { ++ std::promise* task = new std::promise; ++ tasks[i] = task; ++ futures[i] = task->get_future(); ++ threads[i] = std::thread(run_task, task); ++ } ++ ++ for (int i = 0; i < THREADS; ++i) ++ { ++ // the temporary future releases the state as soon as wait() returns ++ std::future(std::move(futures[i])).wait(); ++ // state is ready, should now be safe to delete promise, so it ++ // releases the shared state too ++ delete tasks[i]; ++ } ++ ++ for (auto& t : threads) ++ t.join(); ++} +Index: libstdc++-v3/testsuite/ext/rope/61946.cc +=================================================================== +--- libstdc++-v3/testsuite/ext/rope/61946.cc (.../tags/gcc_4_8_3_release) (revision 0) ++++ libstdc++-v3/testsuite/ext/rope/61946.cc (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,31 @@ ++// Copyright (C) 2014 Free Software Foundation, Inc. ++// ++// This file is part of the GNU ISO C++ Library. This library is free ++// software; you can redistribute it and/or modify it under the ++// terms of the GNU General Public License as published by the ++// Free Software Foundation; either version 3, or (at your option) ++// any later version. ++ ++// This library is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++ ++// You should have received a copy of the GNU General Public License along ++// with this library; see the file COPYING3. If not see ++// . ++ ++// { dg-do compile } ++ ++#include ++ ++struct empty_char_prod : __gnu_cxx::char_producer ++{ ++ virtual void operator()(size_t, size_t, char*) {} ++}; ++ ++int main () ++{ ++ empty_char_prod* ecp = new empty_char_prod; ++ __gnu_cxx::crope excrope( ecp, 10L, true ); ++} +Index: libstdc++-v3/testsuite/lib/gdb-test.exp +=================================================================== +--- libstdc++-v3/testsuite/lib/gdb-test.exp (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/testsuite/lib/gdb-test.exp (.../branches/gcc-4_8-branch) (revision 217117) +@@ -91,7 +91,7 @@ + } + } + +- set do_whatis_tests [gdb_batch_check "python print gdb.type_printers" \ ++ set do_whatis_tests [gdb_batch_check "python print(gdb.type_printers)" \ + "\\\[\\\]"] + if {!$do_whatis_tests} { + send_log "skipping 'whatis' tests - gdb too old" +@@ -252,6 +252,6 @@ + # but not earlier versions. + # Return 1 if the version is ok, 0 otherwise. + proc gdb_version_check {} { +- return [gdb_batch_check "python print gdb.lookup_global_symbol" \ ++ return [gdb_batch_check "python print(gdb.lookup_global_symbol)" \ + ""] + } +Index: libstdc++-v3/config/os/mingw32-w64/os_defines.h +=================================================================== +--- libstdc++-v3/config/os/mingw32-w64/os_defines.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/config/os/mingw32-w64/os_defines.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -78,4 +78,7 @@ + #define _GLIBCXX_LLP64 1 + #endif + ++// See libstdc++/59807 ++#define _GTHREAD_USE_MUTEX_INIT_FUNC 1 ++ + #endif +Index: libstdc++-v3/config/os/mingw32/os_defines.h +=================================================================== +--- libstdc++-v3/config/os/mingw32/os_defines.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/config/os/mingw32/os_defines.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -75,4 +75,7 @@ + #define _GLIBCXX_LLP64 1 + #endif + ++// See libstdc++/59807 ++#define _GTHREAD_USE_MUTEX_INIT_FUNC 1 ++ + #endif +Index: libstdc++-v3/config/abi/post/hppa-linux-gnu/baseline_symbols.txt +=================================================================== +--- libstdc++-v3/config/abi/post/hppa-linux-gnu/baseline_symbols.txt (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libstdc++-v3/config/abi/post/hppa-linux-gnu/baseline_symbols.txt (.../branches/gcc-4_8-branch) (revision 217117) +@@ -400,6 +400,7 @@ + FUNC:_ZNKSt15basic_streambufIwSt11char_traitsIwEE6getlocEv@@GLIBCXX_3.4 + FUNC:_ZNKSt15basic_stringbufIcSt11char_traitsIcESaIcEE3strEv@@GLIBCXX_3.4 + FUNC:_ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv@@GLIBCXX_3.4 ++FUNC:_ZNKSt17bad_function_call4whatEv@@GLIBCXX_3.4.18 + FUNC:_ZNKSt18basic_stringstreamIcSt11char_traitsIcESaIcEE3strEv@@GLIBCXX_3.4 + FUNC:_ZNKSt18basic_stringstreamIcSt11char_traitsIcESaIcEE5rdbufEv@@GLIBCXX_3.4 + FUNC:_ZNKSt18basic_stringstreamIwSt11char_traitsIwESaIwEE3strEv@@GLIBCXX_3.4 +@@ -587,6 +588,8 @@ + FUNC:_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewm@@GLIBCXX_3.4 + FUNC:_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewx@@GLIBCXX_3.4 + FUNC:_ZNKSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE6do_putES3_RSt8ios_basewy@@GLIBCXX_3.4 ++FUNC:_ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEj@@GLIBCXX_3.4.18 ++FUNC:_ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEjjj@@GLIBCXX_3.4.18 + FUNC:_ZNKSt8bad_cast4whatEv@@GLIBCXX_3.4.9 + FUNC:_ZNKSt8ios_base7failure4whatEv@@GLIBCXX_3.4 + FUNC:_ZNKSt8messagesIcE18_M_convert_to_charERKSs@@GLIBCXX_3.4 +@@ -1204,6 +1207,7 @@ + FUNC:_ZNSt11regex_errorD0Ev@@GLIBCXX_3.4.15 + FUNC:_ZNSt11regex_errorD1Ev@@GLIBCXX_3.4.15 + FUNC:_ZNSt11regex_errorD2Ev@@GLIBCXX_3.4.15 ++FUNC:_ZNSt11this_thread11__sleep_forENSt6chrono8durationIxSt5ratioILx1ELx1EEEENS1_IxS2_ILx1ELx1000000000EEEE@@GLIBCXX_3.4.18 + FUNC:_ZNSt12__basic_fileIcE2fdEv@@GLIBCXX_3.4 + FUNC:_ZNSt12__basic_fileIcE4fileEv@@GLIBCXX_3.4.1 + FUNC:_ZNSt12__basic_fileIcE4openEPKcSt13_Ios_Openmodei@@GLIBCXX_3.4 +@@ -1471,6 +1475,11 @@ + FUNC:_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEt@@GLIBCXX_3.4 + FUNC:_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEx@@GLIBCXX_3.4 + FUNC:_ZNSt13basic_ostreamIwSt11char_traitsIwEElsEy@@GLIBCXX_3.4 ++FUNC:_ZNSt13random_device14_M_init_pretr1ERKSs@@GLIBCXX_3.4.18 ++FUNC:_ZNSt13random_device16_M_getval_pretr1Ev@@GLIBCXX_3.4.18 ++FUNC:_ZNSt13random_device7_M_finiEv@@GLIBCXX_3.4.18 ++FUNC:_ZNSt13random_device7_M_initERKSs@@GLIBCXX_3.4.18 ++FUNC:_ZNSt13random_device9_M_getvalEv@@GLIBCXX_3.4.18 + FUNC:_ZNSt13runtime_errorC1ERKSs@@GLIBCXX_3.4 + FUNC:_ZNSt13runtime_errorC2ERKSs@@GLIBCXX_3.4 + FUNC:_ZNSt13runtime_errorD0Ev@@GLIBCXX_3.4 +@@ -1900,6 +1909,8 @@ + FUNC:_ZNSt6__norm15_List_node_base8transferEPS0_S1_@@GLIBCXX_3.4.9 + FUNC:_ZNSt6__norm15_List_node_base9_M_unhookEv@@GLIBCXX_3.4.14 + FUNC:_ZNSt6chrono12system_clock3nowEv@@GLIBCXX_3.4.11 ++FUNC:_ZNSt6chrono3_V212steady_clock3nowEv@@GLIBCXX_3.4.19 ++FUNC:_ZNSt6chrono3_V212system_clock3nowEv@@GLIBCXX_3.4.19 + FUNC:_ZNSt6gslice8_IndexerC1EjRKSt8valarrayIjES4_@@GLIBCXX_3.4 + FUNC:_ZNSt6gslice8_IndexerC2EjRKSt8valarrayIjES4_@@GLIBCXX_3.4 + FUNC:_ZNSt6locale11_M_coalesceERKS_S1_i@@GLIBCXX_3.4 +@@ -2436,6 +2447,7 @@ + FUNC:__cxa_guard_release@@CXXABI_1.3 + FUNC:__cxa_pure_virtual@@CXXABI_1.3 + FUNC:__cxa_rethrow@@CXXABI_1.3 ++FUNC:__cxa_thread_atexit@@CXXABI_1.3.7 + FUNC:__cxa_throw@@CXXABI_1.3 + FUNC:__cxa_tm_cleanup@@CXXABI_TM_1 + FUNC:__cxa_vec_cctor@@CXXABI_1.3 +@@ -2482,6 +2494,7 @@ + OBJECT:0:CXXABI_1.3.4 + OBJECT:0:CXXABI_1.3.5 + OBJECT:0:CXXABI_1.3.6 ++OBJECT:0:CXXABI_1.3.7 + OBJECT:0:CXXABI_TM_1 + OBJECT:0:GLIBCXX_3.4 + OBJECT:0:GLIBCXX_3.4.1 +@@ -2493,6 +2506,8 @@ + OBJECT:0:GLIBCXX_3.4.15 + OBJECT:0:GLIBCXX_3.4.16 + OBJECT:0:GLIBCXX_3.4.17 ++OBJECT:0:GLIBCXX_3.4.18 ++OBJECT:0:GLIBCXX_3.4.19 + OBJECT:0:GLIBCXX_3.4.2 + OBJECT:0:GLIBCXX_3.4.3 + OBJECT:0:GLIBCXX_3.4.4 +@@ -2992,6 +3007,8 @@ + OBJECT:1:_ZNSt21__numeric_limits_base9is_moduloE@@GLIBCXX_3.4 + OBJECT:1:_ZNSt21__numeric_limits_base9is_signedE@@GLIBCXX_3.4 + OBJECT:1:_ZNSt6chrono12system_clock12is_monotonicE@@GLIBCXX_3.4.11 ++OBJECT:1:_ZNSt6chrono3_V212steady_clock9is_steadyE@@GLIBCXX_3.4.19 ++OBJECT:1:_ZNSt6chrono3_V212system_clock9is_steadyE@@GLIBCXX_3.4.19 + OBJECT:1:_ZSt10adopt_lock@@GLIBCXX_3.4.11 + OBJECT:1:_ZSt10defer_lock@@GLIBCXX_3.4.11 + OBJECT:1:_ZSt11try_to_lock@@GLIBCXX_3.4.11 +Index: configure.ac +=================================================================== +--- configure.ac (.../tags/gcc_4_8_3_release) (revision 217117) ++++ configure.ac (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1154,6 +1154,9 @@ + *-mingw*) + host_makefile_frag="config/mh-mingw" + ;; ++ alpha*-*-linux*) ++ host_makefile_frag="config/mh-alpha-linux" ++ ;; + hppa*-hp-hpux10*) + host_makefile_frag="config/mh-pa-hpux10" + ;; +Index: ChangeLog +=================================================================== +--- ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,9 @@ ++2014-07-26 Uros Bizjak ++ ++ PR target/47230 ++ * configure.ac (alpha*-*-linux*): Use mh-alpha-linux. ++ * configure: Regenerate. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: contrib/ChangeLog +=================================================================== +--- contrib/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ contrib/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,7 @@ ++2014-07-07 Richard Biener ++ ++ * gennews: Use gcc-3.0/index.html. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: contrib/gennews +=================================================================== +--- contrib/gennews (.../tags/gcc_4_8_3_release) (revision 217117) ++++ contrib/gennews (.../branches/gcc-4_8-branch) (revision 217117) +@@ -37,7 +37,7 @@ + gcc-3.3/index.html gcc-3.3/changes.html + gcc-3.2/index.html gcc-3.2/changes.html + gcc-3.1/index.html gcc-3.1/changes.html +- gcc-3.0/gcc-3.0.html gcc-3.0/features.html gcc-3.0/caveats.html ++ gcc-3.0/index.html gcc-3.0/features.html gcc-3.0/caveats.html + gcc-2.95/index.html gcc-2.95/features.html gcc-2.95/caveats.html + egcs-1.1/index.html egcs-1.1/features.html egcs-1.1/caveats.html + egcs-1.0/index.html egcs-1.0/features.html egcs-1.0/caveats.html" +Index: config/mh-alpha-linux +=================================================================== +--- config/mh-alpha-linux (.../tags/gcc_4_8_3_release) (revision 0) ++++ config/mh-alpha-linux (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,3 @@ ++# Prevent GPREL16 relocation truncation ++LDFLAGS += -Wl,--no-relax ++BOOT_LDFLAGS += -Wl,--no-relax +Index: config/ChangeLog +=================================================================== +--- config/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ config/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,8 @@ ++2014-07-26 Uros Bizjak ++ ++ PR target/47230 ++ * mh-alpha-linux: New file. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libjava/classpath +=================================================================== +--- libjava/classpath (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libjava/classpath (.../branches/gcc-4_8-branch) (revision 217117) + +Property changes on: libjava/classpath +___________________________________________________________________ +Modified: svn:mergeinfo + Merged /trunk/libjava/classpath:r211733,215049 +Index: configure +=================================================================== +--- configure (.../tags/gcc_4_8_3_release) (revision 217117) ++++ configure (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3834,6 +3834,9 @@ + *-mingw*) + host_makefile_frag="config/mh-mingw" + ;; ++ alpha*-*-linux*) ++ host_makefile_frag="config/mh-alpha-linux" ++ ;; + hppa*-hp-hpux10*) + host_makefile_frag="config/mh-pa-hpux10" + ;; +Index: libgcc/ChangeLog +=================================================================== +--- libgcc/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgcc/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,14 @@ ++2014-10-26 John David Anglin ++ ++ * config/pa/linux-unwind.h (pa32_read_access_ok): New function. ++ (pa32_fallback_frame_state): Use pa32_read_access_ok to check if ++ memory read accesses are ok. ++ ++2014-09-18 Joseph Myers ++ ++ * config/i386/sfp-machine.h (FP_TRAPPING_EXCEPTIONS): Treat clear ++ bits not set bits as indicating trapping exceptions. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libgcc/config/i386/sfp-machine.h +=================================================================== +--- libgcc/config/i386/sfp-machine.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgcc/config/i386/sfp-machine.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -59,7 +59,7 @@ + __sfp_handle_exceptions (_fex); \ + } while (0); + +-#define FP_TRAPPING_EXCEPTIONS ((_fcw >> FP_EX_SHIFT) & FP_EX_ALL) ++#define FP_TRAPPING_EXCEPTIONS ((~_fcw >> FP_EX_SHIFT) & FP_EX_ALL) + + #define FP_ROUNDMODE (_fcw & FP_RND_MASK) + #endif +Index: libgcc/config/pa/linux-unwind.h +=================================================================== +--- libgcc/config/pa/linux-unwind.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgcc/config/pa/linux-unwind.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -32,6 +32,17 @@ + #include + #include + ++/* Return TRUE if read access to *P is allowed. */ ++ ++static inline long ++pa32_read_access_ok (void *p) ++{ ++ long ret; ++ ++ __asm__ ("proberi (%1),3,%0" : "=r" (ret) : "r" (p) :); ++ return ret; ++} ++ + /* Unfortunately, because of various bugs and changes to the kernel, + we have several cases to deal with. + +@@ -48,8 +59,13 @@ + tell us how to locate the sigcontext structure. + + Note that with a 2.4 64-bit kernel, the signal context is not properly +- passed back to userspace so the unwind will not work correctly. */ ++ passed back to userspace so the unwind will not work correctly. + ++ There is also a bug in various glibc versions. The (CONTEXT)->ra ++ for the outermost frame is not marked as undefined, so we need to ++ check whether read access is allowed for all the accesses used in ++ searching for the signal trampoline. */ ++ + #define MD_FALLBACK_FRAME_STATE_FOR pa32_fallback_frame_state + + static _Unwind_Reason_Code +@@ -73,14 +89,17 @@ + e4008200 be,l 0x100(%sr2, %r0), %sr0, %r31 + 08000240 nop */ + +- if (pc[0] == 0x34190000 || pc[0] == 0x34190002) ++ if (pa32_read_access_ok (pc) ++ && (pc[0] == 0x34190000 || pc[0] == 0x34190002)) + off = 4*4; +- else if (pc[4] == 0x34190000 || pc[4] == 0x34190002) ++ else if (pa32_read_access_ok (&pc[4]) ++ && (pc[4] == 0x34190000 || pc[4] == 0x34190002)) + { + pc += 4; + off = 10 * 4; + } +- else if (pc[5] == 0x34190000 || pc[5] == 0x34190002) ++ else if (pa32_read_access_ok (&pc[5]) ++ && (pc[5] == 0x34190000 || pc[5] == 0x34190002)) + { + pc += 5; + off = 10 * 4; +@@ -96,13 +115,16 @@ + word boundary and we can then determine the frame offset. */ + sp = (unsigned long)context->ra; + pc = (unsigned int *)sp; +- if ((pc[0] == 0x34190000 || pc[0] == 0x34190002) && (sp & 4)) ++ if ((sp & 4) ++ && pa32_read_access_ok (pc) ++ && (pc[0] == 0x34190000 || pc[0] == 0x34190002)) + off = 5 * 4; + else + return _URC_END_OF_STACK; + } + +- if (pc[1] != 0x3414015a ++ if (!pa32_read_access_ok (&pc[3]) ++ || pc[1] != 0x3414015a + || pc[2] != 0xe4008200 + || pc[3] != 0x08000240) + return _URC_END_OF_STACK; +Index: gcc/doc/sourcebuild.texi +=================================================================== +--- gcc/doc/sourcebuild.texi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/doc/sourcebuild.texi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1299,6 +1299,9 @@ + @item double64plus + Target has @code{double} that is 64 bits or longer. + ++@item longdouble128 ++Target has 128-bit @code{long double}. ++ + @item int32plus + Target has @code{int} that is at 32 bits or longer. + +Index: gcc/doc/extend.texi +=================================================================== +--- gcc/doc/extend.texi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/doc/extend.texi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -375,6 +375,8 @@ + This is more friendly to code living in shared libraries, as it reduces + the number of dynamic relocations that are needed, and by consequence, + allows the data to be read-only. ++This alternative with label differences is not supported for the AVR target, ++please use the first approach for AVR programs. + + The @code{&&foo} expressions for the same label might have different + values if the containing function is inlined or cloned. If a program +@@ -10490,7 +10492,7 @@ + name. + + @smallexample +-v32qi __builtin_ia32_mpsadbw256 (v32qi,v32qi,v32qi,int) ++v32qi __builtin_ia32_mpsadbw256 (v32qi,v32qi,int) + v32qi __builtin_ia32_pabsb256 (v32qi) + v16hi __builtin_ia32_pabsw256 (v16hi) + v8si __builtin_ia32_pabsd256 (v8si) +@@ -10725,8 +10727,8 @@ + @smallexample + v2df __builtin_ia32_vfrczpd (v2df) + v4sf __builtin_ia32_vfrczps (v4sf) +-v2df __builtin_ia32_vfrczsd (v2df, v2df) +-v4sf __builtin_ia32_vfrczss (v4sf, v4sf) ++v2df __builtin_ia32_vfrczsd (v2df) ++v4sf __builtin_ia32_vfrczss (v4sf) + v4df __builtin_ia32_vfrczpd256 (v4df) + v8sf __builtin_ia32_vfrczps256 (v8sf) + v2di __builtin_ia32_vpcmov (v2di, v2di, v2di) +@@ -11855,8 +11857,6 @@ + uint64_t __builtin_ppc_get_timebase (); + unsigned long __builtin_ppc_mftb (); + double __builtin_unpack_longdouble (long double, int); +-double __builtin_longdouble_dw0 (long double); +-double __builtin_longdouble_dw1 (long double); + long double __builtin_pack_longdouble (double, double); + @end smallexample + +Index: gcc/doc/tm.texi +=================================================================== +--- gcc/doc/tm.texi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/doc/tm.texi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3930,6 +3930,13 @@ + @c above is overfull. not sure what to do. --mew 5feb93 did + @c something, not sure if it looks good. --mew 10feb93 + ++@defmac INCOMING_REG_PARM_STACK_SPACE (@var{fndecl}) ++Like @code{REG_PARM_STACK_SPACE}, but for incoming register arguments. ++Define this macro if space guaranteed when compiling a function body ++is different to space required when making a call, a situation that ++can arise with K&R style function definitions. ++@end defmac ++ + @defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype}) + Define this to a nonzero value if it is the responsibility of the + caller to allocate the area reserved for arguments passed in registers +Index: gcc/doc/tm.texi.in +=================================================================== +--- gcc/doc/tm.texi.in (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/doc/tm.texi.in (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3898,6 +3898,13 @@ + @c above is overfull. not sure what to do. --mew 5feb93 did + @c something, not sure if it looks good. --mew 10feb93 + ++@defmac INCOMING_REG_PARM_STACK_SPACE (@var{fndecl}) ++Like @code{REG_PARM_STACK_SPACE}, but for incoming register arguments. ++Define this macro if space guaranteed when compiling a function body ++is different to space required when making a call, a situation that ++can arise with K&R style function definitions. ++@end defmac ++ + @defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype}) + Define this to a nonzero value if it is the responsibility of the + caller to allocate the area reserved for arguments passed in registers +Index: gcc/doc/invoke.texi +=================================================================== +--- gcc/doc/invoke.texi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/doc/invoke.texi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -475,6 +475,7 @@ + -mstrict-align @gol + -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol + -mtls-dialect=desc -mtls-dialect=traditional @gol ++-mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol + -march=@var{name} -mcpu=@var{name} -mtune=@var{name}} + + @emph{Adapteva Epiphany Options} +@@ -1009,6 +1010,7 @@ + -ffixed-@var{reg} -fexceptions @gol + -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol + -fasynchronous-unwind-tables @gol ++-fno-gnu-unique @gol + -finhibit-size-directive -finstrument-functions @gol + -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol + -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol +@@ -10933,6 +10935,14 @@ + Use traditional TLS as the thread-local storage mechanism for dynamic accesses + of TLS variables. + ++@item -mfix-cortex-a53-835769 ++@itemx -mno-fix-cortex-a53-835769 ++@opindex -mfix-cortex-a53-835769 ++@opindex -mno-fix-cortex-a53-835769 ++Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769. ++This will involve inserting a NOP instruction between memory instructions and ++64-bit integer multiply-accumulate instructions. ++ + @item -march=@var{name} + @opindex march + Specify the name of the target architecture, optionally suffixed by one or +@@ -11271,8 +11281,8 @@ + + @option{-march=native} causes the compiler to auto-detect the architecture + of the build computer. At present, this feature is only supported on +-Linux, and not all architectures are recognized. If the auto-detect is +-unsuccessful the option has no effect. ++GNU/Linux, and not all architectures are recognized. If the auto-detect ++is unsuccessful the option has no effect. + + @item -mtune=@var{name} + @opindex mtune +@@ -11317,7 +11327,7 @@ + + @option{-mtune=native} causes the compiler to auto-detect the CPU + of the build computer. At present, this feature is only supported on +-Linux, and not all architectures are recognized. If the auto-detect is ++GNU/Linux, and not all architectures are recognized. If the auto-detect is + unsuccessful the option has no effect. + + @item -mcpu=@var{name} +@@ -11338,8 +11348,8 @@ + + @option{-mcpu=native} causes the compiler to auto-detect the CPU + of the build computer. At present, this feature is only supported on +-Linux, and not all architectures are recognized. If the auto-detect is +-unsuccessful the option has no effect. ++GNU/Linux, and not all architectures are recognized. If the auto-detect ++is unsuccessful the option has no effect. + + @item -mfpu=@var{name} + @opindex mfpu +@@ -12479,7 +12489,7 @@ + @item -mkernel + @opindex mkernel + Enable kernel development mode. The @option{-mkernel} option sets +-@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit}, ++@option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit}, + @option{-fno-exceptions}, @option{-fno-non-call-exceptions}, + @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where + applicable. This mode also sets @option{-mno-altivec}, +@@ -18707,6 +18717,72 @@ + @opindex m4 + Generate code for the SH4. + ++@item -m4-100 ++@opindex m4-100 ++Generate code for SH4-100. ++ ++@item -m4-100-nofpu ++@opindex m4-100-nofpu ++Generate code for SH4-100 in such a way that the ++floating-point unit is not used. ++ ++@item -m4-100-single ++@opindex m4-100-single ++Generate code for SH4-100 assuming the floating-point unit is in ++single-precision mode by default. ++ ++@item -m4-100-single-only ++@opindex m4-100-single-only ++Generate code for SH4-100 in such a way that no double-precision ++floating-point operations are used. ++ ++@item -m4-200 ++@opindex m4-200 ++Generate code for SH4-200. ++ ++@item -m4-200-nofpu ++@opindex m4-200-nofpu ++Generate code for SH4-200 without in such a way that the ++floating-point unit is not used. ++ ++@item -m4-200-single ++@opindex m4-200-single ++Generate code for SH4-200 assuming the floating-point unit is in ++single-precision mode by default. ++ ++@item -m4-200-single-only ++@opindex m4-200-single-only ++Generate code for SH4-200 in such a way that no double-precision ++floating-point operations are used. ++ ++@item -m4-300 ++@opindex m4-300 ++Generate code for SH4-300. ++ ++@item -m4-300-nofpu ++@opindex m4-300-nofpu ++Generate code for SH4-300 without in such a way that the ++floating-point unit is not used. ++ ++@item -m4-300-single ++@opindex m4-300-single ++Generate code for SH4-300 in such a way that no double-precision ++floating-point operations are used. ++ ++@item -m4-300-single-only ++@opindex m4-300-single-only ++Generate code for SH4-300 in such a way that no double-precision ++floating-point operations are used. ++ ++@item -m4-340 ++@opindex m4-340 ++Generate code for SH4-340 (no MMU, no FPU). ++ ++@item -m4-500 ++@opindex m4-500 ++Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the ++assembler. ++ + @item -m4a-nofpu + @opindex m4a-nofpu + Generate code for the SH4al-dsp, or for a SH4a in such a way that the +@@ -18732,6 +18808,33 @@ + @option{-dsp} to the assembler. GCC doesn't generate any DSP + instructions at the moment. + ++@item -m5-32media ++@opindex m5-32media ++Generate 32-bit code for SHmedia. ++ ++@item -m5-32media-nofpu ++@opindex m5-32media-nofpu ++Generate 32-bit code for SHmedia in such a way that the ++floating-point unit is not used. ++ ++@item -m5-64media ++@opindex m5-64media ++Generate 64-bit code for SHmedia. ++ ++@item -m5-64media-nofpu ++@opindex m5-64media-nofpu ++Generate 64-bit code for SHmedia in such a way that the ++floating-point unit is not used. ++ ++@item -m5-compact ++@opindex m5-compact ++Generate code for SHcompact. ++ ++@item -m5-compact-nofpu ++@opindex m5-compact-nofpu ++Generate code for SHcompact in such a way that the ++floating-point unit is not used. ++ + @item -mb + @opindex mb + Compile code for the processor in big-endian mode. +@@ -18765,16 +18868,12 @@ + Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for + alignment constraints. + +-@item -mhitachi +-@opindex mhitachi +-Comply with the calling conventions defined by Renesas. +- + @item -mrenesas +-@opindex mhitachi ++@opindex mrenesas + Comply with the calling conventions defined by Renesas. + + @item -mno-renesas +-@opindex mhitachi ++@opindex mno-renesas + Comply with the calling conventions defined for GCC before the Renesas + conventions were available. This option is the default for all + targets of the SH toolchain. +@@ -18782,12 +18881,12 @@ + @item -mnomacsave + @opindex mnomacsave + Mark the @code{MAC} register as call-clobbered, even if +-@option{-mhitachi} is given. ++@option{-mrenesas} is given. + + @item -mieee + @itemx -mno-ieee + @opindex mieee +-@opindex mnoieee ++@opindex mno-ieee + Control the IEEE compliance of floating-point comparisons, which affects the + handling of cases where the result of a comparison is unordered. By default + @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is +@@ -18827,7 +18926,7 @@ + + @item none + Disable compiler generated atomic sequences and emit library calls for atomic +-operations. This is the default if the target is not @code{sh-*-linux*}. ++operations. This is the default if the target is not @code{sh*-*-linux*}. + + @item soft-gusa + Generate GNU/Linux compatible gUSA software atomic sequences for the atomic +@@ -18834,7 +18933,7 @@ + built-in functions. The generated atomic sequences require additional support + from the interrupt/exception handling code of the system and are only suitable + for SH3* and SH4* single-core systems. This option is enabled by default when +-the target is @code{sh-*-linux*} and SH3* or SH4*. When the target is SH4A, ++the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A, + this option will also partially utilize the hardware atomic instructions + @code{movli.l} and @code{movco.l} to create more efficient code, unless + @samp{strict} is specified. +@@ -18853,7 +18952,7 @@ + in privileged mode and is only suitable for single-core systems. Additional + support from the interrupt/exception handling code of the system is not + required. This model is enabled by default when the target is +-@code{sh-*-linux*} and SH1* or SH2*. ++@code{sh*-*-linux*} and SH1* or SH2*. + + @item hard-llcs + Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l} +@@ -18888,10 +18987,6 @@ + processors the @code{tas.b} instruction must be used with caution since it + can result in data corruption for certain cache configurations. + +-@item -mspace +-@opindex mspace +-Optimize for space instead of speed. Implied by @option{-Os}. +- + @item -mprefergot + @opindex mprefergot + When generating position-independent code, emit function calls using +@@ -18898,11 +18993,14 @@ + the Global Offset Table instead of the Procedure Linkage Table. + + @item -musermode ++@itemx -mno-usermode + @opindex musermode +-Don't generate privileged mode only code. This option +-implies @option{-mno-inline-ic_invalidate} +-if the inlined code would not work in user mode. +-This is the default when the target is @code{sh-*-linux*}. ++@opindex mno-usermode ++Don't allow (allow) the compiler generating privileged mode code. Specifying ++@option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the ++inlined code would not work in user mode. @option{-musermode} is the default ++when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2* ++@option{-musermode} has no effect, since there is no user mode. + + @item -multcost=@var{number} + @opindex multcost=@var{number} +@@ -20357,6 +20455,20 @@ + table is exact at each instruction boundary, so it can be used for stack + unwinding from asynchronous events (such as debugger or garbage collector). + ++@item -fno-gnu-unique ++@opindex fno-gnu-unique ++On systems with recent GNU assembler and C library, the C++ compiler ++uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions ++of template static data members and static local variables in inline ++functions are unique even in the presence of @code{RTLD_LOCAL}; this ++is necessary to avoid problems with a library used by two different ++@code{RTLD_LOCAL} plugins depending on a definition in one of them and ++therefore disagreeing with the other one about the binding of the ++symbol. But this causes @code{dlclose} to be ignored for affected ++DSOs; if your program relies on reinitialization of a DSO via ++@code{dlclose} and @code{dlopen}, you can use ++@option{-fno-gnu-unique}. ++ + @item -fpcc-struct-return + @opindex fpcc-struct-return + Return ``short'' @code{struct} and @code{union} values in memory like +Index: gcc/doc/md.texi +=================================================================== +--- gcc/doc/md.texi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/doc/md.texi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2081,6 +2081,18 @@ + @item wg + If @option{-mmfpgpr} was used, a floating point register or NO_REGS. + ++@item wh ++Floating point register if direct moves are available, or NO_REGS. ++ ++@item wi ++FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS. ++ ++@item wj ++FP or VSX register to hold 64-bit integers for direct moves or NO_REGS. ++ ++@item wk ++FP or VSX register to hold 64-bit doubles for direct moves or NO_REGS. ++ + @item wl + Floating point register if the LFIWAX instruction is enabled or NO_REGS. + +@@ -2112,7 +2124,7 @@ + Floating point register if the STFIWX instruction is enabled or NO_REGS. + + @item wy +-VSX vector register to hold scalar float values or NO_REGS. ++FP or VSX register to perform ISA 2.07 float ops or NO_REGS. + + @item wz + Floating point register if the LFIWZX instruction is enabled or NO_REGS. +Index: gcc/doc/install.texi +=================================================================== +--- gcc/doc/install.texi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/doc/install.texi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2915,12 +2915,6 @@ + Solaris 2 (SPARC, Intel): + @itemize + @item +-@uref{http://www.sunfreeware.com/,,Sunfreeware} +- +-@item +-@uref{http://www.blastwave.org/,,Blastwave} +- +-@item + @uref{http://www.opencsw.org/,,OpenCSW} + + @item +@@ -2988,6 +2982,8 @@ + @ifhtml + @itemize + @item ++@uref{#aarch64x-x-x,,aarch64*-*-*} ++@item + @uref{#alpha-x-x,,alpha*-*-*} + @item + @uref{#alpha-dec-osf51,,alpha*-dec-osf5.1} +@@ -3130,6 +3126,18 @@ + +
    + @end html ++ ++@heading @anchor{aarch64x-x-x}aarch64*-*-* ++To enable a workaround for the Cortex-A53 erratum number 835769 by default ++(for all CPUs regardless of -mcpu option given) at configure time use the ++@option{--enable-fix-cortex-a53-835769} option. This will enable the fix by ++default and can be explicitly disabled during during compilation by passing the ++@option{-mno-fix-cortex-a53-835769} option. Conversely, ++@option{--disable-fix-cortex-a53-835769} will disable the workaround by ++default. The workaround is disabled by default if neither of ++@option{--enable-fix-cortex-a53-835769} or ++@option{--disable-fix-cortex-a53-835769} is given at configure time. ++ + @heading @anchor{alpha-x-x}alpha*-*-* + + This section contains general configuration information for all +Index: gcc/tree-ssa-tail-merge.c +=================================================================== +--- gcc/tree-ssa-tail-merge.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-ssa-tail-merge.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1060,6 +1060,24 @@ + gcc_unreachable (); + } + ++/* Return true if gimple operands T1 and T2 have the same value. */ ++ ++static bool ++gimple_operand_equal_value_p (tree t1, tree t2) ++{ ++ if (t1 == t2) ++ return true; ++ ++ if (t1 == NULL_TREE ++ || t2 == NULL_TREE) ++ return false; ++ ++ if (operand_equal_p (t1, t2, 0)) ++ return true; ++ ++ return gvn_uses_equal (t1, t2); ++} ++ + /* Return true if gimple statements S1 and S2 are equal. Gimple_bb (s1) and + gimple_bb (s2) are members of SAME_SUCC. */ + +@@ -1122,8 +1140,9 @@ + lhs2 = gimple_get_lhs (s2); + if (TREE_CODE (lhs1) != SSA_NAME + && TREE_CODE (lhs2) != SSA_NAME) +- return (vn_valueize (gimple_vdef (s1)) +- == vn_valueize (gimple_vdef (s2))); ++ return (operand_equal_p (lhs1, lhs2, 0) ++ && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1), ++ gimple_assign_rhs1 (s2))); + else if (TREE_CODE (lhs1) == SSA_NAME + && TREE_CODE (lhs2) == SSA_NAME) + return vn_valueize (lhs1) == vn_valueize (lhs2); +Index: gcc/DATESTAMP +=================================================================== +--- gcc/DATESTAMP (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/DATESTAMP (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1 +1 @@ +-20140522 ++20141105 +Index: gcc/ipa-cp.c +=================================================================== +--- gcc/ipa-cp.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ipa-cp.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -447,6 +447,8 @@ + else if (!opt_for_fn (node->symbol.decl, optimize) + || !opt_for_fn (node->symbol.decl, flag_ipa_cp)) + reason = "non-optimized function"; ++ else if (node->tm_clone) ++ reason = "transactional memory clone"; + + if (reason && dump_file && !node->alias && !node->thunk.thunk_p) + fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n", +@@ -2902,6 +2904,11 @@ + intersect_with_agg_replacements (cs->caller, src_idx, + &inter, 0); + } ++ else ++ { ++ inter.release (); ++ return vNULL; ++ } + } + else + { +@@ -2917,6 +2924,11 @@ + else + intersect_with_plats (src_plats, &inter, 0); + } ++ else ++ { ++ inter.release (); ++ return vNULL; ++ } + } + } + else if (jfunc->type == IPA_JF_ANCESTOR +@@ -3000,7 +3012,8 @@ + vec callers) + { + struct ipa_node_params *dest_info = IPA_NODE_REF (node); +- struct ipa_agg_replacement_value *res = NULL; ++ struct ipa_agg_replacement_value *res; ++ struct ipa_agg_replacement_value **tail = &res; + struct cgraph_edge *cs; + int i, j, count = ipa_get_param_count (dest_info); + +@@ -3044,8 +3057,8 @@ + v->offset = item->offset; + v->value = item->value; + v->by_ref = plats->aggs_by_ref; +- v->next = res; +- res = v; ++ *tail = v; ++ tail = &v->next; + } + + next_param: +@@ -3052,6 +3065,7 @@ + if (inter.exists ()) + inter.release (); + } ++ *tail = NULL; + return res; + } + +@@ -3060,7 +3074,8 @@ + static struct ipa_agg_replacement_value * + known_aggs_to_agg_replacement_list (vec known_aggs) + { +- struct ipa_agg_replacement_value *res = NULL; ++ struct ipa_agg_replacement_value *res; ++ struct ipa_agg_replacement_value **tail = &res; + struct ipa_agg_jump_function *aggjf; + struct ipa_agg_jf_item *item; + int i, j; +@@ -3074,9 +3089,10 @@ + v->offset = item->offset; + v->value = item->value; + v->by_ref = aggjf->by_ref; +- v->next = res; +- res = v; ++ *tail = v; ++ tail = &v->next; + } ++ *tail = NULL; + return res; + } + +Index: gcc/configure +=================================================================== +--- gcc/configure (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/configure (.../branches/gcc-4_8-branch) (revision 217117) +@@ -910,6 +910,7 @@ + enable_gnu_indirect_function + enable_initfini_array + enable_comdat ++enable_fix_cortex_a53_835769 + enable_gnu_unique_object + enable_linker_build_id + with_long_double_128 +@@ -1619,6 +1620,14 @@ + glibc systems + --enable-initfini-array use .init_array/.fini_array sections + --enable-comdat enable COMDAT group support ++ ++ --enable-fix-cortex-a53-835769 ++ enable workaround for AArch64 Cortex-A53 erratum ++ 835769 by default ++ --disable-fix-cortex-a53-835769 ++ disable workaround for AArch64 Cortex-A53 erratum ++ 835769 by default ++ + --enable-gnu-unique-object + enable the use of the @gnu_unique_object ELF + extension on glibc systems +@@ -17838,7 +17847,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 17841 "configure" ++#line 17850 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -17944,7 +17953,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 17947 "configure" ++#line 17956 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -23796,6 +23805,28 @@ + $as_echo "$gcc_cv_lto_plugin" >&6; } + + case "$target" in ++ ++ aarch64*-*-*) ++ # Enable default workaround for AArch64 Cortex-A53 erratum 835769. ++ # Check whether --enable-fix-cortex-a53-835769 was given. ++if test "${enable_fix_cortex_a53_835769+set}" = set; then : ++ enableval=$enable_fix_cortex_a53_835769; ++ case $enableval in ++ yes) ++ tm_defines="${tm_defines} TARGET_FIX_ERR_A53_835769_DEFAULT=1" ++ ;; ++ no) ++ ;; ++ *) ++ as_fn_error "'$enableval' is an invalid value for --enable-fix-cortex-a53-835769.\ ++ Valid choices are 'yes' and 'no'." "$LINENO" 5 ++ ;; ++ ++ esac ++ ++fi ++ ++ ;; + # All TARGET_ABI_OSF targets. + alpha*-*-linux* | alpha*-*-*bsd*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for explicit relocation support" >&5 +Index: gcc/fold-const.c +=================================================================== +--- gcc/fold-const.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fold-const.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -9213,7 +9213,7 @@ + /* Transform comparisons of the form X +- C1 CMP Y +- C2 to + X CMP Y +- C2 +- C1 for signed X, Y. This is valid if + the resulting offset is smaller in absolute value than the +- original one. */ ++ original one and has the same sign. */ + if (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0)) + && (TREE_CODE (arg0) == PLUS_EXPR || TREE_CODE (arg0) == MINUS_EXPR) + && (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST +@@ -9232,19 +9232,20 @@ + "a comparison"); + + /* Put the constant on the side where it doesn't overflow and is +- of lower absolute value than before. */ ++ of lower absolute value and of same sign than before. */ + cst = int_const_binop (TREE_CODE (arg0) == TREE_CODE (arg1) + ? MINUS_EXPR : PLUS_EXPR, + const2, const1); + if (!TREE_OVERFLOW (cst) +- && tree_int_cst_compare (const2, cst) == tree_int_cst_sgn (const2)) ++ && tree_int_cst_compare (const2, cst) == tree_int_cst_sgn (const2) ++ && tree_int_cst_sgn (cst) == tree_int_cst_sgn (const2)) + { + fold_overflow_warning (warnmsg, WARN_STRICT_OVERFLOW_COMPARISON); + return fold_build2_loc (loc, code, type, +- variable1, +- fold_build2_loc (loc, +- TREE_CODE (arg1), TREE_TYPE (arg1), +- variable2, cst)); ++ variable1, ++ fold_build2_loc (loc, TREE_CODE (arg1), ++ TREE_TYPE (arg1), ++ variable2, cst)); + } + + cst = int_const_binop (TREE_CODE (arg0) == TREE_CODE (arg1) +@@ -9251,13 +9252,15 @@ + ? MINUS_EXPR : PLUS_EXPR, + const1, const2); + if (!TREE_OVERFLOW (cst) +- && tree_int_cst_compare (const1, cst) == tree_int_cst_sgn (const1)) ++ && tree_int_cst_compare (const1, cst) == tree_int_cst_sgn (const1) ++ && tree_int_cst_sgn (cst) == tree_int_cst_sgn (const1)) + { + fold_overflow_warning (warnmsg, WARN_STRICT_OVERFLOW_COMPARISON); + return fold_build2_loc (loc, code, type, +- fold_build2_loc (loc, TREE_CODE (arg0), TREE_TYPE (arg0), +- variable1, cst), +- variable2); ++ fold_build2_loc (loc, TREE_CODE (arg0), ++ TREE_TYPE (arg0), ++ variable1, cst), ++ variable2); + } + } + +@@ -11218,7 +11221,6 @@ + { + double_int c1, c2, c3, msk; + int width = TYPE_PRECISION (type), w; +- bool try_simplify = true; + + c1 = tree_to_double_int (TREE_OPERAND (arg0, 1)); + c2 = tree_to_double_int (arg1); +@@ -11255,20 +11257,7 @@ + } + } + +- /* If X is a tree of the form (Y * K1) & K2, this might conflict +- with that optimization from the BIT_AND_EXPR optimizations. +- This could end up in an infinite recursion. */ +- if (TREE_CODE (TREE_OPERAND (arg0, 0)) == MULT_EXPR +- && TREE_CODE (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1)) +- == INTEGER_CST) +- { +- tree t = TREE_OPERAND (TREE_OPERAND (arg0, 0), 1); +- double_int masked = mask_with_tz (type, c3, tree_to_double_int (t)); +- +- try_simplify = (masked != c1); +- } +- +- if (try_simplify && c3 != c1) ++ if (c3 != c1) + return fold_build2_loc (loc, BIT_IOR_EXPR, type, + fold_build2_loc (loc, BIT_AND_EXPR, type, + TREE_OPERAND (arg0, 0), +@@ -11658,16 +11647,25 @@ + && TREE_CODE (arg0) == MULT_EXPR + && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) + { ++ double_int darg1 = tree_to_double_int (arg1); + double_int masked +- = mask_with_tz (type, tree_to_double_int (arg1), ++ = mask_with_tz (type, darg1, + tree_to_double_int (TREE_OPERAND (arg0, 1))); + + if (masked.is_zero ()) + return omit_two_operands_loc (loc, type, build_zero_cst (type), + arg0, arg1); +- else if (masked != tree_to_double_int (arg1)) +- return fold_build2_loc (loc, code, type, op0, +- double_int_to_tree (type, masked)); ++ else if (masked != darg1) ++ { ++ /* Avoid the transform if arg1 is a mask of some ++ mode which allows further optimizations. */ ++ int pop = darg1.popcount (); ++ if (!(pop >= BITS_PER_UNIT ++ && exact_log2 (pop) != -1 ++ && double_int::mask (pop) == darg1)) ++ return fold_build2_loc (loc, code, type, op0, ++ double_int_to_tree (type, masked)); ++ } + } + + /* For constants M and N, if M == (1LL << cst) - 1 && (N & M) == M, +Index: gcc/omp-low.c +=================================================================== +--- gcc/omp-low.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/omp-low.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1586,7 +1586,6 @@ + TREE_STATIC (decl) = 1; + TREE_USED (decl) = 1; + DECL_ARTIFICIAL (decl) = 1; +- DECL_NAMELESS (decl) = 1; + DECL_IGNORED_P (decl) = 0; + TREE_PUBLIC (decl) = 0; + DECL_UNINLINABLE (decl) = 1; +Index: gcc/toplev.c +=================================================================== +--- gcc/toplev.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/toplev.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1036,16 +1036,19 @@ + + if (warn_stack_usage >= 0) + { ++ const location_t loc = DECL_SOURCE_LOCATION (current_function_decl); ++ + if (stack_usage_kind == DYNAMIC) +- warning (OPT_Wstack_usage_, "stack usage might be unbounded"); ++ warning_at (loc, OPT_Wstack_usage_, "stack usage might be unbounded"); + else if (stack_usage > warn_stack_usage) + { + if (stack_usage_kind == DYNAMIC_BOUNDED) +- warning (OPT_Wstack_usage_, "stack usage might be %wd bytes", +- stack_usage); ++ warning_at (loc, ++ OPT_Wstack_usage_, "stack usage might be %wd bytes", ++ stack_usage); + else +- warning (OPT_Wstack_usage_, "stack usage is %wd bytes", +- stack_usage); ++ warning_at (loc, OPT_Wstack_usage_, "stack usage is %wd bytes", ++ stack_usage); + } + } + } +Index: gcc/DEV-PHASE +=================================================================== +--- gcc/DEV-PHASE (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/DEV-PHASE (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1 @@ ++prerelease +Index: gcc/tree-ssa-sccvn.c +=================================================================== +--- gcc/tree-ssa-sccvn.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-ssa-sccvn.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3015,33 +3015,12 @@ + /* If all value numbered to the same value, the phi node has that + value. */ + if (allsame) +- { +- if (is_gimple_min_invariant (sameval)) +- { +- VN_INFO (PHI_RESULT (phi))->has_constants = true; +- VN_INFO (PHI_RESULT (phi))->expr = sameval; +- } +- else +- { +- VN_INFO (PHI_RESULT (phi))->has_constants = false; +- VN_INFO (PHI_RESULT (phi))->expr = sameval; +- } ++ return set_ssa_val_to (PHI_RESULT (phi), sameval); + +- if (TREE_CODE (sameval) == SSA_NAME) +- return visit_copy (PHI_RESULT (phi), sameval); +- +- return set_ssa_val_to (PHI_RESULT (phi), sameval); +- } +- + /* Otherwise, see if it is equivalent to a phi node in this block. */ + result = vn_phi_lookup (phi); + if (result) +- { +- if (TREE_CODE (result) == SSA_NAME) +- changed = visit_copy (PHI_RESULT (phi), result); +- else +- changed = set_ssa_val_to (PHI_RESULT (phi), result); +- } ++ changed = set_ssa_val_to (PHI_RESULT (phi), result); + else + { + vn_phi_insert (phi, PHI_RESULT (phi)); +@@ -3142,24 +3121,18 @@ + catch those with constants. The goal here is to simultaneously + combine constants between expressions, but avoid infinite + expansion of expressions during simplification. */ +- if (TREE_CODE (op0) == SSA_NAME) +- { +- if (VN_INFO (op0)->has_constants ++ op0 = vn_valueize (op0); ++ if (TREE_CODE (op0) == SSA_NAME ++ && (VN_INFO (op0)->has_constants + || TREE_CODE_CLASS (code) == tcc_comparison +- || code == COMPLEX_EXPR) +- op0 = valueize_expr (vn_get_expr_for (op0)); +- else +- op0 = vn_valueize (op0); +- } ++ || code == COMPLEX_EXPR)) ++ op0 = valueize_expr (vn_get_expr_for (op0)); + +- if (TREE_CODE (op1) == SSA_NAME) +- { +- if (VN_INFO (op1)->has_constants +- || code == COMPLEX_EXPR) +- op1 = valueize_expr (vn_get_expr_for (op1)); +- else +- op1 = vn_valueize (op1); +- } ++ op1 = vn_valueize (op1); ++ if (TREE_CODE (op1) == SSA_NAME ++ && (VN_INFO (op1)->has_constants ++ || code == COMPLEX_EXPR)) ++ op1 = valueize_expr (vn_get_expr_for (op1)); + + /* Pointer plus constant can be represented as invariant address. + Do so to allow further propatation, see also tree forwprop. */ +@@ -3217,27 +3190,31 @@ + return NULL_TREE; + + orig_op0 = op0; +- if (VN_INFO (op0)->has_constants) +- op0 = valueize_expr (vn_get_expr_for (op0)); +- else if (CONVERT_EXPR_CODE_P (code) +- || code == REALPART_EXPR +- || code == IMAGPART_EXPR +- || code == VIEW_CONVERT_EXPR +- || code == BIT_FIELD_REF) ++ op0 = vn_valueize (op0); ++ if (TREE_CODE (op0) == SSA_NAME) + { +- /* We want to do tree-combining on conversion-like expressions. +- Make sure we feed only SSA_NAMEs or constants to fold though. */ +- tree tem = valueize_expr (vn_get_expr_for (op0)); +- if (UNARY_CLASS_P (tem) +- || BINARY_CLASS_P (tem) +- || TREE_CODE (tem) == VIEW_CONVERT_EXPR +- || TREE_CODE (tem) == SSA_NAME +- || TREE_CODE (tem) == CONSTRUCTOR +- || is_gimple_min_invariant (tem)) +- op0 = tem; ++ if (VN_INFO (op0)->has_constants) ++ op0 = valueize_expr (vn_get_expr_for (op0)); ++ else if (CONVERT_EXPR_CODE_P (code) ++ || code == REALPART_EXPR ++ || code == IMAGPART_EXPR ++ || code == VIEW_CONVERT_EXPR ++ || code == BIT_FIELD_REF) ++ { ++ /* We want to do tree-combining on conversion-like expressions. ++ Make sure we feed only SSA_NAMEs or constants to fold though. */ ++ tree tem = valueize_expr (vn_get_expr_for (op0)); ++ if (UNARY_CLASS_P (tem) ++ || BINARY_CLASS_P (tem) ++ || TREE_CODE (tem) == VIEW_CONVERT_EXPR ++ || TREE_CODE (tem) == SSA_NAME ++ || TREE_CODE (tem) == CONSTRUCTOR ++ || is_gimple_min_invariant (tem)) ++ op0 = tem; ++ } + } + +- /* Avoid folding if nothing changed, but remember the expression. */ ++ /* Avoid folding if nothing changed. */ + if (op0 == orig_op0) + return NULL_TREE; + +Index: gcc/cgraphunit.c +=================================================================== +--- gcc/cgraphunit.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cgraphunit.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1097,7 +1097,7 @@ + /* We use local aliases for C++ thunks to force the tailcall + to bind locally. This is a hack - to keep it working do + the following (which is not strictly correct). */ +- && (! TREE_CODE (target_node->symbol.decl) == FUNCTION_DECL ++ && (TREE_CODE (target_node->symbol.decl) != FUNCTION_DECL + || ! DECL_VIRTUAL_P (target_node->symbol.decl)) + && ! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl))) + { +Index: gcc/ChangeLog +=================================================================== +--- gcc/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,930 @@ ++2014-10-29 Kyrylo Tkachov ++ ++ * config/aarch64/aarch64.c (aarch64_madd_needs_nop): Restore ++ recog state after aarch64_prev_real_insn call. ++ ++2014-10-24 Kyrylo Tkachov ++ ++ * config.gcc (aarch64*-*-*): Define TARGET_FIX_ERR_A53_835769_DEFAULT ++ if asked. ++ * configure.ac: Add --enable-fix-cortex-a53-835769 option. ++ * configure: Regenerate. ++ * config/aarch64/aarch64.c (aarch64_override_options): Handle ++ TARGET_FIX_ERR_A53_835769_DEFAULT. ++ * config/aarch64/aarch64.opt (mfix-cortex-a53-835769): Set Init value ++ to 2. ++ * doc/install.texi: Document --enable-fix-cortex-a53-835769 option. ++ ++2014-10-24 Kyrylo Tkachov ++ ++ * config/aarch64/aarch64.opt (mfix-cortex-a53-835769): New option. ++ * config/aarch64/aarch64.h (ADJUST_INSN_LENGTH): Define. ++ (FINAL_PRESCAN_INSN): Likewise. ++ * config/aarch64/aarch64.h (is_mem_p): New function. ++ (has_memory_op): Likewise. ++ (aarch64_prev_real_insn): Likewise. ++ (is_madd_op): Likewise. ++ (dep_between_memop_and_curr): Likewise. ++ (aarch64_madd_needs_nop): Likewise. ++ (aarch64_final_prescan_insn): Likewise. ++ * doc/invoke.texi (Document new option). ++ ++2014-10-15 Eric Botcazou ++ ++ * stor-layout.c (self_referential_size): Do not promote arguments. ++ ++2014-10-12 Bill Schmidt ++ ++ Backport from mainline r215880 ++ 2014-10-03 Bill Schmidt ++ ++ * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): ++ Issue a warning message when vec_lvsl or vec_lvsr is used with a ++ little endian target. ++ ++ Backport from mainline r215882 ++ 2014-10-03 Bill Schmidt ++ ++ * altivec.md (altivec_lvsl): New define_expand. ++ (altivec_lvsl_direct): Rename define_insn from altivec_lvsl. ++ (altivec_lvsr): New define_expand. ++ (altivec_lvsr_direct): Rename define_insn from altivec_lvsr. ++ * rs6000.c (rs6000_expand_builtin): Change to use ++ altivec_lvs[lr]_direct; remove commented-out code. ++ ++2014-10-09 Uros Bizjak ++ ++ Backport from mainline ++ 2014-10-09 Uros Bizjak ++ ++ PR rtl-optimization/57003 ++ * regcprop.c (copyprop_hardreg_forward_1): If ksvd.ignore_set_reg, ++ also check CALL_INSN_FUNCTION_USAGE for clobbers again after ++ killing regs_invalidated_by_call. ++ ++2014-10-08 Oleg Endo ++ ++ Backport from mainline ++ 2014-10-08 Oleg Endo ++ ++ PR target/52941 ++ * config/sh/sync.md (atomic_exchangesi_hard, atomic_exchange_hard, ++ atomic_fetch_si_hard, ++ atomic_fetch__hard, atomic_fetch_nandsi_hard, ++ atomic_fetch_nand_hard, atomic__fetchsi_hard, ++ atomic__fetch_hard, atomic_nand_fetchsi_hard, ++ atomic_nand_fetch_hard): Add missing set of T_REG. ++ ++2014-10-02 Martin Jambor ++ ++ PR tree-optimization/63375 ++ * tree-sra.c (build_access_from_expr_1): Disqualify volatile ++ references. ++ ++2014-10-01 Jakub Jelinek ++ ++ PR debug/63342 ++ * dwarf2out.c (loc_list_from_tree): Handle TARGET_MEM_REF and ++ SSA_NAME. ++ ++ PR target/63428 ++ * config/i386/i386.c (expand_vec_perm_pshufb): Fix up rperm[0] ++ argument to avx2_permv2ti. ++ ++2014-10-01 Uros Bizjak ++ ++ Backport from mainline ++ 2014-09-30 Uros Bizjak ++ ++ * config/i386/i386.md (fmodxf3): Enable for flag_finite_math_only only. ++ (fmod3): Ditto. ++ (fpremxf4_i387): Ditto. ++ (reminderxf3): Ditto. ++ (reminder3): Ditto. ++ (fprem1xf4_i387): Ditto. ++ ++2014-09-30 Jakub Jelinek ++ ++ PR inline-asm/63282 ++ * ifcvt.c (dead_or_predicable): Don't call redirect_jump_1 ++ or invert_jump_1 if jump isn't any_condjump_p. ++ ++2014-09-29 Charles Baylis ++ ++ Backport from mainline r212303 ++ PR target/49423 ++ * config/arm/arm-protos.h (arm_legitimate_address_p, ++ arm_is_constant_pool_ref): Add prototypes. ++ * config/arm/arm.c (arm_legitimate_address_p): Remove static. ++ (arm_is_constant_pool_ref) New function. ++ * config/arm/arm.md (unaligned_loadhis, arm_zero_extendhisi2_v6, ++ arm_zero_extendqisi2_v6): Use Uh constraint for memory operand. ++ (arm_extendhisi2, arm_extendhisi2_v6): Use Uh constraint for memory ++ operand and remove pool_range and neg_pool_range attributes. ++ (arm_extendqihi_insn, arm_extendqisi, arm_extendqisi_v6): Remove ++ pool_range and neg_pool_range attributes. ++ * config/arm/constraints.md (Uh): New constraint. (Uq): Don't allow ++ constant pool references. ++ ++2014-09-28 John David Anglin ++ ++ * config/pa/pa.c (pa_output_function_epilogue): Only update ++ last_address when a nonnote insn is found. ++ ++2014-09-25 Oleg Endo ++ ++ Backport from mainline ++ 2014-09-25 Nick Clifton ++ 2014-09-25 Oleg Endo ++ ++ PR target/62218 ++ * config/sh/sync.md (atomic_fetch_nand_soft_imask, ++ atomic_test_and_set_soft_imask): Fix typo in instruction sequence. ++ ++2014-09-25 Bill Schmidt ++ ++ Backport from mainline r215559 ++ 2014-09-25 Bill Schmidt ++ ++ PR target/63335 ++ * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): ++ Exclude VSX_BUILTIN_XVCMPGEDP_P from special handling. ++ ++2014-09-25 Jakub Jelinek ++ ++ PR tree-optimization/63341 ++ * tree-vectorizer.h (vect_create_data_ref_ptr, ++ vect_create_addr_base_for_vector_ref): Add another tree argument ++ defaulting to NULL_TREE. ++ * tree-vect-data-refs.c (vect_create_data_ref_ptr): Add byte_offset ++ argument, pass it down to vect_create_addr_base_for_vector_ref. ++ (vect_create_addr_base_for_vector_ref): Add byte_offset argument, ++ add that to base_offset too if non-NULL. ++ * tree-vect-stmts.c (vectorizable_load): Add byte_offset variable, ++ for dr_explicit_realign_optimized set it to vector byte size ++ - 1 instead of setting offset, pass byte_offset down to ++ vect_create_data_ref_ptr. ++ ++2014-09-23 Michael Meissner ++ ++ Back port from trunk: ++ 2014-09-23 Michael Meissner ++ ++ * config/rs6000/rs6000.md (f32_vsx): New mode attributes to ++ refine the constraints used on 32/64-bit floating point moves. ++ (f32_av): Likewise. ++ (f64_vsx): Likewise. ++ (f64_dm): Likewise. ++ (f64_av): Likewise. ++ (BOOL_REGS_OUTPUT): Use wt constraint for TImode instead of wa. ++ (BOOL_REGS_OP1): Likewise. ++ (BOOL_REGS_OP2): Likewise. ++ (BOOL_REGS_UNARY): Likewise. ++ (mov_hardfloat, SFmode/SDmode): Tighten down constraints for ++ 32/64-bit floating point moves. Do not use wa, instead use ww/ws ++ for moves involving VSX registers. Do not use constraints that ++ target VSX registers for decimal types. ++ (mov_hardfloat32, DFmode/DDmode): Likewise. ++ (mov_hardfloat64, DFmode/DDmode): Likewise. ++ ++2014-09-19 Michael Meissner ++ ++ Back port from trunk: ++ 2014-09-19 Michael Meissner ++ ++ * config/rs6000/predicates.md (fusion_gpr_mem_load): Move testing ++ for base_reg_operand to be common between LO_SUM and PLUS. ++ (fusion_gpr_mem_combo): New predicate to match a fused address ++ that combines the addis and memory offset address. ++ ++ * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): Change ++ calling signature. ++ (emit_fusion_gpr_load): Likewise. ++ ++ * config/rs6000/rs6000.c (fusion_gpr_load_p): Change calling ++ signature to pass each argument separately, rather than ++ using an operands array. Rewrite the insns found by peephole2 to ++ be a single insn, rather than hoping the insns will still be ++ together when the peephole pass is done. Drop being called via a ++ normal peephole. ++ (emit_fusion_gpr_load): Change calling signature to be called from ++ the fusion_gpr_load_ insns with a combined memory address ++ instead of the peephole pass passing the addis and offset ++ separately. ++ ++ * config/rs6000/rs6000.md (UNSPEC_FUSION_GPR): New unspec for GPR ++ fusion. ++ (power8 fusion peephole): Drop support for doing power8 via a ++ normal peephole that was created by the peephole2 pass. ++ (power8 fusion peephole2): Create a new insn with the fused ++ address, so that the fused operation is kept together after ++ register allocation is done. ++ (fusion_gpr_load_): Likewise. ++ ++2014-09-17 Jakub Jelinek ++ ++ PR debug/63284 ++ * tree-cfgcleanup.c (fixup_noreturn_call): Don't split block ++ if there are only debug stmts after the noreturn call, instead ++ remove the debug stmts. ++ ++2014-09-10 Michael Meissner ++ ++ * config/rs6000/vsx.md (vsx_fmav4sf4): Use correct constraints for ++ V2DF, V4SF, DF, and DI modes. ++ (vsx_fmav2df2): Likewise. ++ (vsx_float_fix_2): Likewise. ++ (vsx_reduc__v2df_scalar): Likewise. ++ ++2014-09-10 Alan Modra ++ ++ PR debug/60655 ++ * dwarf2out.c (mem_loc_descriptor ): Return NULL if addend ++ can't be output. ++ ++2014-09-09 Richard Biener ++ ++ Backport from mainline ++ 2014-06-11 Richard Biener ++ ++ PR tree-optimization/61452 ++ * tree-ssa-sccvn.c (visit_phi): Remove pointless setting of ++ expr and has_constants in case we found a leader. ++ (simplify_binary_expression): Always valueize operands first. ++ (simplify_unary_expression): Likewise. ++ ++2014-09-09 Richard Biener ++ ++ Backport from mainline ++ 2014-05-05 Richard Biener ++ ++ PR middle-end/61010 ++ * fold-const.c (fold_binary_loc): Consistently avoid ++ canonicalizing X & CST away from a CST that is the mask ++ of a mode. ++ ++ 2014-05-28 Richard Biener ++ ++ PR middle-end/61045 ++ * fold-const.c (fold_comparison): When folding ++ X +- C1 CMP Y +- C2 to X CMP Y +- C2 +- C1 also ensure ++ the sign of the remaining constant operand stays the same. ++ ++ 2014-08-11 Richard Biener ++ ++ PR tree-optimization/62075 ++ * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Properly ++ handle uses in patterns. ++ ++2014-09-09 James Greenhalgh ++ ++ Backport from mainline. ++ 2014-09-09 James Greenhalgh ++ ++ * doc/invoke.texi (-march): Use GNU/Linux rather than Linux. ++ (-mtune): Likewise. ++ (-mcpu): Likewise. ++ ++2014-09-08 Jakub Jelinek ++ ++ PR tree-optimization/60196 ++ PR tree-optimization/63189 ++ Backported from mainline ++ 2013-09-17 Cong Hou ++ ++ * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Fix a bug ++ when checking the dot production pattern. The type of rhs operand ++ of multiply is now checked correctly. ++ ++2014-09-08 Jakub Jelinek ++ ++ Backported from mainline ++ 2014-08-06 Vladimir Makarov ++ ++ PR debug/61923 ++ * haifa-sched.c (advance_one_cycle): Fix dump. ++ (schedule_block): Don't advance cycle if we are already at the ++ beginning of the cycle. ++ ++2014-09-03 Martin Jambor ++ ++ PR ipa/62015 ++ * ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible ++ pass-trough jump functions correctly. ++ ++2014-09-03 Martin Jambor ++ ++ PR ipa/61986 ++ * ipa-cp.c (find_aggregate_values_for_callers_subset): Chain ++ created replacements in ascending order of offsets. ++ (known_aggs_to_agg_replacement_list): Likewise. ++ ++2014-09-01 Marek Polacek ++ ++ Backport from mainline ++ 2014-08-21 Marek Polacek ++ ++ PR c/61271 ++ * expr.c (is_aligning_offset): Remove logical not. ++ ++2014-09-01 Marek Polacek ++ ++ Backport from mainline ++ 2014-08-19 Marek Polacek ++ ++ PR c/61271 ++ * cgraphunit.c (handle_alias_pairs): Fix condition. ++ ++2014-08-30 John David Anglin ++ ++ * config/pa/pa.c (pa_assemble_integer): Don't add PLABEL relocation ++ prefix to function labels when generating fast indirect calls. ++ ++2014-08-26 Joel Sherrill ++ ++ * doc/invoke.texi: -fno-cxa-atexit should be -fno-use-cxa-atexit. ++ ++2014-08-26 Marek Polacek ++ ++ Backport from mainline ++ 2014-08-26 Marek Polacek ++ ++ PR c/61271 ++ * tree-vectorizer.h (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT, ++ LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Wrap in parens. ++ ++2014-08-24 Oleg Endo ++ ++ Backport from mainline ++ 2014-08-24 Oleg Endo ++ ++ PR target/61996 ++ * config/sh/sh.opt (musermode): Allow negative form. ++ * config/sh/sh.c (sh_option_override): Disable TARGET_USERMODE for ++ targets that don't support it. ++ * doc/invoke.texi (SH Options): Rename sh-*-linux* to sh*-*-linux*. ++ Document -mno-usermode option. ++ ++2014-08-23 John David Anglin ++ ++ PR target/62038 ++ * config/pa/pa.c (pa_output_function_epilogue): Don't set ++ last_address when the current function is a thunk. ++ (pa_asm_output_mi_thunk): When we don't have named sections or they ++ are not being used, check that thunk can reach the stub table with a ++ short branch. ++ ++2014-08-22 Michael Meissner ++ ++ Backport fro mainline ++ 2014-08-22 Michael Meissner ++ ++ PR target/62195 ++ * doc/md.texi (Machine Constraints): Update PowerPC wi constraint ++ documentation to state it is only for VSX operations. ++ ++ * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Make wi ++ constraint only active if VSX. ++ ++ * config/rs6000/rs6000.md (lfiwax): Use wj constraint instead of ++ wi cosntraint for ISA 2.07 lxsiwax/lxsiwzx instructions. ++ (lfiwzx): Likewise. ++ ++2014-08-15 Tom de Vries ++ ++ Backport from mainline: ++ 2014-08-14 Tom de Vries ++ ++ PR rtl-optimization/62004 ++ PR rtl-optimization/62030 ++ * ifcvt.c (rtx_interchangeable_p): New function. ++ (noce_try_move, noce_process_if_block): Use rtx_interchangeable_p. ++ ++ 2014-08-05 Richard Biener ++ ++ * emit-rtl.h (mem_attrs_eq_p): Declare. ++ * emit-rtl.c (mem_attrs_eq_p): Export. ++ ++2014-08-16 John David Anglin ++ ++ Backport from trunk: ++ 2014-04-06 John David Anglin ++ ++ PR debug/55794 ++ * config/pa/pa.c (pa_output_function_epilogue): Skip address and code ++ size accounting for thunks. ++ (pa_asm_output_mi_thunk): Use final_start_function() and ++ final_end_function() to output function start and end directives. ++ ++2014-08-15 Oleg Endo ++ ++ Backport from mainline: ++ 2014-08-15 Oleg Endo ++ ++ * doc/invoke.texi (SH options): Document missing processor variant ++ options. Remove references to Hitachi. Undocument deprecated mspace ++ option. ++ ++2014-08-13 Felix Yang ++ ++ PR tree-optimization/62073 ++ * tree-vect-loop.c (vect_is_simple_reduction_1): Check that DEF1 has ++ a basic block. ++ ++2014-08-13 Thomas Preud'homme ++ ++ Backport from mainline ++ 2014-08-12 Thomas Preud'homme ++ ++ PR middle-end/62103 ++ * gimple-fold.c (fold_ctor_reference): Don't fold in presence of ++ bitfields, that is when size doesn't match the size of type or the ++ size of the constructor. ++ ++2014-08-12 Michael Meissner ++ ++ Backport patch from mainline ++ 2014-08-11 Michael Meissner ++ ++ * config/rs6000/constraints.md (wh constraint): New constraint, ++ for FP registers if direct move is available. ++ (wi constraint): New constraint, for VSX/FP registers that can ++ handle 64-bit integers. ++ (wj constraint): New constraint for VSX/FP registers that can ++ handle 64-bit integers for direct moves. ++ (wk constraint): New constraint for VSX/FP registers that can ++ handle 64-bit doubles for direct moves. ++ (wy constraint): Make documentation match implementation. ++ ++ * config/rs6000/rs6000.c (struct rs6000_reg_addr): Add ++ scalar_in_vmx_p field to simplify tests of whether SFmode or ++ DFmode can go in the Altivec registers. ++ (rs6000_hard_regno_mode_ok): Use scalar_in_vmx_p field. ++ (rs6000_setup_reg_addr_masks): Likewise. ++ (rs6000_debug_print_mode): Add debug support for scalar_in_vmx_p ++ field, and wh/wi/wj/wk constraints. ++ (rs6000_init_hard_regno_mode_ok): Setup scalar_in_vmx_p field, and ++ the wh/wi/wj/wk constraints. ++ (rs6000_preferred_reload_class): If SFmode/DFmode can go in the ++ upper registers, prefer VSX registers unless the operation is a ++ memory operation with REG+OFFSET addressing. ++ ++ * config/rs6000/vsx.md (VSr mode attribute): Add support for ++ DImode. Change SFmode to use ww constraint instead of d to allow ++ SF registers in the upper registers. ++ (VSr2): Likewise. ++ (VSr3): Likewise. ++ (VSr5): Fix thinko in comment. ++ (VSa): New mode attribute that is an alternative to wa, that ++ returns the VSX register class that a mode can go in, but may not ++ be the preferred register class. ++ (VS_64dm): New mode attribute for appropriate register classes for ++ referencing 64-bit elements of vectors for direct moves and normal ++ moves. ++ (VS_64reg): Likewise. ++ (vsx_mov): Change wa constraint to to limit the ++ register allocator to only registers the data type can handle. ++ (vsx_le_perm_load_): Likewise. ++ (vsx_le_perm_store_): Likewise. ++ (vsx_xxpermdi2_le_): Likewise. ++ (vsx_xxpermdi4_le_): Likewise. ++ (vsx_lxvd2x2_le_): Likewise. ++ (vsx_lxvd2x4_le_): Likewise. ++ (vsx_stxvd2x2_le_): Likewise. ++ (vsx_add3): Likewise. ++ (vsx_sub3): Likewise. ++ (vsx_mul3): Likewise. ++ (vsx_div3): Likewise. ++ (vsx_tdiv3_internal): Likewise. ++ (vsx_fre2): Likewise. ++ (vsx_neg2): Likewise. ++ (vsx_abs2): Likewise. ++ (vsx_nabs2): Likewise. ++ (vsx_smax3): Likewise. ++ (vsx_smin3): Likewise. ++ (vsx_sqrt2): Likewise. ++ (vsx_rsqrte2): Likewise. ++ (vsx_tsqrt2_internal): Likewise. ++ (vsx_fms4): Likewise. ++ (vsx_nfma4): Likewise. ++ (vsx_eq): Likewise. ++ (vsx_gt): Likewise. ++ (vsx_ge): Likewise. ++ (vsx_eq_p): Likewise. ++ (vsx_gt_p): Likewise. ++ (vsx_ge_p): Likewise. ++ (vsx_xxsel): Likewise. ++ (vsx_xxsel_uns): Likewise. ++ (vsx_copysign3): Likewise. ++ (vsx_float2): Likewise. ++ (vsx_floatuns2): Likewise. ++ (vsx_fix_trunc2): Likewise. ++ (vsx_fixuns_trunc2): Likewise. ++ (vsx_xri): Likewise. ++ (vsx_xric): Likewise. ++ (vsx_btrunc2): Likewise. ++ (vsx_b2trunc2): Likewise. ++ (vsx_floor2): Likewise. ++ (vsx_ceil2): Likewise. ++ (vsx_): Likewise. ++ (vsx_xscvspdp): Likewise. ++ (vsx_xvcvspuxds): Likewise. ++ (vsx_float_fix_2): Likewise. ++ (vsx_set_): Likewise. ++ (vsx_extract__internal1): Likewise. ++ (vsx_extract__internal2): Likewise. ++ (vsx_extract__load): Likewise. ++ (vsx_extract__store): Likewise. ++ (vsx_splat_): Likewise. ++ (vsx_xxspltw_): Likewise. ++ (vsx_xxspltw__direct): Likewise. ++ (vsx_xxmrghw_): Likewise. ++ (vsx_xxmrglw_): Likewise. ++ (vsx_xxsldwi_): Likewise. ++ (vsx_xscvdpspn): Tighten constraints to only use register classes ++ the types use. ++ (vsx_xscvspdpn): Likewise. ++ (vsx_xscvdpspn_scalar): Likewise. ++ ++ * config/rs6000/rs6000.h (enum rs6000_reg_class_enum): Add wh, wi, ++ wj, and wk constraints. ++ (GPR_REG_CLASS_P): New helper macro for register classes targeting ++ general purpose registers. ++ ++ * config/rs6000/rs6000.md (f32_dm): Use wh constraint for SDmode ++ direct moves. ++ (zero_extendsidi2_lfiwz): Use wj constraint for direct move of ++ DImode instead of wm. Use wk constraint for direct move of DFmode ++ instead of wm. ++ (extendsidi2_lfiwax): Likewise. ++ (lfiwax): Likewise. ++ (lfiwzx): Likewise. ++ (movdi_internal64): Likewise. ++ ++ * doc/md.texi (PowerPC and IBM RS6000): Document wh, wi, wj, and ++ wk constraints. Make the wy constraint documentation match them ++ implementation. ++ ++2014-08-01 Thomas Preud'homme ++ ++ Backport from mainline ++ 2014-06-13 Thomas Preud'homme ++ ++ PR tree-optimization/61375 ++ * tree-ssa-math-opts.c (find_bswap_or_nop_1): Cancel optimization if ++ symbolic number cannot be represented in an unsigned HOST_WIDE_INT. ++ (execute_optimize_bswap): Cancel optimization if CHAR_BIT != 8. ++ ++2014-08-01 Richard Biener ++ ++ PR tree-optimization/61964 ++ * tree-ssa-tail-merge.c (gimple_operand_equal_value_p): New ++ function merged from trunk. ++ (gimple_equal_p): Handle non-SSA LHS solely by structural ++ equality. ++ ++2014-07-25 Uros Bizjak ++ ++ * config/alpha/elf.h: Define TARGET_UNWIND_TABLES_DEFAULT. ++ ++2014-07-24 Kyle McMartin ++ ++ * config/aarch64/aarch64-linux.h (TARGET_ASM_FILE_END): Define. ++ ++2014-07-24 Ulrich Weigand ++ ++ * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p): ++ Add prototype. ++ * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): New ++ function. Issue -Wpsabi warning if future GCC releases will use ++ different field alignment rules for this type. ++ * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Call it. ++ * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. ++ * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise. ++ ++2014-07-24 Ulrich Weigand ++ ++ * config/rs6000/rs6000.c (rs6000_function_arg_boundary): Issue ++ -Wpsabi note when encountering a type where future GCC releases ++ will apply different alignment requirements. ++ ++2014-07-24 Ulrich Weigand ++ ++ * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument ++ does not fit fully into floating-point registers, and there is still ++ space in the register parameter area, issue -Wpsabi note that the ABI ++ will change in a future GCC release. ++ ++2014-07-23 Sebastian Huber ++ ++ * config/arm/t-rtems-eabi: Add ++ mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard, ++ mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard, ++ mbig-endian/mthumb/march=armv7-r, and ++ mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard ++ multilibs. ++ ++2014-07-21 Peter Bergner ++ ++ * config/rs6000/sysv4.h (LIBASAN_EARLY_SPEC): Define. ++ (LIBTSAN_EARLY_SPEC): Likewise. ++ (STATIC_LIBASAN_LIBS): Likewise. ++ (STATIC_LIBTSAN_LIBS): Likewise. ++ ++2014-07-19 Eric Botcazou ++ ++ * toplev.c (output_stack_usage): Adjust the location of the warning. ++ ++2014-07-19 Daniel Cederman ++ ++ * config/sparc/sync.md (*membar_storeload_leon3): New insn. ++ (*membar_storeload): Disable for LEON3. ++ ++2014-07-17 Richard Biener ++ ++ PR rtl-optimization/61801 ++ * sched-deps.c (sched_analyze_2): For ASM_OPERANDS and ++ ASM_INPUT don't set reg_pending_barrier if it appears in a ++ debug-insn. ++ ++2014-07-16 Jakub Jelinek ++ ++ * omp-low.c (create_omp_child_function): Don't set DECL_NAMELESS ++ on the FUNCTION_DECL. ++ ++2014-07-10 Tom G. Christensen ++ ++ * doc/install.texi: Remove links to defunct package providers for ++ Solaris. ++ ++2014-07-10 Eric Botcazou ++ ++ PR middle-end/53590 ++ * function.c (allocate_struct_function): Revert r188667 change. ++ ++2014-07-04 Jakub Jelinek ++ ++ PR tree-optimization/61684 ++ * tree-ssa-ifcombine.c (recognize_single_bit_test): Make sure ++ rhs1 of conversion is a SSA_NAME before using SSA_NAME_DEF_STMT on it. ++ ++2014-06-30 Thomas Preud'homme ++ ++ Backport from Mainline ++ 2014-06-20 Jakub Jelinek ++ 2014-06-11 Thomas Preud'homme ++ ++ PR tree-optimization/61306 ++ * tree-ssa-math-opts.c (struct symbolic_number): Store type of ++ expression instead of its size. ++ (do_shift_rotate): Adapt to change in struct symbolic_number. Return ++ false to prevent optimization when the result is unpredictable due to ++ arithmetic right shift of signed type with highest byte is set. ++ (verify_symbolic_number_p): Adapt to change in struct symbolic_number. ++ (find_bswap_1): Likewise. Return NULL to prevent optimization when the ++ result is unpredictable due to sign extension. ++ (find_bswap): Adapt to change in struct symbolic_number. ++ ++2014-06-27 Uros Bizjak ++ ++ Backport from mainline ++ 2014-06-26 Uros Bizjak ++ ++ PR target/61586 ++ * config/alpha/alpha.c (alpha_handle_trap_shadows): Handle BARRIER RTX. ++ ++2014-06-26 Bill Schmidt ++ ++ PR target/61542 ++ * config/rs6000/vsx.md (vsx_extract_v4sf): Fix bug with element ++ extraction other than index 3. ++ ++2014-06-24 Jakub Jelinek ++ ++ PR target/61570 ++ * config/i386/driver-i386.c (host_detect_local_cpu): For unknown ++ model family 6 CPU with has_longmode never use a CPU without ++ 64-bit support. ++ ++2014-06-20 Chung-Lin Tang ++ ++ Backport from mainline ++ ++ 2014-06-20 Julian Brown ++ Chung-Lin Tang ++ ++ * config/arm/arm.c (arm_output_mi_thunk): Fix offset for ++ TARGET_THUMB1_ONLY. Add comments. ++ ++2014-06-18 Uros Bizjak ++ ++ Backport from mainline ++ 2014-06-06 Uros Bizjak ++ ++ PR target/61423 ++ * config/i386/i386.md (*floatunssi2_i387_with_xmm): New ++ define_insn_and_split pattern, merged from *floatunssi2_1 ++ and corresponding splitters. Zero extend general register ++ or memory input operand to XMM temporary. Enable for ++ TARGET_SSE2 and TARGET_INTER_UNIT_MOVES_TO_VEC only. ++ (floatunssi2): Update expander predicate. ++ ++2014-06-18 Richard Henderson ++ ++ PR target/61545 ++ * config/aarch64/aarch64.md (tlsdesc_small): Clobber CC_REGNUM. ++ ++2014-06-17 Nagaraju Mekala ++ ++ Revert on gcc-4_8-branch. ++ * config/microblaze/microblaze.md: Add movsi4_rev insn pattern. ++ * config/microblaze/predicates.md: Add reg_or_mem_operand predicate. ++ ++2014-06-17 Yufeng Zhang ++ ++ Backport from mainline ++ ++ PR target/61483 ++ * config/aarch64/aarch64.c (aarch64_layout_arg): Add new local ++ variable 'size'; calculate 'size' right in the front; use ++ 'size' to compute 'nregs' (when 'allocate_ncrn != 0') and ++ pcum->aapcs_stack_words. ++ ++2014-06-13 Peter Bergner ++ ++ Backport from mainline ++ ++ 2014-06-13 Peter Bergner ++ PR target/61415 ++ * config/rs6000/rs6000-builtin.def (BU_MISC_1): Delete. ++ (BU_MISC_2): Rename to ... ++ (BU_LDBL128_2): ... this. ++ * config/rs6000/rs6000.h (RS6000_BTM_LDBL128): New define. ++ (RS6000_BTM_COMMON): Add RS6000_BTM_LDBL128. ++ * config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Handle ++ RS6000_BTM_LDBL128. ++ (rs6000_invalid_builtin): Add long double 128-bit builtin support. ++ (rs6000_builtin_mask_names): Add RS6000_BTM_LDBL128. ++ * config/rs6000/rs6000.md (unpacktf_0): Remove define)expand. ++ (unpacktf_1): Likewise. ++ * doc/extend.texi (__builtin_longdouble_dw0): Remove documentation. ++ (__builtin_longdouble_dw1): Likewise. ++ * doc/sourcebuild.texi (longdouble128): Document. ++ ++2014-06-13 Jason Merrill ++ ++ PR c++/60731 ++ * common.opt (-fno-gnu-unique): Add. ++ * config/elfos.h (USE_GNU_UNIQUE_OBJECT): Check it. ++ ++2014-06-12 Georg-Johann Lay ++ ++ Backport from 2014-05-09 trunk r210272 ++ ++ * config/avr/avr-fixed.md (round3): Use -1U instead of -1 in ++ unsigned int initializers for regno_in, regno_out. ++ ++ Backport from 2014-05-14 trunk r210418 ++ * config/avr/avr.h (REG_CLASS_CONTENTS): Use unsigned suffix for ++ shifted values to avoid build warning. ++ ++ Backport from 2014-06-12 trunk r211491 ++ ++ PR target/61443 ++ * config/avr/avr.md (push1): Avoid (subreg(mem)) when ++ loading from address spaces. ++ ++2014-06-12 Alan Modra ++ ++ PR target/61300 ++ * doc/tm.texi.in (INCOMING_REG_PARM_STACK_SPACE): Document. ++ * doc/tm.texi: Regenerate. ++ * function.c (INCOMING_REG_PARM_STACK_SPACE): Provide default. ++ Use throughout in place of REG_PARM_STACK_SPACE. ++ * config/rs6000/rs6000.c (rs6000_reg_parm_stack_space): Add ++ "incoming" param. Pass to rs6000_function_parms_need_stack. ++ (rs6000_function_parms_need_stack): Add "incoming" param, ignore ++ prototype_p when incoming. Use function decl when incoming ++ to handle K&R style functions. ++ * config/rs6000/rs6000.h (REG_PARM_STACK_SPACE): Adjust. ++ (INCOMING_REG_PARM_STACK_SPACE): Define. ++ ++2014-06-06 Michael Meissner ++ ++ Back port from trunk ++ 2014-06-06 Michael Meissner ++ ++ PR target/61431 ++ * config/rs6000/vsx.md (VSX_LE): Split VSX_D into 2 separate ++ iterators, VSX_D that handles 64-bit types, and VSX_LE that ++ handles swapping the two 64-bit double words on little endian ++ systems. Include V1TImode and optionally TImode in VSX_LE so that ++ these types are properly swapped. Change all of the insns and ++ splits that do the 64-bit swaps to use VSX_LE. ++ (vsx_le_perm_load_): Likewise. ++ (vsx_le_perm_store_): Likewise. ++ (splitters for little endian memory operations): Likewise. ++ (vsx_xxpermdi2_le_): Likewise. ++ (vsx_lxvd2x2_le_): Likewise. ++ (vsx_stxvd2x2_le_): Likewise. ++ ++2014-06-05 Martin Jambor ++ ++ PR ipa/61393 ++ * ipa-cp.c (determine_versionability): Pretend that tm_clones are ++ not versionable. ++ ++2014-06-04 Richard Biener ++ ++ PR tree-optimization/61383 ++ * tree-ssa-ifcombine.c (bb_no_side_effects_p): Make sure ++ stmts can't trap. ++ ++2014-06-03 Andrey Belevantsev ++ ++ Backport from mainline ++ 2014-05-14 Andrey Belevantsev ++ ++ PR rtl-optimization/60866 ++ * sel-sched-ir (sel_init_new_insn): New parameter old_seqno. ++ Default it to -1. Pass it down to init_simplejump_data. ++ (init_simplejump_data): New parameter old_seqno. Pass it down ++ to get_seqno_for_a_jump. ++ (get_seqno_for_a_jump): New parameter old_seqno. Use it for ++ initializing new jump seqno as a last resort. Add comment. ++ (sel_redirect_edge_and_branch): Save old seqno of the conditional ++ jump and pass it down to sel_init_new_insn. ++ (sel_redirect_edge_and_branch_force): Likewise. ++ ++2014-06-03 Andrey Belevantsev ++ ++ Backport from mainline ++ 2014-05-14 Andrey Belevantsev ++ ++ PR rtl-optimization/60901 ++ * config/i386/i386.c (ix86_dependencies_evaluation_hook): Check that ++ bb predecessor belongs to the same scheduling region. Adjust comment. ++ ++2014-06-03 Uros Bizjak ++ ++ Backport from mainline ++ 2014-06-02 Uros Bizjak ++ ++ PR target/61239 ++ * config/i386/i386.c (ix86_expand_vec_perm) [case V32QImode]: Use ++ GEN_INT (-128) instead of GEN_INT (128) to set MSB of QImode constant. ++ ++2014-05-28 Guozhi Wei ++ ++ PR target/61202 ++ * config/aarch64/arm_neon.h (vqdmulh_n_s16): Change the last operand's ++ constraint. ++ (vqdmulhq_n_s16): Likewise. ++ ++2014-05-28 Eric Botcazou ++ ++ Backport from mainline ++ 2014-05-27 Eric Botcazou ++ ++ * double-int.c (div_and_round_double) : Use the proper ++ predicate to detect a negative quotient. ++ ++2014-05-28 Georg-Johann Lay ++ ++ PR target/61044 ++ * doc/extend.texi (Local Labels): Note that label differences are ++ not supported for AVR. ++ ++2014-05-26 Michael Tautschnig ++ ++ PR target/61249 ++ * doc/extend.texi (X86 Built-in Functions): Fix parameter lists of ++ __builtin_ia32_vfrczs[sd] and __builtin_ia32_mpsadbw256. ++ ++2014-05-23 Alan Modra ++ ++ PR target/61231 ++ * config/rs6000/rs6000.c (mem_operand_gpr): Handle SImode. ++ * config/rs6000/rs6000.md (extendsidi2_lfiwax, extendsidi2_nocell): ++ Use "Y" constraint rather than "m". ++ ++2014-05-22 Peter Bergner ++ ++ Backport from mainline ++ 2014-05-22 Peter Bergner ++ ++ * config/rs6000/htm.md (ttest): Use correct shift value to get CR0. ++ ++2014-05-22 Richard Earnshaw ++ ++ PR target/61208 ++ * arm.md (arm_cmpdi_unsigned): Fix length calculation for Thumb2. ++ ++2013-05-22 Richard Biener ++ ++ * BASE-VER: Set to 4.8.4. ++ * DEV-PHASE: Set to prerelease. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,14 @@ ++/* Test for deprecation messages on use of lvsl and lvsr for little endian. */ ++ ++/* { dg-do compile { target { powerpc64le-*-* } } } */ ++/* { dg-options "-O0 -Wdeprecated" } */ ++ ++#include ++ ++float f[20]; ++ ++void foo () ++{ ++ vector unsigned char a = vec_lvsl (4, f); /* { dg-warning "vec_lvsl is deprecated for little endian; use assignment for unaligned loads and stores" } */ ++ vector unsigned char b = vec_lvsr (8, f); /* { dg-warning "vec_lvsr is deprecated for little endian; use assignment for unaligned loads and stores" } */ ++} +Index: gcc/testsuite/gcc.target/powerpc/pr63335.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/pr63335.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/powerpc/pr63335.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,30 @@ ++/* { dg-do run { target { powerpc64*-*-* } } } */ ++/* { dg-require-effective-target powerpc_vsx_ok } */ ++/* { dg-options "-mvsx" } */ ++ ++#include ++ ++void abort (void); ++ ++vector double vec = (vector double) {99.0, 99.0}; ++ ++int main() { ++ ++ int actual = vec_all_nge(vec, vec); ++ if ( actual != 0) ++ abort(); ++ ++ actual = vec_all_nle(vec, vec); ++ if ( actual != 0) ++ abort(); ++ ++ actual = vec_any_nge(vec, vec); ++ if ( actual != 0) ++ abort(); ++ ++ actual = vec_any_nle(vec, vec); ++ if ( actual != 0) ++ abort(); ++ ++ return 0; ++} +Index: gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,7 +1,7 @@ + /* { dg-do compile { target { powerpc*-*-* } } } */ + /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ + /* { dg-require-effective-target powerpc_vsx_ok } */ +-/* { dg-options "-O3 -mcpu=power7" } */ ++/* { dg-options "-O3 -mcpu=power7 -Wno-deprecated" } */ + + /* Test the various load/store varients. */ + +Index: gcc/testsuite/gcc.target/powerpc/tfmode_off.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/tfmode_off.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.target/powerpc/tfmode_off.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,6 +1,7 @@ + /* { dg-do assemble } */ + /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ + /* { dg-skip-if "no TFmode" { powerpc-*-eabi* } { "*" } { "" } } */ ++/* { dg-require-effective-target longdouble128 } */ + /* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */ + + typedef float TFmode __attribute__ ((mode (TF))); +Index: gcc/testsuite/gcc.target/powerpc/pack02.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/pack02.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.target/powerpc/pack02.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2,6 +2,7 @@ + /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ + /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ + /* { dg-require-effective-target powerpc_fprs } */ ++/* { dg-require-effective-target longdouble128 } */ + /* { dg-options "-O2 -mhard-float" } */ + + #include +Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,12 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++/* { dg-options "-mabi=elfv2" } */ ++ ++struct f8 ++ { ++ float x[8]; ++ }; ++ ++void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */ ++{ ++} ++ +Index: gcc/testsuite/gcc.target/powerpc/htm-ttest.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/htm-ttest.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/powerpc/htm-ttest.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,14 @@ ++/* { dg-do compile { target { powerpc*-*-* } } } */ ++/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ ++/* { dg-require-effective-target powerpc_htm_ok } */ ++/* { dg-options "-O2 -mhtm" } */ ++ ++/* { dg-final { scan-assembler "rlwinm r?\[0-9\]+,r?\[0-9\]+,3,30,31" { target { ilp32 } } } } */ ++/* { dg-final { scan-assembler "rldicl r?\[0-9\]+,r?\[0-9\]+,35,62" { target { lp64 } } } } */ ++ ++#include ++long ++ttest (void) ++{ ++ return _HTM_STATE(__builtin_ttest()); ++} +Index: gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,21 @@ ++/* Test expected code generation for lvsl and lvsr on little endian. ++ Note that lvsl and lvsr are each produced once, but the filename ++ causes them to appear twice in the file. */ ++ ++/* { dg-do compile { target { powerpc64le-*-* } } } */ ++/* { dg-options "-O0 -Wno-deprecated" } */ ++/* { dg-final { scan-assembler-times "lvsl" 2 } } */ ++/* { dg-final { scan-assembler-times "lvsr" 2 } } */ ++/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */ ++/* { dg-final { scan-assembler-times "vperm" 2 } } */ ++ ++ ++#include ++ ++float f[20]; ++ ++void foo () ++{ ++ vector unsigned char a = vec_lvsl (4, f); ++ vector unsigned char b = vec_lvsr (8, f); ++} +Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,12 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++/* { dg-options "-mno-compat-align-parm" } */ ++ ++struct test ++ { ++ long a __attribute__((aligned (16))); ++ }; ++ ++void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment will change" } */ ++{ ++} ++ +Index: gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,9 @@ ++/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ ++/* { dg-require-effective-target powerpc_altivec_ok } */ ++/* { dg-options "-maltivec" } */ ++ ++struct test ++ { ++ int a __attribute__((vector_size (8))); ++ }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment will change" } */ ++ +Index: gcc/testsuite/gcc.target/powerpc/altivec-6.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/altivec-6.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.target/powerpc/altivec-6.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,6 +1,6 @@ + /* { dg-do compile { target powerpc*-*-* } } */ + /* { dg-require-effective-target powerpc_altivec_ok } */ +-/* { dg-options "-maltivec -O0 -Wall" } */ ++/* { dg-options "-maltivec -O0 -Wall -Wno-deprecated" } */ + + #include + +Index: gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,7 +1,7 @@ + /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ + /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */ + /* { dg-require-effective-target powerpc_altivec_ok } */ +-/* { dg-options "-maltivec -O2" } */ ++/* { dg-options "-maltivec -O2 -Wno-deprecated" } */ + + #include + +Index: gcc/testsuite/gcc.target/powerpc/altivec-20.c +=================================================================== +--- gcc/testsuite/gcc.target/powerpc/altivec-20.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.target/powerpc/altivec-20.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,5 +1,5 @@ + /* { dg-do compile { target powerpc_altivec_ok } } */ +-/* { dg-options "-maltivec -mcpu=G5 -O2" } */ ++/* { dg-options "-maltivec -mcpu=G5 -O2 -Wno-deprecated" } */ + + #include + +Index: gcc/testsuite/gcc.target/alpha/pr61586.c +=================================================================== +--- gcc/testsuite/gcc.target/alpha/pr61586.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/alpha/pr61586.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,10 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -mieee" } */ ++ ++void foo (int *dimensions, double **params, int hh) ++{ ++ if (params[hh]) ++ ; ++ else if (dimensions[hh] > 0) ++ params[hh][0] = 1.0f; ++} +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c +=================================================================== +--- gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,35 @@ ++/* Test AAPCS64 layout and __builtin_va_start. ++ ++ Pass named HFA/HVA argument on stack. */ ++ ++/* { dg-do run { target aarch64*-*-* } } */ ++ ++#ifndef IN_FRAMEWORK ++#define AAPCS64_TEST_STDARG ++#define TESTFILE "va_arg-14.c" ++#include "type-def.h" ++ ++struct hfa_fx2_t hfa_fx2 = {1.2f, 2.2f}; ++struct hfa_fx3_t hfa_fx3 = {3.2f, 4.2f, 5.2f}; ++vf4_t float32x4 = {6.2f, 7.2f, 8.2f, 9.2f}; ++vf4_t float32x4_2 = {10.2f, 11.2f, 12.2f, 13.2f}; ++ ++#include "abitest.h" ++#else ++ ARG (float, 1.0f, S0, 0) ++ ARG (float, 2.0f, S1, 1) ++ ARG (float, 3.0f, S2, 2) ++ ARG (float, 4.0f, S3, 3) ++ ARG (float, 5.0f, S4, 4) ++ ARG (float, 6.0f, S5, 5) ++ ARG (float, 7.0f, S6, 6) ++ ARG (struct hfa_fx3_t, hfa_fx3, STACK, 7) ++ /* Previous argument size has been rounded up to the nearest multiple of ++ 8 bytes. */ ++ ARG (struct hfa_fx2_t, hfa_fx2, STACK + 16, 8) ++ /* NSAA is rounded up to the nearest natural alignment of float32x4. */ ++ ARG (vf4_t, float32x4, STACK + 32, 9) ++ ARG (vf4_t, float32x4_2, STACK + 48, LAST_NAMED_ARG_ID) ++ DOTS ++ LAST_ANON (double, 123456789.987, STACK + 64, 11) ++#endif +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h +=================================================================== +--- gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -34,6 +34,13 @@ + float b; + }; + ++struct hfa_fx3_t ++{ ++ float a; ++ float b; ++ float c; ++}; ++ + struct hfa_dx2_t + { + double a; +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c +=================================================================== +--- gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,59 @@ ++/* Test AAPCS64 layout and __builtin_va_start. ++ ++ Pass named HFA/HVA argument on stack. */ ++ ++/* { dg-do run { target aarch64*-*-* } } */ ++ ++#ifndef IN_FRAMEWORK ++#define AAPCS64_TEST_STDARG ++#define TESTFILE "va_arg-13.c" ++ ++struct float_float_t ++{ ++ float a; ++ float b; ++} float_float; ++ ++union float_int_t ++{ ++ float b8; ++ int b5; ++} float_int; ++ ++#define HAS_DATA_INIT_FUNC ++void ++init_data () ++{ ++ float_float.a = 1.2f; ++ float_float.b = 2.2f; ++ ++ float_int.b8 = 4983.80f; ++} ++ ++#include "abitest.h" ++#else ++ ARG (float, 1.0f, S0, 0) ++ ARG (float, 2.0f, S1, 1) ++ ARG (float, 3.0f, S2, 2) ++ ARG (float, 4.0f, S3, 3) ++ ARG (float, 5.0f, S4, 4) ++ ARG (float, 6.0f, S5, 5) ++ ARG (float, 7.0f, S6, 6) ++ ARG (struct float_float_t, float_float, STACK, 7) ++ ARG (int, 9, W0, 8) ++ ARG (int, 10, W1, 9) ++ ARG (int, 11, W2, 10) ++ ARG (int, 12, W3, 11) ++ ARG (int, 13, W4, 12) ++ ARG (int, 14, W5, 13) ++ ARG (int, 15, W6, LAST_NAMED_ARG_ID) ++ DOTS ++ /* Note on the reason of using 'X7' instead of 'W7' here: ++ Using 'X7' makes sure the test works in the big-endian mode. ++ According to PCS rules B.4 and C.10, the size of float_int is rounded ++ to 8 bytes and prepared in the register X7 as if loaded via LDR from ++ the memory, with the content of the other 4 bytes unspecified. The ++ test framework will only compare the 4 relavent bytes. */ ++ ANON (union float_int_t, float_int, X7, 15) ++ LAST_ANON (long long, 12683143434LL, STACK + 8, 16) ++#endif +Index: gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c +=================================================================== +--- gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,39 @@ ++/* Test AAPCS64 layout and __builtin_va_start. ++ ++ Pass named __128int argument on stack. */ ++ ++/* { dg-do run { target aarch64*-*-* } } */ ++ ++#ifndef IN_FRAMEWORK ++#define AAPCS64_TEST_STDARG ++#define TESTFILE "va_arg-15.c" ++#include "type-def.h" ++ ++union int128_t qword; ++ ++#define HAS_DATA_INIT_FUNC ++void ++init_data () ++{ ++ /* Init signed quad-word integer. */ ++ qword.l64 = 0xfdb9753102468aceLL; ++ qword.h64 = 0xeca8642013579bdfLL; ++} ++ ++#include "abitest.h" ++#else ++ ARG (int, 1, W0, 0) ++ ARG (int, 2, W1, 1) ++ ARG (int, 3, W2, 2) ++ ARG (int, 4, W3, 3) ++ ARG (int, 5, W4, 4) ++ ARG (int, 6, W5, 5) ++ ARG (int, 7, W6, 6) ++ ARG (__int128, qword.i, STACK, LAST_NAMED_ARG_ID) ++ DOTS ++#ifndef __AAPCS64_BIG_ENDIAN__ ++ LAST_ANON (int, 8, STACK + 16, 8) ++#else ++ LAST_ANON (int, 8, STACK + 20, 8) ++#endif ++#endif +Index: gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c +=================================================================== +--- gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,14 @@ ++/* { dg-do assemble } */ ++/* { dg-options "-O2 -mfix-cortex-a53-835769" } */ ++ ++int ++test (int a, double b, int c, int d, int e) ++{ ++ double result; ++ __asm__ __volatile ("// %0, %1" ++ : "=w" (result) ++ : "0" (b) ++ : /* No clobbers */ ++ ); ++ return c * d + e; ++} +Index: gcc/testsuite/gcc.target/avr/torture/pr61443.c +=================================================================== +--- gcc/testsuite/gcc.target/avr/torture/pr61443.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/avr/torture/pr61443.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,134 @@ ++/* { dg-do run } */ ++/* { dg-options "-std=gnu99" } */ ++ ++#include ++#include ++ ++#define NC __attribute__((noinline,noclone)) ++ ++void NC vfun (char n, ...) ++{ ++ va_list ap; ++ ++ va_start (ap, n); ++ ++ switch (n) ++ { ++ default: ++ abort(); ++ case 1: ++ if (11 != va_arg (ap, int)) ++ abort(); ++ break; ++ case 2: ++ if (2222 != va_arg (ap, int)) ++ abort(); ++ break; ++ case 3: ++ if (333333 != va_arg (ap, __int24)) ++ abort(); ++ break; ++ case 4: ++ if (44444444 != va_arg (ap, long)) ++ abort(); ++ break; ++ case 8: ++ if (8888888888888888 != va_arg (ap, long long)) ++ abort(); ++ break; ++ } ++ ++ va_end (ap); ++} ++ ++ ++void NC boo_qi (const __flash char *p) ++{ ++ vfun (1, *p); ++} ++ ++void NC boox_qi (const __memx char *p) ++{ ++ vfun (1, *p); ++} ++ ++void NC boo_hi (const __flash int *p) ++{ ++ vfun (2, *p); ++} ++ ++void NC boox_hi (const __memx int *p) ++{ ++ vfun (2, *p); ++} ++ ++void NC boo_psi (const __flash __int24 *p) ++{ ++ vfun (3, *p); ++} ++ ++void NC boox_psi (const __memx __int24 *p) ++{ ++ vfun (3, *p); ++} ++ ++void NC boo_si (const __flash long *p) ++{ ++ vfun (4, *p); ++} ++ ++void NC boox_si (const __memx long *p) ++{ ++ vfun (4, *p); ++} ++ ++void NC boo_di (const __flash long long *p) ++{ ++ vfun (8, *p); ++} ++ ++void NC boox_di (const __memx long long *p) ++{ ++ vfun (8, *p); ++} ++ ++const __flash char f_qi = 11; ++const __flash int f_hi = 2222; ++const __flash __int24 f_psi = 333333; ++const __flash long f_si = 44444444; ++const __flash long long f_di = 8888888888888888; ++ ++const __memx char x_qi = 11; ++const __memx int x_hi = 2222; ++const __memx __int24 x_psi = 333333; ++const __memx long x_si = 44444444; ++const __memx long long x_di = 8888888888888888; ++ ++char r_qi = 11; ++int r_hi = 2222; ++__int24 r_psi = 333333; ++long r_si = 44444444; ++long long r_di = 8888888888888888; ++ ++int main (void) ++{ ++ boo_qi (&f_qi); ++ boo_hi (&f_hi); ++ boo_psi (&f_psi); ++ boo_si (&f_si); ++ boo_di (&f_di); ++ ++ boox_qi (&x_qi); ++ boox_hi (&x_hi); ++ boox_psi (&x_psi); ++ boox_si (&x_si); ++ boox_di (&x_di); ++ ++ boox_qi (&r_qi); ++ boox_hi (&r_hi); ++ boox_psi (&r_psi); ++ boox_si (&r_si); ++ boox_di (&r_di); ++ ++ exit (0); ++} +Index: gcc/testsuite/gcc.target/i386/pr61923.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr61923.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr61923.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,36 @@ ++/* PR debug/61923 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -fcompare-debug" } */ ++ ++typedef struct ++{ ++ struct ++ { ++ struct ++ { ++ char head; ++ } tickets; ++ }; ++} arch_spinlock_t; ++struct ext4_map_blocks ++{ ++ int m_lblk; ++ int m_len; ++ int m_flags; ++}; ++int ext4_da_map_blocks_ei_0; ++void fn1 (int p1, struct ext4_map_blocks *p2) ++{ ++ int ret; ++ if (p2->m_flags) ++ { ++ ext4_da_map_blocks_ei_0++; ++ arch_spinlock_t *lock; ++ switch (sizeof *&lock->tickets.head) ++ case 1: ++ asm("" : "+m"(*&lock->tickets.head) : ""(0)); ++ __asm__(""); ++ ret = 0; ++ } ++ fn2 (p2->m_lblk, p2->m_len); ++} +Index: gcc/testsuite/gcc.target/i386/pr61423.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr61423.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr61423.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,38 @@ ++/* PR target/61423 */ ++/* { dg-do run { target ia32 } } */ ++/* { dg-options "-O1 -ftree-vectorize -msse2 -mfpmath=387 -mtune=core2" } */ ++ ++#define N 1024 ++static unsigned int A[N]; ++ ++double ++__attribute__((noinline)) ++func (void) ++{ ++ unsigned int sum = 0; ++ unsigned i; ++ double t; ++ ++ for (i = 0; i < N; i++) ++ sum += A[i]; ++ ++ t = sum; ++ return t; ++} ++ ++int ++main () ++{ ++ unsigned i; ++ double d; ++ ++ for(i = 0; i < N; i++) ++ A[i] = 1; ++ ++ d = func(); ++ ++ if (d != 1024.0) ++ __builtin_abort (); ++ ++ return 0; ++} +Index: gcc/testsuite/gcc.target/i386/pr60901.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr60901.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr60901.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,17 @@ ++/* { dg-options "-O -fselective-scheduling -fschedule-insns -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fno-tree-dominator-opts" } */ ++ ++extern int n; ++extern void bar (void); ++extern int baz (int); ++ ++void ++foo (void) ++{ ++ int i, j; ++ for (j = 0; j < n; j++) ++ { ++ for (i = 1; i < j; i++) ++ bar (); ++ baz (0); ++ } ++} +Index: gcc/testsuite/gcc.target/i386/pr61801.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr61801.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr61801.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,21 @@ ++/* PR rtl-optimization/61801 */ ++/* { dg-do compile } */ ++/* { dg-options "-Os -fcompare-debug" } */ ++ ++int a, c; ++int bar (void); ++void baz (void); ++ ++void ++foo (void) ++{ ++ int d; ++ if (bar ()) ++ { ++ int e; ++ baz (); ++ asm volatile ("" : "=a" (e) : "0" (a), "i" (0)); ++ d = e; ++ } ++ c = d; ++} +Index: gcc/testsuite/gcc.target/i386/pr61446.c +=================================================================== +--- gcc/testsuite/gcc.target/i386/pr61446.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/i386/pr61446.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,14 @@ ++/* PR rtl-optimization/61446 */ ++ ++/* { dg-do compile { target { ia32 } } } */ ++/* { dg-options "-O2 -march=corei7 -mfpmath=387" } */ ++ ++unsigned long long ++foo (float a) ++{ ++ const double dfa = a; ++ const unsigned int hi = dfa / 0x1p32f; ++ const unsigned int lo = dfa - (double) hi * 0x1p32f; ++ ++ return ((unsigned long long) hi << (4 * (8))) | lo; ++} +Index: gcc/testsuite/gcc.target/mips/pr62030-octeon.c +=================================================================== +--- gcc/testsuite/gcc.target/mips/pr62030-octeon.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/mips/pr62030-octeon.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,50 @@ ++/* { dg-do run } */ ++/* { dg-options "-march=octeon" } */ ++ ++extern void abort (void); ++ ++struct node ++{ ++ struct node *next; ++ struct node *prev; ++}; ++ ++struct node node; ++ ++struct head ++{ ++ struct node *first; ++}; ++ ++struct head heads[5]; ++ ++int k = 2; ++ ++struct head *head = &heads[2]; ++ ++static int __attribute__((noinline)) ++foo (void) ++{ ++ node.prev = (void *)head; ++ head->first = &node; ++ ++ struct node *n = head->first; ++ struct head *h = &heads[k]; ++ struct node *next = n->next; ++ ++ if (n->prev == (void *)h) ++ h->first = next; ++ else ++ n->prev->next = next; ++ ++ n->next = h->first; ++ return n->next == &node; ++} ++ ++int ++main (void) ++{ ++ if (foo ()) ++ abort (); ++ return 0; ++} +Index: gcc/testsuite/gcc.target/sh/pr61996.c +=================================================================== +--- gcc/testsuite/gcc.target/sh/pr61996.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.target/sh/pr61996.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,12 @@ ++/* Check that the option -musermode has no effect on targets that do not ++ support user/privileged mode and that it does not interfere with option ++ -matomic-model=soft-imask. */ ++/* { dg-do compile } */ ++/* { dg-options "-matomic-model=soft-imask" } */ ++/* { dg-skip-if "" { "sh*-*-*" } { "*"} { "-m1*" "-m2*" } } */ ++ ++int ++test (void) ++{ ++ return 0; ++} +Index: gcc/testsuite/lib/target-supports.exp +=================================================================== +--- gcc/testsuite/lib/target-supports.exp (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/lib/target-supports.exp (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1790,6 +1790,15 @@ + }] + } + ++# Return 1 if the target supports long double of 128 bits, ++# 0 otherwise. ++ ++proc check_effective_target_longdouble128 { } { ++ return [check_no_compiler_messages longdouble128 object { ++ int dummy[sizeof(long double) == 16 ? 1 : -1]; ++ }] ++} ++ + # Return 1 if the target supports double of 64 bits, + # 0 otherwise. + +@@ -5329,3 +5338,40 @@ + return 0 + } + } ++ ++# Return 1 if is available with all the standard IEEE ++# exceptions and floating-point exceptions are raised by arithmetic ++# operations. (If the target requires special options for "inexact" ++# exceptions, those need to be specified in the testcases.) ++ ++proc check_effective_target_fenv_exceptions {} { ++ return [check_runtime fenv_exceptions { ++ #include ++ #include ++ #ifndef FE_DIVBYZERO ++ # error Missing FE_DIVBYZERO ++ #endif ++ #ifndef FE_INEXACT ++ # error Missing FE_INEXACT ++ #endif ++ #ifndef FE_INVALID ++ # error Missing FE_INVALID ++ #endif ++ #ifndef FE_OVERFLOW ++ # error Missing FE_OVERFLOW ++ #endif ++ #ifndef FE_UNDERFLOW ++ # error Missing FE_UNDERFLOW ++ #endif ++ volatile float a = 0.0f, r; ++ int ++ main (void) ++ { ++ r = a / a; ++ if (fetestexcept (FE_INVALID)) ++ exit (0); ++ else ++ abort (); ++ } ++ } "-std=gnu99"] ++} +Index: gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,6 +1,6 @@ + ! { dg-require-effective-target fortran_large_real } +-! { dg-do run { xfail powerpc*-apple-darwin* powerpc*-*-linux* } } +-! Test XFAILed on these platforms because the system's printf() lacks ++! { dg-do run { xfail powerpc*-apple-darwin* } } ++! Test XFAILed on this platform because the system's printf() lacks + ! proper support for denormalized long doubles. See PR24685 + ! + ! This tests that the default formats for formatted I/O of reals are +Index: gcc/testsuite/gfortran.dg/dot_product_3.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/dot_product_3.f90 (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/dot_product_3.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,15 @@ ++! { dg-do compile } ++! { dg-options "-fdump-tree-original" } ++! PR 61999 - this used to ICE. ++! Original test case by A. Kasahara ++program main ++ use, intrinsic:: iso_fortran_env, only: output_unit ++ ++ implicit none ++ ++ write(output_unit, *) dot_product([1, 2], [2.0, 3.0]) ++ ++ stop ++end program main ++! { dg-final { scan-tree-dump-times "8\\.0e\\+0" 1 "original" } } ++! { dg-final { cleanup-tree-dump "original" } } +Index: gcc/testsuite/gfortran.dg/gomp/pr59488-1.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/gomp/pr59488-1.f90 (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/gomp/pr59488-1.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,13 @@ ++! PR fortran/59488 ++! { dg-do compile } ++! { dg-options "-fopenmp" } ++ ++ implicit none ++ integer, parameter :: p(2) = (/ 11, 12 /) ++ integer :: r ++ ++ !$omp parallel do default(none) ++ do r = 1, 2 ++ print *, p(r) ++ end do ++end +Index: gcc/testsuite/gfortran.dg/gomp/pr59488-2.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/gomp/pr59488-2.f90 (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/gomp/pr59488-2.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,16 @@ ++! PR fortran/59488 ++! { dg-do compile } ++! { dg-options "-fopenmp" } ++ ++ implicit none ++ type t ++ integer :: s1, s2, s3 ++ end type ++ integer :: r ++ type(t), parameter :: u = t(1, 2, 3) ++ ++ !$omp parallel do default(none) ++ do r = 1, 2 ++ print *, u ++ end do ++end +Index: gcc/testsuite/gfortran.dg/cray_pointers_10.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/cray_pointers_10.f90 (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/cray_pointers_10.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,18 @@ ++! { dg-do run } ++! { dg-options "-fcray-pointer" } ++! ++! PR fortran/45187 ++! ++module foo ++ implicit none ++ real :: a ++ pointer(c_a, a) ++end module foo ++ ++program test ++ use foo ++ real :: z ++ c_a = loc(z) ++ a = 42 ++ if (z /= 42) call abort ++end program test +Index: gcc/testsuite/gfortran.dg/dependency_44.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/dependency_44.f90 (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/dependency_44.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,36 @@ ++! { dg-do run } ++! Tests fix for PR61780 in which the loop reversal mechanism was ++! not accounting for the first index being an element so that no ++! loop in this dimension is created. ++! ++! Contributed by Manfred Tietze on clf. ++! ++program prgm3 ++ implicit none ++ integer, parameter :: n = 10, k = 3 ++ integer :: i, j ++ integer, dimension(n,n) :: y ++ integer :: res1(n), res2(n) ++ ++1 format(10i5) ++ ++!initialize ++ do i=1,n ++ do j=1,n ++ y(i,j) = n*i + j ++ end do ++ end do ++ res2 = y(k,:) ++ ++!shift right ++ y(k,4:n) = y(k,3:n-1) ++ y(k,3) = 0 ++ res1 = y(k,:) ++ y(k,:) = res2 ++ y(k,n:4:-1) = y(k,n-1:3:-1) ++ y(k,3) = 0 ++ res2 = y(k,:) ++! print *, res1 ++! print *, res2 ++ if (any(res1 /= res2)) call abort () ++end program prgm3 +Index: gcc/testsuite/gfortran.dg/oldstyle_5.f +=================================================================== +--- gcc/testsuite/gfortran.dg/oldstyle_5.f (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/oldstyle_5.f (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,8 @@ ++C { dg-do compile } ++ TYPE T ++ INTEGER A(2)/1,2/ ! { dg-error "Invalid old style initialization for derived type component" } ++ END TYPE ++ TYPE S ++ INTEGER B/1/ ! { dg-error "Invalid old style initialization for derived type component" } ++ END TYPE ++ END +Index: gcc/testsuite/gfortran.dg/nint_2.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/nint_2.f90 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gfortran.dg/nint_2.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -4,7 +4,8 @@ + ! http://gcc.gnu.org/ml/fortran/2005-04/msg00139.html + ! + ! { dg-do run } +-! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc*-*-linux* *-*-mingw* } { "-O0" } { "" } } ++! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc-*-linux* powerpc64-*-linux* *-*-mingw* } { "-O0" } { "" } } ++! Note that this doesn't fail on powerpc64le-*-linux*. + real(kind=8) :: a + integer(kind=8) :: i1, i2 + real :: b +Index: gcc/testsuite/gfortran.dg/pointer_intent_7.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/pointer_intent_7.f90 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gfortran.dg/pointer_intent_7.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -23,7 +23,7 @@ + call bar2 (c) + call bar3 (c) + call bar2p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } +- call bar3p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } ++ call bar3p (b) ! { dg-error "Actual argument to .n. at \\(1\\) must be polymorphic" } + call bar2p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } + call bar3p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } + end subroutine +Index: gcc/testsuite/gfortran.dg/array_assignment_5.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/array_assignment_5.f90 (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/array_assignment_5.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,16 @@ ++! { dg-do run } ++! { dg-options "-ffrontend-optimize" } ++! PR 62214 - this used to give the wrong result. ++! Original test case by Oliver Fuhrer ++PROGRAM test ++ IMPLICIT NONE ++ CHARACTER(LEN=20) :: fullNames(2) ++ CHARACTER(LEN=255) :: pathName ++ CHARACTER(LEN=5) :: fileNames(2) ++ ++ pathName = "/dir1/dir2/" ++ fileNames = (/ "file1", "file2" /) ++ fullNames = SPREAD(TRIM(pathName),1,2) // fileNames ++ if (fullNames(1) /= '/dir1/dir2/file1' .or. & ++ & fullnames(2) /= '/dir1/dir2/file2') call abort ++END PROGRAM test +Index: gcc/testsuite/gfortran.dg/pr45636.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/pr45636.f90 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gfortran.dg/pr45636.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -10,5 +10,5 @@ + b = y + call sub(a, b) + end program main +-! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { mips*-*-* && { ! nomips16 } } } } } ++! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { { hppa*-*-* && { ! lp64 } } || { mips*-*-* && { ! nomips16 } } } } } } + ! { dg-final { cleanup-tree-dump "forwprop2" } } +Index: gcc/testsuite/gfortran.dg/allocatable_function_8.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/allocatable_function_8.f90 (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gfortran.dg/allocatable_function_8.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,47 @@ ++! { dg-do run } ++! Test the fix for PR61459. ++! ++! Contributed by John Wingate ++! ++module a ++ ++ implicit none ++ private ++ public :: f_segfault, f_segfault_plus, f_workaround ++ integer, dimension(2,2) :: b = reshape([1,-1,1,1],[2,2]) ++ ++contains ++ ++ function f_segfault(x) ++ real, dimension(:), allocatable :: f_segfault ++ real, dimension(:), intent(in) :: x ++ allocate(f_segfault(2)) ++ f_segfault = matmul(b,x) ++ end function f_segfault ++ ++! Sefaulted without the ALLOCATE as well. ++ function f_segfault_plus(x) ++ real, dimension(:), allocatable :: f_segfault_plus ++ real, dimension(:), intent(in) :: x ++ f_segfault_plus = matmul(b,x) ++ end function f_segfault_plus ++ ++ function f_workaround(x) ++ real, dimension(:), allocatable :: f_workaround ++ real, dimension(:), intent(in) :: x ++ real, dimension(:), allocatable :: tmp ++ allocate(f_workaround(2),tmp(2)) ++ tmp = matmul(b,x) ++ f_workaround = tmp ++ end function f_workaround ++ ++end module a ++ ++program main ++ use a ++ implicit none ++ real, dimension(2) :: x = 1.0, y ++ y = f_workaround (x) ++ if (any (f_segfault (x) .ne. y)) call abort ++ if (any (f_segfault_plus (x) .ne. y)) call abort ++end program main +Index: gcc/testsuite/gfortran.dg/bessel_7.f90 +=================================================================== +--- gcc/testsuite/gfortran.dg/bessel_7.f90 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gfortran.dg/bessel_7.f90 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -16,7 +16,7 @@ + implicit none + real,parameter :: values(*) = [0.0, 0.5, 1.0, 0.9, 1.8,2.0,3.0,4.0,4.25,8.0,34.53, 475.78] + real,parameter :: myeps(size(values)) = epsilon(0.0) & +- * [2, 3, 4, 5, 8, 2, 12, 6, 7, 6, 36, 168 ] ++ * [2, 3, 4, 5, 8, 2, 13, 6, 7, 6, 36, 168 ] + ! The following is sufficient for me - the values above are a bit + ! more tolerant + ! * [0, 0, 0, 3, 3, 0, 9, 0, 2, 1, 22, 130 ] +Index: gcc/testsuite/gcc.c-torture/execute/pr61306-1.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/pr61306-1.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/pr61306-1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,39 @@ ++#ifdef __INT32_TYPE__ ++typedef __INT32_TYPE__ int32_t; ++#else ++typedef int int32_t; ++#endif ++ ++#ifdef __UINT32_TYPE__ ++typedef __UINT32_TYPE__ uint32_t; ++#else ++typedef unsigned uint32_t; ++#endif ++ ++#define __fake_const_swab32(x) ((uint32_t)( \ ++ (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ ++ (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ ++ (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ ++ (( (int32_t)(x) & (int32_t)0xff000000UL) >> 24))) ++ ++/* Previous version of bswap optimization failed to consider sign extension ++ and as a result would replace an expression *not* doing a bswap by a ++ bswap. */ ++ ++__attribute__ ((noinline, noclone)) uint32_t ++fake_bswap32 (uint32_t in) ++{ ++ return __fake_const_swab32 (in); ++} ++ ++int ++main(void) ++{ ++ if (sizeof (int32_t) * __CHAR_BIT__ != 32) ++ return 0; ++ if (sizeof (uint32_t) * __CHAR_BIT__ != 32) ++ return 0; ++ if (fake_bswap32 (0x87654321) != 0xffffff87) ++ __builtin_abort (); ++ return 0; ++} +Index: gcc/testsuite/gcc.c-torture/execute/pr23135.x +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/pr23135.x (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/pr23135.x (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,2 @@ ++set additional_flags "-Wno-psabi" ++return 0 +Index: gcc/testsuite/gcc.c-torture/execute/bitfld-6.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/bitfld-6.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/bitfld-6.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,23 @@ ++union U ++{ ++ const int a; ++ unsigned b : 20; ++}; ++ ++static union U u = { 0x12345678 }; ++ ++/* Constant folding used to fail to account for endianness when folding a ++ union. */ ++ ++int ++main (void) ++{ ++#ifdef __BYTE_ORDER__ ++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ++ return u.b - 0x45678; ++#else ++ return u.b - 0x12345; ++#endif ++#endif ++ return 0; ++} +Index: gcc/testsuite/gcc.c-torture/execute/pr61306-3.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/pr61306-3.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/pr61306-3.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,13 @@ ++short a = -1; ++int b; ++char c; ++ ++int ++main () ++{ ++ c = a; ++ b = a | c; ++ if (b != -1) ++ __builtin_abort (); ++ return 0; ++} +Index: gcc/testsuite/gcc.c-torture/execute/20050604-1.x +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/20050604-1.x (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.c-torture/execute/20050604-1.x (.../branches/gcc-4_8-branch) (revision 217117) +@@ -6,4 +6,5 @@ + set additional_flags "-mno-mmx" + } + ++set additional_flags "-Wno-psabi" + return 0 +Index: gcc/testsuite/gcc.c-torture/execute/pr61306-2.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/pr61306-2.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/pr61306-2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,40 @@ ++#ifdef __INT16_TYPE__ ++typedef __INT16_TYPE__ int16_t; ++#else ++typedef short int16_t; ++#endif ++ ++#ifdef __UINT32_TYPE__ ++typedef __UINT32_TYPE__ uint32_t; ++#else ++typedef unsigned uint32_t; ++#endif ++ ++#define __fake_const_swab32(x) ((uint32_t)( \ ++ (((uint32_t) (x) & (uint32_t)0x000000ffUL) << 24) | \ ++ (((uint32_t)(int16_t)(x) & (uint32_t)0x00ffff00UL) << 8) | \ ++ (((uint32_t) (x) & (uint32_t)0x00ff0000UL) >> 8) | \ ++ (((uint32_t) (x) & (uint32_t)0xff000000UL) >> 24))) ++ ++ ++/* Previous version of bswap optimization failed to consider sign extension ++ and as a result would replace an expression *not* doing a bswap by a ++ bswap. */ ++ ++__attribute__ ((noinline, noclone)) uint32_t ++fake_bswap32 (uint32_t in) ++{ ++ return __fake_const_swab32 (in); ++} ++ ++int ++main(void) ++{ ++ if (sizeof (uint32_t) * __CHAR_BIT__ != 32) ++ return 0; ++ if (sizeof (int16_t) * __CHAR_BIT__ != 16) ++ return 0; ++ if (fake_bswap32 (0x81828384) != 0xff838281) ++ __builtin_abort (); ++ return 0; ++} +Index: gcc/testsuite/gcc.c-torture/execute/pr61375.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/pr61375.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/pr61375.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,35 @@ ++#ifdef __UINT64_TYPE__ ++typedef __UINT64_TYPE__ uint64_t; ++#else ++typedef unsigned long long uint64_t; ++#endif ++ ++#ifndef __SIZEOF_INT128__ ++#define __int128 long long ++#endif ++ ++/* Some version of bswap optimization would ICE when analyzing a mask constant ++ too big for an HOST_WIDE_INT (PR61375). */ ++ ++__attribute__ ((noinline, noclone)) uint64_t ++uint128_central_bitsi_ior (unsigned __int128 in1, uint64_t in2) ++{ ++ __int128 mask = (__int128)0xffff << 56; ++ return ((in1 & mask) >> 56) | in2; ++} ++ ++int ++main (int argc) ++{ ++ __int128 in = 1; ++#ifdef __SIZEOF_INT128__ ++ in <<= 64; ++#endif ++ if (sizeof (uint64_t) * __CHAR_BIT__ != 64) ++ return 0; ++ if (sizeof (unsigned __int128) * __CHAR_BIT__ != 128) ++ return 0; ++ if (uint128_central_bitsi_ior (in, 2) != 0x102) ++ __builtin_abort (); ++ return 0; ++} +Index: gcc/testsuite/gcc.c-torture/execute/20050316-1.x +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/20050316-1.x (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.c-torture/execute/20050316-1.x (.../branches/gcc-4_8-branch) (revision 217117) +@@ -4,4 +4,5 @@ + return 1 + } + ++set additional_flags "-Wno-psabi" + return 0; +Index: gcc/testsuite/gcc.c-torture/execute/20050316-3.x +=================================================================== +--- gcc/testsuite/gcc.c-torture/execute/20050316-3.x (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/execute/20050316-3.x (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,2 @@ ++set additional_flags "-Wno-psabi" ++return 0 +Index: gcc/testsuite/gcc.c-torture/compile/pr61684.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/compile/pr61684.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/compile/pr61684.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,15 @@ ++/* PR tree-optimization/61684 */ ++ ++int a, c; ++static int *b = 0; ++short d; ++static short **e = 0; ++ ++void ++foo () ++{ ++ for (; c < 1; c++) ++ ; ++ *e = &d; ++ a = d && (c && 1) & *b; ++} +Index: gcc/testsuite/gcc.c-torture/compile/pr63282.c +=================================================================== +--- gcc/testsuite/gcc.c-torture/compile/pr63282.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.c-torture/compile/pr63282.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,13 @@ ++/* PR inline-asm/63282 */ ++ ++void bar (void); ++ ++void ++foo (void) ++{ ++ asm volatile goto ("" : : : : a, b); ++a: ++ bar (); ++b: ++ return; ++} +Index: gcc/testsuite/gnat.dg/opt41_pkg.adb +=================================================================== +--- gcc/testsuite/gnat.dg/opt41_pkg.adb (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gnat.dg/opt41_pkg.adb (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,53 @@ ++with Ada.Streams; use Ada.Streams; ++ ++package body Opt41_Pkg is ++ ++ type Wstream is new Root_Stream_Type with record ++ S : Unbounded_String; ++ end record; ++ ++ procedure Read (Stream : in out Wstream; ++ Item : out Stream_Element_Array; ++ Last : out Stream_Element_Offset) is null; ++ ++ procedure Write (Stream : in out Wstream; Item : Stream_Element_Array) is ++ begin ++ for J in Item'Range loop ++ Append (Stream.S, Character'Val (Item (J))); ++ end loop; ++ end Write; ++ ++ function Rec_Write (R : Rec) return Unbounded_String is ++ S : aliased Wstream; ++ begin ++ Rec'Output (S'Access, R); ++ return S.S; ++ end Rec_Write; ++ ++ type Rstream is new Root_Stream_Type with record ++ S : String_Access; ++ Idx : Integer := 1; ++ end record; ++ ++ procedure Write (Stream : in out Rstream; Item : Stream_Element_Array) is null; ++ ++ procedure Read (Stream : in out Rstream; ++ Item : out Stream_Element_Array; ++ Last : out Stream_Element_Offset) is ++ begin ++ Last := Stream_Element_Offset'Min ++ (Item'Last, Item'First + Stream_Element_Offset (Stream.S'Last - Stream.Idx)); ++ for I in Item'First .. Last loop ++ Item (I) := Stream_Element (Character'Pos (Stream.S (Stream.Idx))); ++ Stream.Idx := Stream.Idx + 1; ++ end loop; ++ end Read; ++ ++ function Rec_Read (Str : String_Access) return Rec is ++ S : aliased Rstream; ++ begin ++ S.S := Str; ++ return Rec'Input (S'Access); ++ end Rec_Read; ++ ++end Opt41_Pkg; +Index: gcc/testsuite/gnat.dg/opt41_pkg.ads +=================================================================== +--- gcc/testsuite/gnat.dg/opt41_pkg.ads (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gnat.dg/opt41_pkg.ads (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,28 @@ ++with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; ++ ++package Opt41_Pkg is ++ ++ type Enum is (One, Two, Three, Four, Five, Six); ++ ++ type Rec (D : Enum) is record ++ case D is ++ when One => ++ I : Integer; ++ when Two | Five | Six => ++ S : Unbounded_String; ++ case D is ++ when Two => B : Boolean; ++ when others => null; ++ end case; ++ when others => ++ null; ++ end case; ++ end record; ++ ++ type Rec_Ptr is access all Rec; ++ ++ function Rec_Write (R : Rec) return Unbounded_String; ++ ++ function Rec_Read (Str : String_Access) return Rec; ++ ++end Opt41_Pkg; +Index: gcc/testsuite/gnat.dg/opt39.adb +=================================================================== +--- gcc/testsuite/gnat.dg/opt39.adb (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gnat.dg/opt39.adb (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,31 @@ ++-- { dg-do compile } ++-- { dg-options "-O2 -fno-inline -fdump-tree-optimized" } ++ ++procedure Opt39 (I : Integer) is ++ ++ type Rec is record ++ I1 : Integer; ++ I2 : Integer; ++ I3 : Integer; ++ I4 : Integer; ++ I5 : Integer; ++ end record; ++ ++ procedure Set (A : access Rec; I : Integer) is ++ Tmp : Rec := A.all; ++ begin ++ Tmp.I1 := I; ++ A.all := Tmp; ++ end; ++ ++ R : aliased Rec; ++ ++begin ++ Set (R'Access, I); ++ if R.I1 /= I then ++ raise Program_Error; ++ end if; ++end; ++ ++-- { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } ++-- { dg-final { cleanup-tree-dump "optimized" } } +Index: gcc/testsuite/gnat.dg/opt41.adb +=================================================================== +--- gcc/testsuite/gnat.dg/opt41.adb (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gnat.dg/opt41.adb (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,15 @@ ++-- { dg-do run } ++-- { dg-options "-Os" } ++ ++with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; ++with Opt41_Pkg; use Opt41_Pkg; ++ ++procedure Opt41 is ++ R : Rec := (Five, To_Unbounded_String ("CONFIG")); ++ SP : String_Access := new String'(To_String (Rec_Write (R))); ++ RP : Rec_Ptr := new Rec'(Rec_Read (SP)); ++begin ++ if RP.D /= R.D then ++ raise Program_Error; ++ end if; ++end; +Index: gcc/testsuite/gnat.dg/overflow_fixed.adb +=================================================================== +--- gcc/testsuite/gnat.dg/overflow_fixed.adb (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gnat.dg/overflow_fixed.adb (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,19 @@ ++-- { dg-do run } ++-- { dg-options "-gnato -O" } ++ ++procedure Overflow_Fixed is ++ ++ type Unsigned_8_Bit is mod 2**8; ++ ++ procedure Fixed_To_Eight (Value : Duration) is ++ Item : Unsigned_8_Bit; ++ begin ++ Item := Unsigned_8_Bit(Value); ++ raise Program_Error; ++ exception ++ when Constraint_Error => null; -- expected case ++ end; ++ ++begin ++ Fixed_To_Eight (-0.5); ++end; +Index: gcc/testsuite/gnat.dg/aliasing1.adb +=================================================================== +--- gcc/testsuite/gnat.dg/aliasing1.adb (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gnat.dg/aliasing1.adb (.../branches/gcc-4_8-branch) (revision 217117) +@@ -18,5 +18,5 @@ + + end Aliasing1; + +--- { dg-final { scan-tree-dump-not "__gnat_rcheck" "optimized" } } ++-- { dg-final { scan-tree-dump-not "gnat_rcheck" "optimized" } } + -- { dg-final { cleanup-tree-dump "optimized" } } +Index: gcc/testsuite/gcc.dg/pr60866.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr60866.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr60866.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,18 @@ ++/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ ++/* { dg-options "-O -fselective-scheduling -fno-if-conversion -fschedule-insns" } */ ++ ++int n; ++ ++void ++foo (int w, int **dnroot, int **dn) ++{ ++ int *child; ++ int *xchild = xchild; ++ for (; w < n; w++) ++ if (!dnroot) ++ { ++ dnroot = dn; ++ for (child = *dn; child; child = xchild) ++ ; ++ } ++} +Index: gcc/testsuite/gcc.dg/vmx/3c-01a.c +=================================================================== +--- gcc/testsuite/gcc.dg/vmx/3c-01a.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.dg/vmx/3c-01a.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,4 +1,5 @@ + /* { dg-do compile } */ ++/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ + #include + typedef const volatile unsigned int _1; + typedef const unsigned int _2; +Index: gcc/testsuite/gcc.dg/vmx/ops.c +=================================================================== +--- gcc/testsuite/gcc.dg/vmx/ops.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.dg/vmx/ops.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,4 +1,5 @@ + /* { dg-do compile } */ ++/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ + #include + #include + extern char * *var_char_ptr; +Index: gcc/testsuite/gcc.dg/vmx/ops-long-1.c +=================================================================== +--- gcc/testsuite/gcc.dg/vmx/ops-long-1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.dg/vmx/ops-long-1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,4 +1,5 @@ + /* { dg-do compile } */ ++/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ + + /* Checks from the original ops.c that pass pointers to long or + unsigned long for operations that support that in released versions +Index: gcc/testsuite/gcc.dg/pr63342.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr63342.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr63342.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,26 @@ ++/* PR debug/63342 */ ++/* { dg-do compile } */ ++/* { dg-options "-g -O2" } */ ++/* { dg-additional-options "-fpic" { target fpic } } */ ++ ++static __thread double u[9], v[9]; ++ ++void ++foo (double **p, double **q) ++{ ++ *p = u; ++ *q = v; ++} ++ ++double ++bar (double x) ++{ ++ int i; ++ double s = 0.0; ++ for (i = 0; i < 9; i++) ++ { ++ double a = x + v[i]; ++ s += u[i] * a * a; ++ } ++ return s; ++} +Index: gcc/testsuite/gcc.dg/pr63284.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr63284.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr63284.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,42 @@ ++/* PR debug/63284 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -fcompare-debug" } */ ++ ++int a[10], *b, *d, c, f; ++int fn2 (void); ++void fn3 (void); ++void fn4 (int); ++ ++static int ++fn1 (int x) ++{ ++ int e = a[0]; ++ if (e) ++ return 1; ++ if (b) ++ switch (x) ++ { ++ case 1: ++ if (d) ++ e = fn2 (); ++ else ++ fn3 (); ++ break; ++ case 0: ++ if (d) ++ { ++ fn3 (); ++ if (c) ++ fn4 (1); ++ } ++ else ++ fn4 (0); ++ } ++ return e; ++} ++ ++void ++fn6 (void) ++{ ++ f = fn1 (0); ++} +Index: gcc/testsuite/gcc.dg/pr61045.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr61045.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr61045.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,12 @@ ++/* { dg-do run } */ ++/* { dg-options "-fstrict-overflow" } */ ++ ++int main () ++{ ++ int a = 0; ++ int b = __INT_MAX__; ++ int t = (a - 2) > (b - 1); ++ if (t != 0) ++ __builtin_abort(); ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/pr52769.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr52769.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr52769.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,24 @@ ++/* PR c/52769 */ ++/* { dg-do run } */ ++/* { dg-options "-O3" } */ ++ ++typedef struct ++{ ++ int should_be_zero; ++ char s[6]; ++ int x; ++} foo_t; ++ ++int ++main (void) ++{ ++ volatile foo_t foo = { ++ .s = "123456", ++ .x = 2 ++ }; ++ ++ if (foo.should_be_zero != 0) ++ __builtin_abort (); ++ ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/pr62004.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr62004.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr62004.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,47 @@ ++/* { dg-do run } */ ++/* { dg-options "-O2 -fno-tree-tail-merge" } */ ++ ++struct node ++{ ++ struct node *next; ++ struct node *prev; ++}; ++ ++struct node node; ++ ++struct head ++{ ++ struct node *first; ++}; ++ ++struct head heads[5]; ++ ++int k = 2; ++ ++struct head *head = &heads[2]; ++ ++int ++main () ++{ ++ struct node *p; ++ ++ node.next = (void*)0; ++ ++ node.prev = (void *)head; ++ ++ head->first = &node; ++ ++ struct node *n = head->first; ++ ++ struct head *h = &heads[k]; ++ ++ heads[2].first = n->next; ++ ++ if ((void*)n->prev == (void *)h) ++ p = h->first; ++ else ++ /* Dead tbaa-unsafe load from ((struct node *)&heads[2])->next. */ ++ p = n->prev->next; ++ ++ return !(p == (void*)0); ++} +Index: gcc/testsuite/gcc.dg/pr51879-18.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr51879-18.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.dg/pr51879-18.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -13,5 +13,5 @@ + *q = foo (); + } + +-/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre"} } */ ++/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre" { xfail *-*-* } } } */ + /* { dg-final { cleanup-tree-dump "pre" } } */ +Index: gcc/testsuite/gcc.dg/torture/pr61964.c +=================================================================== +--- gcc/testsuite/gcc.dg/torture/pr61964.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/torture/pr61964.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,33 @@ ++/* { dg-do run } */ ++ ++extern void abort (void); ++ ++struct node { struct node *next, *prev; } node; ++struct head { struct node *first; } heads[5]; ++int k = 2; ++struct head *head = &heads[2]; ++ ++static int __attribute__((noinline)) ++foo() ++{ ++ node.prev = (void *)head; ++ head->first = &node; ++ ++ struct node *n = head->first; ++ struct head *h = &heads[k]; ++ ++ if (n->prev == (void *)h) ++ h->first = n->next; ++ else ++ n->prev->next = n->next; ++ ++ n->next = h->first; ++ return n->next == &node; ++} ++ ++int main() ++{ ++ if (foo ()) ++ abort (); ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/torture/pr61010.c +=================================================================== +--- gcc/testsuite/gcc.dg/torture/pr61010.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/torture/pr61010.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,8 @@ ++/* { dg-do compile } */ ++ ++int main (void) ++{ ++ int a = 0; ++ unsigned b = (a * 64 & 192) | 63U; ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/torture/pr61452.c +=================================================================== +--- gcc/testsuite/gcc.dg/torture/pr61452.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/torture/pr61452.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,31 @@ ++/* { dg-do run } */ ++ ++int a, b; ++short c, d; ++char e, f; ++ ++int ++fn1 (int p1, char p2) ++{ ++ return p1 || p2 ? 0 : p2; ++} ++ ++void ++fn2 () ++{ ++ for (; a;) ++ { ++ int g; ++ g = c = e; ++ for (; a;) ++ b = fn1 (g = d = e, g); ++ f = g; ++ } ++} ++ ++int ++main () ++{ ++ fn2 (); ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/torture/pr61383-1.c +=================================================================== +--- gcc/testsuite/gcc.dg/torture/pr61383-1.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/torture/pr61383-1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,35 @@ ++/* { dg-do run } */ ++ ++int a, b = 1, c, d, e, f, g; ++ ++int ++fn1 () ++{ ++ int h; ++ for (;;) ++ { ++ g = b; ++ g = g ? 0 : 1 % g; ++ e = a + 1; ++ for (; d < 1; d = e) ++ { ++ if (f == 0) ++ h = 0; ++ else ++ h = 1 % f; ++ if (f < 1) ++ c = 0; ++ else if (h) ++ break; ++ } ++ if (b) ++ return 0; ++ } ++} ++ ++int ++main () ++{ ++ fn1 (); ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c +=================================================================== +--- gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,41 @@ ++/* Test that exact underflow in __float128 signals the underflow ++ exception if trapping is enabled, but does not raise the flag ++ otherwise. */ ++ ++/* { dg-do run { target i?86-*-*gnu* x86_64-*-*gnu* } } */ ++/* { dg-options "-D_GNU_SOURCE" } */ ++/* { dg-require-effective-target fenv_exceptions } */ ++ ++#include ++#include ++#include ++#include ++ ++volatile sig_atomic_t caught_sigfpe; ++sigjmp_buf buf; ++ ++static void ++handle_sigfpe (int sig) ++{ ++ caught_sigfpe = 1; ++ siglongjmp (buf, 1); ++} ++ ++int ++main (void) ++{ ++ volatile __float128 a = 0x1p-16382q, b = 0x1p-2q; ++ volatile __float128 r; ++ r = a * b; ++ if (fetestexcept (FE_UNDERFLOW)) ++ abort (); ++ if (r != 0x1p-16384q) ++ abort (); ++ feenableexcept (FE_UNDERFLOW); ++ signal (SIGFPE, handle_sigfpe); ++ if (sigsetjmp (buf, 1) == 0) ++ r = a * b; ++ if (!caught_sigfpe) ++ abort (); ++ exit (0); ++} +Index: gcc/testsuite/gcc.dg/torture/vshuf-4.inc +=================================================================== +--- gcc/testsuite/gcc.dg/torture/vshuf-4.inc (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.dg/torture/vshuf-4.inc (.../branches/gcc-4_8-branch) (revision 217117) +@@ -23,7 +23,8 @@ + T (20, 0, 4, 1, 5) \ + T (21, 2, 6, 3, 7) \ + T (22, 1, 2, 3, 0) \ +-T (23, 2, 1, 0, 3) ++T (23, 2, 1, 0, 3) \ ++T (24, 2, 5, 6, 3) + #define EXPTESTS \ + T (116, 1, 2, 4, 3) \ + T (117, 7, 3, 3, 0) \ +@@ -31,7 +32,6 @@ + T (119, 0, 3, 5, 6) \ + T (120, 0, 0, 1, 5) \ + T (121, 4, 6, 2, 1) \ +-T (122, 2, 5, 6, 3) \ + T (123, 4, 6, 3, 2) \ + T (124, 4, 7, 5, 6) \ + T (125, 0, 4, 2, 4) \ +Index: gcc/testsuite/gcc.dg/stack-usage-2.c +=================================================================== +--- gcc/testsuite/gcc.dg/stack-usage-2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/gcc.dg/stack-usage-2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,21 +1,21 @@ + /* { dg-do compile } */ + /* { dg-options "-Wstack-usage=512" } */ + +-int foo1 (void) ++int foo1 (void) /* { dg-bogus "stack usage" } */ + { + char arr[16]; + arr[0] = 1; + return 0; +-} /* { dg-bogus "stack usage" } */ ++} + +-int foo2 (void) ++int foo2 (void) /* { dg-warning "stack usage is \[0-9\]* bytes" } */ + { + char arr[1024]; + arr[0] = 1; + return 0; +-} /* { dg-warning "stack usage is \[0-9\]* bytes" } */ ++} + +-int foo3 (void) ++int foo3 (void) /* { dg-warning "stack usage might be \[0-9\]* bytes" } */ + { + char arr[1024] __attribute__((aligned (512))); + arr[0] = 1; +@@ -22,12 +22,11 @@ + /* Force dynamic realignment of argument pointer. */ + __builtin_apply ((void (*)()) foo2, 0, 0); + return 0; ++} + +-} /* { dg-warning "stack usage might be \[0-9\]* bytes" } */ +- +-int foo4 (int n) ++int foo4 (int n) /* { dg-warning "stack usage might be unbounded" } */ + { + char arr[n]; + arr[0] = 1; + return 0; +-} /* { dg-warning "stack usage might be unbounded" } */ ++} +Index: gcc/testsuite/gcc.dg/ipa/pr61986.c +=================================================================== +--- gcc/testsuite/gcc.dg/ipa/pr61986.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/ipa/pr61986.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,48 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O3" } */ ++ ++int a, b, c; ++ ++struct S ++{ ++ int f0; ++ int f1; ++} d; ++ ++static int fn2 (struct S); ++void fn3 (struct S); ++ ++void ++fn1 (struct S p) ++{ ++ struct S h = { 0, 0 }; ++ fn3 (p); ++ fn2 (h); ++} ++ ++int ++fn2 (struct S p) ++{ ++ struct S j = { 0, 0 }; ++ fn3 (p); ++ fn2 (j); ++ return 0; ++} ++ ++void ++fn3 (struct S p) ++{ ++ for (; b; a++) ++ c = p.f0; ++ fn1 (d); ++} ++ ++void ++fn4 () ++{ ++ for (;;) ++ { ++ struct S f = { 0, 0 }; ++ fn1 (f); ++ } ++} +Index: gcc/testsuite/gcc.dg/pr62030.c +=================================================================== +--- gcc/testsuite/gcc.dg/pr62030.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/pr62030.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,50 @@ ++/* { dg-do run } */ ++/* { dg-options "-O2" } */ ++ ++extern void abort (void); ++ ++struct node ++{ ++ struct node *next; ++ struct node *prev; ++}; ++ ++struct node node; ++ ++struct head ++{ ++ struct node *first; ++}; ++ ++struct head heads[5]; ++ ++int k = 2; ++ ++struct head *head = &heads[2]; ++ ++static int __attribute__((noinline)) ++foo (void) ++{ ++ node.prev = (void *)head; ++ head->first = &node; ++ ++ struct node *n = head->first; ++ struct head *h = &heads[k]; ++ struct node *next = n->next; ++ ++ if (n->prev == (void *)h) ++ h->first = next; ++ else ++ n->prev->next = next; ++ ++ n->next = h->first; ++ return n->next == &node; ++} ++ ++int ++main (void) ++{ ++ if (foo ()) ++ abort (); ++ return 0; ++} +Index: gcc/testsuite/gcc.dg/vect/pr63341-2.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/pr63341-2.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/pr63341-2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,35 @@ ++/* PR tree-optimization/63341 */ ++/* { dg-do run } */ ++ ++#include "tree-vect.h" ++ ++typedef union U { unsigned short s; unsigned char c; } __attribute__((packed)) U; ++struct S { char e __attribute__((aligned (64))); U s[32]; }; ++struct S t = {0, {{0x5010}, {0x5111}, {0x5212}, {0x5313}, {0x5414}, {0x5515}, {0x5616}, {0x5717}, ++ {0x5818}, {0x5919}, {0x5a1a}, {0x5b1b}, {0x5c1c}, {0x5d1d}, {0x5e1e}, {0x5f1f}, ++ {0x6020}, {0x6121}, {0x6222}, {0x6323}, {0x6424}, {0x6525}, {0x6626}, {0x6727}, ++ {0x6828}, {0x6929}, {0x6a2a}, {0x6b2b}, {0x6c2c}, {0x6d2d}, {0x6e2e}, {0x6f2f}}}; ++unsigned short d[32] = { 1 }; ++ ++__attribute__((noinline, noclone)) void ++foo () ++{ ++ int i; ++ for (i = 0; i < 32; i++) ++ d[i] = t.s[i].s + 4; ++ for (i = 0; i < 32; i++) ++ if (d[i] != t.s[i].s + 4) ++ abort (); ++ else ++ asm volatile ("" : : : "memory"); ++} ++ ++int ++main () ++{ ++ check_vect (); ++ foo (); ++ return 0; ++} ++ ++/* { dg-final { cleanup-tree-dump "vect" } } */ +Index: gcc/testsuite/gcc.dg/vect/pr63189.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/pr63189.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/pr63189.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,26 @@ ++/* PR tree-optimization/63189 */ ++/* { dg-do run } */ ++ ++#include "tree-vect.h" ++ ++short int d[16] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; ++ ++__attribute__((noinline, noclone)) void ++foo (void) ++{ ++ int j, s = 0; ++ for (j = 0; j < 8; j++) ++ s += d[j] * j; ++ if (s != 7) ++ abort (); ++} ++ ++int ++main () ++{ ++ check_vect (); ++ foo (); ++ return 0; ++} ++ ++/* { dg-final { cleanup-tree-dump "vect" } } */ +Index: gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16c.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16c.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16c.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,73 @@ ++/* { dg-require-effective-target vect_int } */ ++ ++#include ++#include "tree-vect.h" ++ ++#define N 64 ++#define DOT 43680 ++ ++signed short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); ++signed int Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); ++ ++/* (short, int)->int->int dot product. ++ Not detected as a dot-product pattern. */ ++ ++__attribute__ ((noinline)) int ++foo (int len) ++{ ++ int i; ++ int result = 0; ++ ++ for (i = 0; i < len; i++) ++ { ++ result += (X[i] * Y[i]); ++ } ++ return result; ++} ++ ++ ++/* (int, short)->int->int dot product. ++ Not detected as a dot-product pattern. */ ++ ++__attribute__ ((noinline)) int ++bar (int len) ++{ ++ int i; ++ int result = 0; ++ ++ for (i = 0; i < len; i++) ++ { ++ result += (Y[i] * X[i]); ++ } ++ return result; ++} ++ ++int ++main (void) ++{ ++ int i; ++ int dot; ++ ++ check_vect (); ++ ++ for (i = 0; i < N; i++) ++ { ++ X[i] = i; ++ Y[i] = N - i; ++ __asm__ volatile (""); ++ } ++ ++ dot = foo (N); ++ if (dot != DOT) ++ abort (); ++ ++ dot = bar (N); ++ if (dot != DOT) ++ abort (); ++ ++ return 0; ++} ++ ++/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */ ++/* { dg-final { cleanup-tree-dump "vect" } } */ ++ +Index: gcc/testsuite/gcc.dg/vect/pr62073.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/pr62073.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/pr62073.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,40 @@ ++/* { dg-do compile } */ ++/* { dg-additional-options "-O1" } */ ++ ++struct S0 ++{ ++ int f7; ++}; ++struct S0 g_50; ++int g_70; ++int g_76; ++ ++int foo (long long p_56, int * p_57) ++{ ++ int *l_77; ++ int l_101; ++ ++ for (; g_70;) ++ { ++ int **l_78 = &l_77; ++ if (g_50.f7) ++ continue; ++ *l_78 = 0; ++ } ++ for (g_76 = 1; g_76 >= 0; g_76--) ++ { ++ int *l_90; ++ for (l_101 = 4; l_101 >= 0; l_101--) ++ if (l_101) ++ *l_90 = 0; ++ else ++ { ++ int **l_113 = &l_77; ++ *l_113 = p_57; ++ } ++ } ++ ++ return *l_77; ++} ++ ++/* { dg-final { cleanup-tree-dump "vect" } } */ +Index: gcc/testsuite/gcc.dg/vect/pr60196-1.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/pr60196-1.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/pr60196-1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,34 @@ ++/* PR tree-optimization/63189 */ ++/* { dg-additional-options "-fwrapv" } */ ++/* { dg-do run } */ ++ ++#include "tree-vect.h" ++ ++__attribute__((noinline, noclone)) static int ++bar (const short *a, int len) ++{ ++ int x; ++ int x1 = 0; ++ ++ for (x = 0; x < len; x++) ++ x1 += x * a[x]; ++ return x1; ++} ++ ++__attribute__((noinline, noclone)) void ++foo (void) ++{ ++ short stuff[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1 }; ++ if (bar (stuff, 9) != 36) ++ abort (); ++} ++ ++int ++main () ++{ ++ check_vect (); ++ foo (); ++ return 0; ++} ++ ++/* { dg-final { cleanup-tree-dump "vect" } } */ +Index: gcc/testsuite/gcc.dg/vect/pr62075.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/pr62075.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/pr62075.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,22 @@ ++/* { dg-do compile } */ ++ ++int a[16][2]; ++struct A ++{ ++ int b[16][2]; ++ int c[16][1]; ++}; ++ ++void ++foo (struct A *x) ++{ ++ int i; ++ for (i = 0; i < 16; ++i) ++ { ++ x->b[i][0] = a[i][0]; ++ x->c[i][0] = 0 != a[i][0]; ++ x->b[i][1] = a[i][1]; ++ } ++} ++ ++/* { dg-final { cleanup-tree-dump "vect" } } */ +Index: gcc/testsuite/gcc.dg/vect/pr60196-2.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/pr60196-2.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/pr60196-2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,33 @@ ++/* PR tree-optimization/63189 */ ++/* { dg-do run } */ ++ ++#include "tree-vect.h" ++ ++static const short a[8] = {1, 1, 1, 1, 1, 1, 1, 1 }; ++static const unsigned char b[8] = {0, 0, 0, 0, 0, 0, 0, 0 }; ++ ++__attribute__((noinline, noclone)) static int ++bar (void) ++{ ++ int sum = 0, i; ++ for (i = 0; i < 8; ++i) ++ sum += a[i] * b[i]; ++ return sum; ++} ++ ++__attribute__((noinline, noclone)) void ++foo (void) ++{ ++ if (bar () != 0) ++ abort (); ++} ++ ++int ++main () ++{ ++ check_vect (); ++ foo (); ++ return 0; ++} ++ ++/* { dg-final { cleanup-tree-dump "vect" } } */ +Index: gcc/testsuite/gcc.dg/vect/pr63341-1.c +=================================================================== +--- gcc/testsuite/gcc.dg/vect/pr63341-1.c (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/gcc.dg/vect/pr63341-1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,32 @@ ++/* PR tree-optimization/63341 */ ++/* { dg-do run } */ ++ ++#include "tree-vect.h" ++ ++typedef union U { unsigned short s; unsigned char c; } __attribute__((packed)) U; ++struct S { char e __attribute__((aligned (64))); U s[32]; }; ++struct S t = {0, {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, ++ {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, ++ {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, ++ {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32}}}; ++unsigned short d[32] = { 1 }; ++ ++__attribute__((noinline, noclone)) void ++foo () ++{ ++ int i; ++ for (i = 0; i < 32; i++) ++ d[i] = t.s[i].s; ++ if (__builtin_memcmp (d, t.s, sizeof d)) ++ abort (); ++} ++ ++int ++main () ++{ ++ check_vect (); ++ foo (); ++ return 0; ++} ++ ++/* { dg-final { cleanup-tree-dump "vect" } } */ +Index: gcc/testsuite/ChangeLog +=================================================================== +--- gcc/testsuite/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,433 @@ ++2014-11-03 Marek Polacek ++ ++ PR c/52769 ++ * gcc.dg/pr52769.c: New test. ++ ++2014-10-29 Kyrylo Tkachov ++ ++ * gcc.target/aarch64/madd_after_asm_1.c: New test. ++ ++2014-10-15 Eric Botcazou ++ ++ * gnat.dg/opt41.adb: New test. ++ * gnat.dg/opt41_pkg.ad[sb]: New helper. ++ ++2014-10-12 Bill Schmidt ++ ++ Backport from mainline r215880 ++ 2014-10-03 Bill Schmidt ++ ++ * g++.dg/ext/altivec-2.C: Compile with -Wno-deprecated to avoid ++ failing with the new warning message. ++ * gcc.dg/vmx/3c-01a.c: Likewise. ++ * gcc.dg/vmx/ops-long-1.c: Likewise. ++ * gcc.dg/vmx/ops.c: Likewise. ++ * gcc.target/powerpc/altivec-20.c: Likewise. ++ * gcc.target/powerpc/altivec-6.c: Likewise. ++ * gcc.target/powerpc/altivec-vec-merge.c: Likewise. ++ * gcc.target/powerpc/vsx-builtin-8.c: Likewise. ++ * gcc.target/powerpc/warn-lvsl-lvsr.c: New test. ++ ++ Backport from mainline r215882 ++ 2014-10-03 Bill Schmidt ++ ++ * gcc.target/powerpc/lvsl-lvsr.c: New test. ++ ++ Backport from mainline r216017 ++ 2014-10-08 Pat Haugen ++ ++ * gcc.dg/vmx/3c-01a.c: Add default options from vmx.exp. ++ * gcc.dg/vmx/ops.c: Likewise. ++ * gcc.dg/vmx/ops-long-1.c: Likewise. ++ ++2014-10-10 Jakub Jelinek ++ ++ PR fortran/59488 ++ * gfortran.dg/gomp/pr59488-1.f90: New test. ++ * gfortran.dg/gomp/pr59488-2.f90: New test. ++ ++2014-10-01 Jakub Jelinek ++ ++ PR debug/63342 ++ * gcc.dg/pr63342.c: New test. ++ ++ PR target/63428 ++ * gcc.dg/torture/vshuf-4.inc: Move test 122 from EXPTESTS ++ to test 24 in TESTS. ++ ++2014-10-01 Uros Bizjak ++ ++ Backport from mainline ++ 2013-11-07 Joseph Myers ++ ++ * lib/target-supports.exp ++ (check_effective_target_fenv_exceptions): New function. ++ ++2014-09-30 Jakub Jelinek ++ ++ PR inline-asm/63282 ++ * gcc.c-torture/compile/pr63282.c: New test. ++ ++2014-09-26 Jakub Jelinek ++ ++ * g++.dg/compat/struct-layout-1_generate.c: Add -Wno-abi ++ to default options. ++ ++2014-09-25 Bill Schmidt ++ ++ Backport from mainline r215559 ++ 2014-09-25 Bill Schmidt ++ ++ PR target/63335 ++ * gcc.target/powerpc/pr63335.c: New test. ++ ++2014-09-25 Jakub Jelinek ++ ++ PR tree-optimization/63341 ++ * gcc.dg/vect/pr63341-1.c: New test. ++ * gcc.dg/vect/pr63341-2.c: New test. ++ ++2014-09-18 Joseph Myers ++ ++ * gcc.dg/torture/float128-exact-underflow.c: New test. ++ ++2014-09-17 Jakub Jelinek ++ ++ PR debug/63284 ++ * gcc.dg/pr63284.c: New test. ++ ++2014-09-09 Richard Biener ++ ++ Backport from mainline ++ 2014-06-11 Richard Biener ++ ++ PR tree-optimization/61452 ++ * gcc.dg/torture/pr61452.c: New testcase. ++ ++2014-09-09 Richard Biener ++ ++ Backport from mainline ++ 2014-05-05 Richard Biener ++ ++ PR middle-end/61010 ++ * gcc.dg/torture/pr61010.c: New testcase. ++ ++ 2014-05-28 Richard Biener ++ ++ PR middle-end/61045 ++ * gcc.dg/pr61045.c: New testcase. ++ ++ 2014-08-11 Richard Biener ++ ++ PR tree-optimization/62075 ++ * gcc.dg/vect/pr62075.c: New testcase. ++ ++2014-09-08 Jakub Jelinek ++ ++ PR tree-optimization/60196 ++ PR tree-optimization/63189 ++ * gcc.dg/vect/pr63189.c: New test. ++ * gcc.dg/vect/pr60196-1.c: New test. ++ * gcc.dg/vect/pr60196-2.c: New test. ++ ++ Backported from mainline ++ 2013-09-17 Cong Hou ++ ++ * gcc.dg/vect/vect-reduc-dot-s16c.c: Add a test case with dot product ++ on two arrays with short and int types. This should not be recognized ++ as a dot product pattern. ++ ++2014-09-08 Jakub Jelinek ++ ++ Backported from mainline ++ 2014-08-06 Vladimir Makarov ++ ++ PR debug/61923 ++ * gcc.target/i386/pr61923.c: New test. ++ ++2014-09-06 John David Anglin ++ ++ PR testsuite/56194 ++ * g++.dg/init/const9.C: Skip scan-assembler-not "rodata" on hppa*-*-*. ++ ++2014-09-03 Marek Polacek ++ ++ Backport from mainline ++ 2014-09-02 Marek Polacek ++ ++ PR fortran/62270 ++ * gfortran.dg/pointer_intent_7.f90: Adjust dg-error. ++ ++2014-09-03 Martin Jambor ++ ++ PR ipa/62015 ++ * g++.dg/ipa/pr62015.C: New test. ++ ++2014-09-03 Martin Jambor ++ ++ PR ipa/61986 ++ * gcc.dg/ipa/pr61986.c: New test. ++ ++2014-08-26 Dominik Vogt ++ ++ * gfortran.dg/bessel_7.f90: Bump allowed precision to avoid ++ failure on s390*-*-linux-gnu. ++ ++2014-08-24 Oleg Endo ++ ++ Backport from mainline ++ 2014-08-24 Oleg Endo ++ ++ PR target/61996 ++ * gcc.target/sh/pr61996.c: New. ++ ++2014-08-21 Thomas Koenig ++ ++ Backport from trunk ++ PR fortran/62214 ++ * gfortran.dg/array_assignment_5.f90: New test. ++ ++2014-08-15 Tom de Vries ++ ++ Backport from mainline: ++ 2014-08-14 Tom de Vries ++ ++ PR rtl-optimization/62004 ++ PR rtl-optimization/62030 ++ * gcc.dg/pr62004.c: New test. ++ * gcc.dg/pr62030.c: Same. ++ * gcc.target/mips/pr62030-octeon.c: Same. ++ ++2014-08-13 Felix Yang ++ ++ PR tree-optimization/62073 ++ * gcc.dg/vect/pr62073.c: New test. ++ ++2014-08-13 Thomas Preud'homme ++ ++ Backport from mainline ++ 2014-08-12 Thomas Preud'homme ++ ++ PR middle-end/62103 ++ * gcc.c-torture/execute/bitfld-6.c: New test. ++ ++2014-08-10 Thomas Koenig ++ ++ Backport from trunk ++ PR fortran/61999 ++ * gfortran.dg/dot_product_3.f90: New test case. ++ ++2014-08-07 John David Anglin ++ ++ PR tree-optimization/60707 ++ * gfortran.dg/pr45636.f90: xfail on 32-bit hppa*-*-*. ++ ++2014-08-06 Jakub Jelinek ++ ++ PR rtl-optimization/61801 ++ * gcc.target/i386/pr61801.c: Rewritten. ++ ++2014-08-01 Thomas Preud'homme ++ ++ Backport from mainline ++ 2014-06-13 Thomas Preud'homme ++ ++ PR tree-optimization/61375 ++ * gcc.c-torture/execute/pr61375-1.c: New test. ++ ++2014-08-01 Richard Biener ++ ++ PR tree-optimization/61964 ++ * gcc.dg/torture/pr61964.c: New testcase. ++ * gcc.dg/pr51879-18.c: XFAIL. ++ ++2014-07-28 Richard Biener ++ ++ PR rtl-optimization/61801 ++ * gcc.target/i386/pr61801.c: Fix testcase. ++ ++2014-07-28 Richard Biener ++ ++ PR rtl-optimization/61801 ++ * gcc.target/i386/pr61801.c: New testcase. ++ ++2014-07-24 Ulrich Weigand ++ ++ Backport from mainline: ++ 2014-07-24 Ulrich Weigand ++ ++ * gcc.target/powerpc/ppc64-abi-warn-3.c: New test. ++ ++ * gcc.c-torture/execute/20050316-1.x: Add -Wno-psabi. ++ * gcc.c-torture/execute/20050604-1.x: Add -Wno-psabi. ++ * gcc.c-torture/execute/20050316-3.x: New file. Add -Wno-psabi. ++ * gcc.c-torture/execute/pr23135.x: Likewise. ++ ++2014-07-24 Ulrich Weigand ++ ++ Backport from mainline: ++ 2014-07-24 Ulrich Weigand ++ ++ * gcc.target/powerpc/ppc64-abi-warn-2.c: New test. ++ ++2014-07-24 Ulrich Weigand ++ ++ Backport from mainline: ++ 2014-07-24 Ulrich Weigand ++ ++ * gcc.target/powerpc/ppc64-abi-warn-1.c: New test. ++ ++2014-07-24 Ulrich Weigand ++ ++ Backport from mainline: ++ 2014-07-24 Ulrich Weigand ++ ++ * g++.dg/compat/struct-layout-1.exp: Load g++-dg.exp. ++ ++2014-07-19 Eric Botcazou ++ ++ * gcc.dg/stack-usage-2.c: Adjust. ++ ++2014-07-19 Paul Thomas ++ ++ Backport from trunk. ++ PR fortran/61780 ++ * gfortran.dg/dependency_44.f90 : New test ++ ++2014-07-10 Eric Botcazou ++ ++ * gnat.dg/opt39.adb: New test. ++ ++2014-07-08 Paul Thomas ++ ++ PR fortran/61459 ++ PR fortran/58883 ++ * gfortran.dg/allocatable_function_8.f90 : New test ++ ++2014-07-04 Jakub Jelinek ++ ++ PR tree-optimization/61684 ++ * gcc.c-torture/compile/pr61684.c: New test. ++ ++2014-07-02 Jakub Jelinek ++ Fritz Reese ++ ++ * gfortran.dg/oldstyle_5.f: New test. ++ ++2014-06-30 Thomas Preud'homme ++ ++ Backport from mainline ++ 2014-06-11 Thomas Preud'homme ++ ++ PR tree-optimization/61306 ++ * gcc.c-torture/execute/pr61306-1.c: New test. ++ * gcc.c-torture/execute/pr61306-2.c: Likewise. ++ * gcc.c-torture/execute/pr61306-3.c: Likewise. ++ ++2014-06-27 Bill Schmidt ++ ++ * gfortran.dg/nint_2.f90: Don't XFAIL for powerpc64le-*-linux*. ++ ++2014-06-27 Uros Bizjak ++ ++ Backport from mainline ++ 2014-06-26 Uros Bizjak ++ ++ PR target/61586 ++ * gcc.target/alpha/pr61586.c: New test. ++ ++2014-06-25 Bill Schmidt ++ ++ * gfortran.dg/default_format_denormal_2.f90: Remove xfail for ++ powerpc*-*-linux*. ++ ++2014-06-18 Uros Bizjak ++ ++ Backport from mainline ++ 2014-06-13 Ilya Enkovich ++ ++ PR rtl-optimization/61094 ++ PR rtl-optimization/61446 ++ * gcc.target/i386/pr61446.c : New. ++ ++ Backport from mainline ++ 2014-06-06 Uros Bizjak ++ ++ PR target/61423 ++ * gcc.target/i386/pr61423.c: New test. ++ ++2014-06-17 Yufeng Zhang ++ ++ Backport from mainline ++ ++ PR target/61483 ++ * gcc.target/aarch64/aapcs64/type-def.h (struct hfa_fx2_t): New type. ++ * gcc.target/aarch64/aapcs64/va_arg-13.c: New test. ++ * gcc.target/aarch64/aapcs64/va_arg-14.c: Ditto. ++ * gcc.target/aarch64/aapcs64/va_arg-15.c: Ditto. ++ ++2014-06-15 Francois-Xavier Coudert ++ ++ Backport from trunk. ++ PR fortran/45187 ++ * gfortran.dg/cray_pointers_10.f90: New file. ++ ++2014-06-13 Peter Bergner ++ ++ Backport from mainline ++ ++ 2014-06-13 Peter Bergner ++ PR target/61415 ++ * lib/target-supports.exp (check_effective_target_longdouble128): New. ++ * gcc.target/powerpc/pack02.c: Use it. ++ * gcc.target/powerpc/tfmode_off.c: Likewise. ++ ++2014-06-12 Georg-Johann Lay ++ ++ Backport from 2014-06-12 trunk r211491 ++ ++ PR target/61443 ++ * gcc.target/avr/torture/pr61443.c: New test. ++ ++2014-06-04 Richard Biener ++ ++ PR tree-optimization/61383 ++ * gcc.dg/torture/pr61383-1.c: New testcase. ++ ++2014-06-03 Andrey Belevantsev ++ ++ Backport from mainline ++ 2014-05-14 Andrey Belevantsev ++ ++ PR rtl-optimization/60866 ++ * gcc.dg/pr60866.c: New test. ++ ++2014-06-03 Andrey Belevantsev ++ ++ Backport from mainline ++ 2014-05-14 Andrey Belevantsev ++ ++ PR rtl-optimization/60901 ++ * gcc.target/i386/pr60901.c: New test. ++ ++2014-05-28 Eric Botcazou ++ ++ Backport from mainline ++ 2014-05-27 Eric Botcazou ++ ++ * gnat.dg/overflow_fixed.adb: New test. ++ ++2014-05-27 Eric Botcazou ++ ++ * gnat.dg/aliasing1.adb (dg-final): Robustify pattern matching. ++ ++2014-05-22 Peter Bergner ++ ++ Backport from mainline ++ 2014-05-22 Peter Bergner ++ ++ * gcc.target/powerpc/htm-ttest.c: New test. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: gcc/testsuite/g++.dg/rtti/dyncast7.C +=================================================================== +--- gcc/testsuite/g++.dg/rtti/dyncast7.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/rtti/dyncast7.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,28 @@ ++// I think this dynamic_cast has undefined behavior when destroying E::o ++// because we're the F period of destruction has started and ap doesn't ++// point to the object currently being destroyed--but the reasonable ++// options are success or failure, not SEGV. ++ ++// { dg-do run } ++ ++extern "C" void abort(); ++ ++struct A { virtual ~A(); }; ++struct B { virtual ~B() { } }; ++struct C : B, A { }; ++struct E : virtual B { A o; }; ++struct F : virtual C, virtual E { }; ++ ++A* ap; ++C* cp; ++ ++A::~A() { ++ C* cp2 = dynamic_cast(ap); ++ if (cp2 != cp && cp2 != 0) ++ abort(); ++} ++ ++int main() { ++ F f; ++ ap = cp = &f; ++} +Index: gcc/testsuite/g++.dg/ext/altivec-2.C +=================================================================== +--- gcc/testsuite/g++.dg/ext/altivec-2.C (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/g++.dg/ext/altivec-2.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,6 +1,6 @@ + /* { dg-do compile { target powerpc*-*-* } } */ + /* { dg-require-effective-target powerpc_altivec_ok } */ +-/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable" } */ ++/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable -Wno-deprecated" } */ + + /* This test checks if AltiVec builtins accept const-qualified + arguments. */ +Index: gcc/testsuite/g++.dg/ext/stmtexpr16.C +=================================================================== +--- gcc/testsuite/g++.dg/ext/stmtexpr16.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/ext/stmtexpr16.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,10 @@ ++// PR c++/63455 ++// { dg-options "-std=gnu++11" } ++ ++int main() ++{ ++ int x = 0; ++ ++ // without '+0', gcc 4.6 gives a different error (no ICE though) ++ decltype(({ int y = x; y; })+0) v1 = 0; ++} +Index: gcc/testsuite/g++.dg/expr/cond12.C +=================================================================== +--- gcc/testsuite/g++.dg/expr/cond12.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/expr/cond12.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,12 @@ ++// PR c++/58714 ++// { dg-do run } ++ ++struct X { ++ X& operator=(const X&){} ++ X& operator=(X&){__builtin_abort();} ++}; ++ ++int main(int argv,char**) { ++ X a, b; ++ ((argv > 2) ? a : b) = X(); ++} +Index: gcc/testsuite/g++.dg/init/const9.C +=================================================================== +--- gcc/testsuite/g++.dg/init/const9.C (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/g++.dg/init/const9.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,5 +1,5 @@ + // PR c++/55893 +-// { dg-final { scan-assembler-not "rodata" } } ++// { dg-final { scan-assembler-not "rodata" { target { ! hppa*-*-* } } } } + + struct foo + { +Index: gcc/testsuite/g++.dg/tls/thread_local10.C +=================================================================== +--- gcc/testsuite/g++.dg/tls/thread_local10.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/tls/thread_local10.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,23 @@ ++// PR c++/58624 ++ ++// { dg-do run { target c++11 } } ++// { dg-add-options tls } ++// { dg-require-effective-target tls_runtime } ++ ++int i; ++ ++template struct A ++{ ++ static thread_local int s; ++ ++ A () { i = s; } ++}; ++ ++int f() { return 42; } ++template thread_local int A::s = f(); ++ ++int main () { ++ A a; ++ if (i != 42) ++ __builtin_abort(); ++} +Index: gcc/testsuite/g++.dg/parse/typename7.C +=================================================================== +--- gcc/testsuite/g++.dg/parse/typename7.C (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/g++.dg/parse/typename7.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -7,10 +7,9 @@ + + struct A + { +- template void foo(int); // { dg-message "note" } +- template void bar(T t) { // { dg-message "note" } ++ template void foo(int); ++ template void bar(T t) { + this->foo(t); } // { dg-error "expected|parse error|no matching" } +- // { dg-message "candidate" "candidate note" { target *-*-* } 12 } + template void bad(T t) { + foo(t); } // { dg-error "expected|parse error|no matching" } + }; +@@ -20,7 +19,6 @@ + { + void bar(T t) { + A().bar(t); } // { dg-error "expected|parse error|no matching" } +- // { dg-message "candidate" "candidate note" { target *-*-* } 22 } + void bad(T t) { + B::bar(t); } // { dg-error "invalid|not a template" } + }; +Index: gcc/testsuite/g++.dg/parse/parameter-declaration-2.C +=================================================================== +--- gcc/testsuite/g++.dg/parse/parameter-declaration-2.C (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/g++.dg/parse/parameter-declaration-2.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,2 +1,2 @@ +-void f (int i, int p[i]); // { dg-error "use of parameter .i. outside function body" } ++void f (int i, int p[i]); // { dg-error "use of parameter.*outside function body" } + // { dg-prune-output "array bound" } +Index: gcc/testsuite/g++.dg/parse/ambig7.C +=================================================================== +--- gcc/testsuite/g++.dg/parse/ambig7.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/parse/ambig7.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,16 @@ ++// PR c++/60361 ++ ++struct Helper ++{ ++ Helper(int a, void (*pfunc)()); ++}; ++ ++template void function(); ++ ++const int A = 1; ++const int B = 2; ++ ++Helper testOk(A, function); ++Helper testOk2(int(A), function); ++Helper testOk3((int(A)), function); ++Helper testFail(int(A), function); +Index: gcc/testsuite/g++.dg/compat/struct-layout-1.exp +=================================================================== +--- gcc/testsuite/g++.dg/compat/struct-layout-1.exp (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/g++.dg/compat/struct-layout-1.exp (.../branches/gcc-4_8-branch) (revision 217117) +@@ -89,6 +89,9 @@ + # This must be done after the compat-use-*-compiler definitions. + load_lib compat.exp + ++# Provide the g++-dg-prune routine (gcc-dp.exp is loaded by compat.exp) ++load_lib g++-dg.exp ++ + g++_init + + # Save variables for the C++ compiler under test, which each test will +Index: gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c +=================================================================== +--- gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,5 +1,5 @@ + /* Structure layout test generator. +- Copyright (C) 2004, 2005, 2007, 2008, 2009, 2011, 2012 ++ Copyright (C) 2004-2014 + Free Software Foundation, Inc. + Contributed by Jakub Jelinek . + +@@ -44,7 +44,7 @@ + #endif + + const char *dg_options[] = { +-"/* { dg-options \"%s-I%s\" } */\n", ++"/* { dg-options \"%s-I%s -Wno-abi\" } */\n", + "/* { dg-options \"%s-I%s -mno-mmx -Wno-abi\" { target i?86-*-* x86_64-*-* } } */\n", + "/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n", + "/* { dg-options \"%s-I%s -mno-mmx -fno-common -Wno-abi\" { target i?86-*-darwin* x86_64-*-darwin* i?86-*-mingw32* x86_64-*-mingw32* i?86-*-cygwin* } } */\n", +Index: gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,28 @@ ++// PR c++/61959 ++// { dg-do compile { target c++11 } } ++ ++template struct BasePoint ++{ ++ Coord x, y; ++ constexpr BasePoint (Coord, Coord) : x (0), y (0) {} ++}; ++template struct BaseCoord ++{ ++ int value; ++ constexpr BaseCoord (T) : value (1) {} ++}; ++template struct IntCoordTyped : BaseCoord, units ++{ ++ typedef BaseCoord Super; ++ constexpr IntCoordTyped (int) : Super (0) {} ++}; ++template ++struct IntPointTyped : BasePoint >, units ++{ ++ typedef BasePoint > Super; ++ constexpr IntPointTyped (int, int) : Super (0, 0) {} ++}; ++struct A ++{ ++}; ++IntPointTyped a (0, 0); +Index: gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,9 @@ ++// PR c++/56710 ++// { dg-options "-std=c++11 -Wall" } ++ ++int main() ++{ ++ int t = 0; ++ return [&]() -> int {int __t; __t = t; return __t; }(); ++ return [&t]() -> int {int __t; __t = t; return __t; }(); ++} +Index: gcc/testsuite/g++.dg/cpp0x/variadic158.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/variadic158.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/variadic158.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,24 @@ ++// PR c++/61134 ++// { dg-do compile { target c++11 } } ++ ++struct Base { }; ++ ++template ++struct Fixed { ++ typedef const char* name; ++}; ++ ++template ++void New(const char* name, ++ typename Fixed::name... field_names); ++ ++template ++void CreateMetric(const char* name, ++ typename Fixed::name... field_names, ++ const Base&) { } ++ ++ ++void Fn() ++{ ++ CreateMetric("abcd", "def", Base()); ++} +Index: gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,7 @@ ++// PR c++/63415 ++// { dg-do compile { target c++11 } } ++ ++template ++struct A { ++ static constexpr int value = int(T{}); ++}; +Index: gcc/testsuite/g++.dg/cpp0x/variadic160.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/variadic160.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/variadic160.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,49 @@ ++// PR c++/61539 ++// { dg-do compile { target c++11 } } ++ ++template class A; ++template class B; ++template class C; ++template <> class C ++{ ++ virtual void xparse (int &, const B > &) const; ++}; ++template class G : C ++{ ++public: ++ G (void *) {} ++ void default_value (const T &); ++ void xparse (int &, const B > &) const; ++}; ++template ++void validate (int &, const B > &, T *, int); ++template ++void G::xparse (int &p1, const B > &p2) const ++{ ++ validate (p1, p2, (T *)0, 0); ++} ++template G *value (T *) { return new G(0); } ++namespace Eigen ++{ ++template struct D; ++template class F; ++template ++struct D > ++{ ++ typedef _Scalar Scalar; ++}; ++template class F ++{ ++public: ++ typedef typename Eigen::D::Scalar Scalar; ++ F (const Scalar &, const Scalar &, const Scalar &); ++}; ++template ++void validate (int &, const B > &, Eigen::F *); ++} ++int main (int, char *[]) ++{ ++ Eigen::F a (0, 0, 0); ++ value (&a)->default_value (Eigen::F(0, 0, 0)); ++} +Index: gcc/testsuite/g++.dg/cpp0x/rv-cond1.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/rv-cond1.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/rv-cond1.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,13 @@ ++// PR c++/58714 ++// { dg-do compile { target c++11 } } ++ ++struct X { ++ X& operator=(const X&) = delete; ++ X& operator=(X&& ) = default; ++}; ++ ++void f(bool t) { ++ X a, b; ++ *(t ? &a : &b) = X(); ++ (t ? a : b) = X(); ++} +Index: gcc/testsuite/g++.dg/cpp0x/overload3.C +=================================================================== +--- gcc/testsuite/g++.dg/cpp0x/overload3.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/cpp0x/overload3.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,17 @@ ++// PR c++/59823 ++// { dg-options "-std=c++11" } ++ ++struct X { }; ++ ++void f(X&&); // { dg-message "void f" } ++ ++struct wrap ++{ ++ operator const X&() const; ++}; ++ ++int main() ++{ ++ wrap w; ++ f(w); // { dg-error "lvalue" } ++} +Index: gcc/testsuite/g++.dg/ipa/pr62015.C +=================================================================== +--- gcc/testsuite/g++.dg/ipa/pr62015.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/ipa/pr62015.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,55 @@ ++/* { dg-do run } */ ++/* { dg-options "-O3 -std=c++11" } */ ++ ++ ++extern "C" int printf(const char *fmt, ...); ++extern "C" void abort(void); ++ ++struct Side { ++ enum _Value { Left, Right, Invalid }; ++ ++ constexpr Side() : _value(Invalid) {} ++ constexpr Side(_Value value) : _value(value) {} ++ operator _Value() const { return (_Value)_value; } ++ ++ private: ++ char _value; ++}; ++ ++struct A { ++ void init(); ++ void adjust(Side side, bool final); ++ void move(Side side); ++}; ++ ++void A::init() ++{ ++ adjust(Side::Invalid, false); ++} ++ ++static void __attribute__((noinline)) ++check (int v, int final) ++{ ++ if (v != 0) ++ abort(); ++} ++ ++ ++__attribute__((noinline)) ++void A::adjust(Side side, bool final) ++{ ++ check ((int)side, final); ++} ++ ++void A::move(Side side) ++{ ++ adjust(side, false); ++ adjust(side, true); ++} ++ ++int main() ++{ ++ A t; ++ t.move(Side::Left); ++ return 0; ++} +Index: gcc/testsuite/g++.dg/template/local-fn1.C +=================================================================== +--- gcc/testsuite/g++.dg/template/local-fn1.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/template/local-fn1.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,8 @@ ++// PR c++/60605 ++ ++template ++struct Foo { ++ void bar() { ++ void bug(); ++ } ++}; +Index: gcc/testsuite/g++.dg/template/conv14.C +=================================================================== +--- gcc/testsuite/g++.dg/template/conv14.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/template/conv14.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,30 @@ ++// PR c++/61647 ++ ++class XX; ++ ++template ++struct Accessor; ++ ++template ++class Variant { ++protected: ++ KeyStore index; ++ Container state; ++public: ++ Variant(Container st, const Key& i) : index(i), state(st) {} ++ ++ template ++ operator T() const { ++ return Accessor::template get(state, index); ++ } ++}; ++ ++class AutoCleanVariant : public Variant { ++public: ++ AutoCleanVariant(XX* st, int i) : Variant(st,i) {} ++ ++ template ++ operator T() const { ++ return Variant::operator T(); ++ } ++}; +Index: gcc/testsuite/g++.dg/template/friend55.C +=================================================================== +--- gcc/testsuite/g++.dg/template/friend55.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/template/friend55.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,18 @@ ++// PR c++/59956 ++ ++template struct A; ++template class B { ++ int i; ++ template friend void A::impl(); ++}; ++ ++B<0> b1; ++templatestruct A { void impl(); }; ++B<1> b2; ++ ++template void A::impl() { ++b1.i; ++b2.i; } ++ ++int main() ++{ ++ A<0>().impl(); ++} +Index: gcc/testsuite/g++.dg/template/memclass5.C +=================================================================== +--- gcc/testsuite/g++.dg/template/memclass5.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/template/memclass5.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,26 @@ ++// PR c++/60241 ++ ++template ++struct x ++{ ++ template ++ struct y ++ { ++ typedef T result2; ++ }; ++ ++ typedef y zy; ++}; ++ ++template<> ++template ++struct x::y ++{ ++ typedef double result2; ++}; ++ ++int main() ++{ ++ x::zy::result2 xxx; ++ x::y::result2 xxx2; ++} +Index: gcc/testsuite/g++.dg/template/ptrmem27.C +=================================================================== +--- gcc/testsuite/g++.dg/template/ptrmem27.C (.../tags/gcc_4_8_3_release) (revision 0) ++++ gcc/testsuite/g++.dg/template/ptrmem27.C (.../branches/gcc-4_8-branch) (revision 217117) +@@ -0,0 +1,22 @@ ++// PR c++/61500 ++ ++struct X { ++ int i; ++ int j; ++ ++ int foo(int X::* ptr); ++ ++ template ++ int bar(); ++}; ++ ++int X::foo(int X::* ptr) { ++ int* p = &(this->*ptr); // OK. ++ return *p; ++} ++ ++template ++int X::bar() { ++ int* p = &(this->*ptr); // gcc 4.9.0: OK in C++98 mode, fails in C++11 mode. ++ return *p; ++} +Index: gcc/cp/tree.c +=================================================================== +--- gcc/cp/tree.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cp/tree.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,6 +97,16 @@ + case IMAGPART_EXPR: + return lvalue_kind (TREE_OPERAND (ref, 0)); + ++ case MEMBER_REF: ++ case DOTSTAR_EXPR: ++ if (TREE_CODE (ref) == MEMBER_REF) ++ op1_lvalue_kind = clk_ordinary; ++ else ++ op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); ++ if (TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (ref, 1)))) ++ op1_lvalue_kind = clk_none; ++ return op1_lvalue_kind; ++ + case COMPONENT_REF: + op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); + /* Look at the member designator. */ +@@ -3738,6 +3748,10 @@ + { + init_expr = get_target_expr (exp); + exp = TARGET_EXPR_SLOT (init_expr); ++ if (CLASS_TYPE_P (TREE_TYPE (exp))) ++ exp = move (exp); ++ else ++ exp = rvalue (exp); + } + else + { +Index: gcc/cp/ChangeLog +=================================================================== +--- gcc/cp/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cp/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,87 @@ ++2014-10-15 Jason Merrill ++ ++ PR c++/63455 ++ Revert: ++ * parser.c (cp_parser_abort_tentative_parse): Make sure we haven't ++ committed to this tentative parse. ++ ++ PR c++/63415 ++ * pt.c (value_dependent_expression_p) [CONSTRUCTOR]: Check the type. ++ (iterative_hash_template_arg): Likewise. ++ ++ PR c++/56710 ++ * semantics.c (finish_member_declaration): Don't push closure ++ members. ++ ++ PR c++/58624 ++ * pt.c (tsubst_copy_and_build) [VAR_DECL]: Use TLS wrapper. ++ * semantics.c (finish_id_expression): Don't call TLS wrapper in a ++ template. ++ ++2014-08-07 Jason Merrill ++ ++ PR c++/61959 ++ * semantics.c (cxx_eval_bare_aggregate): Handle POINTER_PLUS_EXPR. ++ ++ PR c++/58714 ++ * tree.c (stabilize_expr): A stabilized prvalue is an xvalue. ++ ++2014-01-27 Jason Merrill ++ ++ PR c++/59823 ++ Core DR 1138 ++ * call.c (reference_binding): Pass LOOKUP_NO_TEMP_BIND for ++ list-initialization. A conversion to rvalue ref that involves ++ an lvalue-rvalue conversion is bad. ++ (convert_like_real): Give helpful error message. ++ ++2014-01-29 Jason Merrill ++ ++ PR c++/59956 ++ * friend.c (do_friend): Pass the TEMPLATE_DECL to add_friend if we ++ have a friend template in a class template. ++ * pt.c (tsubst_friend_function): Look through it. ++ (push_template_decl_real): A friend member template is ++ primary. ++ ++2014-02-21 Jason Merrill ++ ++ PR c++/60241 ++ * pt.c (lookup_template_class_1): Update DECL_TEMPLATE_INSTANTIATIONS ++ of the partial instantiation, not the most general template. ++ (maybe_process_partial_specialization): Reassign everything on ++ that list. ++ ++2014-03-05 Jason Merrill ++ ++ PR c++/60361 ++ * parser.c (cp_parser_template_id): Don't set up a CPP_TEMPLATE_ID ++ if re-parsing might succeed. ++ * semantics.c (finish_id_expression): Use of a parameter outside ++ the function body is a parse error. ++ ++2014-06-30 Jason Merrill ++ ++ PR c++/61647 ++ * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE. ++ ++ PR c++/61539 ++ * pt.c (unify_one_argument): Type/expression mismatch just causes ++ deduction failure. ++ ++ PR c++/61500 ++ * tree.c (lvalue_kind): Handle MEMBER_REF and DOTSTAR_EXPR. ++ ++2014-06-17 Jason Merrill ++ ++ PR c++/60605 ++ * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P. ++ ++2014-06-02 Jason Merrill ++ ++ PR c++/61134 ++ * pt.c (pack_deducible_p): Handle canonicalization. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: gcc/cp/pt.c +=================================================================== +--- gcc/cp/pt.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cp/pt.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -907,11 +907,13 @@ + t; t = TREE_CHAIN (t)) + { + tree inst = TREE_VALUE (t); +- if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst)) ++ if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst) ++ || !COMPLETE_OR_OPEN_TYPE_P (inst)) + { + /* We already have a full specialization of this partial +- instantiation. Reassign it to the new member +- specialization template. */ ++ instantiation, or a full specialization has been ++ looked up but not instantiated. Reassign it to the ++ new member specialization template. */ + spec_entry elt; + spec_entry *entry; + void **slot; +@@ -930,7 +932,7 @@ + *entry = elt; + *slot = entry; + } +- else if (COMPLETE_OR_OPEN_TYPE_P (inst)) ++ else + /* But if we've had an implicit instantiation, that's a + problem ([temp.expl.spec]/6). */ + error ("specialization %qT after instantiation %qT", +@@ -1569,6 +1571,7 @@ + case CONSTRUCTOR: + { + tree field, value; ++ iterative_hash_template_arg (TREE_TYPE (arg), val); + FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (arg), i, field, value) + { + val = iterative_hash_template_arg (field, val); +@@ -4308,7 +4311,8 @@ + in the template-parameter-list of the definition of a member of a + class template. */ + +- if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL) ++ if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL ++ || (TREE_CODE (decl) == FUNCTION_DECL && DECL_LOCAL_FUNCTION_P (decl))) + /* You can't have a function template declaration in a local + scope, nor you can you define a member of a class template in a + local scope. */ +@@ -4572,7 +4576,8 @@ + DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); + + /* See if this is a primary template. */ +- if (is_friend && ctx) ++ if (is_friend && ctx ++ && uses_template_parms_level (ctx, processing_template_decl)) + /* A friend template that specifies a class context, i.e. + template friend void A::f(); + is not primary. */ +@@ -7454,7 +7459,7 @@ + } + + /* Let's consider the explicit specialization of a member +- of a class template specialization that is implicitely instantiated, ++ of a class template specialization that is implicitly instantiated, + e.g.: + template + struct S +@@ -7552,9 +7557,9 @@ + + /* Note this use of the partial instantiation so we can check it + later in maybe_process_partial_specialization. */ +- DECL_TEMPLATE_INSTANTIATIONS (templ) ++ DECL_TEMPLATE_INSTANTIATIONS (found) + = tree_cons (arglist, t, +- DECL_TEMPLATE_INSTANTIATIONS (templ)); ++ DECL_TEMPLATE_INSTANTIATIONS (found)); + + if (TREE_CODE (template_type) == ENUMERAL_TYPE && !is_dependent_type) + /* Now that the type has been registered on the instantiations +@@ -8289,10 +8294,17 @@ + + if (COMPLETE_TYPE_P (context)) + { ++ tree fn = new_friend; ++ /* do_friend adds the TEMPLATE_DECL for any member friend ++ template even if it isn't a member template, i.e. ++ template friend A::f(); ++ Look through it in that case. */ ++ if (TREE_CODE (fn) == TEMPLATE_DECL ++ && !PRIMARY_TEMPLATE_P (fn)) ++ fn = DECL_TEMPLATE_RESULT (fn); + /* Check to see that the declaration is really present, and, + possibly obtain an improved declaration. */ +- tree fn = check_classfn (context, +- new_friend, NULL_TREE); ++ fn = check_classfn (context, fn, NULL_TREE); + + if (fn) + new_friend = fn; +@@ -14488,6 +14500,16 @@ + case PARM_DECL: + { + tree r = tsubst_copy (t, args, complain, in_decl); ++ if (TREE_CODE (r) == VAR_DECL ++ && !processing_template_decl ++ && !cp_unevaluated_operand ++ && DECL_THREAD_LOCAL_P (r)) ++ { ++ if (tree wrap = get_tls_wrapper_fn (r)) ++ /* Replace an evaluated use of the thread_local variable with ++ a call to its wrapper. */ ++ r = build_cxx_call (wrap, 0, NULL, tf_warning_or_error); ++ } + + if (TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE) + /* If the original type was a reference, we'll be wrapped in +@@ -14934,7 +14956,7 @@ + continue; + for (packs = PACK_EXPANSION_PARAMETER_PACKS (type); + packs; packs = TREE_CHAIN (packs)) +- if (TREE_VALUE (packs) == parm) ++ if (template_args_equal (TREE_VALUE (packs), parm)) + { + /* The template parameter pack is used in a function parameter + pack. If this is the end of the parameter list, the +@@ -15502,8 +15524,9 @@ + maybe_adjust_types_for_deduction (strict, &parm, &arg, arg_expr); + } + else +- gcc_assert ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL) +- == (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)); ++ if ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL) ++ != (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)) ++ return unify_template_argument_mismatch (explain_p, parm, arg); + + /* For deduction from an init-list we need the actual list. */ + if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr)) +@@ -19804,6 +19827,8 @@ + { + unsigned ix; + tree val; ++ if (dependent_type_p (TREE_TYPE (expression))) ++ return true; + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expression), ix, val) + if (value_dependent_expression_p (val)) + return true; +@@ -20009,7 +20034,12 @@ + return true; + + if (BASELINK_P (expression)) +- expression = BASELINK_FUNCTIONS (expression); ++ { ++ if (BASELINK_OPTYPE (expression) ++ && dependent_type_p (BASELINK_OPTYPE (expression))) ++ return true; ++ expression = BASELINK_FUNCTIONS (expression); ++ } + + if (TREE_CODE (expression) == TEMPLATE_ID_EXPR) + { +Index: gcc/cp/semantics.c +=================================================================== +--- gcc/cp/semantics.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cp/semantics.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2735,8 +2735,10 @@ + /*friend_p=*/0); + } + } +- /* Enter the DECL into the scope of the class. */ +- else if (pushdecl_class_level (decl)) ++ /* Enter the DECL into the scope of the class, if the class ++ isn't a closure (whose fields are supposed to be unnamed). */ ++ else if (CLASSTYPE_LAMBDA_EXPR (current_class_type) ++ || pushdecl_class_level (decl)) + { + if (TREE_CODE (decl) == USING_DECL) + { +@@ -3108,7 +3110,7 @@ + && DECL_CONTEXT (decl) == NULL_TREE + && !cp_unevaluated_operand) + { +- error ("use of parameter %qD outside function body", decl); ++ *error_msg = "use of parameter outside function body"; + return error_mark_node; + } + } +@@ -3343,6 +3345,7 @@ + tree wrap; + if (TREE_CODE (decl) == VAR_DECL + && !cp_unevaluated_operand ++ && !processing_template_decl + && DECL_THREAD_LOCAL_P (decl) + && (wrap = get_tls_wrapper_fn (decl))) + { +@@ -7296,7 +7299,9 @@ + constructor_elt *inner = base_field_constructor_elt (n, ce->index); + inner->value = elt; + } +- else if (ce->index && TREE_CODE (ce->index) == NOP_EXPR) ++ else if (ce->index ++ && (TREE_CODE (ce->index) == NOP_EXPR ++ || TREE_CODE (ce->index) == POINTER_PLUS_EXPR)) + { + /* This is an initializer for an empty base; now that we've + checked that it's constant, we can ignore it. */ +Index: gcc/cp/parser.c +=================================================================== +--- gcc/cp/parser.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cp/parser.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -12831,7 +12831,12 @@ + the effort required to do the parse, nor will we issue duplicate + error messages about problems during instantiation of the + template. */ +- if (start_of_id) ++ if (start_of_id ++ /* Don't do this if we had a parse error in a declarator; re-parsing ++ might succeed if a name changes meaning (60361). */ ++ && !(cp_parser_error_occurred (parser) ++ && cp_parser_parsing_tentatively (parser) ++ && parser->in_declarator_p)) + { + cp_token *token = cp_lexer_token_at (parser->lexer, start_of_id); + +@@ -23774,8 +23779,6 @@ + static void + cp_parser_abort_tentative_parse (cp_parser* parser) + { +- gcc_assert (parser->context->status != CP_PARSER_STATUS_KIND_COMMITTED +- || errorcount > 0); + cp_parser_simulate_error (parser); + /* Now, pretend that we want to see if the construct was + successfully parsed. */ +Index: gcc/cp/call.c +=================================================================== +--- gcc/cp/call.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cp/call.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1464,7 +1464,7 @@ + { + maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS); + conv = implicit_conversion (to, from, expr, c_cast_p, +- flags, complain); ++ flags|LOOKUP_NO_TEMP_BIND, complain); + if (!CLASS_TYPE_P (to) + && CONSTRUCTOR_NELTS (expr) == 1) + { +@@ -1624,9 +1624,9 @@ + + /* [dcl.init.ref] + +- Otherwise, the reference shall be to a non-volatile const type. +- +- Under C++0x, [8.5.3/5 dcl.init.ref] it may also be an rvalue reference */ ++ Otherwise, the reference shall be an lvalue reference to a ++ non-volatile const type, or the reference shall be an rvalue ++ reference. */ + if (!CP_TYPE_CONST_NON_VOLATILE_P (to) && !TYPE_REF_IS_RVALUE (rto)) + return NULL; + +@@ -1664,7 +1664,16 @@ + /* This reference binding, unlike those above, requires the + creation of a temporary. */ + conv->need_temporary_p = true; +- conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto); ++ if (TYPE_REF_IS_RVALUE (rto)) ++ { ++ conv->rvaluedness_matches_p = 1; ++ /* In the second case, if the reference is an rvalue reference and ++ the second standard conversion sequence of the user-defined ++ conversion sequence includes an lvalue-to-rvalue conversion, the ++ program is ill-formed. */ ++ if (conv->user_conv_p && next_conversion (conv)->kind == ck_rvalue) ++ conv->bad_p = 1; ++ } + + return conv; + } +@@ -5811,7 +5820,7 @@ + && convs->kind != ck_list + && convs->kind != ck_ambig + && (convs->kind != ck_ref_bind +- || convs->user_conv_p) ++ || (convs->user_conv_p && next_conversion (convs)->bad_p)) + && (convs->kind != ck_rvalue + || SCALAR_TYPE_P (totype)) + && convs->kind != ck_base) +@@ -6110,7 +6119,8 @@ + if (convs->bad_p && !next_conversion (convs)->bad_p) + { + gcc_assert (TYPE_REF_IS_RVALUE (ref_type) +- && real_lvalue_p (expr)); ++ && (real_lvalue_p (expr) ++ || next_conversion(convs)->kind == ck_rvalue)); + + error_at (loc, "cannot bind %qT lvalue to %qT", + TREE_TYPE (expr), totype); +Index: gcc/cp/friend.c +=================================================================== +--- gcc/cp/friend.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/cp/friend.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -502,7 +502,13 @@ + ? current_template_parms + : NULL_TREE); + +- if (template_member_p && decl && TREE_CODE (decl) == FUNCTION_DECL) ++ if ((template_member_p ++ /* Always pull out the TEMPLATE_DECL if we have a friend ++ template in a class template so that it gets tsubsted ++ properly later on (59956). tsubst_friend_function knows ++ how to tell this apart from a member template. */ ++ || (class_template_depth && friend_depth)) ++ && decl && TREE_CODE (decl) == FUNCTION_DECL) + decl = DECL_TI_TEMPLATE (decl); + + if (decl) +Index: gcc/haifa-sched.c +=================================================================== +--- gcc/haifa-sched.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/haifa-sched.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2931,7 +2931,7 @@ + { + advance_state (curr_state); + if (sched_verbose >= 6) +- fprintf (sched_dump, ";;\tAdvanced a state.\n"); ++ fprintf (sched_dump, ";;\tAdvance the current state.\n"); + } + + /* Update register pressure after scheduling INSN. */ +@@ -5964,6 +5964,7 @@ + modulo_insns_scheduled = 0; + + ls.modulo_epilogue = false; ++ ls.first_cycle_insn_p = true; + + /* Loop until all the insns in BB are scheduled. */ + while ((*current_sched_info->schedule_more_p) ()) +@@ -6034,7 +6035,6 @@ + if (must_backtrack) + goto do_backtrack; + +- ls.first_cycle_insn_p = true; + ls.shadows_only_p = false; + cycle_issued_insns = 0; + ls.can_issue_more = issue_rate; +@@ -6321,11 +6321,13 @@ + break; + } + } ++ ls.first_cycle_insn_p = true; + } + if (ls.modulo_epilogue) + success = true; + end_schedule: +- advance_one_cycle (); ++ if (!ls.first_cycle_insn_p) ++ advance_one_cycle (); + perform_replacements_new_cycle (); + if (modulo_ii > 0) + { +Index: gcc/double-int.c +=================================================================== +--- gcc/double-int.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/double-int.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -616,7 +616,7 @@ + == (unsigned HOST_WIDE_INT) htwice) + && (labs_den <= ltwice))) + { +- if (*hquo < 0) ++ if (quo_neg) + /* quo = quo - 1; */ + add_double (*lquo, *hquo, + (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo); +Index: gcc/tree-ssa-math-opts.c +=================================================================== +--- gcc/tree-ssa-math-opts.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-ssa-math-opts.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1537,7 +1537,7 @@ + + struct symbolic_number { + unsigned HOST_WIDEST_INT n; +- int size; ++ tree type; + }; + + /* Perform a SHIFT or ROTATE operation by COUNT bits on symbolic +@@ -1549,13 +1549,15 @@ + struct symbolic_number *n, + int count) + { ++ int bitsize = TYPE_PRECISION (n->type); ++ + if (count % 8 != 0) + return false; + + /* Zero out the extra bits of N in order to avoid them being shifted + into the significant bits. */ +- if (n->size < (int)sizeof (HOST_WIDEST_INT)) +- n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1; ++ if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) ++ n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; + + switch (code) + { +@@ -1563,20 +1565,24 @@ + n->n <<= count; + break; + case RSHIFT_EXPR: ++ /* Arithmetic shift of signed type: result is dependent on the value. */ ++ if (!TYPE_UNSIGNED (n->type) ++ && (n->n & ((unsigned HOST_WIDEST_INT) 0xff << (bitsize - 8)))) ++ return false; + n->n >>= count; + break; + case LROTATE_EXPR: +- n->n = (n->n << count) | (n->n >> ((n->size * BITS_PER_UNIT) - count)); ++ n->n = (n->n << count) | (n->n >> (bitsize - count)); + break; + case RROTATE_EXPR: +- n->n = (n->n >> count) | (n->n << ((n->size * BITS_PER_UNIT) - count)); ++ n->n = (n->n >> count) | (n->n << (bitsize - count)); + break; + default: + return false; + } + /* Zero unused bits for size. */ +- if (n->size < (int)sizeof (HOST_WIDEST_INT)) +- n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1; ++ if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) ++ n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; + return true; + } + +@@ -1593,7 +1599,7 @@ + if (TREE_CODE (lhs_type) != INTEGER_TYPE) + return false; + +- if (TYPE_PRECISION (lhs_type) != n->size * BITS_PER_UNIT) ++ if (TYPE_PRECISION (lhs_type) != TYPE_PRECISION (n->type)) + return false; + + return true; +@@ -1650,20 +1656,25 @@ + to initialize the symbolic number. */ + if (!source_expr1) + { ++ int size; ++ + /* Set up the symbolic number N by setting each byte to a + value between 1 and the byte size of rhs1. The highest + order byte is set to n->size and the lowest order + byte to 1. */ +- n->size = TYPE_PRECISION (TREE_TYPE (rhs1)); +- if (n->size % BITS_PER_UNIT != 0) ++ n->type = TREE_TYPE (rhs1); ++ size = TYPE_PRECISION (n->type); ++ if (size % BITS_PER_UNIT != 0) + return NULL_TREE; +- n->size /= BITS_PER_UNIT; ++ if (size > HOST_BITS_PER_WIDEST_INT) ++ return NULL_TREE; ++ size /= BITS_PER_UNIT; + n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 : + (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201); + +- if (n->size < (int)sizeof (HOST_WIDEST_INT)) ++ if (size < (int)sizeof (HOST_WIDEST_INT)) + n->n &= ((unsigned HOST_WIDEST_INT)1 << +- (n->size * BITS_PER_UNIT)) - 1; ++ (size * BITS_PER_UNIT)) - 1; + + source_expr1 = rhs1; + } +@@ -1672,12 +1683,12 @@ + { + case BIT_AND_EXPR: + { +- int i; ++ int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; + unsigned HOST_WIDEST_INT val = widest_int_cst_value (rhs2); + unsigned HOST_WIDEST_INT tmp = val; + + /* Only constants masking full bytes are allowed. */ +- for (i = 0; i < n->size; i++, tmp >>= BITS_PER_UNIT) ++ for (i = 0; i < size; i++, tmp >>= BITS_PER_UNIT) + if ((tmp & 0xff) != 0 && (tmp & 0xff) != 0xff) + return NULL_TREE; + +@@ -1693,12 +1704,24 @@ + break; + CASE_CONVERT: + { +- int type_size; ++ int type_size, old_type_size; ++ tree type; + +- type_size = TYPE_PRECISION (gimple_expr_type (stmt)); ++ type = gimple_expr_type (stmt); ++ type_size = TYPE_PRECISION (type); + if (type_size % BITS_PER_UNIT != 0) + return NULL_TREE; ++ if (type_size > (int) HOST_BITS_PER_WIDEST_INT) ++ return NULL_TREE; + ++ /* Sign extension: result is dependent on the value. */ ++ old_type_size = TYPE_PRECISION (n->type); ++ if (!TYPE_UNSIGNED (n->type) ++ && type_size > old_type_size ++ && n->n & ++ ((unsigned HOST_WIDEST_INT) 0xff << (old_type_size - 8))) ++ return NULL_TREE; ++ + if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT))) + { + /* If STMT casts to a smaller type mask out the bits not +@@ -1705,7 +1728,7 @@ + belonging to the target type. */ + n->n &= ((unsigned HOST_WIDEST_INT)1 << type_size) - 1; + } +- n->size = type_size / BITS_PER_UNIT; ++ n->type = type; + } + break; + default: +@@ -1718,7 +1741,7 @@ + + if (rhs_class == GIMPLE_BINARY_RHS) + { +- int i; ++ int i, size; + struct symbolic_number n1, n2; + unsigned HOST_WIDEST_INT mask; + tree source_expr2; +@@ -1742,11 +1765,12 @@ + source_expr2 = find_bswap_1 (rhs2_stmt, &n2, limit - 1); + + if (source_expr1 != source_expr2 +- || n1.size != n2.size) ++ || TYPE_PRECISION (n1.type) != TYPE_PRECISION (n2.type)) + return NULL_TREE; + +- n->size = n1.size; +- for (i = 0, mask = 0xff; i < n->size; i++, mask <<= BITS_PER_UNIT) ++ n->type = n1.type; ++ size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; ++ for (i = 0, mask = 0xff; i < size; i++, mask <<= BITS_PER_UNIT) + { + unsigned HOST_WIDEST_INT masked1, masked2; + +@@ -1785,7 +1809,7 @@ + + struct symbolic_number n; + tree source_expr; +- int limit; ++ int limit, bitsize; + + /* The last parameter determines the depth search limit. It usually + correlates directly to the number of bytes to be touched. We +@@ -1800,13 +1824,14 @@ + return NULL_TREE; + + /* Zero out the extra bits of N and CMP. */ +- if (n.size < (int)sizeof (HOST_WIDEST_INT)) ++ bitsize = TYPE_PRECISION (n.type); ++ if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) + { + unsigned HOST_WIDEST_INT mask = +- ((unsigned HOST_WIDEST_INT)1 << (n.size * BITS_PER_UNIT)) - 1; ++ ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; + + n.n &= mask; +- cmp >>= (sizeof (HOST_WIDEST_INT) - n.size) * BITS_PER_UNIT; ++ cmp >>= sizeof (HOST_WIDEST_INT) * BITS_PER_UNIT - bitsize; + } + + /* A complete byte swap should make the symbolic number to start +@@ -1828,7 +1853,7 @@ + bool changed = false; + tree bswap16_type = NULL_TREE, bswap32_type = NULL_TREE, bswap64_type = NULL_TREE; + +- if (BITS_PER_UNIT != 8) ++ if (BITS_PER_UNIT != 8 || CHAR_BIT != 8) + return 0; + + if (sizeof (HOST_WIDEST_INT) < 8) +Index: gcc/ifcvt.c +=================================================================== +--- gcc/ifcvt.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ifcvt.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -294,6 +294,28 @@ + + return (e) ? e->dest : NULL_BLOCK; + } ++ ++/* Return true if RTXs A and B can be safely interchanged. */ ++ ++static bool ++rtx_interchangeable_p (const_rtx a, const_rtx b) ++{ ++ if (!rtx_equal_p (a, b)) ++ return false; ++ ++ if (GET_CODE (a) != MEM) ++ return true; ++ ++ /* A dead type-unsafe memory reference is legal, but a live type-unsafe memory ++ reference is not. Interchanging a dead type-unsafe memory reference with ++ a live type-safe one creates a live type-unsafe memory reference, in other ++ words, it makes the program illegal. ++ We check here conservatively whether the two memory references have equal ++ memory attributes. */ ++ ++ return mem_attrs_eq_p (get_mem_attrs (a), get_mem_attrs (b)); ++} ++ + + /* Go through a bunch of insns, converting them to conditional + execution format if possible. Return TRUE if all of the non-note +@@ -1014,6 +1036,9 @@ + || (rtx_equal_p (if_info->a, XEXP (cond, 1)) + && rtx_equal_p (if_info->b, XEXP (cond, 0)))) + { ++ if (!rtx_interchangeable_p (if_info->a, if_info->b)) ++ return FALSE; ++ + y = (code == EQ) ? if_info->a : if_info->b; + + /* Avoid generating the move if the source is the destination. */ +@@ -2483,7 +2508,7 @@ + if (! insn_b + || insn_b != last_active_insn (else_bb, FALSE) + || (set_b = single_set (insn_b)) == NULL_RTX +- || ! rtx_equal_p (x, SET_DEST (set_b))) ++ || ! rtx_interchangeable_p (x, SET_DEST (set_b))) + return FALSE; + } + else +@@ -2496,7 +2521,7 @@ + || BLOCK_FOR_INSN (insn_b) != BLOCK_FOR_INSN (if_info->cond_earliest) + || !NONJUMP_INSN_P (insn_b) + || (set_b = single_set (insn_b)) == NULL_RTX +- || ! rtx_equal_p (x, SET_DEST (set_b)) ++ || ! rtx_interchangeable_p (x, SET_DEST (set_b)) + || ! noce_operand_ok (SET_SRC (set_b)) + || reg_overlap_mentioned_p (x, SET_SRC (set_b)) + || modified_between_p (SET_SRC (set_b), insn_b, jump) +@@ -2562,7 +2587,7 @@ + + /* Look and see if A and B are really the same. Avoid creating silly + cmove constructs that no one will fix up later. */ +- if (rtx_equal_p (a, b)) ++ if (rtx_interchangeable_p (a, b)) + { + /* If we have an INSN_B, we don't have to create any new rtl. Just + move the instruction that we already have. If we don't have an +@@ -4246,6 +4271,9 @@ + old_dest = JUMP_LABEL (jump); + if (other_bb != new_dest) + { ++ if (!any_condjump_p (jump)) ++ goto cancel; ++ + if (JUMP_P (BB_END (dest_edge->src))) + new_dest_label = JUMP_LABEL (BB_END (dest_edge->src)); + else if (new_dest == EXIT_BLOCK_PTR) +Index: gcc/dwarf2out.c +=================================================================== +--- gcc/dwarf2out.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/dwarf2out.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -12234,7 +12234,7 @@ + op1 = mem_loc_descriptor (XEXP (rtl, 1), mode, mem_mode, + VAR_INIT_STATUS_INITIALIZED); + if (op1 == 0) +- break; ++ return NULL; + add_loc_descr (&mem_loc_result, op1); + add_loc_descr (&mem_loc_result, + new_loc_descr (DW_OP_plus, 0, 0)); +@@ -13882,6 +13882,10 @@ + have_address = 1; + break; + ++ case TARGET_MEM_REF: ++ case SSA_NAME: ++ return NULL; ++ + case COMPOUND_EXPR: + return loc_list_from_tree (TREE_OPERAND (loc, 1), want_address); + +Index: gcc/expr.c +=================================================================== +--- gcc/expr.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/expr.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -10603,7 +10603,7 @@ + || !host_integerp (TREE_OPERAND (offset, 1), 1) + || compare_tree_int (TREE_OPERAND (offset, 1), + BIGGEST_ALIGNMENT / BITS_PER_UNIT) <= 0 +- || !exact_log2 (tree_low_cst (TREE_OPERAND (offset, 1), 1) + 1) < 0) ++ || exact_log2 (tree_low_cst (TREE_OPERAND (offset, 1), 1) + 1) < 0) + return 0; + + /* Look at the first operand of BIT_AND_EXPR and strip any conversion. +Index: gcc/ada/socket.c +=================================================================== +--- gcc/ada/socket.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ada/socket.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -212,7 +212,7 @@ + struct hostent *rh; + int ri; + +-#if defined(__linux__) || defined(__GLIBC__) ++#if defined(__linux__) || defined(__GLIBC__) || defined(__rtems__) + (void) gethostbyname_r (name, ret, buf, buflen, &rh, h_errnop); + #else + rh = gethostbyname_r (name, ret, buf, buflen, h_errnop); +Index: gcc/ada/uintp.adb +=================================================================== +--- gcc/ada/uintp.adb (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ada/uintp.adb (.../branches/gcc-4_8-branch) (revision 217117) +@@ -171,22 +171,6 @@ + -- If Discard_Quotient is True, Quotient is set to No_Uint + -- If Discard_Remainder is True, Remainder is set to No_Uint + +- function Vector_To_Uint +- (In_Vec : UI_Vector; +- Negative : Boolean) return Uint; +- -- Functions that calculate values in UI_Vectors, call this function to +- -- create and return the Uint value. In_Vec contains the multiple precision +- -- (Base) representation of a non-negative value. Leading zeroes are +- -- permitted. Negative is set if the desired result is the negative of the +- -- given value. The result will be either the appropriate directly +- -- represented value, or a table entry in the proper canonical format is +- -- created and returned. +- -- +- -- Note that Init_Operand puts a signed value in the result vector, but +- -- Vector_To_Uint is always presented with a non-negative value. The +- -- processing of signs is something that is done by the caller before +- -- calling Vector_To_Uint. +- + ------------ + -- Direct -- + ------------ +Index: gcc/ada/uintp.ads +=================================================================== +--- gcc/ada/uintp.ads (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ada/uintp.ads (.../branches/gcc-4_8-branch) (revision 217117) +@@ -90,6 +90,18 @@ + Uint_Minus_80 : constant Uint; + Uint_Minus_128 : constant Uint; + ++ type UI_Vector is array (Pos range <>) of Int; ++ -- Vector containing the integer values of a Uint value ++ ++ -- Note: An earlier version of this package used pointers of arrays of Ints ++ -- (dynamically allocated) for the Uint type. The change leads to a few ++ -- less natural idioms used throughout this code, but eliminates all uses ++ -- of the heap except for the table package itself. For example, Uint ++ -- parameters are often converted to UI_Vectors for internal manipulation. ++ -- This is done by creating the local UI_Vector using the function N_Digits ++ -- on the Uint to find the size needed for the vector, and then calling ++ -- Init_Operand to copy the values out of the table into the vector. ++ + ----------------- + -- Subprograms -- + ----------------- +@@ -252,6 +264,22 @@ + -- function is used for capacity checks, and it can be one bit off + -- without affecting its usage. + ++ function Vector_To_Uint ++ (In_Vec : UI_Vector; ++ Negative : Boolean) return Uint; ++ -- Functions that calculate values in UI_Vectors, call this function to ++ -- create and return the Uint value. In_Vec contains the multiple precision ++ -- (Base) representation of a non-negative value. Leading zeroes are ++ -- permitted. Negative is set if the desired result is the negative of the ++ -- given value. The result will be either the appropriate directly ++ -- represented value, or a table entry in the proper canonical format is ++ -- created and returned. ++ -- ++ -- Note that Init_Operand puts a signed value in the result vector, but ++ -- Vector_To_Uint is always presented with a non-negative value. The ++ -- processing of signs is something that is done by the caller before ++ -- calling Vector_To_Uint. ++ + --------------------- + -- Output Routines -- + --------------------- +@@ -494,18 +522,6 @@ + -- UI_Vector is defined for this purpose and some internal subprograms + -- used for converting from one to the other are defined. + +- type UI_Vector is array (Pos range <>) of Int; +- -- Vector containing the integer values of a Uint value +- +- -- Note: An earlier version of this package used pointers of arrays of Ints +- -- (dynamically allocated) for the Uint type. The change leads to a few +- -- less natural idioms used throughout this code, but eliminates all uses +- -- of the heap except for the table package itself. For example, Uint +- -- parameters are often converted to UI_Vectors for internal manipulation. +- -- This is done by creating the local UI_Vector using the function N_Digits +- -- on the Uint to find the size needed for the vector, and then calling +- -- Init_Operand to copy the values out of the table into the vector. +- + type Uint_Entry is record + Length : Pos; + -- Length of entry in Udigits table in digits (i.e. in words) +Index: gcc/ada/ChangeLog +=================================================================== +--- gcc/ada/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ada/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,20 @@ ++2014-10-13 Eric Botcazou ++ Alan Modra ++ ++ PR ada/63225 ++ * uintp.adb (Vector_To_Uint): Move from here to... ++ * uintp.ads (UI_Vector): Make public. ++ (Vector_To_Uint): ...here. ++ ++2014-08-12 Joel Sherrill ++ ++ * socket.c: For RTEMS, use correct prototype of gethostbyname_r(). ++ * gsocket.h Add include of on RTEMS. ++ ++2014-08-11 Joel Sherrill ++ ++ * s-osinte-rtems.adb: Correct formatting of line in license block. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: gcc/ada/s-osinte-rtems.adb +=================================================================== +--- gcc/ada/s-osinte-rtems.adb (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ada/s-osinte-rtems.adb (.../branches/gcc-4_8-branch) (revision 217117) +@@ -22,7 +22,7 @@ + -- You should have received a copy of the GNU General Public License and -- + -- a copy of the GCC Runtime Library Exception along with this program; -- + -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +--- . ++-- . -- + -- -- + -- GNARL was developed by the GNARL team at Florida State University. It is -- + -- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- +Index: gcc/ada/gsocket.h +=================================================================== +--- gcc/ada/gsocket.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/ada/gsocket.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -183,6 +183,11 @@ + #include + #endif + ++#if defined(__rtems__) ++#include ++/* Required, for read(), write(), and close() */ ++#endif ++ + /* + * RTEMS has these .h files but not until you have built and installed RTEMS. + * When building a C/C++ toolset, you also build the newlib C library, so the +Index: gcc/tree-ssa-ifcombine.c +=================================================================== +--- gcc/tree-ssa-ifcombine.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-ssa-ifcombine.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -105,7 +105,11 @@ + { + gimple stmt = gsi_stmt (gsi); + ++ if (is_gimple_debug (stmt)) ++ continue; ++ + if (gimple_has_side_effects (stmt) ++ || gimple_could_trap_p (stmt) + || gimple_vuse (stmt)) + return false; + } +@@ -197,7 +201,8 @@ + while (is_gimple_assign (stmt) + && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt)) + && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt))) +- <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt))))) ++ <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt)))) ++ && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME) + || gimple_assign_ssa_name_copy_p (stmt))) + stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); + +Index: gcc/sel-sched-ir.c +=================================================================== +--- gcc/sel-sched-ir.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/sel-sched-ir.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -162,7 +162,7 @@ + static void free_av_set (basic_block); + static void invalidate_av_set (basic_block); + static void extend_insn_data (void); +-static void sel_init_new_insn (insn_t, int); ++static void sel_init_new_insn (insn_t, int, int = -1); + static void finish_insns (void); + + /* Various list functions. */ +@@ -4011,9 +4011,10 @@ + return seqno; + } + +-/* Compute seqno for INSN by its preds or succs. */ ++/* Compute seqno for INSN by its preds or succs. Use OLD_SEQNO to compute ++ seqno in corner cases. */ + static int +-get_seqno_for_a_jump (insn_t insn) ++get_seqno_for_a_jump (insn_t insn, int old_seqno) + { + int seqno; + +@@ -4069,8 +4070,16 @@ + if (seqno < 0) + seqno = get_seqno_by_succs (insn); + ++ if (seqno < 0) ++ { ++ /* The only case where this could be here legally is that the only ++ unscheduled insn was a conditional jump that got removed and turned ++ into this unconditional one. Initialize from the old seqno ++ of that jump passed down to here. */ ++ seqno = old_seqno; ++ } ++ + gcc_assert (seqno >= 0); +- + return seqno; + } + +@@ -4250,22 +4259,24 @@ + } + + /* This is used to initialize spurious jumps generated by +- sel_redirect_edge (). */ ++ sel_redirect_edge (). OLD_SEQNO is used for initializing seqnos ++ in corner cases within get_seqno_for_a_jump. */ + static void +-init_simplejump_data (insn_t insn) ++init_simplejump_data (insn_t insn, int old_seqno) + { + init_expr (INSN_EXPR (insn), vinsn_create (insn, false), 0, + REG_BR_PROB_BASE, 0, 0, 0, 0, 0, 0, + vNULL, true, false, false, + false, true); +- INSN_SEQNO (insn) = get_seqno_for_a_jump (insn); ++ INSN_SEQNO (insn) = get_seqno_for_a_jump (insn, old_seqno); + init_first_time_insn_data (insn); + } + + /* Perform deferred initialization of insns. This is used to process +- a new jump that may be created by redirect_edge. */ +-void +-sel_init_new_insn (insn_t insn, int flags) ++ a new jump that may be created by redirect_edge. OLD_SEQNO is used ++ for initializing simplejumps in init_simplejump_data. */ ++static void ++sel_init_new_insn (insn_t insn, int flags, int old_seqno) + { + /* We create data structures for bb when the first insn is emitted in it. */ + if (INSN_P (insn) +@@ -4292,7 +4303,7 @@ + if (flags & INSN_INIT_TODO_SIMPLEJUMP) + { + extend_insn_data (); +- init_simplejump_data (insn); ++ init_simplejump_data (insn, old_seqno); + } + + gcc_assert (CONTAINING_RGN (BLOCK_NUM (insn)) +@@ -5578,8 +5589,7 @@ + } + + /* A wrapper for redirect_edge_and_branch_force, which also initializes +- data structures for possibly created bb and insns. Returns the newly +- added bb or NULL, when a bb was not needed. */ ++ data structures for possibly created bb and insns. */ + void + sel_redirect_edge_and_branch_force (edge e, basic_block to) + { +@@ -5586,6 +5596,7 @@ + basic_block jump_bb, src, orig_dest = e->dest; + int prev_max_uid; + rtx jump; ++ int old_seqno = -1; + + /* This function is now used only for bookkeeping code creation, where + we'll never get the single pred of orig_dest block and thus will not +@@ -5594,8 +5605,13 @@ + && !single_pred_p (orig_dest)); + src = e->src; + prev_max_uid = get_max_uid (); ++ /* Compute and pass old_seqno down to sel_init_new_insn only for the case ++ when the conditional jump being redirected may become unconditional. */ ++ if (any_condjump_p (BB_END (src)) ++ && INSN_SEQNO (BB_END (src)) >= 0) ++ old_seqno = INSN_SEQNO (BB_END (src)); ++ + jump_bb = redirect_edge_and_branch_force (e, to); +- + if (jump_bb != NULL) + sel_add_bb (jump_bb); + +@@ -5607,7 +5623,8 @@ + + jump = find_new_jump (src, jump_bb, prev_max_uid); + if (jump) +- sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP); ++ sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP, ++ old_seqno); + set_immediate_dominator (CDI_DOMINATORS, to, + recompute_dominator (CDI_DOMINATORS, to)); + set_immediate_dominator (CDI_DOMINATORS, orig_dest, +@@ -5626,6 +5643,7 @@ + edge redirected; + bool recompute_toporder_p = false; + bool maybe_unreachable = single_pred_p (orig_dest); ++ int old_seqno = -1; + + latch_edge_p = (pipelining_p + && current_loop_nest +@@ -5634,6 +5652,12 @@ + src = e->src; + prev_max_uid = get_max_uid (); + ++ /* Compute and pass old_seqno down to sel_init_new_insn only for the case ++ when the conditional jump being redirected may become unconditional. */ ++ if (any_condjump_p (BB_END (src)) ++ && INSN_SEQNO (BB_END (src)) >= 0) ++ old_seqno = INSN_SEQNO (BB_END (src)); ++ + redirected = redirect_edge_and_branch (e, to); + + gcc_assert (redirected && !last_added_blocks.exists ()); +@@ -5654,7 +5678,7 @@ + + jump = find_new_jump (src, NULL, prev_max_uid); + if (jump) +- sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP); ++ sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP, old_seqno); + + /* Only update dominator info when we don't have unreachable blocks. + Otherwise we'll update in maybe_tidy_empty_bb. */ +Index: gcc/fortran/interface.c +=================================================================== +--- gcc/fortran/interface.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/interface.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1923,7 +1923,7 @@ + /* F2008, 12.5.2.5; IR F08/0073. */ + if (formal->ts.type == BT_CLASS && actual->expr_type != EXPR_NULL + && ((CLASS_DATA (formal)->attr.class_pointer +- && !formal->attr.intent == INTENT_IN) ++ && formal->attr.intent != INTENT_IN) + || CLASS_DATA (formal)->attr.allocatable)) + { + if (actual->ts.type != BT_CLASS) +Index: gcc/fortran/trans-expr.c +=================================================================== +--- gcc/fortran/trans-expr.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/trans-expr.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -7096,7 +7096,7 @@ + + res_desc = gfc_evaluate_now (desc, &se->pre); + gfc_conv_descriptor_data_set (&se->pre, res_desc, null_pointer_node); +- se->expr = gfc_build_addr_expr (TREE_TYPE (se->expr), res_desc); ++ se->expr = gfc_build_addr_expr (NULL_TREE, res_desc); + + /* Free the lhs after the function call and copy the result data to + the lhs descriptor. */ +Index: gcc/fortran/decl.c +=================================================================== +--- gcc/fortran/decl.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/decl.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1996,6 +1996,13 @@ + if (gfc_notify_std (GFC_STD_GNU, "Old-style " + "initialization at %C") == FAILURE) + return MATCH_ERROR; ++ else if (gfc_current_state () == COMP_DERIVED) ++ { ++ gfc_error ("Invalid old style initialization for derived type " ++ "component at %C"); ++ m = MATCH_ERROR; ++ goto cleanup; ++ } + + return match_old_style_init (name); + } +Index: gcc/fortran/trans-openmp.c +=================================================================== +--- gcc/fortran/trans-openmp.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/trans-openmp.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -115,6 +115,16 @@ + if (GFC_DECL_RESULT (decl) && ! DECL_HAS_VALUE_EXPR_P (decl)) + return OMP_CLAUSE_DEFAULT_SHARED; + ++ /* These are either array or derived parameters, or vtables. ++ In the former cases, the OpenMP standard doesn't consider them to be ++ variables at all (they can't be redefined), but they can nevertheless appear ++ in parallel/task regions and for default(none) purposes treat them as shared. ++ For vtables likely the same handling is desirable. */ ++ if (TREE_CODE (decl) == VAR_DECL ++ && TREE_READONLY (decl) ++ && TREE_STATIC (decl)) ++ return OMP_CLAUSE_DEFAULT_SHARED; ++ + return OMP_CLAUSE_DEFAULT_UNSPECIFIED; + } + +Index: gcc/fortran/ChangeLog +=================================================================== +--- gcc/fortran/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,63 @@ ++2014-10-10 Jakub Jelinek ++ ++ PR fortran/59488 ++ * trans-openmp.c (gfc_omp_predetermined_sharing): Return ++ OMP_CLAUSE_DEFAULT_SHARED for parameters or vtables. ++ ++2014-09-03 Marek Polacek ++ ++ Backport from trunk ++ PR fortran/62270 ++ * interface.c (compare_parameter): Fix condition. ++ ++2014-08-21 Thomas Koenig ++ ++ Backport from trunk ++ PR fortran/62214 ++ * gfortran.dg/array_assignment_5.f90: New test. ++ ++2014-08-10 Thomas Koenig ++ ++ Backport from trunk ++ PR fortran/61999 ++ * simplify.c (gfc_simplify_dot_product): Convert types of ++ vectors before calculating the result. ++ ++2014-07-19 Paul Thomas ++ ++ Backport from trunk. ++ PR fortran/61780 ++ * dependency.c (gfc_dep_resolver): Index the 'reverse' array so ++ that elements are skipped. This then correctly aligns 'reverse' ++ with the scalarizer loops. ++ ++2014-07-08 Paul Thomas ++ ++ PR fortran/61459 ++ PR fortran/58883 ++ * trans-expr.c (fcncall_realloc_result): Use the natural type ++ for the address expression of 'res_desc'. ++ ++2014-07-02 Jakub Jelinek ++ Fritz Reese ++ ++ * decl.c (variable_decl): Reject old style initialization ++ for derived type components. ++ ++2014-06-15 Francois-Xavier Coudert ++ ++ Backport from trunk. ++ PR fortran/45187 ++ * trans-decl.c (gfc_create_module_variable): Don't create ++ Cray-pointee decls twice. ++ ++2014-05-26 Janne Blomqvist ++ ++ Backport from mainline ++ PR libfortran/61310 ++ * intrinsics.texi (CTIME): Remove mention of locale-dependent ++ behavior. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: gcc/fortran/frontend-passes.c +=================================================================== +--- gcc/fortran/frontend-passes.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/frontend-passes.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -874,6 +874,10 @@ + return true; + break; + ++ case INTRINSIC_CONCAT: ++ /* Do not do string concatenations. */ ++ break; ++ + default: + /* Binary operators. */ + if (optimize_binop_array_assignment (c, &e->value.op.op1, true)) +Index: gcc/fortran/trans-decl.c +=================================================================== +--- gcc/fortran/trans-decl.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/trans-decl.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -4084,8 +4084,8 @@ + } + + /* Don't generate variables from other modules. Variables from +- COMMONs will already have been generated. */ +- if (sym->attr.use_assoc || sym->attr.in_common) ++ COMMONs and Cray pointees will already have been generated. */ ++ if (sym->attr.use_assoc || sym->attr.in_common || sym->attr.cray_pointee) + return; + + /* Equivalenced variables arrive here after creation. */ +Index: gcc/fortran/dependency.c +=================================================================== +--- gcc/fortran/dependency.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/dependency.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1779,6 +1779,7 @@ + gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse) + { + int n; ++ int m; + gfc_dependency fin_dep; + gfc_dependency this_dep; + +@@ -1828,6 +1829,8 @@ + break; + } + ++ /* Index for the reverse array. */ ++ m = -1; + for (n=0; n < lref->u.ar.dimen; n++) + { + /* Assume dependency when either of array reference is vector +@@ -1862,31 +1865,37 @@ + The ability to reverse or not is set by previous conditions + in this dimension. If reversal is not activated, the + value GFC_DEP_BACKWARD is reset to GFC_DEP_OVERLAP. */ ++ ++ /* Get the indexing right for the scalarizing loop. If this ++ is an element, there is no corresponding loop. */ ++ if (lref->u.ar.dimen_type[n] != DIMEN_ELEMENT) ++ m++; ++ + if (rref->u.ar.dimen_type[n] == DIMEN_RANGE + && lref->u.ar.dimen_type[n] == DIMEN_RANGE) + { + /* Set reverse if backward dependence and not inhibited. */ +- if (reverse && reverse[n] == GFC_ENABLE_REVERSE) +- reverse[n] = (this_dep == GFC_DEP_BACKWARD) ? +- GFC_REVERSE_SET : reverse[n]; ++ if (reverse && reverse[m] == GFC_ENABLE_REVERSE) ++ reverse[m] = (this_dep == GFC_DEP_BACKWARD) ? ++ GFC_REVERSE_SET : reverse[m]; + + /* Set forward if forward dependence and not inhibited. */ +- if (reverse && reverse[n] == GFC_ENABLE_REVERSE) +- reverse[n] = (this_dep == GFC_DEP_FORWARD) ? +- GFC_FORWARD_SET : reverse[n]; ++ if (reverse && reverse[m] == GFC_ENABLE_REVERSE) ++ reverse[m] = (this_dep == GFC_DEP_FORWARD) ? ++ GFC_FORWARD_SET : reverse[m]; + + /* Flag up overlap if dependence not compatible with + the overall state of the expression. */ +- if (reverse && reverse[n] == GFC_REVERSE_SET ++ if (reverse && reverse[m] == GFC_REVERSE_SET + && this_dep == GFC_DEP_FORWARD) + { +- reverse[n] = GFC_INHIBIT_REVERSE; ++ reverse[m] = GFC_INHIBIT_REVERSE; + this_dep = GFC_DEP_OVERLAP; + } +- else if (reverse && reverse[n] == GFC_FORWARD_SET ++ else if (reverse && reverse[m] == GFC_FORWARD_SET + && this_dep == GFC_DEP_BACKWARD) + { +- reverse[n] = GFC_INHIBIT_REVERSE; ++ reverse[m] = GFC_INHIBIT_REVERSE; + this_dep = GFC_DEP_OVERLAP; + } + +@@ -1893,7 +1902,7 @@ + /* If no intention of reversing or reversing is explicitly + inhibited, convert backward dependence to overlap. */ + if ((reverse == NULL && this_dep == GFC_DEP_BACKWARD) +- || (reverse != NULL && reverse[n] == GFC_INHIBIT_REVERSE)) ++ || (reverse != NULL && reverse[m] == GFC_INHIBIT_REVERSE)) + this_dep = GFC_DEP_OVERLAP; + } + +Index: gcc/fortran/intrinsic.texi +=================================================================== +--- gcc/fortran/intrinsic.texi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/intrinsic.texi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3343,10 +3343,8 @@ + @table @asis + @item @emph{Description}: + @code{CTIME} converts a system time value, such as returned by +-@code{TIME8}, to a string. Unless the application has called +-@code{setlocale}, the output will be in the default locale, of length +-24 and of the form @samp{Sat Aug 19 18:13:14 1995}. In other locales, +-a longer string may result. ++@code{TIME8}, to a string. The output will be of the form @samp{Sat ++Aug 19 18:13:14 1995}. + + This intrinsic is provided in both subroutine and function forms; however, + only one form can be used in any given program unit. +Index: gcc/fortran/simplify.c +=================================================================== +--- gcc/fortran/simplify.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/fortran/simplify.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1877,6 +1877,9 @@ + gfc_expr* + gfc_simplify_dot_product (gfc_expr *vector_a, gfc_expr *vector_b) + { ++ ++ gfc_expr temp; ++ + if (!is_constant_array_expr (vector_a) + || !is_constant_array_expr (vector_b)) + return NULL; +@@ -1883,8 +1886,14 @@ + + gcc_assert (vector_a->rank == 1); + gcc_assert (vector_b->rank == 1); +- gcc_assert (gfc_compare_types (&vector_a->ts, &vector_b->ts)); + ++ temp.expr_type = EXPR_OP; ++ gfc_clear_ts (&temp.ts); ++ temp.value.op.op = INTRINSIC_NONE; ++ temp.value.op.op1 = vector_a; ++ temp.value.op.op2 = vector_b; ++ gfc_type_convert_binary (&temp, 1); ++ + return compute_dot_product (vector_a, 1, 0, vector_b, 1, 0, true); + } + +Index: gcc/configure.ac +=================================================================== +--- gcc/configure.ac (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/configure.ac (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3443,6 +3443,32 @@ + AC_MSG_RESULT($gcc_cv_lto_plugin) + + case "$target" in ++ ++ aarch64*-*-*) ++ # Enable default workaround for AArch64 Cortex-A53 erratum 835769. ++ AC_ARG_ENABLE(fix-cortex-a53-835769, ++ [ ++AS_HELP_STRING([--enable-fix-cortex-a53-835769], ++ [enable workaround for AArch64 Cortex-A53 erratum 835769 by default]) ++AS_HELP_STRING([--disable-fix-cortex-a53-835769], ++ [disable workaround for AArch64 Cortex-A53 erratum 835769 by default]) ++ ], ++ [ ++ case $enableval in ++ yes) ++ tm_defines="${tm_defines} TARGET_FIX_ERR_A53_835769_DEFAULT=1" ++ ;; ++ no) ++ ;; ++ *) ++ AC_MSG_ERROR(['$enableval' is an invalid value for --enable-fix-cortex-a53-835769.\ ++ Valid choices are 'yes' and 'no'.]) ++ ;; ++ ++ esac ++ ], ++ []) ++ ;; + # All TARGET_ABI_OSF targets. + alpha*-*-linux* | alpha*-*-*bsd*) + gcc_GAS_CHECK_FEATURE([explicit relocation support], +Index: gcc/function.c +=================================================================== +--- gcc/function.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/function.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1354,9 +1354,13 @@ + #define STACK_POINTER_OFFSET 0 + #endif + ++#if defined (REG_PARM_STACK_SPACE) && !defined (INCOMING_REG_PARM_STACK_SPACE) ++#define INCOMING_REG_PARM_STACK_SPACE REG_PARM_STACK_SPACE ++#endif ++ + /* If not defined, pick an appropriate default for the offset of dynamically + allocated memory depending on the value of ACCUMULATE_OUTGOING_ARGS, +- REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE. */ ++ INCOMING_REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE. */ + + #ifndef STACK_DYNAMIC_OFFSET + +@@ -1368,12 +1372,12 @@ + `crtl->outgoing_args_size'. Nevertheless, we must allow + for it when allocating stack dynamic objects. */ + +-#if defined(REG_PARM_STACK_SPACE) ++#ifdef INCOMING_REG_PARM_STACK_SPACE + #define STACK_DYNAMIC_OFFSET(FNDECL) \ + ((ACCUMULATE_OUTGOING_ARGS \ + ? (crtl->outgoing_args_size \ + + (OUTGOING_REG_PARM_STACK_SPACE ((!(FNDECL) ? NULL_TREE : TREE_TYPE (FNDECL))) ? 0 \ +- : REG_PARM_STACK_SPACE (FNDECL))) \ ++ : INCOMING_REG_PARM_STACK_SPACE (FNDECL))) \ + : 0) + (STACK_POINTER_OFFSET)) + #else + #define STACK_DYNAMIC_OFFSET(FNDECL) \ +@@ -2211,8 +2215,9 @@ + #endif + all->args_so_far = pack_cumulative_args (&all->args_so_far_v); + +-#ifdef REG_PARM_STACK_SPACE +- all->reg_parm_stack_space = REG_PARM_STACK_SPACE (current_function_decl); ++#ifdef INCOMING_REG_PARM_STACK_SPACE ++ all->reg_parm_stack_space ++ = INCOMING_REG_PARM_STACK_SPACE (current_function_decl); + #endif + } + +@@ -4518,6 +4523,7 @@ + /* ??? This could be set on a per-function basis by the front-end + but is this worth the hassle? */ + cfun->can_throw_non_call_exceptions = flag_non_call_exceptions; ++ cfun->can_delete_dead_exceptions = flag_delete_dead_exceptions; + } + } + +Index: gcc/tree-vectorizer.h +=================================================================== +--- gcc/tree-vectorizer.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-vectorizer.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -324,9 +324,9 @@ + #define LOOP_VINFO_OPERANDS_SWAPPED(L) (L)->operands_swapped + + #define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \ +-(L)->may_misalign_stmts.length () > 0 ++((L)->may_misalign_stmts.length () > 0) + #define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \ +-(L)->may_alias_ddrs.length () > 0 ++((L)->may_alias_ddrs.length () > 0) + + #define NITERS_KNOWN_P(n) \ + (host_integerp ((n),0) \ +@@ -931,7 +931,8 @@ + extern bool vect_analyze_data_refs (loop_vec_info, bb_vec_info, int *); + extern tree vect_create_data_ref_ptr (gimple, tree, struct loop *, tree, + tree *, gimple_stmt_iterator *, +- gimple *, bool, bool *); ++ gimple *, bool, bool *, ++ tree = NULL_TREE); + extern tree bump_vector_ptr (tree, gimple, gimple_stmt_iterator *, gimple, tree); + extern tree vect_create_destination_var (tree, tree); + extern bool vect_grouped_store_supported (tree, unsigned HOST_WIDE_INT); +@@ -949,7 +950,8 @@ + extern int vect_get_place_in_interleaving_chain (gimple, gimple); + extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *); + extern tree vect_create_addr_base_for_vector_ref (gimple, gimple_seq *, +- tree, struct loop *); ++ tree, struct loop *, ++ tree = NULL_TREE); + + /* In tree-vect-loop.c. */ + /* FORNOW: Used in tree-parloops.c. */ +Index: gcc/stor-layout.c +=================================================================== +--- gcc/stor-layout.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/stor-layout.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -234,12 +234,7 @@ + param_type = TREE_TYPE (ref); + param_decl + = build_decl (input_location, PARM_DECL, param_name, param_type); +- if (targetm.calls.promote_prototypes (NULL_TREE) +- && INTEGRAL_TYPE_P (param_type) +- && TYPE_PRECISION (param_type) < TYPE_PRECISION (integer_type_node)) +- DECL_ARG_TYPE (param_decl) = integer_type_node; +- else +- DECL_ARG_TYPE (param_decl) = param_type; ++ DECL_ARG_TYPE (param_decl) = param_type; + DECL_ARTIFICIAL (param_decl) = 1; + TREE_READONLY (param_decl) = 1; + +Index: gcc/tree-vect-loop.c +=================================================================== +--- gcc/tree-vect-loop.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-vect-loop.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2205,7 +2205,8 @@ + } + + def1 = SSA_NAME_DEF_STMT (op1); +- if (flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) ++ if (gimple_bb (def1) ++ && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) + && loop->inner + && flow_bb_inside_loop_p (loop->inner, gimple_bb (def1)) + && is_gimple_assign (def1)) +Index: gcc/tree-vect-data-refs.c +=================================================================== +--- gcc/tree-vect-data-refs.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-vect-data-refs.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3553,6 +3553,9 @@ + is as follows: + if LOOP=i_loop: &in (relative to i_loop) + if LOOP=j_loop: &in+i*2B (relative to j_loop) ++ BYTE_OFFSET: Optional, defaulted to NULL. If supplied, it is added to the ++ initial address. Unlike OFFSET, which is number of elements to ++ be added, BYTE_OFFSET is measured in bytes. + + Output: + 1. Return an SSA_NAME whose value is the address of the memory location of +@@ -3566,7 +3569,8 @@ + vect_create_addr_base_for_vector_ref (gimple stmt, + gimple_seq *new_stmt_list, + tree offset, +- struct loop *loop) ++ struct loop *loop, ++ tree byte_offset) + { + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); +@@ -3628,7 +3632,17 @@ + base_offset = force_gimple_operand (base_offset, &seq, false, tmp); + gimple_seq_add_seq (new_stmt_list, seq); + } ++ if (byte_offset) ++ { ++ tree tmp = create_tmp_var (sizetype, "offset"); + ++ byte_offset = fold_convert (sizetype, byte_offset); ++ base_offset = fold_build2 (PLUS_EXPR, sizetype, ++ base_offset, byte_offset); ++ base_offset = force_gimple_operand (base_offset, &seq, false, tmp); ++ gimple_seq_add_seq (new_stmt_list, seq); ++ } ++ + /* base + base_offset */ + if (loop_vinfo) + addr_base = fold_build_pointer_plus (data_ref_base, base_offset); +@@ -3692,6 +3706,10 @@ + 5. BSI: location where the new stmts are to be placed if there is no loop + 6. ONLY_INIT: indicate if ap is to be updated in the loop, or remain + pointing to the initial address. ++ 7. BYTE_OFFSET (optional, defaults to NULL): a byte offset to be added ++ to the initial address accessed by the data-ref in STMT. This is ++ similar to OFFSET, but OFFSET is counted in elements, while BYTE_OFFSET ++ in bytes. + + Output: + 1. Declare a new ptr to vector_type, and have it point to the base of the +@@ -3705,6 +3723,8 @@ + initial_address = &a[init]; + if OFFSET is supplied: + initial_address = &a[init + OFFSET]; ++ if BYTE_OFFSET is supplied: ++ initial_address = &a[init] + BYTE_OFFSET; + + Return the initial_address in INITIAL_ADDRESS. + +@@ -3722,7 +3742,7 @@ + vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop, + tree offset, tree *initial_address, + gimple_stmt_iterator *gsi, gimple *ptr_incr, +- bool only_init, bool *inv_p) ++ bool only_init, bool *inv_p, tree byte_offset) + { + const char *base_name; + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); +@@ -3881,10 +3901,10 @@ + /* (2) Calculate the initial address of the aggregate-pointer, and set + the aggregate-pointer to point to it before the loop. */ + +- /* Create: (&(base[init_val+offset]) in the loop preheader. */ ++ /* Create: (&(base[init_val+offset]+byte_offset) in the loop preheader. */ + + new_temp = vect_create_addr_base_for_vector_ref (stmt, &new_stmt_list, +- offset, loop); ++ offset, loop, byte_offset); + if (new_stmt_list) + { + if (pe) +Index: gcc/emit-rtl.c +=================================================================== +--- gcc/emit-rtl.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/emit-rtl.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -263,7 +263,7 @@ + + /* Return true if the given memory attributes are equal. */ + +-static bool ++bool + mem_attrs_eq_p (const struct mem_attrs *p, const struct mem_attrs *q) + { + return (p->alias == q->alias +Index: gcc/gimple-fold.c +=================================================================== +--- gcc/gimple-fold.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/gimple-fold.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2955,8 +2955,8 @@ + result. */ + if (!AGGREGATE_TYPE_P (TREE_TYPE (ctor)) && !offset + /* VIEW_CONVERT_EXPR is defined only for matching sizes. */ +- && operand_equal_p (TYPE_SIZE (type), +- TYPE_SIZE (TREE_TYPE (ctor)), 0)) ++ && !compare_tree_int (TYPE_SIZE (type), size) ++ && !compare_tree_int (TYPE_SIZE (TREE_TYPE (ctor)), size)) + { + ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl); + ret = fold_unary (VIEW_CONVERT_EXPR, type, ret); +Index: gcc/emit-rtl.h +=================================================================== +--- gcc/emit-rtl.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/emit-rtl.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -20,6 +20,9 @@ + #ifndef GCC_EMIT_RTL_H + #define GCC_EMIT_RTL_H + ++/* Return whether two MEM_ATTRs are equal. */ ++bool mem_attrs_eq_p (const struct mem_attrs *, const struct mem_attrs *); ++ + /* Set the alias set of MEM to SET. */ + extern void set_mem_alias_set (rtx, alias_set_type); + +Index: gcc/tree-cfgcleanup.c +=================================================================== +--- gcc/tree-cfgcleanup.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-cfgcleanup.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -498,7 +498,20 @@ + + /* First split basic block if stmt is not last. */ + if (stmt != gsi_stmt (gsi_last_bb (bb))) +- split_block (bb, stmt); ++ { ++ if (stmt == gsi_stmt (gsi_last_nondebug_bb (bb))) ++ { ++ /* Don't split if there are only debug stmts ++ after stmt, that can result in -fcompare-debug ++ failures. Remove the debug stmts instead, ++ they should be all unreachable anyway. */ ++ gimple_stmt_iterator gsi = gsi_for_stmt (stmt); ++ for (gsi_next (&gsi); !gsi_end_p (gsi); ) ++ gsi_remove (&gsi, true); ++ } ++ else ++ split_block (bb, stmt); ++ } + + changed |= remove_fallthru_edge (bb->succs); + +Index: gcc/tree-sra.c +=================================================================== +--- gcc/tree-sra.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-sra.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1030,6 +1030,11 @@ + "component."); + return NULL; + } ++ if (TREE_THIS_VOLATILE (expr)) ++ { ++ disqualify_base_of_expr (expr, "part of a volatile reference."); ++ return NULL; ++ } + + switch (TREE_CODE (expr)) + { +Index: gcc/common.opt +=================================================================== +--- gcc/common.opt (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/common.opt (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1226,6 +1226,10 @@ + Common Report Var(flag_tm) + Enable support for GNU transactional memory + ++fgnu-unique ++Common Report Var(flag_gnu_unique) Init(1) ++Use STB_GNU_UNIQUE if supported by the assembler ++ + floop-flatten + Common Ignore + Does nothing. Preserved for backward compatibility. +Index: gcc/tree-vect-patterns.c +=================================================================== +--- gcc/tree-vect-patterns.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-vect-patterns.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -395,7 +395,7 @@ + || !promotion) + return NULL; + oprnd00 = gimple_assign_rhs1 (def_stmt); +- if (!type_conversion_p (oprnd0, stmt, true, &half_type1, &def_stmt, ++ if (!type_conversion_p (oprnd1, stmt, true, &half_type1, &def_stmt, + &promotion) + || !promotion) + return NULL; +Index: gcc/sched-deps.c +=================================================================== +--- gcc/sched-deps.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/sched-deps.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2744,7 +2744,8 @@ + Consider for instance a volatile asm that changes the fpu rounding + mode. An insn should not be moved across this even if it only uses + pseudo-regs because it might give an incorrectly rounded result. */ +- if (code != ASM_OPERANDS || MEM_VOLATILE_P (x)) ++ if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x)) ++ && !DEBUG_INSN_P (insn)) + reg_pending_barrier = TRUE_BARRIER; + + /* For all ASM_OPERANDS, we must traverse the vector of input operands. +Index: gcc/tree-vect-stmts.c +=================================================================== +--- gcc/tree-vect-stmts.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-vect-stmts.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -4319,6 +4319,7 @@ + int i, j, group_size; + tree msq = NULL_TREE, lsq; + tree offset = NULL_TREE; ++ tree byte_offset = NULL_TREE; + tree realignment_token = NULL_TREE; + gimple phi = NULL; + vec dr_chain = vNULL; +@@ -4934,7 +4935,8 @@ + if (alignment_support_scheme == dr_explicit_realign_optimized) + { + phi = SSA_NAME_DEF_STMT (msq); +- offset = size_int (TYPE_VECTOR_SUBPARTS (vectype) - 1); ++ byte_offset = size_binop (MINUS_EXPR, TYPE_SIZE_UNIT (vectype), ++ size_one_node); + } + } + else +@@ -4955,7 +4957,8 @@ + if (j == 0) + dataref_ptr = vect_create_data_ref_ptr (first_stmt, aggr_type, at_loop, + offset, &dummy, gsi, +- &ptr_incr, false, &inv_p); ++ &ptr_incr, false, &inv_p, ++ byte_offset); + else + dataref_ptr = bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt, + TYPE_SIZE_UNIT (aggr_type)); +Index: gcc/config/alpha/elf.h +=================================================================== +--- gcc/config/alpha/elf.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/alpha/elf.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -126,6 +126,10 @@ + "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" + ++/* This variable should be set to 'true' if the target ABI requires ++ unwinding tables even when exceptions are not used. */ ++#define TARGET_UNWIND_TABLES_DEFAULT true ++ + /* Select a format to encode pointers in exception handling data. CODE + is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is + true if the symbol may be affected by dynamic relocations. +Index: gcc/config/alpha/alpha.c +=================================================================== +--- gcc/config/alpha/alpha.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/alpha/alpha.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -8658,6 +8658,11 @@ + } + break; + ++ case BARRIER: ++ /* __builtin_unreachable can expand to no code at all, ++ leaving (barrier) RTXes in the instruction stream. */ ++ goto close_shadow_notrapb; ++ + case JUMP_INSN: + case CALL_INSN: + case CODE_LABEL: +@@ -8673,6 +8678,7 @@ + n = emit_insn_before (gen_trapb (), i); + PUT_MODE (n, TImode); + PUT_MODE (i, TImode); ++ close_shadow_notrapb: + trap_pending = 0; + shadow.used.i = 0; + shadow.used.fp = 0; +Index: gcc/config/elfos.h +=================================================================== +--- gcc/config/elfos.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/elfos.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -287,7 +287,7 @@ + /* Write the extra assembler code needed to declare an object properly. */ + + #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT +-#define USE_GNU_UNIQUE_OBJECT 1 ++#define USE_GNU_UNIQUE_OBJECT flag_gnu_unique + #else + #define USE_GNU_UNIQUE_OBJECT 0 + #endif +Index: gcc/config/sparc/sync.md +=================================================================== +--- gcc/config/sparc/sync.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/sparc/sync.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -64,11 +64,19 @@ + "stbar" + [(set_attr "type" "multi")]) + ++;; For LEON3, STB has the effect of membar #StoreLoad. ++(define_insn "*membar_storeload_leon3" ++ [(set (match_operand:BLK 0 "" "") ++ (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))] ++ "TARGET_LEON3" ++ "stb\t%%g0, [%%sp-1]" ++ [(set_attr "type" "store")]) ++ + ;; For V8, LDSTUB has the effect of membar #StoreLoad. + (define_insn "*membar_storeload" + [(set (match_operand:BLK 0 "" "") + (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))] +- "TARGET_V8" ++ "TARGET_V8 && !TARGET_LEON3" + "ldstub\t[%%sp-1], %%g0" + [(set_attr "type" "multi")]) + +Index: gcc/config/i386/i386.md +=================================================================== +--- gcc/config/i386/i386.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/i386/i386.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -5339,66 +5339,37 @@ + + ;; Avoid store forwarding (partial memory) stall penalty by extending + ;; SImode value to DImode through XMM register instead of pushing two +-;; SImode values to stack. Note that even !TARGET_INTER_UNIT_MOVES +-;; targets benefit from this optimization. Also note that fild +-;; loads from memory only. ++;; SImode values to stack. Also note that fild loads from memory only. + +-(define_insn "*floatunssi2_1" +- [(set (match_operand:X87MODEF 0 "register_operand" "=f,f") ++(define_insn_and_split "*floatunssi2_i387_with_xmm" ++ [(set (match_operand:X87MODEF 0 "register_operand" "=f") + (unsigned_float:X87MODEF +- (match_operand:SI 1 "nonimmediate_operand" "x,m"))) +- (clobber (match_operand:DI 2 "memory_operand" "=m,m")) +- (clobber (match_scratch:SI 3 "=X,x"))] ++ (match_operand:SI 1 "nonimmediate_operand" "rm"))) ++ (clobber (match_scratch:DI 3 "=x")) ++ (clobber (match_operand:DI 2 "memory_operand" "=m"))] + "!TARGET_64BIT + && TARGET_80387 && X87_ENABLE_FLOAT (mode, DImode) +- && TARGET_SSE" ++ && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES" + "#" ++ "&& reload_completed" ++ [(set (match_dup 3) (zero_extend:DI (match_dup 1))) ++ (set (match_dup 2) (match_dup 3)) ++ (set (match_dup 0) ++ (float:X87MODEF (match_dup 2)))] ++ "" + [(set_attr "type" "multi") + (set_attr "mode" "")]) + +-(define_split +- [(set (match_operand:X87MODEF 0 "register_operand") +- (unsigned_float:X87MODEF +- (match_operand:SI 1 "register_operand"))) +- (clobber (match_operand:DI 2 "memory_operand")) +- (clobber (match_scratch:SI 3))] +- "!TARGET_64BIT +- && TARGET_80387 && X87_ENABLE_FLOAT (mode, DImode) +- && TARGET_SSE +- && reload_completed" +- [(set (match_dup 2) (match_dup 1)) +- (set (match_dup 0) +- (float:X87MODEF (match_dup 2)))] +- "operands[1] = simplify_gen_subreg (DImode, operands[1], SImode, 0);") +- +-(define_split +- [(set (match_operand:X87MODEF 0 "register_operand") +- (unsigned_float:X87MODEF +- (match_operand:SI 1 "memory_operand"))) +- (clobber (match_operand:DI 2 "memory_operand")) +- (clobber (match_scratch:SI 3))] +- "!TARGET_64BIT +- && TARGET_80387 && X87_ENABLE_FLOAT (mode, DImode) +- && TARGET_SSE +- && reload_completed" +- [(set (match_dup 2) (match_dup 3)) +- (set (match_dup 0) +- (float:X87MODEF (match_dup 2)))] +-{ +- emit_move_insn (operands[3], operands[1]); +- operands[3] = simplify_gen_subreg (DImode, operands[3], SImode, 0); +-}) +- + (define_expand "floatunssi2" + [(parallel + [(set (match_operand:X87MODEF 0 "register_operand") + (unsigned_float:X87MODEF + (match_operand:SI 1 "nonimmediate_operand"))) +- (clobber (match_dup 2)) +- (clobber (match_scratch:SI 3))])] ++ (clobber (match_scratch:DI 3)) ++ (clobber (match_dup 2))])] + "!TARGET_64BIT + && ((TARGET_80387 && X87_ENABLE_FLOAT (mode, DImode) +- && TARGET_SSE) ++ && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES) + || (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH))" + { + if (SSE_FLOAT_MODE_P (mode) && TARGET_SSE_MATH) +@@ -13545,7 +13516,8 @@ + (set (reg:CCFP FPSR_REG) + (unspec:CCFP [(match_dup 2) (match_dup 3)] + UNSPEC_C2_FLAG))] +- "TARGET_USE_FANCY_MATH_387" ++ "TARGET_USE_FANCY_MATH_387 ++ && flag_finite_math_only" + "fprem" + [(set_attr "type" "fpspc") + (set_attr "mode" "XF")]) +@@ -13554,7 +13526,8 @@ + [(use (match_operand:XF 0 "register_operand")) + (use (match_operand:XF 1 "general_operand")) + (use (match_operand:XF 2 "general_operand"))] +- "TARGET_USE_FANCY_MATH_387" ++ "TARGET_USE_FANCY_MATH_387 ++ && flag_finite_math_only" + { + rtx label = gen_label_rtx (); + +@@ -13577,7 +13550,8 @@ + [(use (match_operand:MODEF 0 "register_operand")) + (use (match_operand:MODEF 1 "general_operand")) + (use (match_operand:MODEF 2 "general_operand"))] +- "TARGET_USE_FANCY_MATH_387" ++ "TARGET_USE_FANCY_MATH_387 ++ && flag_finite_math_only" + { + rtx (*gen_truncxf) (rtx, rtx); + +@@ -13616,7 +13590,8 @@ + (set (reg:CCFP FPSR_REG) + (unspec:CCFP [(match_dup 2) (match_dup 3)] + UNSPEC_C2_FLAG))] +- "TARGET_USE_FANCY_MATH_387" ++ "TARGET_USE_FANCY_MATH_387 ++ && flag_finite_math_only" + "fprem1" + [(set_attr "type" "fpspc") + (set_attr "mode" "XF")]) +@@ -13625,7 +13600,8 @@ + [(use (match_operand:XF 0 "register_operand")) + (use (match_operand:XF 1 "general_operand")) + (use (match_operand:XF 2 "general_operand"))] +- "TARGET_USE_FANCY_MATH_387" ++ "TARGET_USE_FANCY_MATH_387 ++ && flag_finite_math_only" + { + rtx label = gen_label_rtx (); + +@@ -13648,7 +13624,8 @@ + [(use (match_operand:MODEF 0 "register_operand")) + (use (match_operand:MODEF 1 "general_operand")) + (use (match_operand:MODEF 2 "general_operand"))] +- "TARGET_USE_FANCY_MATH_387" ++ "TARGET_USE_FANCY_MATH_387 ++ && flag_finite_math_only" + { + rtx (*gen_truncxf) (rtx, rtx); + +Index: gcc/config/i386/driver-i386.c +=================================================================== +--- gcc/config/i386/driver-i386.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/i386/driver-i386.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -713,6 +713,11 @@ + /* Assume Core 2. */ + cpu = "core2"; + } ++ else if (has_longmode) ++ /* Perhaps some emulator? Assume x86-64, otherwise gcc ++ -march=native would be unusable for 64-bit compilations, ++ as all the CPUs below are 32-bit only. */ ++ cpu = "x86-64"; + else if (has_sse3) + /* It is Core Duo. */ + cpu = "pentium-m"; +Index: gcc/config/i386/i386.c +=================================================================== +--- gcc/config/i386/i386.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/i386/i386.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -20505,7 +20505,7 @@ + t1 = gen_reg_rtx (V32QImode); + t2 = gen_reg_rtx (V32QImode); + t3 = gen_reg_rtx (V32QImode); +- vt2 = GEN_INT (128); ++ vt2 = GEN_INT (-128); + for (i = 0; i < 32; i++) + vec[i] = vt2; + vt = gen_rtx_CONST_VECTOR (V32QImode, gen_rtvec_v (32, vec)); +@@ -24640,13 +24640,17 @@ + { + edge e; + edge_iterator ei; +- /* Assume that region is SCC, i.e. all immediate predecessors +- of non-head block are in the same region. */ ++ ++ /* Regions are SCCs with the exception of selective ++ scheduling with pipelining of outer blocks enabled. ++ So also check that immediate predecessors of a non-head ++ block are in the same region. */ + FOR_EACH_EDGE (e, ei, bb->preds) + { + /* Avoid creating of loop-carried dependencies through +- using topological odering in region. */ +- if (BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index)) ++ using topological ordering in the region. */ ++ if (rgn == CONTAINING_RGN (e->src->index) ++ && BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index)) + add_dependee_for_func_arg (first_arg, e->src); + } + } +@@ -38807,8 +38811,8 @@ + op0 = gen_lowpart (V4DImode, d->op0); + op1 = gen_lowpart (V4DImode, d->op1); + rperm[0] +- = GEN_INT (((d->perm[0] & (nelt / 2)) ? 1 : 0) +- || ((d->perm[nelt / 2] & (nelt / 2)) ? 2 : 0)); ++ = GEN_INT ((d->perm[0] / (nelt / 2)) ++ | ((d->perm[nelt / 2] / (nelt / 2)) * 16)); + emit_insn (gen_avx2_permv2ti (target, op0, op1, rperm[0])); + return true; + } +Index: gcc/config/sh/sh.c +=================================================================== +--- gcc/config/sh/sh.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/sh/sh.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -808,6 +808,12 @@ + targetm.asm_out.aligned_op.di = NULL; + targetm.asm_out.unaligned_op.di = NULL; + } ++ ++ /* User/priviledged mode is supported only on SH3*, SH4* and SH5*. ++ Disable it for everything else. */ ++ if (! (TARGET_SH3 || TARGET_SH5) && TARGET_USERMODE) ++ TARGET_USERMODE = false; ++ + if (TARGET_SH1) + { + if (! strcmp (sh_div_str, "call-div1")) +Index: gcc/config/sh/sync.md +=================================================================== +--- gcc/config/sh/sync.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/sh/sync.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -466,6 +466,7 @@ + (set (mem:SI (match_dup 1)) + (unspec:SI + [(match_operand:SI 2 "arith_operand" "rI08")] UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG))] + "TARGET_ATOMIC_HARD_LLCS + || (TARGET_SH4A_ARCH && TARGET_ATOMIC_ANY && !TARGET_ATOMIC_STRICT)" +@@ -484,6 +485,7 @@ + (set (mem:QIHI (match_dup 1)) + (unspec:QIHI + [(match_operand:QIHI 2 "register_operand" "r")] UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG)) + (clobber (match_scratch:SI 3 "=&r")) + (clobber (match_scratch:SI 4 "=1"))] +@@ -617,6 +619,7 @@ + [(FETCHOP:SI (mem:SI (match_dup 1)) + (match_operand:SI 2 "" ""))] + UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG))] + "TARGET_ATOMIC_HARD_LLCS + || (TARGET_SH4A_ARCH && TARGET_ATOMIC_ANY && !TARGET_ATOMIC_STRICT)" +@@ -637,6 +640,7 @@ + [(FETCHOP:QIHI (mem:QIHI (match_dup 1)) + (match_operand:QIHI 2 "" ""))] + UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG)) + (clobber (match_scratch:SI 3 "=&r")) + (clobber (match_scratch:SI 4 "=1"))] +@@ -784,6 +788,7 @@ + [(not:SI (and:SI (mem:SI (match_dup 1)) + (match_operand:SI 2 "logical_operand" "rK08")))] + UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG))] + "TARGET_ATOMIC_HARD_LLCS + || (TARGET_SH4A_ARCH && TARGET_ATOMIC_ANY && !TARGET_ATOMIC_STRICT)" +@@ -805,6 +810,7 @@ + [(not:QIHI (and:QIHI (mem:QIHI (match_dup 1)) + (match_operand:QIHI 2 "logical_operand" "rK08")))] + UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG)) + (clobber (match_scratch:SI 3 "=&r")) + (clobber (match_scratch:SI 4 "=1"))] +@@ -903,7 +909,7 @@ + " and %0,%3" "\n" + " not %3,%3" "\n" + " mov. %3,@%1" "\n" +- " stc %4,sr"; ++ " ldc %4,sr"; + } + [(set_attr "length" "20")]) + +@@ -960,7 +966,8 @@ + (set (mem:SI (match_dup 1)) + (unspec:SI + [(FETCHOP:SI (mem:SI (match_dup 1)) (match_dup 2))] +- UNSPEC_ATOMIC))] ++ UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1))] + "TARGET_ATOMIC_HARD_LLCS + || (TARGET_SH4A_ARCH && TARGET_ATOMIC_ANY && !TARGET_ATOMIC_STRICT)" + { +@@ -980,6 +987,7 @@ + (unspec:QIHI + [(FETCHOP:QIHI (mem:QIHI (match_dup 1)) (match_dup 2))] + UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG)) + (clobber (match_scratch:SI 3 "=&r")) + (clobber (match_scratch:SI 4 "=1"))] +@@ -1124,7 +1132,8 @@ + (set (mem:SI (match_dup 1)) + (unspec:SI + [(not:SI (and:SI (mem:SI (match_dup 1)) (match_dup 2)))] +- UNSPEC_ATOMIC))] ++ UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1))] + "TARGET_ATOMIC_HARD_LLCS + || (TARGET_SH4A_ARCH && TARGET_ATOMIC_ANY && !TARGET_ATOMIC_STRICT)" + { +@@ -1145,6 +1154,7 @@ + (unspec:QIHI + [(not:QIHI (and:QIHI (mem:QIHI (match_dup 1)) (match_dup 2)))] + UNSPEC_ATOMIC)) ++ (set (reg:SI T_REG) (const_int 1)) + (clobber (reg:SI R0_REG)) + (clobber (match_scratch:SI 3 "=&r")) + (clobber (match_scratch:SI 4 "=1"))] +@@ -1353,7 +1363,7 @@ + " ldc r0,sr" "\n" + " mov.b @%0,r0" "\n" + " mov.b %1,@%0" "\n" +- " stc %2,sr" "\n" ++ " ldc %2,sr" "\n" + " tst r0,r0"; + } + [(set_attr "length" "16")]) +Index: gcc/config/sh/sh.opt +=================================================================== +--- gcc/config/sh/sh.opt (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/sh/sh.opt (.../branches/gcc-4_8-branch) (revision 217117) +@@ -343,7 +343,7 @@ + Cost to assume for a multiply insn + + musermode +-Target Report RejectNegative Var(TARGET_USERMODE) ++Target Var(TARGET_USERMODE) + Don't generate privileged-mode only code; implies -mno-inline-ic_invalidate if the inline code would not work in user mode. + + ;; We might want to enable this by default for TARGET_HARD_SH4, because +Index: gcc/config/microblaze/predicates.md +=================================================================== +--- gcc/config/microblaze/predicates.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/microblaze/predicates.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -85,10 +85,6 @@ + (ior (match_operand 0 "const_0_operand") + (match_operand 0 "register_operand"))) + +-(define_predicate "reg_or_mem_operand" +- (ior (match_operand 0 "memory_operand") +- (match_operand 0 "register_operand"))) +- + ;; Return if the operand is either the PC or a label_ref. + (define_special_predicate "pc_or_label_operand" + (ior (match_code "pc,label_ref") +Index: gcc/config/microblaze/microblaze.md +=================================================================== +--- gcc/config/microblaze/microblaze.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/microblaze/microblaze.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1119,18 +1119,6 @@ + } + ) + +-;;Load and store reverse +-(define_insn "movsi4_rev" +- [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Q") +- (bswap:SI (match_operand:SF 1 "reg_or_mem_operand" "Q,r")))] +- "TARGET_REORDER" +- "@ +- lwr\t%0,%y1,r0 +- swr\t%1,%y0,r0" +- [(set_attr "type" "load,store") +- (set_attr "mode" "SI") +- (set_attr "length" "4,4")]) +- + ;; 32-bit floating point moves + + (define_expand "movsf" +Index: gcc/config/avr/avr-fixed.md +=================================================================== +--- gcc/config/avr/avr-fixed.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/avr/avr-fixed.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -430,8 +430,8 @@ + } + + // Input and output of the libgcc function +- const unsigned int regno_in[] = { -1, 22, 22, -1, 18 }; +- const unsigned int regno_out[] = { -1, 24, 24, -1, 22 }; ++ const unsigned int regno_in[] = { -1U, 22, 22, -1U, 18 }; ++ const unsigned int regno_out[] = { -1U, 24, 24, -1U, 22 }; + + operands[3] = gen_rtx_REG (mode, regno_out[(size_t) GET_MODE_SIZE (mode)]); + operands[4] = gen_rtx_REG (mode, regno_in[(size_t) GET_MODE_SIZE (mode)]); +Index: gcc/config/avr/avr.md +=================================================================== +--- gcc/config/avr/avr.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/avr/avr.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -367,6 +367,15 @@ + "" + { + int i; ++ ++ // Avoid (subreg (mem)) for non-generic address spaces below. Because ++ // of the poor addressing capabilities of these spaces it's better to ++ // load them in one chunk. And it avoids PR61443. ++ ++ if (MEM_P (operands[0]) ++ && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[0]))) ++ operands[0] = copy_to_mode_reg (mode, operands[0]); ++ + for (i = GET_MODE_SIZE (mode) - 1; i >= 0; --i) + { + rtx part = simplify_gen_subreg (QImode, operands[0], mode, i); +Index: gcc/config/avr/avr.h +=================================================================== +--- gcc/config/avr/avr.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/avr/avr.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -250,18 +250,18 @@ + #define REG_CLASS_CONTENTS { \ + {0x00000000,0x00000000}, /* NO_REGS */ \ + {0x00000001,0x00000000}, /* R0_REG */ \ +- {3 << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \ +- {3 << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \ +- {3 << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \ ++ {3u << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \ ++ {3u << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \ ++ {3u << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \ + {0x00000000,0x00000003}, /* STACK_REG, STACK */ \ +- {(3 << REG_Y) | (3 << REG_Z), \ ++ {(3u << REG_Y) | (3u << REG_Z), \ + 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \ +- {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z), \ ++ {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z), \ + 0x00000000}, /* POINTER_REGS, r26 - r31 */ \ +- {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W), \ ++ {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z) | (3u << REG_W), \ + 0x00000000}, /* ADDW_REGS, r24 - r31 */ \ + {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \ +- {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16), \ ++ {(3u << REG_X)|(3u << REG_Y)|(3u << REG_Z)|(3u << REG_W)|(0xffu << 16),\ + 0x00000000}, /* LD_REGS, r16 - r31 */ \ + {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \ + {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \ +Index: gcc/config/aarch64/arm_neon.h +=================================================================== +--- gcc/config/aarch64/arm_neon.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/aarch64/arm_neon.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -13815,7 +13815,7 @@ + int16x4_t result; + __asm__ ("sqdmulh %0.4h,%1.4h,%2.h[0]" + : "=w"(result) +- : "w"(a), "w"(b) ++ : "w"(a), "x"(b) + : /* No clobbers */); + return result; + } +@@ -13837,7 +13837,7 @@ + int16x8_t result; + __asm__ ("sqdmulh %0.8h,%1.8h,%2.h[0]" + : "=w"(result) +- : "w"(a), "w"(b) ++ : "w"(a), "x"(b) + : /* No clobbers */); + return result; + } +Index: gcc/config/aarch64/aarch64.md +=================================================================== +--- gcc/config/aarch64/aarch64.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/aarch64/aarch64.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3292,6 +3292,7 @@ + (unspec:DI [(match_operand:DI 0 "aarch64_valid_symref" "S")] + UNSPEC_TLSDESC)) + (clobber (reg:DI LR_REGNUM)) ++ (clobber (reg:CC CC_REGNUM)) + (clobber (match_scratch:DI 1 "=r"))] + "TARGET_TLS_DESC" + "adrp\\tx0, %A0\;ldr\\t%1, [x0, #%L0]\;add\\tx0, x0, %L0\;.tlsdesccall\\t%0\;blr\\t%1" +Index: gcc/config/aarch64/aarch64.opt +=================================================================== +--- gcc/config/aarch64/aarch64.opt (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/aarch64/aarch64.opt (.../branches/gcc-4_8-branch) (revision 217117) +@@ -67,6 +67,10 @@ + Target Report RejectNegative Mask(GENERAL_REGS_ONLY) + Generate code which uses only the general registers + ++mfix-cortex-a53-835769 ++Target Report Var(aarch64_fix_a53_err835769) Init(2) ++Workaround for ARM Cortex-A53 Erratum number 835769 ++ + mlittle-endian + Target Report RejectNegative InverseMask(BIG_END) + Assume target CPU is configured as little endian +Index: gcc/config/aarch64/aarch64-protos.h +=================================================================== +--- gcc/config/aarch64/aarch64-protos.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/aarch64/aarch64-protos.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -247,6 +247,8 @@ + + extern void aarch64_split_combinev16qi (rtx operands[3]); + extern void aarch64_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel); ++extern bool aarch64_madd_needs_nop (rtx); ++extern void aarch64_final_prescan_insn (rtx); + extern bool + aarch64_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel); + +Index: gcc/config/aarch64/aarch64.c +=================================================================== +--- gcc/config/aarch64/aarch64.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/aarch64/aarch64.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1201,6 +1201,7 @@ + CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); + int ncrn, nvrn, nregs; + bool allocate_ncrn, allocate_nvrn; ++ HOST_WIDE_INT size; + + /* We need to do this once per argument. */ + if (pcum->aapcs_arg_processed) +@@ -1208,6 +1209,11 @@ + + pcum->aapcs_arg_processed = true; + ++ /* Size in bytes, rounded to the nearest multiple of 8 bytes. */ ++ size ++ = AARCH64_ROUND_UP (type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode), ++ UNITS_PER_WORD); ++ + allocate_ncrn = (type) ? !(FLOAT_TYPE_P (type)) : !FLOAT_MODE_P (mode); + allocate_nvrn = aarch64_vfp_is_call_candidate (pcum_v, + mode, +@@ -1258,10 +1264,8 @@ + } + + ncrn = pcum->aapcs_ncrn; +- nregs = ((type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode)) +- + UNITS_PER_WORD - 1) / UNITS_PER_WORD; ++ nregs = size / UNITS_PER_WORD; + +- + /* C6 - C9. though the sign and zero extension semantics are + handled elsewhere. This is the case where the argument fits + entirely general registers. */ +@@ -1309,13 +1313,12 @@ + pcum->aapcs_nextncrn = NUM_ARG_REGS; + + /* The argument is passed on stack; record the needed number of words for +- this argument (we can re-use NREGS) and align the total size if +- necessary. */ ++ this argument and align the total size if necessary. */ + on_stack: +- pcum->aapcs_stack_words = nregs; ++ pcum->aapcs_stack_words = size / UNITS_PER_WORD; + if (aarch64_function_arg_alignment (mode, type) == 16 * BITS_PER_UNIT) + pcum->aapcs_stack_size = AARCH64_ROUND_UP (pcum->aapcs_stack_size, +- 16 / UNITS_PER_WORD) + 1; ++ 16 / UNITS_PER_WORD); + return; + } + +@@ -4845,6 +4848,15 @@ + aarch64_tune = selected_tune->core; + aarch64_tune_params = selected_tune->tune; + ++ if (aarch64_fix_a53_err835769 == 2) ++ { ++#ifdef TARGET_FIX_ERR_A53_835769_DEFAULT ++ aarch64_fix_a53_err835769 = 1; ++#else ++ aarch64_fix_a53_err835769 = 0; ++#endif ++ } ++ + aarch64_override_options_after_change (); + } + +@@ -6037,6 +6049,135 @@ + return NULL; + } + ++ ++/* Return true iff X is a MEM rtx. */ ++ ++static int ++is_mem_p (rtx *x, void *data ATTRIBUTE_UNUSED) ++{ ++ return MEM_P (*x); ++} ++ ++ ++/* Return true if mem_insn contains a MEM RTX somewhere in it. */ ++ ++static bool ++has_memory_op (rtx mem_insn) ++{ ++ rtx pattern = PATTERN (mem_insn); ++ return for_each_rtx (&pattern, is_mem_p, NULL); ++} ++ ++ ++/* Find the first rtx before insn that will generate an assembly ++ instruction. */ ++ ++static rtx ++aarch64_prev_real_insn (rtx insn) ++{ ++ if (!insn) ++ return NULL; ++ ++ do ++ { ++ insn = prev_real_insn (insn); ++ } ++ while (insn && recog_memoized (insn) < 0); ++ ++ return insn; ++} ++ ++/* Return true iff t1 is the v8type of a multiply-accumulate instruction. */ ++ ++static bool ++is_madd_op (enum attr_v8type t1) ++{ ++ return t1 == V8TYPE_MADD ++ || t1 == V8TYPE_MADDL; ++} ++ ++ ++/* Check if there is a register dependency between a load and the insn ++ for which we hold recog_data. */ ++ ++static bool ++dep_between_memop_and_curr (rtx memop) ++{ ++ rtx load_reg; ++ int opno; ++ ++ gcc_assert (GET_CODE (memop) == SET); ++ ++ if (!REG_P (SET_DEST (memop))) ++ return false; ++ ++ load_reg = SET_DEST (memop); ++ for (opno = 1; opno < recog_data.n_operands; opno++) ++ { ++ rtx operand = recog_data.operand[opno]; ++ if (REG_P (operand) ++ && reg_overlap_mentioned_p (load_reg, operand)) ++ return true; ++ ++ } ++ return false; ++} ++ ++ ++ ++/* When working around the Cortex-A53 erratum 835769, ++ given rtx_insn INSN, return true if it is a 64-bit multiply-accumulate ++ instruction and has a preceding memory instruction such that a NOP ++ should be inserted between them. */ ++ ++bool ++aarch64_madd_needs_nop (rtx insn) ++{ ++ enum attr_v8type attr_type; ++ rtx prev; ++ rtx body; ++ ++ if (!aarch64_fix_a53_err835769) ++ return false; ++ ++ if (recog_memoized (insn) < 0) ++ return false; ++ ++ attr_type = get_attr_v8type (insn); ++ if (!is_madd_op (attr_type)) ++ return false; ++ ++ prev = aarch64_prev_real_insn (insn); ++ /* aarch64_prev_real_insn can call recog_memoized on insns other than INSN. ++ Restore recog state to INSN to avoid state corruption. */ ++ extract_constrain_insn_cached (insn); ++ ++ if (!prev || !has_memory_op (prev)) ++ return false; ++ ++ body = single_set (prev); ++ ++ /* If the previous insn is a memory op and there is no dependency between ++ it and the madd, emit a nop between them. If we know it's a memop but ++ body is NULL, return true to be safe. */ ++ if (GET_MODE (recog_data.operand[0]) == DImode ++ && (!body || !dep_between_memop_and_curr (body))) ++ return true; ++ ++ return false; ++ ++} ++ ++/* Implement FINAL_PRESCAN_INSN. */ ++ ++void ++aarch64_final_prescan_insn (rtx insn) ++{ ++ if (aarch64_madd_needs_nop (insn)) ++ fprintf (asm_out_file, "\tnop // between mem op and mult-accumulate\n"); ++} ++ ++ + /* Return the equivalent letter for size. */ + static unsigned char + sizetochar (int size) +Index: gcc/config/aarch64/aarch64-linux.h +=================================================================== +--- gcc/config/aarch64/aarch64-linux.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/aarch64/aarch64-linux.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -43,4 +43,6 @@ + } \ + while (0) + ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ + #endif /* GCC_AARCH64_LINUX_H */ +Index: gcc/config/aarch64/aarch64.h +=================================================================== +--- gcc/config/aarch64/aarch64.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/aarch64/aarch64.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -465,6 +465,18 @@ + (TARGET_CPU_generic | (AARCH64_CPU_DEFAULT_FLAGS << 6)) + #endif + ++/* If inserting NOP before a mult-accumulate insn remember to adjust the ++ length so that conditional branching code is updated appropriately. */ ++#define ADJUST_INSN_LENGTH(insn, length) \ ++ do \ ++ { \ ++ if (aarch64_madd_needs_nop (insn)) \ ++ length += 4; \ ++ } while (0) ++ ++#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \ ++ aarch64_final_prescan_insn (INSN); \ ++ + /* The processor for which instructions should be scheduled. */ + extern enum aarch64_processor aarch64_tune; + +Index: gcc/config/rs6000/constraints.md +=================================================================== +--- gcc/config/rs6000/constraints.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/constraints.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -65,6 +65,20 @@ + (define_register_constraint "wg" "rs6000_constraints[RS6000_CONSTRAINT_wg]" + "If -mmfpgpr was used, a floating point register or NO_REGS.") + ++(define_register_constraint "wh" "rs6000_constraints[RS6000_CONSTRAINT_wh]" ++ "Floating point register if direct moves are available, or NO_REGS.") ++ ++;; At present, DImode is not allowed in the Altivec registers. If in the ++;; future it is allowed, wi/wj can be set to VSX_REGS instead of FLOAT_REGS. ++(define_register_constraint "wi" "rs6000_constraints[RS6000_CONSTRAINT_wi]" ++ "FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS.") ++ ++(define_register_constraint "wj" "rs6000_constraints[RS6000_CONSTRAINT_wj]" ++ "FP or VSX register to hold 64-bit integers for direct moves or NO_REGS.") ++ ++(define_register_constraint "wk" "rs6000_constraints[RS6000_CONSTRAINT_wk]" ++ "FP or VSX register to hold 64-bit doubles for direct moves or NO_REGS.") ++ + (define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]" + "Floating point register if the LFIWAX instruction is enabled or NO_REGS.") + +@@ -98,7 +112,7 @@ + "Floating point register if the STFIWX instruction is enabled or NO_REGS.") + + (define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]" +- "VSX vector register to hold scalar float values or NO_REGS.") ++ "FP or VSX register to perform ISA 2.07 float ops or NO_REGS.") + + (define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]" + "Floating point register if the LFIWZX instruction is enabled or NO_REGS.") +Index: gcc/config/rs6000/predicates.md +=================================================================== +--- gcc/config/rs6000/predicates.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/predicates.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1795,7 +1795,7 @@ + (define_predicate "fusion_gpr_mem_load" + (match_code "mem,sign_extend,zero_extend") + { +- rtx addr; ++ rtx addr, base, offset; + + /* Handle sign/zero extend. */ + if (GET_CODE (op) == ZERO_EXTEND +@@ -1825,24 +1825,79 @@ + } + + addr = XEXP (op, 0); ++ if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM) ++ return 0; ++ ++ base = XEXP (addr, 0); ++ if (!base_reg_operand (base, GET_MODE (base))) ++ return 0; ++ ++ offset = XEXP (addr, 1); ++ + if (GET_CODE (addr) == PLUS) ++ return satisfies_constraint_I (offset); ++ ++ else if (GET_CODE (addr) == LO_SUM) + { +- rtx base = XEXP (addr, 0); +- rtx offset = XEXP (addr, 1); ++ if (TARGET_XCOFF || (TARGET_ELF && TARGET_POWERPC64)) ++ return small_toc_ref (offset, GET_MODE (offset)); + +- return (base_reg_operand (base, GET_MODE (base)) +- && satisfies_constraint_I (offset)); ++ else if (TARGET_ELF && !TARGET_POWERPC64) ++ return CONSTANT_P (offset); + } + +- else if (GET_CODE (addr) == LO_SUM) ++ return 0; ++}) ++ ++;; Match a GPR load (lbz, lhz, lwz, ld) that uses a combined address in the ++;; memory field with both the addis and the memory offset. Sign extension ++;; is not handled here, since lha and lwa are not fused. ++(define_predicate "fusion_gpr_mem_combo" ++ (match_code "mem,zero_extend") ++{ ++ rtx addr, base, offset; ++ ++ /* Handle zero extend. */ ++ if (GET_CODE (op) == ZERO_EXTEND) + { +- rtx base = XEXP (addr, 0); +- rtx offset = XEXP (addr, 1); ++ op = XEXP (op, 0); ++ mode = GET_MODE (op); ++ } + +- if (!base_reg_operand (base, GET_MODE (base))) ++ if (!MEM_P (op)) ++ return 0; ++ ++ switch (mode) ++ { ++ case QImode: ++ case HImode: ++ case SImode: ++ break; ++ ++ case DImode: ++ if (!TARGET_POWERPC64) + return 0; ++ break; + +- else if (TARGET_XCOFF || (TARGET_ELF && TARGET_POWERPC64)) ++ default: ++ return 0; ++ } ++ ++ addr = XEXP (op, 0); ++ if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM) ++ return 0; ++ ++ base = XEXP (addr, 0); ++ if (!fusion_gpr_addis (base, GET_MODE (base))) ++ return 0; ++ ++ offset = XEXP (addr, 1); ++ if (GET_CODE (addr) == PLUS) ++ return satisfies_constraint_I (offset); ++ ++ else if (GET_CODE (addr) == LO_SUM) ++ { ++ if (TARGET_XCOFF || (TARGET_ELF && TARGET_POWERPC64)) + return small_toc_ref (offset, GET_MODE (offset)); + + else if (TARGET_ELF && !TARGET_POWERPC64) +Index: gcc/config/rs6000/htm.md +=================================================================== +--- gcc/config/rs6000/htm.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/htm.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -179,7 +179,7 @@ + (const_int 0)] + UNSPECV_HTM_TABORTWCI)) + (set (subreg:CC (match_dup 2) 0) (match_dup 1)) +- (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 24))) ++ (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 28))) + (parallel [(set (match_operand:SI 0 "int_reg_operand" "") + (and:SI (match_dup 3) (const_int 15))) + (clobber (scratch:CC))])] +Index: gcc/config/rs6000/freebsd64.h +=================================================================== +--- gcc/config/rs6000/freebsd64.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/freebsd64.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -367,7 +367,7 @@ + /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ + #undef ADJUST_FIELD_ALIGN + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 \ + : (TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ +Index: gcc/config/rs6000/rs6000-protos.h +=================================================================== +--- gcc/config/rs6000/rs6000-protos.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/rs6000-protos.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -79,9 +79,9 @@ + extern bool gpr_or_gpr_p (rtx, rtx); + extern bool direct_move_p (rtx, rtx); + extern bool quad_load_store_p (rtx, rtx); +-extern bool fusion_gpr_load_p (rtx *, bool); ++extern bool fusion_gpr_load_p (rtx, rtx, rtx, rtx); + extern void expand_fusion_gpr_load (rtx *); +-extern const char *emit_fusion_gpr_load (rtx *); ++extern const char *emit_fusion_gpr_load (rtx, rtx); + extern enum reg_class (*rs6000_preferred_reload_class_ptr) (rtx, + enum reg_class); + extern enum reg_class (*rs6000_secondary_reload_class_ptr) (enum reg_class, +@@ -153,6 +153,7 @@ + + #ifdef TREE_CODE + extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); ++extern bool rs6000_special_adjust_field_align_p (tree, unsigned int); + extern unsigned int rs6000_special_round_type_align (tree, unsigned int, + unsigned int); + extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int, +@@ -161,7 +162,7 @@ + extern rtx rs6000_libcall_value (enum machine_mode); + extern rtx rs6000_va_arg (tree, tree); + extern int function_ok_for_sibcall (tree); +-extern int rs6000_reg_parm_stack_space (tree); ++extern int rs6000_reg_parm_stack_space (tree, bool); + extern void rs6000_elf_declare_function_name (FILE *, const char *, tree); + extern bool rs6000_elf_in_small_data_p (const_tree); + #ifdef ARGS_SIZE_RTX +Index: gcc/config/rs6000/rs6000-builtin.def +=================================================================== +--- gcc/config/rs6000/rs6000-builtin.def (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/rs6000-builtin.def (.../branches/gcc-4_8-branch) (revision 217117) +@@ -622,20 +622,13 @@ + | RS6000_BTC_TERNARY), \ + CODE_FOR_ ## ICODE) /* ICODE */ + +-/* Miscellaneous builtins. */ +-#define BU_MISC_1(ENUM, NAME, ATTR, ICODE) \ ++/* 128-bit long double floating point builtins. */ ++#define BU_LDBL128_2(ENUM, NAME, ATTR, ICODE) \ + RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \ + "__builtin_" NAME, /* NAME */ \ +- RS6000_BTM_HARD_FLOAT, /* MASK */ \ ++ (RS6000_BTM_HARD_FLOAT /* MASK */ \ ++ | RS6000_BTM_LDBL128), \ + (RS6000_BTC_ ## ATTR /* ATTR */ \ +- | RS6000_BTC_UNARY), \ +- CODE_FOR_ ## ICODE) /* ICODE */ +- +-#define BU_MISC_2(ENUM, NAME, ATTR, ICODE) \ +- RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \ +- "__builtin_" NAME, /* NAME */ \ +- RS6000_BTM_HARD_FLOAT, /* MASK */ \ +- (RS6000_BTC_ ## ATTR /* ATTR */ \ + | RS6000_BTC_BINARY), \ + CODE_FOR_ ## ICODE) /* ICODE */ + +@@ -1593,10 +1586,8 @@ + BU_DFP_MISC_2 (PACK_TD, "pack_dec128", CONST, packtd) + BU_DFP_MISC_2 (UNPACK_TD, "unpack_dec128", CONST, unpacktd) + +-BU_MISC_2 (PACK_TF, "pack_longdouble", CONST, packtf) +-BU_MISC_2 (UNPACK_TF, "unpack_longdouble", CONST, unpacktf) +-BU_MISC_1 (UNPACK_TF_0, "longdouble_dw0", CONST, unpacktf_0) +-BU_MISC_1 (UNPACK_TF_1, "longdouble_dw1", CONST, unpacktf_1) ++BU_LDBL128_2 (PACK_TF, "pack_longdouble", CONST, packtf) ++BU_LDBL128_2 (UNPACK_TF, "unpack_longdouble", CONST, unpacktf) + + BU_P7_MISC_2 (PACK_V1TI, "pack_vector_int128", CONST, packv1ti) + BU_P7_MISC_2 (UNPACK_V1TI, "unpack_vector_int128", CONST, unpackv1ti) +Index: gcc/config/rs6000/rs6000-c.c +=================================================================== +--- gcc/config/rs6000/rs6000-c.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/rs6000-c.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -4126,7 +4126,8 @@ + argument) is reversed. Patch the arguments here before building + the resolved CALL_EXPR. */ + if (desc->code == ALTIVEC_BUILTIN_VEC_VCMPGE_P +- && desc->overloaded_code != ALTIVEC_BUILTIN_VCMPGEFP_P) ++ && desc->overloaded_code != ALTIVEC_BUILTIN_VCMPGEFP_P ++ && desc->overloaded_code != VSX_BUILTIN_XVCMPGEDP_P) + { + tree t; + t = args[2], args[2] = args[1], args[1] = t; +@@ -4184,6 +4185,14 @@ + if (TARGET_DEBUG_BUILTIN) + fprintf (stderr, "altivec_resolve_overloaded_builtin, code = %4d, %s\n", + (int)fcode, IDENTIFIER_POINTER (DECL_NAME (fndecl))); ++ ++ /* vec_lvsl and vec_lvsr are deprecated for use with LE element order. */ ++ if (fcode == ALTIVEC_BUILTIN_VEC_LVSL && !VECTOR_ELT_ORDER_BIG) ++ warning (OPT_Wdeprecated, "vec_lvsl is deprecated for little endian; use \ ++assignment for unaligned loads and stores"); ++ else if (fcode == ALTIVEC_BUILTIN_VEC_LVSR && !VECTOR_ELT_ORDER_BIG) ++ warning (OPT_Wdeprecated, "vec_lvsr is deprecated for little endian; use \ ++assignment for unaligned loads and stores"); + + /* For now treat vec_splats and vec_promote as the same. */ + if (fcode == ALTIVEC_BUILTIN_VEC_SPLATS +Index: gcc/config/rs6000/linux64.h +=================================================================== +--- gcc/config/rs6000/linux64.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/linux64.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -246,7 +246,7 @@ + /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ + #undef ADJUST_FIELD_ALIGN + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 \ + : (TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ +Index: gcc/config/rs6000/rs6000.c +=================================================================== +--- gcc/config/rs6000/rs6000.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/rs6000.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -369,6 +369,7 @@ + enum insn_code reload_gpr_vsx; /* INSN to move from GPR to VSX. */ + enum insn_code reload_vsx_gpr; /* INSN to move from VSX to GPR. */ + addr_mask_type addr_mask[(int)N_RELOAD_REG]; /* Valid address masks. */ ++ bool scalar_in_vmx_p; /* Scalar value can go in VMX. */ + }; + + static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES]; +@@ -1704,8 +1705,7 @@ + asked for it. */ + if (TARGET_VSX && VSX_REGNO_P (regno) + && (VECTOR_MEM_VSX_P (mode) +- || (TARGET_VSX_SCALAR_FLOAT && mode == SFmode) +- || (TARGET_VSX_SCALAR_DOUBLE && (mode == DFmode || mode == DImode)) ++ || reg_addr[mode].scalar_in_vmx_p + || (TARGET_VSX_TIMODE && mode == TImode) + || (TARGET_VADDUQM && mode == V1TImode))) + { +@@ -1714,12 +1714,9 @@ + + if (ALTIVEC_REGNO_P (regno)) + { +- if (mode == SFmode && !TARGET_UPPER_REGS_SF) ++ if (GET_MODE_SIZE (mode) != 16 && !reg_addr[mode].scalar_in_vmx_p) + return 0; + +- if ((mode == DFmode || mode == DImode) && !TARGET_UPPER_REGS_DF) +- return 0; +- + return ALTIVEC_REGNO_P (last_regno); + } + } +@@ -1897,14 +1894,16 @@ + if (rs6000_vector_unit[m] != VECTOR_NONE + || rs6000_vector_mem[m] != VECTOR_NONE + || (reg_addr[m].reload_store != CODE_FOR_nothing) +- || (reg_addr[m].reload_load != CODE_FOR_nothing)) ++ || (reg_addr[m].reload_load != CODE_FOR_nothing) ++ || reg_addr[m].scalar_in_vmx_p) + { + fprintf (stderr, +- " Vector-arith=%-10s Vector-mem=%-10s Reload=%c%c", ++ " Vector-arith=%-10s Vector-mem=%-10s Reload=%c%c Upper=%c", + rs6000_debug_vector_unit (rs6000_vector_unit[m]), + rs6000_debug_vector_unit (rs6000_vector_mem[m]), + (reg_addr[m].reload_store != CODE_FOR_nothing) ? 's' : '*', +- (reg_addr[m].reload_load != CODE_FOR_nothing) ? 'l' : '*'); ++ (reg_addr[m].reload_load != CODE_FOR_nothing) ? 'l' : '*', ++ (reg_addr[m].scalar_in_vmx_p) ? 'y' : 'n'); + } + + fputs ("\n", stderr); +@@ -2021,6 +2020,10 @@ + "wd reg_class = %s\n" + "wf reg_class = %s\n" + "wg reg_class = %s\n" ++ "wh reg_class = %s\n" ++ "wi reg_class = %s\n" ++ "wj reg_class = %s\n" ++ "wk reg_class = %s\n" + "wl reg_class = %s\n" + "wm reg_class = %s\n" + "wr reg_class = %s\n" +@@ -2040,6 +2043,10 @@ + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wd]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wf]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wg]], ++ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wh]], ++ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wi]], ++ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wj]], ++ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wk]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wl]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wm]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wr]], +@@ -2324,6 +2331,8 @@ + + for (m = 0; m < NUM_MACHINE_MODES; ++m) + { ++ enum machine_mode m2 = (enum machine_mode)m; ++ + /* SDmode is special in that we want to access it only via REG+REG + addressing on power7 and above, since we want to use the LFIWZX and + STFIWZX instructions to load it. */ +@@ -2358,13 +2367,12 @@ + + if (TARGET_UPDATE + && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR) +- && GET_MODE_SIZE (m) <= 8 +- && !VECTOR_MODE_P (m) +- && !COMPLEX_MODE_P (m) ++ && GET_MODE_SIZE (m2) <= 8 ++ && !VECTOR_MODE_P (m2) ++ && !COMPLEX_MODE_P (m2) + && !indexed_only_p +- && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m) == 8) +- && !(m == DFmode && TARGET_UPPER_REGS_DF) +- && !(m == SFmode && TARGET_UPPER_REGS_SF)) ++ && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m2) == 8) ++ && !reg_addr[m2].scalar_in_vmx_p) + { + addr_mask |= RELOAD_REG_PRE_INCDEC; + +@@ -2595,16 +2603,22 @@ + f - Register class to use with traditional SFmode instructions. + v - Altivec register. + wa - Any VSX register. ++ wc - Reserved to represent individual CR bits (used in LLVM). + wd - Preferred register class for V2DFmode. + wf - Preferred register class for V4SFmode. + wg - Float register for power6x move insns. ++ wh - FP register for direct move instructions. ++ wi - FP or VSX register to hold 64-bit integers for VSX insns. ++ wj - FP or VSX register to hold 64-bit integers for direct moves. ++ wk - FP or VSX register to hold 64-bit doubles for direct moves. + wl - Float register if we can do 32-bit signed int loads. + wm - VSX register for ISA 2.07 direct move operations. ++ wn - always NO_REGS. + wr - GPR if 64-bit mode is permitted. + ws - Register class to do ISA 2.06 DF operations. ++ wt - VSX register for TImode in VSX registers. + wu - Altivec register for ISA 2.07 VSX SF/SI load/stores. + wv - Altivec register for ISA 2.06 VSX DF/DI load/stores. +- wt - VSX register for TImode in VSX registers. + ww - Register class to do SF conversions in with VSX operations. + wx - Float register if we can do 32-bit int stores. + wy - Register class to do ISA 2.07 SF operations. +@@ -2611,21 +2625,22 @@ + wz - Float register if we can do 32-bit unsigned int loads. */ + + if (TARGET_HARD_FLOAT && TARGET_FPRS) +- rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS; /* SFmode */ + + if (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT) +- rs6000_constraints[RS6000_CONSTRAINT_d] = FLOAT_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_d] = FLOAT_REGS; /* DFmode */ + + if (TARGET_VSX) + { + rs6000_constraints[RS6000_CONSTRAINT_wa] = VSX_REGS; +- rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS; +- rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS; /* V2DFmode */ ++ rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS; /* V4SFmode */ ++ rs6000_constraints[RS6000_CONSTRAINT_wi] = FLOAT_REGS; /* DImode */ + + if (TARGET_VSX_TIMODE) +- rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS; /* TImode */ + +- if (TARGET_UPPER_REGS_DF) ++ if (TARGET_UPPER_REGS_DF) /* DFmode */ + { + rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS; + rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS; +@@ -2639,19 +2654,26 @@ + if (TARGET_ALTIVEC) + rs6000_constraints[RS6000_CONSTRAINT_v] = ALTIVEC_REGS; + +- if (TARGET_MFPGPR) ++ if (TARGET_MFPGPR) /* DFmode */ + rs6000_constraints[RS6000_CONSTRAINT_wg] = FLOAT_REGS; + + if (TARGET_LFIWAX) +- rs6000_constraints[RS6000_CONSTRAINT_wl] = FLOAT_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_wl] = FLOAT_REGS; /* DImode */ + + if (TARGET_DIRECT_MOVE) +- rs6000_constraints[RS6000_CONSTRAINT_wm] = VSX_REGS; ++ { ++ rs6000_constraints[RS6000_CONSTRAINT_wh] = FLOAT_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_wj] /* DImode */ ++ = rs6000_constraints[RS6000_CONSTRAINT_wi]; ++ rs6000_constraints[RS6000_CONSTRAINT_wk] /* DFmode */ ++ = rs6000_constraints[RS6000_CONSTRAINT_ws]; ++ rs6000_constraints[RS6000_CONSTRAINT_wm] = VSX_REGS; ++ } + + if (TARGET_POWERPC64) + rs6000_constraints[RS6000_CONSTRAINT_wr] = GENERAL_REGS; + +- if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF) ++ if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF) /* SFmode */ + { + rs6000_constraints[RS6000_CONSTRAINT_wu] = ALTIVEC_REGS; + rs6000_constraints[RS6000_CONSTRAINT_wy] = VSX_REGS; +@@ -2666,10 +2688,10 @@ + rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS; + + if (TARGET_STFIWX) +- rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS; /* DImode */ + + if (TARGET_LFIWZX) +- rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS; ++ rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS; /* DImode */ + + /* Set up the reload helper and direct move functions. */ + if (TARGET_VSX || TARGET_ALTIVEC) +@@ -2692,10 +2714,11 @@ + reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_di_load; + if (TARGET_VSX && TARGET_UPPER_REGS_DF) + { +- reg_addr[DFmode].reload_store = CODE_FOR_reload_df_di_store; +- reg_addr[DFmode].reload_load = CODE_FOR_reload_df_di_load; +- reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_di_store; +- reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_di_load; ++ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_di_store; ++ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_di_load; ++ reg_addr[DFmode].scalar_in_vmx_p = true; ++ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_di_store; ++ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_di_load; + } + if (TARGET_P8_VECTOR) + { +@@ -2703,6 +2726,8 @@ + reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_di_load; + reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_di_store; + reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_di_load; ++ if (TARGET_UPPER_REGS_SF) ++ reg_addr[SFmode].scalar_in_vmx_p = true; + } + if (TARGET_VSX_TIMODE) + { +@@ -2759,10 +2784,11 @@ + reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_si_load; + if (TARGET_VSX && TARGET_UPPER_REGS_DF) + { +- reg_addr[DFmode].reload_store = CODE_FOR_reload_df_si_store; +- reg_addr[DFmode].reload_load = CODE_FOR_reload_df_si_load; +- reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_si_store; +- reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_si_load; ++ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_si_store; ++ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_si_load; ++ reg_addr[DFmode].scalar_in_vmx_p = true; ++ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_si_store; ++ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_si_load; + } + if (TARGET_P8_VECTOR) + { +@@ -2770,6 +2796,8 @@ + reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_si_load; + reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_si_store; + reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_si_load; ++ if (TARGET_UPPER_REGS_SF) ++ reg_addr[SFmode].scalar_in_vmx_p = true; + } + if (TARGET_VSX_TIMODE) + { +@@ -2810,6 +2838,7 @@ + + for (m = 0; m < NUM_MACHINE_MODES; ++m) + { ++ enum machine_mode m2 = (enum machine_mode)m; + int reg_size2 = reg_size; + + /* TFmode/TDmode always takes 2 registers, even in VSX. */ +@@ -2818,7 +2847,7 @@ + reg_size2 = UNITS_PER_FP_WORD; + + rs6000_class_max_nregs[m][c] +- = (GET_MODE_SIZE (m) + reg_size2 - 1) / reg_size2; ++ = (GET_MODE_SIZE (m2) + reg_size2 - 1) / reg_size2; + } + } + +@@ -3014,7 +3043,8 @@ + | ((TARGET_CRYPTO) ? RS6000_BTM_CRYPTO : 0) + | ((TARGET_HTM) ? RS6000_BTM_HTM : 0) + | ((TARGET_DFP) ? RS6000_BTM_DFP : 0) +- | ((TARGET_HARD_FLOAT) ? RS6000_BTM_HARD_FLOAT : 0)); ++ | ((TARGET_HARD_FLOAT) ? RS6000_BTM_HARD_FLOAT : 0) ++ | ((TARGET_LONG_DOUBLE_128) ? RS6000_BTM_LDBL128 : 0)); + } + + /* Override command line options. Mostly we process the processor type and +@@ -5861,6 +5891,34 @@ + return align; + } + ++/* Previous GCC releases forced all vector types to have 16-byte alignment. */ ++ ++bool ++rs6000_special_adjust_field_align_p (tree field, unsigned int computed) ++{ ++ if (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (field)) == VECTOR_TYPE) ++ { ++ if (computed != 128) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the layout of aggregates containing vectors with" ++ " %d-byte alignment will change in a future GCC release", ++ computed / BITS_PER_UNIT); ++ } ++ } ++ /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we ++ keep the special treatment of vector types, but warn if there will ++ be differences in future GCC releases. */ ++ return true; ++ } ++ ++ return false; ++} ++ + /* AIX increases natural record alignment to doubleword if the first + field is an FP double while the FP fields remain word aligned. */ + +@@ -6109,7 +6167,8 @@ + return false; + + extra = GET_MODE_SIZE (mode) - UNITS_PER_WORD; +- gcc_assert (extra >= 0); ++ if (extra < 0) ++ extra = 0; + + if (GET_CODE (addr) == LO_SUM) + /* For lo_sum addresses, we must allow any offset except one that +@@ -9198,14 +9257,51 @@ + || (type && TREE_CODE (type) == VECTOR_TYPE + && int_size_in_bytes (type) >= 16)) + return 128; +- else if (((TARGET_MACHO && rs6000_darwin64_abi) +- || DEFAULT_ABI == ABI_ELFv2 +- || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)) +- && mode == BLKmode +- && type && TYPE_ALIGN (type) > 64) ++ ++ /* Aggregate types that need > 8 byte alignment are quadword-aligned ++ in the parameter area in the ELFv2 ABI, and in the AIX ABI unless ++ -mcompat-align-parm is used. */ ++ if (((DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm) ++ || DEFAULT_ABI == ABI_ELFv2) ++ && type && TYPE_ALIGN (type) > 64) ++ { ++ /* "Aggregate" means any AGGREGATE_TYPE except for single-element ++ or homogeneous float/vector aggregates here. We already handled ++ vector aggregates above, but still need to check for float here. */ ++ bool aggregate_p = (AGGREGATE_TYPE_P (type) ++ && !SCALAR_FLOAT_MODE_P (elt_mode)); ++ ++ /* We used to check for BLKmode instead of the above aggregate type ++ check. Warn when this results in any difference to the ABI. */ ++ if (aggregate_p != (mode == BLKmode)) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the ABI of passing aggregates with %d-byte alignment" ++ " will change in a future GCC release", ++ (int) TYPE_ALIGN (type) / BITS_PER_UNIT); ++ } ++ } ++ ++ /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we ++ keep using the BLKmode check, but warn if there will be differences ++ in future GCC releases. */ ++ if (mode == BLKmode) ++ return 128; ++ } ++ ++ /* Similar for the Darwin64 ABI. Note that for historical reasons we ++ implement the "aggregate type" check as a BLKmode check here; this ++ means certain aggregate types are in fact not aligned. */ ++ if (TARGET_MACHO && rs6000_darwin64_abi ++ && mode == BLKmode ++ && type && TYPE_ALIGN (type) > 64) + return 128; +- else +- return PARM_BOUNDARY; ++ ++ return PARM_BOUNDARY; + } + + /* The offset in words to the start of the parameter save area. */ +@@ -10243,6 +10339,7 @@ + rtx r, off; + int i, k = 0; + unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; ++ int fpr_words; + + /* Do we also need to pass this argument in the parameter + save area? */ +@@ -10271,6 +10368,37 @@ + rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); + } + ++ /* If there were not enough FPRs to hold the argument, the rest ++ usually goes into memory. However, if the current position ++ is still within the register parameter area, a portion may ++ actually have to go into GPRs. ++ ++ Note that it may happen that the portion of the argument ++ passed in the first "half" of the first GPR was already ++ passed in the last FPR as well. ++ ++ For unnamed arguments, we already set up GPRs to cover the ++ whole argument in rs6000_psave_function_arg, so there is ++ nothing further to do at this point. ++ ++ GCC 4.8/4.9 Note: This was implemented incorrectly in earlier ++ GCC releases. To avoid any ABI change on the release branch, ++ we retain that original implementation here, but warn if we ++ encounter a case where the ABI will change in the future. */ ++ fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8); ++ if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG ++ && cum->nargs_prototype > 0) ++ { ++ static bool warned; ++ if (!warned && warn_psabi) ++ { ++ warned = true; ++ inform (input_location, ++ "the ABI of passing homogeneous float aggregates" ++ " will change in a future GCC release"); ++ } ++ } ++ + return rs6000_finish_function_arg (mode, rvec, k); + } + else if (align_words < GP_ARG_NUM_REG) +@@ -10497,10 +10625,9 @@ + list, or passes any parameter in memory. */ + + static bool +-rs6000_function_parms_need_stack (tree fun) ++rs6000_function_parms_need_stack (tree fun, bool incoming) + { +- function_args_iterator args_iter; +- tree arg_type; ++ tree fntype, result; + CUMULATIVE_ARGS args_so_far_v; + cumulative_args_t args_so_far; + +@@ -10507,26 +10634,57 @@ + if (!fun) + /* Must be a libcall, all of which only use reg parms. */ + return false; ++ ++ fntype = fun; + if (!TYPE_P (fun)) +- fun = TREE_TYPE (fun); ++ fntype = TREE_TYPE (fun); + + /* Varargs functions need the parameter save area. */ +- if (!prototype_p (fun) || stdarg_p (fun)) ++ if ((!incoming && !prototype_p (fntype)) || stdarg_p (fntype)) + return true; + +- INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX); ++ INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fntype, NULL_RTX); + args_so_far = pack_cumulative_args (&args_so_far_v); + +- if (aggregate_value_p (TREE_TYPE (fun), fun)) ++ /* When incoming, we will have been passed the function decl. ++ It is necessary to use the decl to handle K&R style functions, ++ where TYPE_ARG_TYPES may not be available. */ ++ if (incoming) + { +- tree type = build_pointer_type (TREE_TYPE (fun)); +- rs6000_parm_needs_stack (args_so_far, type); ++ gcc_assert (DECL_P (fun)); ++ result = DECL_RESULT (fun); + } ++ else ++ result = TREE_TYPE (fntype); + +- FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter) +- if (rs6000_parm_needs_stack (args_so_far, arg_type)) +- return true; ++ if (result && aggregate_value_p (result, fntype)) ++ { ++ if (!TYPE_P (result)) ++ result = TREE_TYPE (result); ++ result = build_pointer_type (result); ++ rs6000_parm_needs_stack (args_so_far, result); ++ } + ++ if (incoming) ++ { ++ tree parm; ++ ++ for (parm = DECL_ARGUMENTS (fun); ++ parm && parm != void_list_node; ++ parm = TREE_CHAIN (parm)) ++ if (rs6000_parm_needs_stack (args_so_far, TREE_TYPE (parm))) ++ return true; ++ } ++ else ++ { ++ function_args_iterator args_iter; ++ tree arg_type; ++ ++ FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter) ++ if (rs6000_parm_needs_stack (args_so_far, arg_type)) ++ return true; ++ } ++ + return false; + } + +@@ -10537,7 +10695,7 @@ + all parameters in registers. */ + + int +-rs6000_reg_parm_stack_space (tree fun) ++rs6000_reg_parm_stack_space (tree fun, bool incoming) + { + int reg_parm_stack_space; + +@@ -10555,7 +10713,7 @@ + case ABI_ELFv2: + /* ??? Recomputing this every time is a bit expensive. Is there + a place to cache this information? */ +- if (rs6000_function_parms_need_stack (fun)) ++ if (rs6000_function_parms_need_stack (fun, incoming)) + reg_parm_stack_space = TARGET_64BIT ? 64 : 32; + else + reg_parm_stack_space = 0; +@@ -13544,11 +13702,15 @@ + else if ((fnmask & (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR)) + == (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR)) + error ("Builtin function %s requires the -mhard-dfp and" +- "-mpower8-vector options", name); ++ " -mpower8-vector options", name); + else if ((fnmask & RS6000_BTM_DFP) != 0) + error ("Builtin function %s requires the -mhard-dfp option", name); + else if ((fnmask & RS6000_BTM_P8_VECTOR) != 0) + error ("Builtin function %s requires the -mpower8-vector option", name); ++ else if ((fnmask & (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128)) ++ == (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128)) ++ error ("Builtin function %s requires the -mhard-float and" ++ " -mlong-double-128 options", name); + else if ((fnmask & RS6000_BTM_HARD_FLOAT) != 0) + error ("Builtin function %s requires the -mhard-float option", name); + else +@@ -13649,8 +13811,8 @@ + case ALTIVEC_BUILTIN_MASK_FOR_LOAD: + case ALTIVEC_BUILTIN_MASK_FOR_STORE: + { +- int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr +- : (int) CODE_FOR_altivec_lvsl); ++ int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr_direct ++ : (int) CODE_FOR_altivec_lvsl_direct); + enum machine_mode tmode = insn_data[icode].operand[0].mode; + enum machine_mode mode = insn_data[icode].operand[1].mode; + tree arg; +@@ -13678,7 +13840,6 @@ + || ! (*insn_data[icode].operand[0].predicate) (target, tmode)) + target = gen_reg_rtx (tmode); + +- /*pat = gen_altivec_lvsr (target, op);*/ + pat = GEN_FCN (icode) (target, op); + if (!pat) + return 0; +@@ -17099,7 +17260,14 @@ + prefer Altivec loads.. */ + if (rclass == VSX_REGS) + { +- if (GET_MODE_SIZE (mode) <= 8) ++ if (MEM_P (x) && reg_addr[mode].scalar_in_vmx_p) ++ { ++ rtx addr = XEXP (x, 0); ++ if (rs6000_legitimate_offset_address_p (mode, addr, false, true) ++ || legitimate_lo_sum_address_p (mode, addr, false)) ++ return FLOAT_REGS; ++ } ++ else if (GET_MODE_SIZE (mode) <= 8 && !reg_addr[mode].scalar_in_vmx_p) + return FLOAT_REGS; + + if (VECTOR_UNIT_ALTIVEC_P (mode) || VECTOR_MEM_ALTIVEC_P (mode) +@@ -31413,6 +31581,7 @@ + { "htm", RS6000_BTM_HTM, false, false }, + { "hard-dfp", RS6000_BTM_DFP, false, false }, + { "hard-float", RS6000_BTM_HARD_FLOAT, false, false }, ++ { "long-double-128", RS6000_BTM_LDBL128, false, false }, + }; + + /* Option variables that we want to support inside attribute((target)) and +@@ -32663,25 +32832,14 @@ + + /* Return true if the peephole2 can combine a load involving a combination of + an addis instruction and a load with an offset that can be fused together on +- a power8. ++ a power8. */ + +- The operands are: +- operands[0] register set with addis +- operands[1] value set via addis +- operands[2] target register being loaded +- operands[3] D-form memory reference using operands[0]. +- +- In addition, we are passed a boolean that is true if this is a peephole2, +- and we can use see if the addis_reg is dead after the insn and can be +- replaced by the target register. */ +- + bool +-fusion_gpr_load_p (rtx *operands, bool peep2_p) ++fusion_gpr_load_p (rtx addis_reg, /* register set via addis. */ ++ rtx addis_value, /* addis value. */ ++ rtx target, /* target register that is loaded. */ ++ rtx mem) /* bottom part of the memory addr. */ + { +- rtx addis_reg = operands[0]; +- rtx addis_value = operands[1]; +- rtx target = operands[2]; +- rtx mem = operands[3]; + rtx addr; + rtx base_reg; + +@@ -32695,9 +32853,6 @@ + if (!fusion_gpr_addis (addis_value, GET_MODE (addis_value))) + return false; + +- if (!fusion_gpr_mem_load (mem, GET_MODE (mem))) +- return false; +- + /* Allow sign/zero extension. */ + if (GET_CODE (mem) == ZERO_EXTEND + || (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN)) +@@ -32706,22 +32861,22 @@ + if (!MEM_P (mem)) + return false; + ++ if (!fusion_gpr_mem_load (mem, GET_MODE (mem))) ++ return false; ++ + addr = XEXP (mem, 0); /* either PLUS or LO_SUM. */ + if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM) + return false; + + /* Validate that the register used to load the high value is either the +- register being loaded, or we can safely replace its use in a peephole2. ++ register being loaded, or we can safely replace its use. + +- If this is a peephole2, we assume that there are 2 instructions in the +- peephole (addis and load), so we want to check if the target register was +- not used in the memory address and the register to hold the addis result +- is dead after the peephole. */ ++ This function is only called from the peephole2 pass and we assume that ++ there are 2 instructions in the peephole (addis and load), so we want to ++ check if the target register was not used in the memory address and the ++ register to hold the addis result is dead after the peephole. */ + if (REGNO (addis_reg) != REGNO (target)) + { +- if (!peep2_p) +- return false; +- + if (reg_mentioned_p (target, mem)) + return false; + +@@ -32762,9 +32917,6 @@ + enum machine_mode extend_mode = target_mode; + enum machine_mode ptr_mode = Pmode; + enum rtx_code extend = UNKNOWN; +- rtx addis_reg = ((ptr_mode == target_mode) +- ? target +- : simplify_subreg (ptr_mode, target, target_mode, 0)); + + if (GET_CODE (orig_mem) == ZERO_EXTEND + || (TARGET_P8_FUSION_SIGN && GET_CODE (orig_mem) == SIGN_EXTEND)) +@@ -32781,13 +32933,14 @@ + gcc_assert (plus_or_lo_sum == PLUS || plus_or_lo_sum == LO_SUM); + + offset = XEXP (orig_addr, 1); +- new_addr = gen_rtx_fmt_ee (plus_or_lo_sum, ptr_mode, addis_reg, offset); +- new_mem = change_address (orig_mem, target_mode, new_addr); ++ new_addr = gen_rtx_fmt_ee (plus_or_lo_sum, ptr_mode, addis_value, offset); ++ new_mem = replace_equiv_address_nv (orig_mem, new_addr); + + if (extend != UNKNOWN) + new_mem = gen_rtx_fmt_e (ZERO_EXTEND, extend_mode, new_mem); + +- emit_insn (gen_rtx_SET (VOIDmode, addis_reg, addis_value)); ++ new_mem = gen_rtx_UNSPEC (extend_mode, gen_rtvec (1, new_mem), ++ UNSPEC_FUSION_GPR); + emit_insn (gen_rtx_SET (VOIDmode, target, new_mem)); + + if (extend == SIGN_EXTEND) +@@ -32806,55 +32959,40 @@ + } + + /* Return a string to fuse an addis instruction with a gpr load to the same +- register that we loaded up the addis instruction. The code is complicated, +- so we call output_asm_insn directly, and just return "". ++ register that we loaded up the addis instruction. The address that is used ++ is the logical address that was formed during peephole2: ++ (lo_sum (high) (low-part)) + +- The operands are: +- operands[0] register set with addis (must be same reg as target). +- operands[1] value set via addis +- operands[2] target register being loaded +- operands[3] D-form memory reference using operands[0]. */ ++ The code is complicated, so we call output_asm_insn directly, and just ++ return "". */ + + const char * +-emit_fusion_gpr_load (rtx *operands) ++emit_fusion_gpr_load (rtx target, rtx mem) + { +- rtx addis_reg = operands[0]; +- rtx addis_value = operands[1]; +- rtx target = operands[2]; +- rtx mem = operands[3]; ++ rtx addis_value; + rtx fuse_ops[10]; + rtx addr; + rtx load_offset; + const char *addis_str = NULL; + const char *load_str = NULL; +- const char *extend_insn = NULL; + const char *mode_name = NULL; + char insn_template[80]; + enum machine_mode mode; + const char *comment_str = ASM_COMMENT_START; +- bool sign_p = false; + +- gcc_assert (REG_P (addis_reg) && REG_P (target)); +- gcc_assert (REGNO (addis_reg) == REGNO (target)); ++ if (GET_CODE (mem) == ZERO_EXTEND) ++ mem = XEXP (mem, 0); + ++ gcc_assert (REG_P (target) && MEM_P (mem)); ++ + if (*comment_str == ' ') + comment_str++; + +- /* Allow sign/zero extension. */ +- if (GET_CODE (mem) == ZERO_EXTEND) +- mem = XEXP (mem, 0); +- +- else if (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN) +- { +- sign_p = true; +- mem = XEXP (mem, 0); +- } +- +- gcc_assert (MEM_P (mem)); + addr = XEXP (mem, 0); + if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM) + gcc_unreachable (); + ++ addis_value = XEXP (addr, 0); + load_offset = XEXP (addr, 1); + + /* Now emit the load instruction to the same register. */ +@@ -32864,29 +33002,22 @@ + case QImode: + mode_name = "char"; + load_str = "lbz"; +- extend_insn = "extsb %0,%0"; + break; + + case HImode: + mode_name = "short"; + load_str = "lhz"; +- extend_insn = "extsh %0,%0"; + break; + + case SImode: + mode_name = "int"; + load_str = "lwz"; +- extend_insn = "extsw %0,%0"; + break; + + case DImode: +- if (TARGET_POWERPC64) +- { +- mode_name = "long"; +- load_str = "ld"; +- } +- else +- gcc_unreachable (); ++ gcc_assert (TARGET_POWERPC64); ++ mode_name = "long"; ++ load_str = "ld"; + break; + + default: +@@ -33030,14 +33161,6 @@ + else + fatal_insn ("Unable to generate load offset for fusion", load_offset); + +- /* Handle sign extension. The peephole2 pass generates this as a separate +- insn, but we handle it just in case it got reattached. */ +- if (sign_p) +- { +- gcc_assert (extend_insn != NULL); +- output_asm_insn (extend_insn, fuse_ops); +- } +- + return ""; + } + +Index: gcc/config/rs6000/vsx.md +=================================================================== +--- gcc/config/rs6000/vsx.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/vsx.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -24,6 +24,13 @@ + ;; Iterator for the 2 64-bit vector types + (define_mode_iterator VSX_D [V2DF V2DI]) + ++;; Iterator for the 2 64-bit vector types + 128-bit types that are loaded with ++;; lxvd2x to properly handle swapping words on little endian ++(define_mode_iterator VSX_LE [V2DF ++ V2DI ++ V1TI ++ (TI "VECTOR_MEM_VSX_P (TImode)")]) ++ + ;; Iterator for the 2 32-bit vector types + (define_mode_iterator VSX_W [V4SF V4SI]) + +@@ -79,19 +86,26 @@ + (V4SF "wf") + (V2DI "wd") + (V2DF "wd") ++ (DI "wi") + (DF "ws") +- (SF "d") ++ (SF "ww") + (V1TI "v") + (TI "wt")]) + +-;; Map the register class used for float<->int conversions ++;; Map the register class used for float<->int conversions (floating point side) ++;; VSr2 is the preferred register class, VSr3 is any register class that will ++;; hold the data + (define_mode_attr VSr2 [(V2DF "wd") + (V4SF "wf") +- (DF "ws")]) ++ (DF "ws") ++ (SF "ww") ++ (DI "wi")]) + + (define_mode_attr VSr3 [(V2DF "wa") + (V4SF "wa") +- (DF "ws")]) ++ (DF "ws") ++ (SF "ww") ++ (DI "wi")]) + + ;; Map the register class for sp<->dp float conversions, destination + (define_mode_attr VSr4 [(SF "ws") +@@ -99,12 +113,27 @@ + (V2DF "wd") + (V4SF "v")]) + +-;; Map the register class for sp<->dp float conversions, destination ++;; Map the register class for sp<->dp float conversions, source + (define_mode_attr VSr5 [(SF "ws") + (DF "f") + (V2DF "v") + (V4SF "wd")]) + ++;; The VSX register class that a type can occupy, even if it is not the ++;; preferred register class (VSr is the preferred register class that will get ++;; allocated first). ++(define_mode_attr VSa [(V16QI "wa") ++ (V8HI "wa") ++ (V4SI "wa") ++ (V4SF "wa") ++ (V2DI "wa") ++ (V2DF "wa") ++ (DI "wi") ++ (DF "ws") ++ (SF "ww") ++ (V1TI "wa") ++ (TI "wt")]) ++ + ;; Same size integer type for floating point data + (define_mode_attr VSi [(V4SF "v4si") + (V2DF "v2di") +@@ -200,6 +229,16 @@ + (V2DF "V4DF") + (V1TI "V2TI")]) + ++;; Map register class for 64-bit element in 128-bit vector for direct moves ++;; to/from gprs ++(define_mode_attr VS_64dm [(V2DF "wk") ++ (V2DI "wj")]) ++ ++;; Map register class for 64-bit element in 128-bit vector for normal register ++;; to register moves ++(define_mode_attr VS_64reg [(V2DF "ws") ++ (V2DI "wi")]) ++ + ;; Constants for creating unspecs + (define_c_enum "unspec" + [UNSPEC_VSX_CONCAT +@@ -228,8 +267,8 @@ + ;; The patterns for LE permuted loads and stores come before the general + ;; VSX moves so they match first. + (define_insn_and_split "*vsx_le_perm_load_" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") +- (match_operand:VSX_D 1 "memory_operand" "Z"))] ++ [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=") ++ (match_operand:VSX_LE 1 "memory_operand" "Z"))] + "!BYTES_BIG_ENDIAN && TARGET_VSX" + "#" + "!BYTES_BIG_ENDIAN && TARGET_VSX" +@@ -251,7 +290,7 @@ + (set_attr "length" "8")]) + + (define_insn_and_split "*vsx_le_perm_load_" +- [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa") ++ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=") + (match_operand:VSX_W 1 "memory_operand" "Z"))] + "!BYTES_BIG_ENDIAN && TARGET_VSX" + "#" +@@ -342,8 +381,8 @@ + (set_attr "length" "8")]) + + (define_insn "*vsx_le_perm_store_" +- [(set (match_operand:VSX_D 0 "memory_operand" "=Z") +- (match_operand:VSX_D 1 "vsx_register_operand" "+wa"))] ++ [(set (match_operand:VSX_LE 0 "memory_operand" "=Z") ++ (match_operand:VSX_LE 1 "vsx_register_operand" "+"))] + "!BYTES_BIG_ENDIAN && TARGET_VSX" + "#" + [(set_attr "type" "vecstore") +@@ -350,8 +389,8 @@ + (set_attr "length" "12")]) + + (define_split +- [(set (match_operand:VSX_D 0 "memory_operand" "") +- (match_operand:VSX_D 1 "vsx_register_operand" ""))] ++ [(set (match_operand:VSX_LE 0 "memory_operand" "") ++ (match_operand:VSX_LE 1 "vsx_register_operand" ""))] + "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed" + [(set (match_dup 2) + (vec_select: +@@ -369,8 +408,8 @@ + ;; The post-reload split requires that we re-permute the source + ;; register in case it is still live. + (define_split +- [(set (match_operand:VSX_D 0 "memory_operand" "") +- (match_operand:VSX_D 1 "vsx_register_operand" ""))] ++ [(set (match_operand:VSX_LE 0 "memory_operand" "") ++ (match_operand:VSX_LE 1 "vsx_register_operand" ""))] + "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed" + [(set (match_dup 1) + (vec_select: +@@ -388,7 +427,7 @@ + + (define_insn "*vsx_le_perm_store_" + [(set (match_operand:VSX_W 0 "memory_operand" "=Z") +- (match_operand:VSX_W 1 "vsx_register_operand" "+wa"))] ++ (match_operand:VSX_W 1 "vsx_register_operand" "+"))] + "!BYTES_BIG_ENDIAN && TARGET_VSX" + "#" + [(set_attr "type" "vecstore") +@@ -578,8 +617,8 @@ + + + (define_insn "*vsx_mov" +- [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,,,?Z,?wa,?wa,wQ,?&r,??Y,??r,??r,,?wa,*r,v,wZ, v") +- (match_operand:VSX_M 1 "input_operand" ",Z,,wa,Z,wa,r,wQ,r,Y,r,j,j,j,W,v,wZ"))] ++ [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,,,?Z,?,?,wQ,?&r,??Y,??r,??r,,?,*r,v,wZ, v") ++ (match_operand:VSX_M 1 "input_operand" ",Z,,,Z,,r,wQ,r,Y,r,j,j,j,W,v,wZ"))] + "VECTOR_MEM_VSX_P (mode) + && (register_operand (operands[0], mode) + || register_operand (operands[1], mode))" +@@ -681,9 +720,9 @@ + ;; instructions are now combined with the insn for the traditional floating + ;; point unit. + (define_insn "*vsx_add3" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (plus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (plus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvadd %x0,%x1,%x2" + [(set_attr "type" "") +@@ -690,9 +729,9 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_sub3" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (minus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (minus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvsub %x0,%x1,%x2" + [(set_attr "type" "") +@@ -699,9 +738,9 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_mul3" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (mult:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (mult:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvmul %x0,%x1,%x2" + [(set_attr "type" "") +@@ -708,9 +747,9 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_div3" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (div:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (div:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvdiv %x0,%x1,%x2" + [(set_attr "type" "") +@@ -746,8 +785,8 @@ + + (define_insn "*vsx_tdiv3_internal" + [(set (match_operand:CCFP 0 "cc_reg_operand" "=x,x") +- (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_B 2 "vsx_register_operand" ",wa")] ++ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" ",") ++ (match_operand:VSX_B 2 "vsx_register_operand" ",")] + UNSPEC_VSX_TDIV))] + "VECTOR_UNIT_VSX_P (mode)" + "xtdiv %0,%x1,%x2" +@@ -755,8 +794,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_fre2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",")] + UNSPEC_FRES))] + "VECTOR_UNIT_VSX_P (mode)" + "xvre %x0,%x1" +@@ -764,8 +803,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_neg2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (neg:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (neg:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvneg %x0,%x1" + [(set_attr "type" "") +@@ -772,8 +811,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_abs2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (abs:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (abs:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvabs %x0,%x1" + [(set_attr "type" "") +@@ -780,10 +819,10 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_nabs2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") + (neg:VSX_F + (abs:VSX_F +- (match_operand:VSX_F 1 "vsx_register_operand" ",wa"))))] ++ (match_operand:VSX_F 1 "vsx_register_operand" ","))))] + "VECTOR_UNIT_VSX_P (mode)" + "xvnabs %x0,%x1" + [(set_attr "type" "") +@@ -790,9 +829,9 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_smax3" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (smax:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (smax:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvmax %x0,%x1,%x2" + [(set_attr "type" "") +@@ -799,9 +838,9 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_smin3" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (smin:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (smin:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvmin %x0,%x1,%x2" + [(set_attr "type" "") +@@ -808,8 +847,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_sqrt2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (sqrt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (sqrt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvsqrt %x0,%x1" + [(set_attr "type" "") +@@ -816,8 +855,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_rsqrte2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",")] + UNSPEC_RSQRT))] + "VECTOR_UNIT_VSX_P (mode)" + "xvrsqrte %x0,%x1" +@@ -852,7 +891,7 @@ + + (define_insn "*vsx_tsqrt2_internal" + [(set (match_operand:CCFP 0 "cc_reg_operand" "=x,x") +- (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] ++ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" ",")] + UNSPEC_VSX_TSQRT))] + "VECTOR_UNIT_VSX_P (mode)" + "xtsqrt %0,%x1" +@@ -865,11 +904,11 @@ + ;; multiply. + + (define_insn "*vsx_fmav4sf4" +- [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,v") ++ [(set (match_operand:V4SF 0 "vsx_register_operand" "=wf,wf,?wa,?wa,v") + (fma:V4SF +- (match_operand:V4SF 1 "vsx_register_operand" "%ws,ws,wa,wa,v") +- (match_operand:V4SF 2 "vsx_register_operand" "ws,0,wa,0,v") +- (match_operand:V4SF 3 "vsx_register_operand" "0,ws,0,wa,v")))] ++ (match_operand:V4SF 1 "vsx_register_operand" "%wf,wf,wa,wa,v") ++ (match_operand:V4SF 2 "vsx_register_operand" "wf,0,wa,0,v") ++ (match_operand:V4SF 3 "vsx_register_operand" "0,wf,0,wa,v")))] + "VECTOR_UNIT_VSX_P (V4SFmode)" + "@ + xvmaddasp %x0,%x1,%x2 +@@ -880,11 +919,11 @@ + [(set_attr "type" "vecfloat")]) + + (define_insn "*vsx_fmav2df4" +- [(set (match_operand:V2DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa") ++ [(set (match_operand:V2DF 0 "vsx_register_operand" "=wd,wd,?wa,?wa") + (fma:V2DF +- (match_operand:V2DF 1 "vsx_register_operand" "%ws,ws,wa,wa") +- (match_operand:V2DF 2 "vsx_register_operand" "ws,0,wa,0") +- (match_operand:V2DF 3 "vsx_register_operand" "0,ws,0,wa")))] ++ (match_operand:V2DF 1 "vsx_register_operand" "%wd,wd,wa,wa") ++ (match_operand:V2DF 2 "vsx_register_operand" "wd,0,wa,0") ++ (match_operand:V2DF 3 "vsx_register_operand" "0,wd,0,wa")))] + "VECTOR_UNIT_VSX_P (V2DFmode)" + "@ + xvmaddadp %x0,%x1,%x2 +@@ -894,12 +933,12 @@ + [(set_attr "type" "vecdouble")]) + + (define_insn "*vsx_fms4" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,,?wa,?wa") ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,,?,?") + (fma:VSX_F +- (match_operand:VSX_F 1 "vsx_register_operand" "%,,wa,wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",0,wa,0") ++ (match_operand:VSX_F 1 "vsx_register_operand" "%,,,") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",0,,0") + (neg:VSX_F +- (match_operand:VSX_F 3 "vsx_register_operand" "0,,0,wa"))))] ++ (match_operand:VSX_F 3 "vsx_register_operand" "0,,0,"))))] + "VECTOR_UNIT_VSX_P (mode)" + "@ + xvmsuba %x0,%x1,%x2 +@@ -909,12 +948,12 @@ + [(set_attr "type" "")]) + + (define_insn "*vsx_nfma4" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,,?wa,?wa") ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,,?,?") + (neg:VSX_F + (fma:VSX_F +- (match_operand:VSX_F 1 "vsx_register_operand" ",,wa,wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",0,wa,0") +- (match_operand:VSX_F 3 "vsx_register_operand" "0,,0,wa"))))] ++ (match_operand:VSX_F 1 "vsx_register_operand" ",,,") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",0,,0") ++ (match_operand:VSX_F 3 "vsx_register_operand" "0,,0,"))))] + "VECTOR_UNIT_VSX_P (mode)" + "@ + xvnmadda %x0,%x1,%x2 +@@ -959,9 +998,9 @@ + + ;; Vector conditional expressions (no scalar version for these instructions) + (define_insn "vsx_eq" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (eq:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (eq:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvcmpeq %x0,%x1,%x2" + [(set_attr "type" "") +@@ -968,9 +1007,9 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_gt" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (gt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (gt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvcmpgt %x0,%x1,%x2" + [(set_attr "type" "") +@@ -977,9 +1016,9 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_ge" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (ge:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (ge:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvcmpge %x0,%x1,%x2" + [(set_attr "type" "") +@@ -990,10 +1029,10 @@ + (define_insn "*vsx_eq__p" + [(set (reg:CC 74) + (unspec:CC +- [(eq:CC (match_operand:VSX_F 1 "vsx_register_operand" ",?wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",?wa"))] ++ [(eq:CC (match_operand:VSX_F 1 "vsx_register_operand" ",?") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",?"))] + UNSPEC_PREDICATE)) +- (set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") ++ (set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") + (eq:VSX_F (match_dup 1) + (match_dup 2)))] + "VECTOR_UNIT_VSX_P (mode)" +@@ -1003,10 +1042,10 @@ + (define_insn "*vsx_gt__p" + [(set (reg:CC 74) + (unspec:CC +- [(gt:CC (match_operand:VSX_F 1 "vsx_register_operand" ",?wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",?wa"))] ++ [(gt:CC (match_operand:VSX_F 1 "vsx_register_operand" ",?") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",?"))] + UNSPEC_PREDICATE)) +- (set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") ++ (set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") + (gt:VSX_F (match_dup 1) + (match_dup 2)))] + "VECTOR_UNIT_VSX_P (mode)" +@@ -1016,10 +1055,10 @@ + (define_insn "*vsx_ge__p" + [(set (reg:CC 74) + (unspec:CC +- [(ge:CC (match_operand:VSX_F 1 "vsx_register_operand" ",?wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",?wa"))] ++ [(ge:CC (match_operand:VSX_F 1 "vsx_register_operand" ",?") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",?"))] + UNSPEC_PREDICATE)) +- (set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") ++ (set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") + (ge:VSX_F (match_dup 1) + (match_dup 2)))] + "VECTOR_UNIT_VSX_P (mode)" +@@ -1028,23 +1067,23 @@ + + ;; Vector select + (define_insn "*vsx_xxsel" +- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=,?wa") ++ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=,?") + (if_then_else:VSX_L +- (ne:CC (match_operand:VSX_L 1 "vsx_register_operand" ",wa") ++ (ne:CC (match_operand:VSX_L 1 "vsx_register_operand" ",") + (match_operand:VSX_L 4 "zero_constant" "")) +- (match_operand:VSX_L 2 "vsx_register_operand" ",wa") +- (match_operand:VSX_L 3 "vsx_register_operand" ",wa")))] ++ (match_operand:VSX_L 2 "vsx_register_operand" ",") ++ (match_operand:VSX_L 3 "vsx_register_operand" ",")))] + "VECTOR_MEM_VSX_P (mode)" + "xxsel %x0,%x3,%x2,%x1" + [(set_attr "type" "vecperm")]) + + (define_insn "*vsx_xxsel_uns" +- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=,?wa") ++ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=,?") + (if_then_else:VSX_L +- (ne:CCUNS (match_operand:VSX_L 1 "vsx_register_operand" ",wa") ++ (ne:CCUNS (match_operand:VSX_L 1 "vsx_register_operand" ",") + (match_operand:VSX_L 4 "zero_constant" "")) +- (match_operand:VSX_L 2 "vsx_register_operand" ",wa") +- (match_operand:VSX_L 3 "vsx_register_operand" ",wa")))] ++ (match_operand:VSX_L 2 "vsx_register_operand" ",") ++ (match_operand:VSX_L 3 "vsx_register_operand" ",")))] + "VECTOR_MEM_VSX_P (mode)" + "xxsel %x0,%x3,%x2,%x1" + [(set_attr "type" "vecperm")]) +@@ -1051,10 +1090,10 @@ + + ;; Copy sign + (define_insn "vsx_copysign3" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") + (unspec:VSX_F +- [(match_operand:VSX_F 1 "vsx_register_operand" ",wa") +- (match_operand:VSX_F 2 "vsx_register_operand" ",wa")] ++ [(match_operand:VSX_F 1 "vsx_register_operand" ",") ++ (match_operand:VSX_F 2 "vsx_register_operand" ",")] + UNSPEC_COPYSIGN))] + "VECTOR_UNIT_VSX_P (mode)" + "xvcpsgn %x0,%x2,%x1" +@@ -1067,7 +1106,7 @@ + ;; in rs6000.md so don't test VECTOR_UNIT_VSX_P, just test against VSX. + ;; Don't use vsx_register_operand here, use gpc_reg_operand to match rs6000.md. + (define_insn "vsx_float2" +- [(set (match_operand:VSX_B 0 "gpc_reg_operand" "=,?wa") ++ [(set (match_operand:VSX_B 0 "gpc_reg_operand" "=,?") + (float:VSX_B (match_operand: 1 "gpc_reg_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xcvsx %x0,%x1" +@@ -1075,7 +1114,7 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_floatuns2" +- [(set (match_operand:VSX_B 0 "gpc_reg_operand" "=,?wa") ++ [(set (match_operand:VSX_B 0 "gpc_reg_operand" "=,?") + (unsigned_float:VSX_B (match_operand: 1 "gpc_reg_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xcvux %x0,%x1" +@@ -1084,7 +1123,7 @@ + + (define_insn "vsx_fix_trunc2" + [(set (match_operand: 0 "gpc_reg_operand" "=,?") +- (fix: (match_operand:VSX_B 1 "gpc_reg_operand" ",wa")))] ++ (fix: (match_operand:VSX_B 1 "gpc_reg_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xcvsxs %x0,%x1" + [(set_attr "type" "") +@@ -1092,7 +1131,7 @@ + + (define_insn "vsx_fixuns_trunc2" + [(set (match_operand: 0 "gpc_reg_operand" "=,?") +- (unsigned_fix: (match_operand:VSX_B 1 "gpc_reg_operand" ",wa")))] ++ (unsigned_fix: (match_operand:VSX_B 1 "gpc_reg_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xcvuxs %x0,%x1" + [(set_attr "type" "") +@@ -1100,8 +1139,8 @@ + + ;; Math rounding functions + (define_insn "vsx_xri" +- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") +- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?") ++ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",")] + UNSPEC_VSX_ROUND_I))] + "VECTOR_UNIT_VSX_P (mode)" + "xri %x0,%x1" +@@ -1109,8 +1148,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_xric" +- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") +- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?") ++ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",")] + UNSPEC_VSX_ROUND_IC))] + "VECTOR_UNIT_VSX_P (mode)" + "xric %x0,%x1" +@@ -1118,8 +1157,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_btrunc2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (fix:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (fix:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",")))] + "VECTOR_UNIT_VSX_P (mode)" + "xvriz %x0,%x1" + [(set_attr "type" "") +@@ -1126,8 +1165,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "*vsx_b2trunc2" +- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") +- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?") ++ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",")] + UNSPEC_FRIZ))] + "VECTOR_UNIT_VSX_P (mode)" + "xriz %x0,%x1" +@@ -1135,8 +1174,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_floor2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",")] + UNSPEC_FRIM))] + "VECTOR_UNIT_VSX_P (mode)" + "xvrim %x0,%x1" +@@ -1144,8 +1183,8 @@ + (set_attr "fp_type" "")]) + + (define_insn "vsx_ceil2" +- [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") +- (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?") ++ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",")] + UNSPEC_FRIP))] + "VECTOR_UNIT_VSX_P (mode)" + "xvrip %x0,%x1" +@@ -1160,8 +1199,8 @@ + ;; scalar single precision instructions internally use the double format. + ;; Prefer the altivec registers, since we likely will need to do a vperm + (define_insn "vsx_" +- [(set (match_operand: 0 "vsx_register_operand" "=,?wa") +- (unspec: [(match_operand:VSX_SPDP 1 "vsx_register_operand" ",wa")] ++ [(set (match_operand: 0 "vsx_register_operand" "=,?") ++ (unspec: [(match_operand:VSX_SPDP 1 "vsx_register_operand" ",")] + UNSPEC_VSX_CVSPDP))] + "VECTOR_UNIT_VSX_P (mode)" + " %x0,%x1" +@@ -1169,8 +1208,8 @@ + + ;; xscvspdp, represent the scalar SF type as V4SF + (define_insn "vsx_xscvspdp" +- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?wa") +- (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa,wa")] ++ [(set (match_operand:DF 0 "vsx_register_operand" "=ws") ++ (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa")] + UNSPEC_VSX_CVSPDP))] + "VECTOR_UNIT_VSX_P (V4SFmode)" + "xscvspdp %x0,%x1" +@@ -1197,7 +1236,7 @@ + + ;; ISA 2.07 xscvdpspn/xscvspdpn that does not raise an error on signalling NaNs + (define_insn "vsx_xscvdpspn" +- [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,?wa") ++ [(set (match_operand:V4SF 0 "vsx_register_operand" "=ww,?ww") + (unspec:V4SF [(match_operand:DF 1 "vsx_register_operand" "wd,wa")] + UNSPEC_VSX_CVDPSPN))] + "TARGET_XSCVDPSPN" +@@ -1205,8 +1244,8 @@ + [(set_attr "type" "fp")]) + + (define_insn "vsx_xscvspdpn" +- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?wa") +- (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa,wa")] ++ [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?ws") ++ (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wf,wa")] + UNSPEC_VSX_CVSPDPN))] + "TARGET_XSCVSPDPN" + "xscvspdpn %x0,%x1" +@@ -1213,8 +1252,8 @@ + [(set_attr "type" "fp")]) + + (define_insn "vsx_xscvdpspn_scalar" +- [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") +- (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "f")] ++ [(set (match_operand:V4SF 0 "vsx_register_operand" "=wf,?wa") ++ (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "ww,ww")] + UNSPEC_VSX_CVDPSPN))] + "TARGET_XSCVDPSPN" + "xscvdpspn %x0,%x1" +@@ -1302,10 +1341,10 @@ + ;; since the xsrdpiz instruction does not truncate the value if the floating + ;; point value is < LONG_MIN or > LONG_MAX. + (define_insn "*vsx_float_fix_2" +- [(set (match_operand:VSX_DF 0 "vsx_register_operand" "=,?wa") ++ [(set (match_operand:VSX_DF 0 "vsx_register_operand" "=,?") + (float:VSX_DF + (fix: +- (match_operand:VSX_DF 1 "vsx_register_operand" ",?wa"))))] ++ (match_operand:VSX_DF 1 "vsx_register_operand" ",?"))))] + "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT + && VECTOR_UNIT_VSX_P (mode) && flag_unsafe_math_optimizations + && !flag_trapping_math && TARGET_FRIZ" +@@ -1318,10 +1357,10 @@ + + ;; Build a V2DF/V2DI vector from two scalars + (define_insn "vsx_concat_" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=,?wa") ++ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=,?") + (vec_concat:VSX_D +- (match_operand: 1 "vsx_register_operand" "ws,wa") +- (match_operand: 2 "vsx_register_operand" "ws,wa")))] ++ (match_operand: 1 "vsx_register_operand" ",") ++ (match_operand: 2 "vsx_register_operand" ",")))] + "VECTOR_MEM_VSX_P (mode)" + { + if (BYTES_BIG_ENDIAN) +@@ -1352,9 +1391,9 @@ + ;; xxpermdi for little endian loads and stores. We need several of + ;; these since the form of the PARALLEL differs by mode. + (define_insn "*vsx_xxpermdi2_le_" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") +- (vec_select:VSX_D +- (match_operand:VSX_D 1 "vsx_register_operand" "wa") ++ [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=") ++ (vec_select:VSX_LE ++ (match_operand:VSX_LE 1 "vsx_register_operand" "") + (parallel [(const_int 1) (const_int 0)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (mode)" + "xxpermdi %x0,%x1,%x1,2" +@@ -1361,9 +1400,9 @@ + [(set_attr "type" "vecperm")]) + + (define_insn "*vsx_xxpermdi4_le_" +- [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa") ++ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=") + (vec_select:VSX_W +- (match_operand:VSX_W 1 "vsx_register_operand" "wa") ++ (match_operand:VSX_W 1 "vsx_register_operand" "") + (parallel [(const_int 2) (const_int 3) + (const_int 0) (const_int 1)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (mode)" +@@ -1401,9 +1440,9 @@ + ;; lxvd2x for little endian loads. We need several of + ;; these since the form of the PARALLEL differs by mode. + (define_insn "*vsx_lxvd2x2_le_" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") +- (vec_select:VSX_D +- (match_operand:VSX_D 1 "memory_operand" "Z") ++ [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=") ++ (vec_select:VSX_LE ++ (match_operand:VSX_LE 1 "memory_operand" "Z") + (parallel [(const_int 1) (const_int 0)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (mode)" + "lxvd2x %x0,%y1" +@@ -1410,7 +1449,7 @@ + [(set_attr "type" "vecload")]) + + (define_insn "*vsx_lxvd2x4_le_" +- [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa") ++ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=") + (vec_select:VSX_W + (match_operand:VSX_W 1 "memory_operand" "Z") + (parallel [(const_int 2) (const_int 3) +@@ -1450,9 +1489,9 @@ + ;; stxvd2x for little endian stores. We need several of + ;; these since the form of the PARALLEL differs by mode. + (define_insn "*vsx_stxvd2x2_le_" +- [(set (match_operand:VSX_D 0 "memory_operand" "=Z") +- (vec_select:VSX_D +- (match_operand:VSX_D 1 "vsx_register_operand" "wa") ++ [(set (match_operand:VSX_LE 0 "memory_operand" "=Z") ++ (vec_select:VSX_LE ++ (match_operand:VSX_LE 1 "vsx_register_operand" "") + (parallel [(const_int 1) (const_int 0)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (mode)" + "stxvd2x %x1,%y0" +@@ -1461,7 +1500,7 @@ + (define_insn "*vsx_stxvd2x4_le_" + [(set (match_operand:VSX_W 0 "memory_operand" "=Z") + (vec_select:VSX_W +- (match_operand:VSX_W 1 "vsx_register_operand" "wa") ++ (match_operand:VSX_W 1 "vsx_register_operand" "") + (parallel [(const_int 2) (const_int 3) + (const_int 0) (const_int 1)])))] + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (mode)" +@@ -1513,11 +1552,12 @@ + + ;; Set the element of a V2DI/VD2F mode + (define_insn "vsx_set_" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa") +- (unspec:VSX_D [(match_operand:VSX_D 1 "vsx_register_operand" "wd,wa") +- (match_operand: 2 "vsx_register_operand" "ws,wa") +- (match_operand:QI 3 "u5bit_cint_operand" "i,i")] +- UNSPEC_VSX_SET))] ++ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?") ++ (unspec:VSX_D ++ [(match_operand:VSX_D 1 "vsx_register_operand" "wd,") ++ (match_operand: 2 "vsx_register_operand" ",") ++ (match_operand:QI 3 "u5bit_cint_operand" "i,i")] ++ UNSPEC_VSX_SET))] + "VECTOR_MEM_VSX_P (mode)" + { + int idx_first = BYTES_BIG_ENDIAN ? 0 : 1; +@@ -1582,7 +1622,7 @@ + (define_insn_and_split "vsx_extract_v4sf" + [(set (match_operand:SF 0 "vsx_register_operand" "=f,f") + (vec_select:SF +- (match_operand:V4SF 1 "vsx_register_operand" "wa,wa") ++ (match_operand:V4SF 1 "vsx_register_operand" ",") + (parallel [(match_operand:QI 2 "u5bit_cint_operand" "O,i")]))) + (clobber (match_scratch:V4SF 3 "=X,0"))] + "VECTOR_UNIT_VSX_P (V4SFmode)" +@@ -1606,7 +1646,7 @@ + { + if (GET_CODE (op3) == SCRATCH) + op3 = gen_reg_rtx (V4SFmode); +- emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, op2)); ++ emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, GEN_INT (ele))); + tmp = op3; + } + emit_insn (gen_vsx_xscvspdp_scalar2 (op0, tmp)); +@@ -1765,9 +1805,9 @@ + + ;; V2DF/V2DI splat + (define_insn "vsx_splat_" +- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,wd,wd,?wa,?wa,?wa") ++ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,wd,wd,?,?,?") + (vec_duplicate:VSX_D +- (match_operand: 1 "splat_input_operand" "ws,f,Z,wa,wa,Z")))] ++ (match_operand: 1 "splat_input_operand" ",f,Z,,,Z")))] + "VECTOR_MEM_VSX_P (mode)" + "@ + xxpermdi %x0,%x1,%x1,0 +@@ -1780,10 +1820,10 @@ + + ;; V4SF/V4SI splat + (define_insn "vsx_xxspltw_" +- [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa") ++ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?") + (vec_duplicate:VSX_W + (vec_select: +- (match_operand:VSX_W 1 "vsx_register_operand" "wf,wa") ++ (match_operand:VSX_W 1 "vsx_register_operand" "wf,") + (parallel + [(match_operand:QI 2 "u5bit_cint_operand" "i,i")]))))] + "VECTOR_MEM_VSX_P (mode)" +@@ -1796,8 +1836,8 @@ + [(set_attr "type" "vecperm")]) + + (define_insn "vsx_xxspltw__direct" +- [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa") +- (unspec:VSX_W [(match_operand:VSX_W 1 "vsx_register_operand" "wf,wa") ++ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?") ++ (unspec:VSX_W [(match_operand:VSX_W 1 "vsx_register_operand" "wf,") + (match_operand:QI 2 "u5bit_cint_operand" "i,i")] + UNSPEC_VSX_XXSPLTW))] + "VECTOR_MEM_VSX_P (mode)" +@@ -1806,11 +1846,11 @@ + + ;; V4SF/V4SI interleave + (define_insn "vsx_xxmrghw_" +- [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa") ++ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?") + (vec_select:VSX_W + (vec_concat: +- (match_operand:VSX_W 1 "vsx_register_operand" "wf,wa") +- (match_operand:VSX_W 2 "vsx_register_operand" "wf,wa")) ++ (match_operand:VSX_W 1 "vsx_register_operand" "wf,") ++ (match_operand:VSX_W 2 "vsx_register_operand" "wf,")) + (parallel [(const_int 0) (const_int 4) + (const_int 1) (const_int 5)])))] + "VECTOR_MEM_VSX_P (mode)" +@@ -1823,11 +1863,11 @@ + [(set_attr "type" "vecperm")]) + + (define_insn "vsx_xxmrglw_" +- [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa") ++ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?") + (vec_select:VSX_W + (vec_concat: +- (match_operand:VSX_W 1 "vsx_register_operand" "wf,wa") +- (match_operand:VSX_W 2 "vsx_register_operand" "wf,?wa")) ++ (match_operand:VSX_W 1 "vsx_register_operand" "wf,") ++ (match_operand:VSX_W 2 "vsx_register_operand" "wf,?")) + (parallel [(const_int 2) (const_int 6) + (const_int 3) (const_int 7)])))] + "VECTOR_MEM_VSX_P (mode)" +@@ -1841,9 +1881,9 @@ + + ;; Shift left double by word immediate + (define_insn "vsx_xxsldwi_" +- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=wa") +- (unspec:VSX_L [(match_operand:VSX_L 1 "vsx_register_operand" "wa") +- (match_operand:VSX_L 2 "vsx_register_operand" "wa") ++ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=") ++ (unspec:VSX_L [(match_operand:VSX_L 1 "vsx_register_operand" "") ++ (match_operand:VSX_L 2 "vsx_register_operand" "") + (match_operand:QI 3 "u5bit_cint_operand" "i")] + UNSPEC_VSX_SLDWI))] + "VECTOR_MEM_VSX_P (mode)" +@@ -1924,7 +1964,7 @@ + ;; to the top element of the V2DF array without doing an extract. + + (define_insn_and_split "*vsx_reduc__v2df_scalar" +- [(set (match_operand:DF 0 "vfloat_operand" "=&ws,&?wa,ws,?wa") ++ [(set (match_operand:DF 0 "vfloat_operand" "=&ws,&?ws,ws,?ws") + (vec_select:DF + (VEC_reduc:V2DF + (vec_concat:V2DF +Index: gcc/config/rs6000/rs6000.h +=================================================================== +--- gcc/config/rs6000/rs6000.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/rs6000.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1438,6 +1438,10 @@ + RS6000_CONSTRAINT_wd, /* VSX register for V2DF */ + RS6000_CONSTRAINT_wf, /* VSX register for V4SF */ + RS6000_CONSTRAINT_wg, /* FPR register for -mmfpgpr */ ++ RS6000_CONSTRAINT_wh, /* FPR register for direct moves. */ ++ RS6000_CONSTRAINT_wi, /* FPR/VSX register to hold DImode */ ++ RS6000_CONSTRAINT_wj, /* FPR/VSX register for DImode direct moves. */ ++ RS6000_CONSTRAINT_wk, /* FPR/VSX register for DFmode direct moves. */ + RS6000_CONSTRAINT_wl, /* FPR register for LFIWAX */ + RS6000_CONSTRAINT_wm, /* VSX register for direct move */ + RS6000_CONSTRAINT_wr, /* GPR register if 64-bit */ +@@ -1462,6 +1466,9 @@ + #define VSX_REG_CLASS_P(CLASS) \ + ((CLASS) == VSX_REGS || (CLASS) == FLOAT_REGS || (CLASS) == ALTIVEC_REGS) + ++/* Return whether a given register class targets general purpose registers. */ ++#define GPR_REG_CLASS_P(CLASS) ((CLASS) == GENERAL_REGS || (CLASS) == BASE_REGS) ++ + /* Given an rtx X being reloaded into a reg required to be + in class CLASS, return the class of reg to actually use. + In general this is just CLASS; but on some machines +@@ -1593,8 +1600,15 @@ + /* Define this if stack space is still allocated for a parameter passed + in a register. The value is the number of bytes allocated to this + area. */ +-#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL)) ++#define REG_PARM_STACK_SPACE(FNDECL) \ ++ rs6000_reg_parm_stack_space ((FNDECL), false) + ++/* Define this macro if space guaranteed when compiling a function body ++ is different to space required when making a call, a situation that ++ can arise with K&R style function definitions. */ ++#define INCOMING_REG_PARM_STACK_SPACE(FNDECL) \ ++ rs6000_reg_parm_stack_space ((FNDECL), true) ++ + /* Define this if the above stack space is to be considered part of the + space allocated by the caller. */ + #define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1 +@@ -2483,8 +2497,8 @@ + #define RS6000_BTC_SAT RS6000_BTC_MISC /* saturate sets VSCR. */ + + /* Builtin targets. For now, we reuse the masks for those options that are in +- target flags, and pick two random bits for SPE and paired which aren't in +- target_flags. */ ++ target flags, and pick three random bits for SPE, paired and ldbl128 which ++ aren't in target_flags. */ + #define RS6000_BTM_ALWAYS 0 /* Always enabled. */ + #define RS6000_BTM_ALTIVEC MASK_ALTIVEC /* VMX/altivec vectors. */ + #define RS6000_BTM_VSX MASK_VSX /* VSX (vector/scalar). */ +@@ -2501,6 +2515,7 @@ + #define RS6000_BTM_CELL MASK_FPRND /* Target is cell powerpc. */ + #define RS6000_BTM_DFP MASK_DFP /* Decimal floating point. */ + #define RS6000_BTM_HARD_FLOAT MASK_SOFT_FLOAT /* Hardware floating point. */ ++#define RS6000_BTM_LDBL128 MASK_MULTIPLE /* 128-bit long double. */ + + #define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \ + | RS6000_BTM_VSX \ +@@ -2514,7 +2529,8 @@ + | RS6000_BTM_POPCNTD \ + | RS6000_BTM_CELL \ + | RS6000_BTM_DFP \ +- | RS6000_BTM_HARD_FLOAT) ++ | RS6000_BTM_HARD_FLOAT \ ++ | RS6000_BTM_LDBL128) + + /* Define builtin enum index. */ + +Index: gcc/config/rs6000/altivec.md +=================================================================== +--- gcc/config/rs6000/altivec.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/altivec.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2297,7 +2297,31 @@ + "dststt %0,%1,%2" + [(set_attr "type" "vecsimple")]) + +-(define_insn "altivec_lvsl" ++(define_expand "altivec_lvsl" ++ [(use (match_operand:V16QI 0 "register_operand" "")) ++ (use (match_operand:V16QI 1 "memory_operand" ""))] ++ "TARGET_ALTIVEC" ++{ ++ if (VECTOR_ELT_ORDER_BIG) ++ emit_insn (gen_altivec_lvsl_direct (operands[0], operands[1])); ++ else ++ { ++ int i; ++ rtx mask, perm[16], constv, vperm; ++ mask = gen_reg_rtx (V16QImode); ++ emit_insn (gen_altivec_lvsl_direct (mask, operands[1])); ++ for (i = 0; i < 16; ++i) ++ perm[i] = GEN_INT (i); ++ constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm)); ++ constv = force_reg (V16QImode, constv); ++ vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv), ++ UNSPEC_VPERM); ++ emit_insn (gen_rtx_SET (VOIDmode, operands[0], vperm)); ++ } ++ DONE; ++}) ++ ++(define_insn "altivec_lvsl_direct" + [(set (match_operand:V16QI 0 "register_operand" "=v") + (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")] + UNSPEC_LVSL))] +@@ -2305,7 +2329,31 @@ + "lvsl %0,%y1" + [(set_attr "type" "vecload")]) + +-(define_insn "altivec_lvsr" ++(define_expand "altivec_lvsr" ++ [(use (match_operand:V16QI 0 "register_operand" "")) ++ (use (match_operand:V16QI 1 "memory_operand" ""))] ++ "TARGET_ALTIVEC" ++{ ++ if (VECTOR_ELT_ORDER_BIG) ++ emit_insn (gen_altivec_lvsr_direct (operands[0], operands[1])); ++ else ++ { ++ int i; ++ rtx mask, perm[16], constv, vperm; ++ mask = gen_reg_rtx (V16QImode); ++ emit_insn (gen_altivec_lvsr_direct (mask, operands[1])); ++ for (i = 0; i < 16; ++i) ++ perm[i] = GEN_INT (i); ++ constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm)); ++ constv = force_reg (V16QImode, constv); ++ vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv), ++ UNSPEC_VPERM); ++ emit_insn (gen_rtx_SET (VOIDmode, operands[0], vperm)); ++ } ++ DONE; ++}) ++ ++(define_insn "altivec_lvsr_direct" + [(set (match_operand:V16QI 0 "register_operand" "=v") + (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")] + UNSPEC_LVSR))] +Index: gcc/config/rs6000/rs6000.md +=================================================================== +--- gcc/config/rs6000/rs6000.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/rs6000.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -134,6 +134,7 @@ + UNSPEC_UNPACK_128BIT + UNSPEC_PACK_128BIT + UNSPEC_LSQ ++ UNSPEC_FUSION_GPR + ]) + + ;; +@@ -317,8 +318,25 @@ + (define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")]) + + ; Definitions for 32-bit fpr direct move +-(define_mode_attr f32_dm [(SF "wn") (SD "wm")]) ++; At present, the decimal modes are not allowed in the traditional altivec ++; registers, so restrict the constraints to just the traditional FPRs. ++(define_mode_attr f32_dm [(SF "wn") (SD "wh")]) + ++; Definitions for 32-bit VSX ++(define_mode_attr f32_vsx [(SF "ww") (SD "wn")]) ++ ++; Definitions for 32-bit use of altivec registers ++(define_mode_attr f32_av [(SF "wu") (SD "wn")]) ++ ++; Definitions for 64-bit VSX ++(define_mode_attr f64_vsx [(DF "ws") (DD "wn")]) ++ ++; Definitions for 64-bit direct move ++(define_mode_attr f64_dm [(DF "wk") (DD "wh")]) ++ ++; Definitions for 64-bit use of altivec registers ++(define_mode_attr f64_av [(DF "wv") (DD "wn")]) ++ + ; These modes do not fit in integer registers in 32-bit mode. + ; but on e500v2, the gpr are 64 bit registers + (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD]) +@@ -424,7 +442,7 @@ + ;; either. + + ;; Mode attribute for boolean operation register constraints for output +-(define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v") ++(define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wt,v") + (PTI "&r,r,r") + (V16QI "wa,v,&?r,?r,?r") + (V8HI "wa,v,&?r,?r,?r") +@@ -435,7 +453,7 @@ + (V1TI "wa,v,&?r,?r,?r")]) + + ;; Mode attribute for boolean operation register constraints for operand1 +-(define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v") ++(define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wt,v") + (PTI "r,0,r") + (V16QI "wa,v,r,0,r") + (V8HI "wa,v,r,0,r") +@@ -446,7 +464,7 @@ + (V1TI "wa,v,r,0,r")]) + + ;; Mode attribute for boolean operation register constraints for operand2 +-(define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v") ++(define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wt,v") + (PTI "r,r,0") + (V16QI "wa,v,r,r,0") + (V8HI "wa,v,r,r,0") +@@ -459,7 +477,7 @@ + ;; Mode attribute for boolean operation register constraints for operand1 + ;; for one_cmpl. To simplify things, we repeat the constraint where 0 + ;; is used for operand1 or operand2 +-(define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v") ++(define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wt,v") + (PTI "r,0,0") + (V16QI "wa,v,r,0,0") + (V8HI "wa,v,r,0,0") +@@ -566,7 +584,7 @@ + "") + + (define_insn "*zero_extendsidi2_lfiwzx" +- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu") ++ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wj,!wz,!wu") + (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))] + "TARGET_POWERPC64 && TARGET_LFIWZX" + "@ +@@ -736,8 +754,8 @@ + "") + + (define_insn "*extendsidi2_lfiwax" +- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu") +- (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))] ++ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wj,!wl,!wu") ++ (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))] + "TARGET_POWERPC64 && TARGET_LFIWAX" + "@ + lwa%U1%X1 %0,%1 +@@ -760,7 +778,7 @@ + + (define_insn "*extendsidi2_nocell" + [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") +- (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))] ++ (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))] + "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX" + "@ + lwa%U1%X1 %0,%1 +@@ -5614,7 +5632,7 @@ + ; We don't define lfiwax/lfiwzx with the normal definition, because we + ; don't want to support putting SImode in FPR registers. + (define_insn "lfiwax" +- [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm") ++ [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wj,!wj") + (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")] + UNSPEC_LFIWAX))] + "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX" +@@ -5694,7 +5712,7 @@ + (set_attr "type" "fpload")]) + + (define_insn "lfiwzx" +- [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm") ++ [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wj,!wj") + (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")] + UNSPEC_LFIWZX))] + "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX" +@@ -9210,8 +9228,8 @@ + }") + + (define_insn "mov_hardfloat" +- [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,,,wu,Z,?,?r,*c*l,!r,*h,!r,!r") +- (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,,,Z,wu,r,,r,h,0,G,Fn"))] ++ [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,,,,,,Z,?,?r,*c*l,!r,*h,!r,!r") ++ (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,,j,,,Z,,r,,r, h, 0, G,Fn"))] + "(gpc_reg_operand (operands[0], mode) + || gpc_reg_operand (operands[1], mode)) + && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)" +@@ -9422,8 +9440,8 @@ + ;; reloading. + + (define_insn "*mov_hardfloat32" +- [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r") +- (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))] ++ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,,Z,,,Y,r,!r,!r,!r,!r") ++ (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,,,j,r,Y,r,G,H,F"))] + "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT + && (gpc_reg_operand (operands[0], mode) + || gpc_reg_operand (operands[1], mode))" +@@ -9491,8 +9509,8 @@ + ; ld/std require word-aligned displacements -> 'Y' constraint. + ; List Y->r and r->Y before r->r for reload. + (define_insn "*mov_hardfloat64" +- [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm") +- (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))] ++ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,,Z,,,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,") ++ (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,,,j,r,Y,r,r,h,0,G,H,F,wg,r,,r"))] + "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT + && (gpc_reg_operand (operands[0], mode) + || gpc_reg_operand (operands[1], mode))" +@@ -10272,8 +10290,8 @@ + { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }) + + (define_insn "*movdi_internal64" +- [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm") +- (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))] ++ [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wj,?*wi") ++ (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wj,r,O"))] + "TARGET_POWERPC64 + && (gpc_reg_operand (operands[0], DImode) + || gpc_reg_operand (operands[1], DImode))" +@@ -10293,7 +10311,8 @@ + mftgpr %0,%1 + mffgpr %0,%1 + mfvsrd %0,%x1 +- mtvsrd %x0,%1" ++ mtvsrd %x0,%1 ++ xxlxor %x0,%x0,%x0" + [(set_attr_alternative "type" + [(if_then_else + (match_test "update_indexed_address_mem (operands[0], VOIDmode)") +@@ -10334,8 +10353,9 @@ + (const_string "mftgpr") + (const_string "mffgpr") + (const_string "mftgpr") +- (const_string "mffgpr")]) +- (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")]) ++ (const_string "mffgpr") ++ (const_string "vecsimple")]) ++ (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4,4")]) + + ;; immediate value valid for a single instruction hiding in a const_double + (define_insn "" +@@ -15751,23 +15771,10 @@ + ;; a GPR. The addis instruction must be adjacent to the load, and use the same + ;; register that is being loaded. The fused ops must be physically adjacent. + +-;; We use define_peephole for the actual addis/load, and the register used to +-;; hold the addis value must be the same as the register being loaded. We use +-;; define_peephole2 to change the register used for addis to be the register +-;; being loaded, since we can look at whether it is dead after the load insn. ++;; Find cases where the addis that feeds into a load instruction is either used ++;; once or is the same as the target register, and replace it with the fusion ++;; insn + +-(define_peephole +- [(set (match_operand:P 0 "base_reg_operand" "") +- (match_operand:P 1 "fusion_gpr_addis" "")) +- (set (match_operand:INT1 2 "base_reg_operand" "") +- (match_operand:INT1 3 "fusion_gpr_mem_load" ""))] +- "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)" +-{ +- return emit_fusion_gpr_load (operands); +-} +- [(set_attr "type" "load") +- (set_attr "length" "8")]) +- + (define_peephole2 + [(set (match_operand:P 0 "base_reg_operand" "") + (match_operand:P 1 "fusion_gpr_addis" "")) +@@ -15774,9 +15781,8 @@ + (set (match_operand:INT1 2 "base_reg_operand" "") + (match_operand:INT1 3 "fusion_gpr_mem_load" ""))] + "TARGET_P8_FUSION +- && (REGNO (operands[0]) != REGNO (operands[2]) +- || GET_CODE (operands[3]) == SIGN_EXTEND) +- && fusion_gpr_load_p (operands, true)" ++ && fusion_gpr_load_p (operands[0], operands[1], operands[2], ++ operands[3])" + [(const_int 0)] + { + expand_fusion_gpr_load (operands); +@@ -15783,6 +15789,20 @@ + DONE; + }) + ++;; Fusion insn, created by the define_peephole2 above (and eventually by ++;; reload) ++ ++(define_insn "fusion_gpr_load_" ++ [(set (match_operand:INT1 0 "base_reg_operand" "=&b") ++ (unspec:INT1 [(match_operand:INT1 1 "fusion_gpr_mem_combo" "")] ++ UNSPEC_FUSION_GPR))] ++ "TARGET_P8_FUSION" ++{ ++ return emit_fusion_gpr_load (operands[0], operands[1]); ++} ++ [(set_attr "type" "load") ++ (set_attr "length" "8")]) ++ + + ;; Miscellaneous ISA 2.06 (power7) instructions + (define_insn "addg6s" +@@ -15847,26 +15867,6 @@ + "" + "") + +-;; The Advance Toolchain 7.0-3 added private builtins: __builtin_longdouble_dw0 +-;; and __builtin_longdouble_dw1 to optimize glibc. Add support for these +-;; builtins here. +- +-(define_expand "unpacktf_0" +- [(set (match_operand:DF 0 "nonimmediate_operand" "") +- (unspec:DF [(match_operand:TF 1 "register_operand" "") +- (const_int 0)] +- UNSPEC_UNPACK_128BIT))] +- "" +- "") +- +-(define_expand "unpacktf_1" +- [(set (match_operand:DF 0 "nonimmediate_operand" "") +- (unspec:DF [(match_operand:TF 1 "register_operand" "") +- (const_int 1)] +- UNSPEC_UNPACK_128BIT))] +- "" +- "") +- + (define_insn_and_split "unpack_dm" + [(set (match_operand: 0 "nonimmediate_operand" "=d,m,d,r,m") + (unspec: +Index: gcc/config/rs6000/sysv4.h +=================================================================== +--- gcc/config/rs6000/sysv4.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/rs6000/sysv4.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -292,7 +292,7 @@ + /* An expression for the alignment of a structure field FIELD if the + alignment computed in the usual way is COMPUTED. */ + #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ +- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ ++ (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ + ? 128 : COMPUTED) + + #undef BIGGEST_FIELD_ALIGNMENT +@@ -949,3 +949,27 @@ + #define TARGET_USES_SYSV4_OPT 1 + + #undef DBX_REGISTER_NUMBER ++ ++/* Link -lasan early on the command line. For -static-libasan, don't link ++ it for -shared link, the executable should be compiled with -static-libasan ++ in that case, and for executable link link with --{,no-}whole-archive around ++ it to force everything into the executable. And similarly for -ltsan. */ ++#if defined(HAVE_LD_STATIC_DYNAMIC) ++#undef LIBASAN_EARLY_SPEC ++#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ ++ "%{static-libasan:%{!shared:" \ ++ LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ ++ LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" ++#undef LIBTSAN_EARLY_SPEC ++#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ ++ LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ ++ LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" ++#endif ++ ++/* Additional libraries needed by -static-libasan. */ ++#undef STATIC_LIBASAN_LIBS ++#define STATIC_LIBASAN_LIBS "-ldl -lpthread" ++ ++/* Additional libraries needed by -static-libtsan. */ ++#undef STATIC_LIBTSAN_LIBS ++#define STATIC_LIBTSAN_LIBS "-ldl -lpthread" +Index: gcc/config/arm/arm.c +=================================================================== +--- gcc/config/arm/arm.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/arm/arm.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -82,7 +82,6 @@ + static reg_class_t arm_preferred_reload_class (rtx, reg_class_t); + static rtx thumb_legitimize_address (rtx, rtx, enum machine_mode); + inline static int thumb1_index_register_rtx_p (rtx, int); +-static bool arm_legitimate_address_p (enum machine_mode, rtx, bool); + static int thumb_far_jump_used_p (void); + static bool thumb_force_lr_save (void); + static unsigned arm_size_return_regs (void); +@@ -24476,9 +24475,13 @@ + fputs (":\n", file); + if (flag_pic) + { +- /* Output ".word .LTHUNKn-7-.LTHUNKPCn". */ ++ /* Output ".word .LTHUNKn-[3,7]-.LTHUNKPCn". */ + rtx tem = XEXP (DECL_RTL (function), 0); +- tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7)); ++ /* For TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC ++ pipeline offset is four rather than eight. Adjust the offset ++ accordingly. */ ++ tem = plus_constant (GET_MODE (tem), tem, ++ TARGET_THUMB1_ONLY ? -3 : -7); + tem = gen_rtx_MINUS (GET_MODE (tem), + tem, + gen_rtx_SYMBOL_REF (Pmode, +@@ -27462,4 +27465,13 @@ + + } + ++/* return TRUE if x is a reference to a value in a constant pool */ ++extern bool ++arm_is_constant_pool_ref (rtx x) ++{ ++ return (MEM_P (x) ++ && GET_CODE (XEXP (x, 0)) == SYMBOL_REF ++ && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))); ++} ++ + #include "gt-arm.h" +Index: gcc/config/arm/arm-protos.h +=================================================================== +--- gcc/config/arm/arm-protos.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/arm/arm-protos.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -55,6 +55,7 @@ + extern int legitimate_pic_operand_p (rtx); + extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx); + extern rtx legitimize_tls_address (rtx, rtx); ++extern bool arm_legitimate_address_p (enum machine_mode, rtx, bool); + extern int arm_legitimate_address_outer_p (enum machine_mode, rtx, RTX_CODE, int); + extern int thumb_legitimate_offset_p (enum machine_mode, HOST_WIDE_INT); + extern bool arm_legitimize_reload_address (rtx *, enum machine_mode, int, int, +@@ -286,4 +287,6 @@ + + extern void arm_emit_eabi_attribute (const char *, int, int); + ++extern bool arm_is_constant_pool_ref (rtx); ++ + #endif /* ! GCC_ARM_PROTOS_H */ +Index: gcc/config/arm/constraints.md +=================================================================== +--- gcc/config/arm/constraints.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/arm/constraints.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -36,7 +36,7 @@ + ;; in Thumb-2 state: Pj, PJ, Ps, Pt, Pu, Pv, Pw, Px, Py + + ;; The following memory constraints have been used: +-;; in ARM/Thumb-2 state: Q, Ut, Uv, Uy, Un, Um, Us ++;; in ARM/Thumb-2 state: Q, Uh, Ut, Uv, Uy, Un, Um, Us + ;; in ARM state: Uq + ;; in Thumb state: Uu, Uw + +@@ -310,6 +310,12 @@ + An address valid for loading/storing register exclusive" + (match_operand 0 "mem_noofs_operand")) + ++(define_memory_constraint "Uh" ++ "@internal ++ An address suitable for byte and half-word loads which does not point inside a constant pool" ++ (and (match_code "mem") ++ (match_test "arm_legitimate_address_p (GET_MODE (op), XEXP (op, 0), false) && !arm_is_constant_pool_ref (op)"))) ++ + (define_memory_constraint "Ut" + "@internal + In ARM/Thumb-2 state an address valid for loading/storing opaque structure +@@ -356,7 +362,8 @@ + (and (match_code "mem") + (match_test "TARGET_ARM + && arm_legitimate_address_outer_p (GET_MODE (op), XEXP (op, 0), +- SIGN_EXTEND, 0)"))) ++ SIGN_EXTEND, 0) ++ && !arm_is_constant_pool_ref (op)"))) + + (define_memory_constraint "Q" + "@internal +Index: gcc/config/arm/arm.md +=================================================================== +--- gcc/config/arm/arm.md (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/arm/arm.md (.../branches/gcc-4_8-branch) (revision 217117) +@@ -4047,7 +4047,7 @@ + (define_insn "unaligned_loadhis" + [(set (match_operand:SI 0 "s_register_operand" "=l,r") + (sign_extend:SI +- (unspec:HI [(match_operand:HI 1 "memory_operand" "Uw,m")] ++ (unspec:HI [(match_operand:HI 1 "memory_operand" "Uw,Uh")] + UNSPEC_UNALIGNED_LOAD)))] + "unaligned_access && TARGET_32BIT" + "ldr%(sh%)\t%0, %1\t@ unaligned" +@@ -4655,7 +4655,7 @@ + + (define_insn "*arm_zero_extendhisi2_v6" + [(set (match_operand:SI 0 "s_register_operand" "=r,r") +- (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] ++ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Uh")))] + "TARGET_ARM && arm_arch6" + "@ + uxth%?\\t%0, %1 +@@ -4748,7 +4748,7 @@ + + (define_insn "*arm_zero_extendqisi2_v6" + [(set (match_operand:SI 0 "s_register_operand" "=r,r") +- (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))] ++ (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,Uh")))] + "TARGET_ARM && arm_arch6" + "@ + uxtb%(%)\\t%0, %1 +@@ -4980,7 +4980,7 @@ + + (define_insn "*arm_extendhisi2" + [(set (match_operand:SI 0 "s_register_operand" "=r,r") +- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] ++ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Uh")))] + "TARGET_ARM && arm_arch4 && !arm_arch6" + "@ + # +@@ -4987,23 +4987,19 @@ + ldr%(sh%)\\t%0, %1" + [(set_attr "length" "8,4") + (set_attr "type" "alu_shift,load_byte") +- (set_attr "predicable" "yes") +- (set_attr "pool_range" "*,256") +- (set_attr "neg_pool_range" "*,244")] ++ (set_attr "predicable" "yes")] + ) + + ;; ??? Check Thumb-2 pool range + (define_insn "*arm_extendhisi2_v6" + [(set (match_operand:SI 0 "s_register_operand" "=r,r") +- (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))] ++ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Uh")))] + "TARGET_32BIT && arm_arch6" + "@ + sxth%?\\t%0, %1 + ldr%(sh%)\\t%0, %1" + [(set_attr "type" "simple_alu_shift,load_byte") +- (set_attr "predicable" "yes") +- (set_attr "pool_range" "*,256") +- (set_attr "neg_pool_range" "*,244")] ++ (set_attr "predicable" "yes")] + ) + + (define_insn "*arm_extendhisi2addsi" +@@ -5045,9 +5041,7 @@ + "TARGET_ARM && arm_arch4" + "ldr%(sb%)\\t%0, %1" + [(set_attr "type" "load_byte") +- (set_attr "predicable" "yes") +- (set_attr "pool_range" "256") +- (set_attr "neg_pool_range" "244")] ++ (set_attr "predicable" "yes")] + ) + + (define_expand "extendqisi2" +@@ -5087,9 +5081,7 @@ + ldr%(sb%)\\t%0, %1" + [(set_attr "length" "8,4") + (set_attr "type" "alu_shift,load_byte") +- (set_attr "predicable" "yes") +- (set_attr "pool_range" "*,256") +- (set_attr "neg_pool_range" "*,244")] ++ (set_attr "predicable" "yes")] + ) + + (define_insn "*arm_extendqisi_v6" +@@ -5101,9 +5093,7 @@ + sxtb%?\\t%0, %1 + ldr%(sb%)\\t%0, %1" + [(set_attr "type" "simple_alu_shift,load_byte") +- (set_attr "predicable" "yes") +- (set_attr "pool_range" "*,256") +- (set_attr "neg_pool_range" "*,244")] ++ (set_attr "predicable" "yes")] + ) + + (define_insn "*arm_extendqisi2addsi" +@@ -7630,12 +7620,13 @@ + + (define_insn "*arm_cmpdi_unsigned" + [(set (reg:CC_CZ CC_REGNUM) +- (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r") +- (match_operand:DI 1 "arm_di_operand" "rDi")))] ++ (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r,r") ++ (match_operand:DI 1 "arm_di_operand" "rDi,rDi")))] + "TARGET_32BIT" + "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1" + [(set_attr "conds" "set") +- (set_attr "length" "8")] ++ (set_attr "arch" "a,t2") ++ (set_attr "length" "8,10")] + ) + + (define_insn "*arm_cmpdi_zero" +Index: gcc/config/arm/t-rtems-eabi +=================================================================== +--- gcc/config/arm/t-rtems-eabi (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/arm/t-rtems-eabi (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,47 +1,167 @@ + # Custom RTEMS EABI multilibs + +-MULTILIB_OPTIONS = mthumb march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m mfpu=neon mfloat-abi=hard +-MULTILIB_DIRNAMES = thumb armv6-m armv7-a armv7-r armv7-m neon hard ++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 ++MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m neon vfpv3-d16 fpv4-sp-d16 hard + + # Enumeration of multilibs + + MULTILIB_EXCEPTIONS = ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon ++# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfloat-abi=hard ++# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mthumb ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m ++MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon ++MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16 ++MULTILIB_EXCEPTIONS += mbig-endian/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mbig-endian + MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon ++MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfloat-abi=hard + # MULTILIB_EXCEPTIONS += mthumb/march=armv6-m + # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfloat-abi=hard + # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a + MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon ++# MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfloat-abi=hard + # MULTILIB_EXCEPTIONS += mthumb/march=armv7-r + MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16 ++# MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfloat-abi=hard + # MULTILIB_EXCEPTIONS += mthumb/march=armv7-m + MULTILIB_EXCEPTIONS += mthumb/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += mthumb/mfpu=neon ++MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=hard + # MULTILIB_EXCEPTIONS += mthumb + MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon ++MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += march=armv6-m/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv6-m + MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon ++MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += march=armv7-a/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv7-a + MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon ++MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += march=armv7-r/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv7-r + MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon ++MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += march=armv7-m/mfloat-abi=hard + MULTILIB_EXCEPTIONS += march=armv7-m + MULTILIB_EXCEPTIONS += mfpu=neon/mfloat-abi=hard + MULTILIB_EXCEPTIONS += mfpu=neon ++MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16 ++MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16/mfloat-abi=hard ++MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16 + MULTILIB_EXCEPTIONS += mfloat-abi=hard +Index: gcc/config/pa/pa.c +=================================================================== +--- gcc/config/pa/pa.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/config/pa/pa.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3237,7 +3237,12 @@ + && aligned_p + && function_label_operand (x, VOIDmode)) + { +- fputs (size == 8? "\t.dword\tP%" : "\t.word\tP%", asm_out_file); ++ fputs (size == 8? "\t.dword\t" : "\t.word\t", asm_out_file); ++ ++ /* We don't want an OPD when generating fast indirect calls. */ ++ if (!TARGET_FAST_INDIRECT_CALLS) ++ fputs ("P%", asm_out_file); ++ + output_addr_const (asm_out_file, x); + fputc ('\n', asm_out_file); + return true; +@@ -4160,9 +4165,8 @@ + pa_output_function_epilogue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) + { + rtx insn = get_last_insn (); ++ bool extra_nop; + +- last_address = 0; +- + /* pa_expand_epilogue does the dirty work now. We just need + to output the assembler directives which denote the end + of a function. +@@ -4185,14 +4189,16 @@ + if (insn && GET_CODE (insn) == CALL_INSN) + { + fputs ("\tnop\n", file); +- last_address += 4; ++ extra_nop = true; + } ++ else ++ extra_nop = false; + + fputs ("\t.EXIT\n\t.PROCEND\n", file); + + if (TARGET_SOM && TARGET_GAS) + { +- /* We done with this subspace except possibly for some additional ++ /* We are done with this subspace except possibly for some additional + debug information. Forget that we are in this subspace to ensure + that the next function is output in its own subspace. */ + in_section = NULL; +@@ -4199,12 +4205,20 @@ + cfun->machine->in_nsubspa = 2; + } + ++ /* Thunks do their own insn accounting. */ ++ if (cfun->is_thunk) ++ return; ++ + if (INSN_ADDRESSES_SET_P ()) + { ++ last_address = extra_nop ? 4 : 0; + insn = get_last_nonnote_insn (); +- last_address += INSN_ADDRESSES (INSN_UID (insn)); +- if (INSN_P (insn)) +- last_address += insn_default_length (insn); ++ if (insn) ++ { ++ last_address += INSN_ADDRESSES (INSN_UID (insn)); ++ if (INSN_P (insn)) ++ last_address += insn_default_length (insn); ++ } + last_address = ((last_address + FUNCTION_BOUNDARY / BITS_PER_UNIT - 1) + & ~(FUNCTION_BOUNDARY / BITS_PER_UNIT - 1)); + } +@@ -8270,8 +8284,7 @@ + xoperands[1] = XEXP (DECL_RTL (thunk_fndecl), 0); + xoperands[2] = GEN_INT (delta); + +- ASM_OUTPUT_LABEL (file, XSTR (xoperands[1], 0)); +- fprintf (file, "\t.PROC\n\t.CALLINFO FRAME=0,NO_CALLS\n\t.ENTRY\n"); ++ final_start_function (emit_barrier (), file, 1); + + /* Output the thunk. We know that the function is in the same + translation unit (i.e., the same space) as the thunk, and that +@@ -8301,12 +8314,16 @@ + || ((DECL_SECTION_NAME (thunk_fndecl) + == DECL_SECTION_NAME (function)) + && last_address < 262132))) ++ /* In this case, we need to be able to reach the start of ++ the stub table even though the function is likely closer ++ and can be jumped to directly. */ + || (targetm_common.have_named_sections + && DECL_SECTION_NAME (thunk_fndecl) == NULL + && DECL_SECTION_NAME (function) == NULL +- && last_address < 262132) ++ && total_code_bytes < MAX_PCREL17F_OFFSET) ++ /* Likewise. */ + || (!targetm_common.have_named_sections +- && last_address < 262132)))) ++ && total_code_bytes < MAX_PCREL17F_OFFSET)))) + { + if (!val_14) + output_asm_insn ("addil L'%2,%%r26", xoperands); +@@ -8477,17 +8494,8 @@ + } + } + +- fprintf (file, "\t.EXIT\n\t.PROCEND\n"); ++ final_end_function (); + +- if (TARGET_SOM && TARGET_GAS) +- { +- /* We done with this subspace except possibly for some additional +- debug information. Forget that we are in this subspace to ensure +- that the next function is output in its own subspace. */ +- in_section = NULL; +- cfun->machine->in_nsubspa = 2; +- } +- + if (TARGET_SOM && flag_pic && TREE_PUBLIC (function)) + { + switch_to_section (data_section); +Index: gcc/tree-vect-slp.c +=================================================================== +--- gcc/tree-vect-slp.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/tree-vect-slp.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1837,7 +1837,10 @@ + && (stmt_vinfo = vinfo_for_stmt (use_stmt)) + && !STMT_SLP_TYPE (stmt_vinfo) + && (STMT_VINFO_RELEVANT (stmt_vinfo) +- || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo))) ++ || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo)) ++ || (STMT_VINFO_IN_PATTERN_P (stmt_vinfo) ++ && STMT_VINFO_RELATED_STMT (stmt_vinfo) ++ && !STMT_SLP_TYPE (vinfo_for_stmt (STMT_VINFO_RELATED_STMT (stmt_vinfo))))) + && !(gimple_code (use_stmt) == GIMPLE_PHI + && STMT_VINFO_DEF_TYPE (stmt_vinfo) + == vect_reduction_def)) +Index: gcc/regcprop.c +=================================================================== +--- gcc/regcprop.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ gcc/regcprop.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1039,7 +1039,17 @@ + but instead among CLOBBERs on the CALL_INSN, we could wrongly + assume the value in it is still live. */ + if (ksvd.ignore_set_reg) +- note_stores (PATTERN (insn), kill_clobbered_value, vd); ++ { ++ note_stores (PATTERN (insn), kill_clobbered_value, vd); ++ for (exp = CALL_INSN_FUNCTION_USAGE (insn); ++ exp; ++ exp = XEXP (exp, 1)) ++ { ++ rtx x = XEXP (exp, 0); ++ if (GET_CODE (x) == CLOBBER) ++ kill_value (SET_DEST (x), vd); ++ } ++ } + } + + /* Notice stores. */ +Index: libobjc/encoding.c +=================================================================== +--- libobjc/encoding.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libobjc/encoding.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -192,6 +192,8 @@ + ? MAX (MAX (COMPUTED, SPECIFIED), 64) \ + : MAX (COMPUTED, SPECIFIED));}) + ++#define rs6000_special_adjust_field_align_p(FIELD, COMPUTED) \ ++ (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) + + /* Skip a variable name, enclosed in quotes ("). */ + static inline +Index: libobjc/ChangeLog +=================================================================== +--- libobjc/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libobjc/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,16 @@ ++2014-07-27 Ulrich Weigand ++ ++ PR libobjc/61920 ++ * encoding.c (rs6000_special_adjust_field_align_p): Use definition ++ that matches the 4.8 branch ABI. ++ ++2014-07-27 Alan Modra ++ Matthias Klose ++ ++ PR libobjc/61920 ++ ++ * encoding.c: Define rs6000_special_adjust_field_align_p. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libgfortran/m4/in_pack.m4 +=================================================================== +--- libgfortran/m4/in_pack.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/in_pack.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -79,7 +79,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = ('rtype_name` *)xmalloc (ssize * sizeof ('rtype_name`)); ++ destptr = xmallocarray (ssize, sizeof ('rtype_name`)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/m4/pack.m4 +=================================================================== +--- libgfortran/m4/pack.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/pack.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -168,8 +168,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof ('rtype_name`) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof ('rtype_name`)); + + if (total == 0) + return; +Index: libgfortran/m4/spread.m4 +=================================================================== +--- libgfortran/m4/spread.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/spread.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -102,8 +102,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof('rtype_name`)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof('rtype_name`)); + if (rs <= 0) + return; + } +@@ -245,7 +245,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof ('rtype_name`)); ++ ret->base_addr = xmallocarray (ncopies, sizeof ('rtype_name`)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/m4/transpose.m4 +=================================================================== +--- libgfortran/m4/transpose.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/transpose.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -61,7 +61,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof ('rtype_name`)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/m4/iforeach.m4 +=================================================================== +--- libgfortran/m4/iforeach.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/iforeach.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -30,7 +30,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); + } + else + { +@@ -133,7 +133,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); + } + else + { +@@ -264,7 +264,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/m4/eoshift1.m4 +=================================================================== +--- libgfortran/m4/eoshift1.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/eoshift1.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -106,8 +106,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/m4/eoshift3.m4 +=================================================================== +--- libgfortran/m4/eoshift3.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/eoshift3.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -90,7 +90,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +@@ -108,8 +108,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/m4/shape.m4 +=================================================================== +--- libgfortran/m4/shape.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/shape.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -50,7 +50,7 @@ + { + GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); + ret->offset = 0; +- ret->base_addr = xmalloc (sizeof ('rtype_name`) * rank); ++ ret->base_addr = xmallocarray (rank, sizeof ('rtype_name`)); + } + + stride = GFC_DESCRIPTOR_STRIDE(ret,0); +Index: libgfortran/m4/cshift1.m4 +=================================================================== +--- libgfortran/m4/cshift1.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/cshift1.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -81,7 +81,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +Index: libgfortran/m4/matmull.m4 +=================================================================== +--- libgfortran/m4/matmull.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/matmull.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -89,7 +89,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/m4/bessel.m4 +=================================================================== +--- libgfortran/m4/bessel.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/bessel.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -56,7 +56,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof ('rtype_name`) * size); ++ ret->base_addr = xmallocarray (size, sizeof ('rtype_name`)); + ret->offset = 0; + } + +@@ -123,7 +123,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof ('rtype_name`) * size); ++ ret->base_addr = xmallocarray (size, sizeof ('rtype_name`)); + ret->offset = 0; + } + +@@ -163,7 +163,7 @@ + + x2rev = GFC_REAL_'rtype_kind`_LITERAL(2.)/x; + +- for (i = 2; i <= n1+n2; i++) ++ for (i = 2; i <= n2 - n1; i++) + { + #if defined('rtype_name`_INFINITY) + if (unlikely (last2 == -'rtype_name`_INFINITY)) +Index: libgfortran/m4/unpack.m4 +=================================================================== +--- libgfortran/m4/unpack.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/unpack.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -100,7 +100,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof ('rtype_name`)); ++ ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`)); + } + else + { +@@ -245,7 +245,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof ('rtype_name`)); ++ ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`)); + } + else + { +Index: libgfortran/m4/reshape.m4 +=================================================================== +--- libgfortran/m4/reshape.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/reshape.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -115,11 +115,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof ('rtype_name`); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof ('rtype_name`)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/m4/ifunction_logical.m4 +=================================================================== +--- libgfortran/m4/ifunction_logical.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/ifunction_logical.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -89,8 +89,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -99,7 +98,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); + } + else + { +Index: libgfortran/m4/ifunction.m4 +=================================================================== +--- libgfortran/m4/ifunction.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/ifunction.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -85,10 +85,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -260,8 +259,7 @@ + + } + +- alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -273,7 +271,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); + + } + else +@@ -417,8 +415,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -427,7 +424,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); + } + else + { +Index: libgfortran/m4/matmul.m4 +=================================================================== +--- libgfortran/m4/matmul.m4 (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/m4/matmul.m4 (.../branches/gcc-4_8-branch) (revision 217117) +@@ -125,7 +125,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/configure +=================================================================== +--- libgfortran/configure (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/configure (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2595,6 +2595,7 @@ + as_fn_append ac_func_list " getegid" + as_fn_append ac_func_list " secure_getenv" + as_fn_append ac_func_list " __secure_getenv" ++as_fn_append ac_func_list " strtok_r" + as_fn_append ac_header_list " math.h" + # Check that the precious variables saved in the cache have kept the same + # value. +@@ -12339,7 +12340,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 12342 "configure" ++#line 12343 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -12445,7 +12446,7 @@ + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +-#line 12448 "configure" ++#line 12449 "configure" + #include "confdefs.h" + + #if HAVE_DLFCN_H +@@ -16506,6 +16507,8 @@ + + + ++ ++ + + + +Index: libgfortran/runtime/in_pack_generic.c +=================================================================== +--- libgfortran/runtime/in_pack_generic.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/runtime/in_pack_generic.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -180,7 +180,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = xmalloc (ssize * size); ++ destptr = xmallocarray (ssize, size); + dest = (char *)destptr; + src = source->base_addr; + stride0 = stride[0] * size; +Index: libgfortran/runtime/memory.c +=================================================================== +--- libgfortran/runtime/memory.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/runtime/memory.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -25,8 +25,13 @@ + + #include "libgfortran.h" + #include ++#include + ++#ifndef SIZE_MAX ++#define SIZE_MAX ((size_t)-1) ++#endif + ++ + void * + xmalloc (size_t n) + { +@@ -44,12 +49,34 @@ + } + + ++void * ++xmallocarray (size_t nmemb, size_t size) ++{ ++ void *p; ++ ++ if (!nmemb || !size) ++ size = nmemb = 1; ++ else if (nmemb > SIZE_MAX / size) ++ { ++ errno = ENOMEM; ++ os_error ("Integer overflow in xmallocarray"); ++ } ++ ++ p = malloc (nmemb * size); ++ ++ if (!p) ++ os_error ("Memory allocation failed in xmallocarray"); ++ ++ return p; ++} ++ ++ + /* calloc wrapper that aborts on error. */ + + void * + xcalloc (size_t nmemb, size_t size) + { +- if (nmemb * size == 0) ++ if (!nmemb || !size) + nmemb = size = 1; + + void *p = calloc (nmemb, size); +Index: libgfortran/runtime/convert_char.c +=================================================================== +--- libgfortran/runtime/convert_char.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/runtime/convert_char.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -44,7 +44,7 @@ + gfc_charlen_type i, l; + + l = len > 0 ? len : 0; +- *dst = xmalloc ((l + 1) * sizeof (gfc_char4_t)); ++ *dst = xmallocarray ((l + 1), sizeof (gfc_char4_t)); + + for (i = 0; i < l; i++) + (*dst)[i] = src[i]; +@@ -60,7 +60,7 @@ + gfc_charlen_type i, l; + + l = len > 0 ? len : 0; +- *dst = xmalloc ((l + 1) * sizeof (unsigned char)); ++ *dst = xmalloc (l + 1); + + for (i = 0; i < l; i++) + (*dst)[i] = src[i]; +Index: libgfortran/runtime/environ.c +=================================================================== +--- libgfortran/runtime/environ.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/runtime/environ.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -833,7 +833,7 @@ + } + else + { +- elist = xmalloc (unit_count * sizeof (exception_t)); ++ elist = xmallocarray (unit_count, sizeof (exception_t)); + do_count = 0; + p = val; + do_parse (); +Index: libgfortran/runtime/main.c +=================================================================== +--- libgfortran/runtime/main.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/runtime/main.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -153,6 +153,16 @@ + } + + ++#ifndef HAVE_STRTOK_R ++static char* ++gfstrtok_r (char *str, const char *delim, ++ char **saveptr __attribute__ ((unused))) ++{ ++ return strtok (str, delim); ++} ++#define strtok_r gfstrtok_r ++#endif ++ + char *addr2line_path; + + /* Find addr2line and store the path. */ +@@ -161,30 +171,32 @@ + find_addr2line (void) + { + #ifdef HAVE_ACCESS +-#define A2L_LEN 10 ++#define A2L_LEN 11 + char *path = secure_getenv ("PATH"); + if (!path) + return; ++ char *tp = strdup (path); ++ if (!tp) ++ return; + size_t n = strlen (path); +- char ap[n + 1 + A2L_LEN]; +- size_t ai = 0; +- for (size_t i = 0; i < n; i++) ++ char *ap = xmalloc (n + A2L_LEN); ++ char *saveptr; ++ for (char *str = tp;; str = NULL) + { +- if (path[i] != ':') +- ap[ai++] = path[i]; +- else ++ char *token = strtok_r (str, ":", &saveptr); ++ if (!token) ++ break; ++ size_t toklen = strlen (token); ++ memcpy (ap, token, toklen); ++ memcpy (ap + toklen, "/addr2line", A2L_LEN); ++ if (access (ap, R_OK|X_OK) == 0) + { +- ap[ai++] = '/'; +- memcpy (ap + ai, "addr2line", A2L_LEN); +- if (access (ap, R_OK|X_OK) == 0) +- { +- addr2line_path = strdup (ap); +- return; +- } +- else +- ai = 0; ++ addr2line_path = strdup (ap); ++ break; + } + } ++ free (tp); ++ free (ap); + #endif + } + +Index: libgfortran/intrinsics/string_intrinsics_inc.c +=================================================================== +--- libgfortran/intrinsics/string_intrinsics_inc.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/string_intrinsics_inc.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -164,7 +164,7 @@ + else + { + /* Allocate space for result string. */ +- *dest = xmalloc (*len * sizeof (CHARTYPE)); ++ *dest = xmallocarray (*len, sizeof (CHARTYPE)); + + /* Copy string if necessary. */ + memcpy (*dest, src, *len * sizeof (CHARTYPE)); +@@ -442,7 +442,7 @@ + *dest = &zero_length_string; + else + { +- CHARTYPE *tmp = xmalloc (*rlen * sizeof (CHARTYPE)); ++ CHARTYPE *tmp = xmallocarray (*rlen, sizeof (CHARTYPE)); + memcpy (tmp, res, reslen * sizeof (CHARTYPE)); + MEMSET (&tmp[reslen], ' ', *rlen - reslen); + *dest = tmp; +Index: libgfortran/intrinsics/pack_generic.c +=================================================================== +--- libgfortran/intrinsics/pack_generic.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/pack_generic.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -152,8 +152,8 @@ + GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); + + ret->offset = 0; +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, size); + + if (total == 0) + return; /* In this case, nothing remains to be done. */ +@@ -519,7 +519,7 @@ + + ret->offset = 0; + +- ret->base_addr = xmalloc (size * total); ++ ret->base_addr = xmallocarray (total, size); + + if (total == 0) + return; +Index: libgfortran/intrinsics/transpose_generic.c +=================================================================== +--- libgfortran/intrinsics/transpose_generic.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/transpose_generic.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,7 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (size * size0 ((array_t*)ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t*)ret), size); + ret->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/intrinsics/cshift0.c +=================================================================== +--- libgfortran/intrinsics/cshift0.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/cshift0.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -79,8 +79,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + } + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/intrinsics/ctime.c +=================================================================== +--- libgfortran/intrinsics/ctime.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/ctime.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -31,31 +31,53 @@ + #include + + +-/* strftime-like function that fills a C string with %c format which +- is identical to ctime in the default locale. As ctime and ctime_r +- are poorly specified and their usage not recommended, the +- implementation instead uses strftime. */ ++/* Maximum space a ctime-like string might need. A "normal" ctime ++ string is 26 bytes, and in our case 24 bytes as we don't include ++ the trailing newline and null. However, the longest possible year ++ number is -2,147,481,748 (1900 - 2,147,483,648, since tm_year is a ++ 32-bit signed integer) so an extra 7 bytes are needed. */ ++#define CTIME_BUFSZ 31 + +-static size_t +-strctime (char *s, size_t max, const time_t *timep) ++ ++/* Thread-safe ctime-like function that fills a Fortran ++ string. ctime_r is a portability headache and marked as obsolescent ++ in POSIX 2008, which recommends strftime in its place. However, ++ strftime(..., "%c",...) doesn't produce ctime-like output on ++ MinGW, so do it manually with snprintf. */ ++ ++static int ++gf_ctime (char *s, size_t max, const time_t timev) + { + struct tm ltm; + int failed; ++ char buf[CTIME_BUFSZ + 1]; + /* Some targets provide a localtime_r based on a draft of the POSIX + standard where the return type is int rather than the + standardized struct tm*. */ +- __builtin_choose_expr (__builtin_classify_type (localtime_r (timep, <m)) ++ __builtin_choose_expr (__builtin_classify_type (localtime_r (&timev, <m)) + == 5, +- failed = localtime_r (timep, <m) == NULL, +- failed = localtime_r (timep, <m) != 0); ++ failed = localtime_r (&timev, <m) == NULL, ++ failed = localtime_r (&timev, <m) != 0); + if (failed) +- return 0; +- return strftime (s, max, "%c", <m); ++ goto blank; ++ int n = snprintf (buf, sizeof (buf), ++ "%3.3s %3.3s%3d %.2d:%.2d:%.2d %d", ++ "SunMonTueWedThuFriSat" + ltm.tm_wday * 3, ++ "JanFebMarAprMayJunJulAugSepOctNovDec" + ltm.tm_mon * 3, ++ ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, ++ 1900 + ltm.tm_year); ++ if (n < 0) ++ goto blank; ++ if ((size_t) n <= max) ++ { ++ cf_strcpy (s, max, buf); ++ return n; ++ } ++ blank: ++ memset (s, ' ', max); ++ return 0; + } + +-/* In the default locale, the date and time representation fits in 26 +- bytes. However, other locales might need more space. */ +-#define CSZ 100 + + extern void fdate (char **, gfc_charlen_type *); + export_proto(fdate); +@@ -64,8 +86,8 @@ + fdate (char ** date, gfc_charlen_type * date_len) + { + time_t now = time(NULL); +- *date = xmalloc (CSZ); +- *date_len = strctime (*date, CSZ, &now); ++ *date = xmalloc (CTIME_BUFSZ); ++ *date_len = gf_ctime (*date, CTIME_BUFSZ, now); + } + + +@@ -76,10 +98,7 @@ + fdate_sub (char * date, gfc_charlen_type date_len) + { + time_t now = time(NULL); +- char *s = xmalloc (date_len + 1); +- size_t n = strctime (s, date_len + 1, &now); +- fstrcpy (date, date_len, s, n); +- free (s); ++ gf_ctime (date, date_len, now); + } + + +@@ -91,8 +110,8 @@ + PREFIX(ctime) (char ** date, gfc_charlen_type * date_len, GFC_INTEGER_8 t) + { + time_t now = t; +- *date = xmalloc (CSZ); +- *date_len = strctime (*date, CSZ, &now); ++ *date = xmalloc (CTIME_BUFSZ); ++ *date_len = gf_ctime (*date, CTIME_BUFSZ, now); + } + + +@@ -103,8 +122,5 @@ + ctime_sub (GFC_INTEGER_8 * t, char * date, gfc_charlen_type date_len) + { + time_t now = *t; +- char *s = xmalloc (date_len + 1); +- size_t n = strctime (s, date_len + 1, &now); +- fstrcpy (date, date_len, s, n); +- free (s); ++ gf_ctime (date, date_len, now); + } +Index: libgfortran/intrinsics/spread_generic.c +=================================================================== +--- libgfortran/intrinsics/spread_generic.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/spread_generic.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -100,7 +100,7 @@ + GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * size); ++ ret->base_addr = xmallocarray (rs, size); + + if (rs <= 0) + return; +@@ -245,7 +245,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * size); ++ ret->base_addr = xmallocarray (ncopies, size); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/intrinsics/unpack_generic.c +=================================================================== +--- libgfortran/intrinsics/unpack_generic.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/unpack_generic.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -125,7 +125,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * size); ++ ret->base_addr = xmallocarray (rs, size); + } + else + { +Index: libgfortran/intrinsics/eoshift0.c +=================================================================== +--- libgfortran/intrinsics/eoshift0.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/eoshift0.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -86,8 +86,8 @@ + + } + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/intrinsics/eoshift2.c +=================================================================== +--- libgfortran/intrinsics/eoshift2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/eoshift2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -78,8 +78,8 @@ + ret->offset = 0; + ret->dtype = array->dtype; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) + { +Index: libgfortran/intrinsics/reshape_generic.c +=================================================================== +--- libgfortran/intrinsics/reshape_generic.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/intrinsics/reshape_generic.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,11 +99,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; /* xmalloc will allocate 1 byte. */ + else +- alloc_size = rs * size; ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, size); + + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } +Index: libgfortran/configure.ac +=================================================================== +--- libgfortran/configure.ac (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/configure.ac (.../branches/gcc-4_8-branch) (revision 217117) +@@ -267,7 +267,7 @@ + strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \ + getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \ + readlink getgid getpid getppid getuid geteuid umask getegid \ +-secure_getenv __secure_getenv) ++secure_getenv __secure_getenv strtok_r) + + # Check strerror_r, cannot be above as versions with two and three arguments exist + LIBGFOR_CHECK_STRERROR_R +Index: libgfortran/ChangeLog +=================================================================== +--- libgfortran/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,94 @@ ++2014-10-20 Janne Blomqvist ++ ++ PR libfortran/63589 ++ * configure.ac: Check for strtok_r. ++ * runtime/main.c (gfstrtok_r): Fallback implementation of ++ strtok_r. ++ (find_addr2line): Use strtok_r to split PATH. ++ * config.h.in: Regenerated. ++ * configure: Regenerated. ++ ++2014-08-20 Steven G. Kargl ++ ++ PR libgfortran/62188 ++ * m4/bessel.m4: Avoid indexing off the end of an array. ++ * generated/bessel_r10.c: Regenerated. ++ * generated/bessel_r16.c: Ditto. ++ * generated/bessel_r4.c: Ditto. ++ * generated/bessel_r8.c: Ditto. ++ ++2014-07-31 Janne Blomqvist ++ ++ Backport from mainline ++ CVE-2014-5044 ++ * libgfortran.h (xmallocarray): New prototype. ++ * runtime/memory.c (xmallocarray): New function. ++ (xcalloc): Check for nonzero separately instead of multiplying. ++ * generated/*.c: Regenerated. ++ * intrinsics/cshift0.c (cshift0): Call xmallocarray instead of ++ xmalloc. ++ * intrinsics/eoshift0.c (eoshift0): Likewise. ++ * intrinsics/eoshift2.c (eoshift2): Likewise. ++ * intrinsics/pack_generic.c (pack_internal): Likewise. ++ (pack_s_internal): Likewise. ++ * intrinsics/reshape_generic.c (reshape_internal): Likewise. ++ * intrinsics/spread_generic.c (spread_internal): Likewise. ++ (spread_internal_scalar): Likewise. ++ * intrinsics/string_intrinsics_inc.c (string_trim): Likewise. ++ (string_minmax): Likewise. ++ * intrinsics/transpose_generic.c (transpose_internal): Likewise. ++ * intrinsics/unpack_generic.c (unpack_internal): Likewise. ++ * io/list_read.c (nml_touch_nodes): Don't cast xmalloc return value. ++ * io/transfer.c (st_set_nml_var): Call xmallocarray instead of ++ xmalloc. ++ * io/unit.c (get_internal_unit): Likewise. ++ (filename_from_unit): Don't cast xmalloc return value. ++ * io/write.c (nml_write_obj): Likewise, formatting. ++ * m4/bessel.m4 (bessel_jn_r'rtype_kind`): Call xmallocarray ++ instead of xmalloc. ++ (besse_yn_r'rtype_kind`): Likewise. ++ * m4/cshift1.m4 (cshift1): Likewise. ++ * m4/eoshift1.m4 (eoshift1): Likewise. ++ * m4/eoshift3.m4 (eoshift3): Likewise. ++ * m4/iforeach.m4: Likewise. ++ * m4/ifunction.m4: Likewise. ++ * m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code): ++ Likewise. ++ * m4/in_pack.m4 (internal_pack_'rtype_ccode`): Likewise. ++ * m4/matmul.m4 (matmul_'rtype_code`): Likewise. ++ * m4/matmull.m4 (matmul_'rtype_code`): Likewise. ++ * m4/pack.m4 (pack_'rtype_code`): Likewise. ++ * m4/reshape.m4 (reshape_'rtype_ccode`): Likewise. ++ * m4/shape.m4 (shape_'rtype_kind`): Likewise. ++ * m4/spread.m4 (spread_'rtype_code`): Likewise. ++ (spread_scalar_'rtype_code`): Likewise. ++ * m4/transpose.m4 (transpose_'rtype_code`): Likewise. ++ * m4/unpack.m4 (unpack0_'rtype_code`): Likewise. ++ (unpack1_'rtype_code`): Likewise. ++ * runtime/convert_char.c (convert_char1_to_char4): Likewise. ++ (convert_char4_to_char1): Simplify. ++ * runtime/environ.c (init_unformatted): Call xmallocarray instead ++ of xmalloc. ++ * runtime/in_pack_generic.c (internal_pack): Likewise. ++ ++2014-05-26 Janne Blomqvist ++ ++ Backport from mainline ++ PR libfortran/61310 ++ * intrinsics/ctime.c (strctime): Rename to gf_ctime, use snprintf ++ instead of strftime. ++ (fdate): Use gf_ctime. ++ (fdate_sub): Likewise. ++ (ctime): Likewise. ++ (ctime_sub): Likewise. ++ ++2014-05-25 Janne Blomqvist ++ ++ Backport from trunk. ++ PR libfortran/61187 ++ * io/unix.c (raw_close): Check if s->fd is -1. ++ (fd_to_stream): Check return value of fstat(), handle error. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libgfortran/generated/spread_r10.c +=================================================================== +--- libgfortran/generated/spread_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_10)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_10)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_10)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_10)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/maxloc1_4_r8.c +=================================================================== +--- libgfortran/generated/maxloc1_4_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/norm2_r4.c +=================================================================== +--- libgfortran/generated/norm2_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/norm2_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,10 +101,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/parity_l2.c +=================================================================== +--- libgfortran/generated/parity_l2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/parity_l2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/eoshift3_4.c +=================================================================== +--- libgfortran/generated/eoshift3_4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/eoshift3_4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -89,7 +89,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +@@ -107,8 +107,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/transpose_c8.c +=================================================================== +--- libgfortran/generated/transpose_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_COMPLEX_8)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/eoshift1_8.c +=================================================================== +--- libgfortran/generated/eoshift1_8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/eoshift1_8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -105,8 +105,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/reshape_r16.c +=================================================================== +--- libgfortran/generated/reshape_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_REAL_16); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/bessel_r4.c +=================================================================== +--- libgfortran/generated/bessel_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/bessel_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -55,7 +55,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4)); + ret->offset = 0; + } + +@@ -122,7 +122,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4)); + ret->offset = 0; + } + +@@ -162,7 +162,7 @@ + + x2rev = GFC_REAL_4_LITERAL(2.)/x; + +- for (i = 2; i <= n1+n2; i++) ++ for (i = 2; i <= n2 - n1; i++) + { + #if defined(GFC_REAL_4_INFINITY) + if (unlikely (last2 == -GFC_REAL_4_INFINITY)) +Index: libgfortran/generated/any_l2.c +=================================================================== +--- libgfortran/generated/any_l2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/any_l2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); + } + else + { +Index: libgfortran/generated/product_r4.c +=================================================================== +--- libgfortran/generated/product_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + } + else + { +Index: libgfortran/generated/iany_i1.c +=================================================================== +--- libgfortran/generated/iany_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iany_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/parity_l16.c +=================================================================== +--- libgfortran/generated/parity_l16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/parity_l16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/in_pack_r4.c +=================================================================== +--- libgfortran/generated/in_pack_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_REAL_4 *)xmalloc (ssize * sizeof (GFC_REAL_4)); ++ destptr = xmallocarray (ssize, sizeof (GFC_REAL_4)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/product_i2.c +=================================================================== +--- libgfortran/generated/product_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/iparity_i4.c +=================================================================== +--- libgfortran/generated/iparity_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iparity_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc0_4_i1.c +=================================================================== +--- libgfortran/generated/minloc0_4_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/reshape_c4.c +=================================================================== +--- libgfortran/generated/reshape_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_COMPLEX_4); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/maxloc0_4_r16.c +=================================================================== +--- libgfortran/generated/maxloc0_4_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/iall_i8.c +=================================================================== +--- libgfortran/generated/iall_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iall_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/maxloc1_8_r16.c +=================================================================== +--- libgfortran/generated/maxloc1_8_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/sum_r16.c +=================================================================== +--- libgfortran/generated/sum_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + } + else + { +Index: libgfortran/generated/sum_i1.c +=================================================================== +--- libgfortran/generated/sum_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/in_pack_i2.c +=================================================================== +--- libgfortran/generated/in_pack_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_INTEGER_2 *)xmalloc (ssize * sizeof (GFC_INTEGER_2)); ++ destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_2)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/transpose_r10.c +=================================================================== +--- libgfortran/generated/transpose_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_REAL_10)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc1_16_r16.c +=================================================================== +--- libgfortran/generated/maxloc1_16_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/maxloc1_16_i4.c +=================================================================== +--- libgfortran/generated/maxloc1_16_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/spread_i1.c +=================================================================== +--- libgfortran/generated/spread_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_1)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_1)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_1)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_1)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/maxloc0_16_i8.c +=================================================================== +--- libgfortran/generated/maxloc0_16_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxval_r16.c +=================================================================== +--- libgfortran/generated/maxval_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + } + else + { +Index: libgfortran/generated/product_c10.c +=================================================================== +--- libgfortran/generated/product_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); + } + else + { +Index: libgfortran/generated/minloc1_8_i4.c +=================================================================== +--- libgfortran/generated/minloc1_8_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc0_16_i16.c +=================================================================== +--- libgfortran/generated/minloc0_16_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/matmul_r16.c +=================================================================== +--- libgfortran/generated/matmul_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_16)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minloc0_4_r4.c +=================================================================== +--- libgfortran/generated/minloc0_4_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/iany_i2.c +=================================================================== +--- libgfortran/generated/iany_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iany_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/sum_r4.c +=================================================================== +--- libgfortran/generated/sum_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + } + else + { +Index: libgfortran/generated/unpack_c8.c +=================================================================== +--- libgfortran/generated/unpack_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8)); + } + else + { +Index: libgfortran/generated/in_pack_c16.c +=================================================================== +--- libgfortran/generated/in_pack_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_COMPLEX_16 *)xmalloc (ssize * sizeof (GFC_COMPLEX_16)); ++ destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_16)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/minloc0_4_i2.c +=================================================================== +--- libgfortran/generated/minloc0_4_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/spread_c10.c +=================================================================== +--- libgfortran/generated/spread_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_10)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_10)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_10)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_10)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/maxloc0_8_i1.c +=================================================================== +--- libgfortran/generated/maxloc0_8_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/spread_r4.c +=================================================================== +--- libgfortran/generated/spread_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_4)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_4)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_4)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_4)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/minloc0_8_i8.c +=================================================================== +--- libgfortran/generated/minloc0_8_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/matmul_c8.c +=================================================================== +--- libgfortran/generated/matmul_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_8)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minloc1_16_r10.c +=================================================================== +--- libgfortran/generated/minloc1_16_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/sum_i2.c +=================================================================== +--- libgfortran/generated/sum_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/iparity_i16.c +=================================================================== +--- libgfortran/generated/iparity_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iparity_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/minloc0_16_i1.c +=================================================================== +--- libgfortran/generated/minloc0_16_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/reshape_c16.c +=================================================================== +--- libgfortran/generated/reshape_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_COMPLEX_16); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/pack_c4.c +=================================================================== +--- libgfortran/generated/pack_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_4)); + + if (total == 0) + return; +Index: libgfortran/generated/parity_l4.c +=================================================================== +--- libgfortran/generated/parity_l4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/parity_l4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/spread_i2.c +=================================================================== +--- libgfortran/generated/spread_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_2)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_2)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_2)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_2)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/any_l4.c +=================================================================== +--- libgfortran/generated/any_l4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/any_l4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); + } + else + { +Index: libgfortran/generated/maxloc1_4_i8.c +=================================================================== +--- libgfortran/generated/maxloc1_4_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxloc0_8_r4.c +=================================================================== +--- libgfortran/generated/maxloc0_8_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc1_4_i16.c +=================================================================== +--- libgfortran/generated/maxloc1_4_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc0_4_r10.c +=================================================================== +--- libgfortran/generated/minloc0_4_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc0_8_i16.c +=================================================================== +--- libgfortran/generated/minloc0_8_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc1_8_r10.c +=================================================================== +--- libgfortran/generated/minloc1_8_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc0_16_r4.c +=================================================================== +--- libgfortran/generated/minloc0_16_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/product_i4.c +=================================================================== +--- libgfortran/generated/product_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/sum_c16.c +=================================================================== +--- libgfortran/generated/sum_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); + } + else + { +Index: libgfortran/generated/transpose_c10.c +=================================================================== +--- libgfortran/generated/transpose_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_COMPLEX_10)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc1_16_r8.c +=================================================================== +--- libgfortran/generated/maxloc1_16_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/transpose_r4.c +=================================================================== +--- libgfortran/generated/transpose_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_REAL_4)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/cshift1_4.c +=================================================================== +--- libgfortran/generated/cshift1_4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/cshift1_4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -80,7 +80,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +Index: libgfortran/generated/maxloc0_8_i2.c +=================================================================== +--- libgfortran/generated/maxloc0_8_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/count_8_l.c +=================================================================== +--- libgfortran/generated/count_8_l.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/count_8_l.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/in_pack_i4.c +=================================================================== +--- libgfortran/generated/in_pack_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_INTEGER_4 *)xmalloc (ssize * sizeof (GFC_INTEGER_4)); ++ destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_4)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/minloc0_16_i2.c +=================================================================== +--- libgfortran/generated/minloc0_16_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc1_8_r8.c +=================================================================== +--- libgfortran/generated/minloc1_8_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/matmul_c16.c +=================================================================== +--- libgfortran/generated/matmul_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_16)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minval_i1.c +=================================================================== +--- libgfortran/generated/minval_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/shape_i16.c +=================================================================== +--- libgfortran/generated/shape_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/shape_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -49,7 +49,7 @@ + { + GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); + ret->offset = 0; +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + + stride = GFC_DESCRIPTOR_STRIDE(ret,0); +Index: libgfortran/generated/iany_i4.c +=================================================================== +--- libgfortran/generated/iany_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iany_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc0_16_r16.c +=================================================================== +--- libgfortran/generated/minloc0_16_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/product_i16.c +=================================================================== +--- libgfortran/generated/product_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/unpack_i1.c +=================================================================== +--- libgfortran/generated/unpack_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/minloc0_4_i4.c +=================================================================== +--- libgfortran/generated/minloc0_4_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/matmul_i1.c +=================================================================== +--- libgfortran/generated/matmul_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_INTEGER_1) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_1)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minval_r4.c +=================================================================== +--- libgfortran/generated/minval_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + } + else + { +Index: libgfortran/generated/spread_i16.c +=================================================================== +--- libgfortran/generated/spread_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_16)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_16)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_16)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_16)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/sum_i4.c +=================================================================== +--- libgfortran/generated/sum_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/unpack_r10.c +=================================================================== +--- libgfortran/generated/unpack_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10)); + } + else + { +Index: libgfortran/generated/bessel_r16.c +=================================================================== +--- libgfortran/generated/bessel_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/bessel_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -59,7 +59,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16)); + ret->offset = 0; + } + +@@ -126,7 +126,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16)); + ret->offset = 0; + } + +@@ -166,7 +166,7 @@ + + x2rev = GFC_REAL_16_LITERAL(2.)/x; + +- for (i = 2; i <= n1+n2; i++) ++ for (i = 2; i <= n2 - n1; i++) + { + #if defined(GFC_REAL_16_INFINITY) + if (unlikely (last2 == -GFC_REAL_16_INFINITY)) +Index: libgfortran/generated/norm2_r8.c +=================================================================== +--- libgfortran/generated/norm2_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/norm2_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,10 +101,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/spread_i4.c +=================================================================== +--- libgfortran/generated/spread_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_4)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_4)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_4)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_4)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/eoshift3_8.c +=================================================================== +--- libgfortran/generated/eoshift3_8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/eoshift3_8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -89,7 +89,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +@@ -107,8 +107,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minloc1_4_i1.c +=================================================================== +--- libgfortran/generated/minloc1_4_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minval_i2.c +=================================================================== +--- libgfortran/generated/minval_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/bessel_r8.c +=================================================================== +--- libgfortran/generated/bessel_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/bessel_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -55,7 +55,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8)); + ret->offset = 0; + } + +@@ -122,7 +122,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8)); + ret->offset = 0; + } + +@@ -162,7 +162,7 @@ + + x2rev = GFC_REAL_8_LITERAL(2.)/x; + +- for (i = 2; i <= n1+n2; i++) ++ for (i = 2; i <= n2 - n1; i++) + { + #if defined(GFC_REAL_8_INFINITY) + if (unlikely (last2 == -GFC_REAL_8_INFINITY)) +Index: libgfortran/generated/unpack_r4.c +=================================================================== +--- libgfortran/generated/unpack_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4)); + } + else + { +Index: libgfortran/generated/product_r8.c +=================================================================== +--- libgfortran/generated/product_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + } + else + { +Index: libgfortran/generated/matmul_r4.c +=================================================================== +--- libgfortran/generated/matmul_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_4)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/unpack_i2.c +=================================================================== +--- libgfortran/generated/unpack_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/in_pack_r8.c +=================================================================== +--- libgfortran/generated/in_pack_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_REAL_8 *)xmalloc (ssize * sizeof (GFC_REAL_8)); ++ destptr = xmallocarray (ssize, sizeof (GFC_REAL_8)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/maxloc1_4_r16.c +=================================================================== +--- libgfortran/generated/maxloc1_4_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc0_8_r16.c +=================================================================== +--- libgfortran/generated/minloc0_8_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/reshape_c8.c +=================================================================== +--- libgfortran/generated/reshape_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_COMPLEX_8); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/iparity_i8.c +=================================================================== +--- libgfortran/generated/iparity_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iparity_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/count_1_l.c +=================================================================== +--- libgfortran/generated/count_1_l.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/count_1_l.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/maxloc0_8_i4.c +=================================================================== +--- libgfortran/generated/maxloc0_8_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/matmul_i2.c +=================================================================== +--- libgfortran/generated/matmul_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_INTEGER_2) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_2)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minloc1_4_r4.c +=================================================================== +--- libgfortran/generated/minloc1_4_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/transpose_i16.c +=================================================================== +--- libgfortran/generated/transpose_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_INTEGER_16)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc0_16_i4.c +=================================================================== +--- libgfortran/generated/minloc0_16_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/transpose_i4.c +=================================================================== +--- libgfortran/generated/transpose_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_INTEGER_4)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc1_16_i8.c +=================================================================== +--- libgfortran/generated/maxloc1_16_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/minloc1_4_i2.c +=================================================================== +--- libgfortran/generated/minloc1_4_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/matmul_l16.c +=================================================================== +--- libgfortran/generated/matmul_l16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_l16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -88,7 +88,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_LOGICAL_16) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_16)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/maxloc1_8_i1.c +=================================================================== +--- libgfortran/generated/maxloc1_8_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc1_8_i8.c +=================================================================== +--- libgfortran/generated/minloc1_8_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc0_4_r8.c +=================================================================== +--- libgfortran/generated/minloc0_4_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/product_r16.c +=================================================================== +--- libgfortran/generated/product_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + } + else + { +Index: libgfortran/generated/sum_r8.c +=================================================================== +--- libgfortran/generated/sum_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + } + else + { +Index: libgfortran/generated/norm2_r10.c +=================================================================== +--- libgfortran/generated/norm2_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/norm2_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,10 +101,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/unpack_c10.c +=================================================================== +--- libgfortran/generated/unpack_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10)); + } + else + { +Index: libgfortran/generated/spread_r8.c +=================================================================== +--- libgfortran/generated/spread_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_8)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_8)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_8)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_8)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/minloc1_16_i16.c +=================================================================== +--- libgfortran/generated/minloc1_16_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/maxloc1_8_r4.c +=================================================================== +--- libgfortran/generated/maxloc1_8_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc1_16_i1.c +=================================================================== +--- libgfortran/generated/minloc1_16_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/spread_r16.c +=================================================================== +--- libgfortran/generated/spread_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_16)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_16)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_16)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_16)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/pack_c8.c +=================================================================== +--- libgfortran/generated/pack_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_8)); + + if (total == 0) + return; +Index: libgfortran/generated/minval_r10.c +=================================================================== +--- libgfortran/generated/minval_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + } + else + { +Index: libgfortran/generated/parity_l8.c +=================================================================== +--- libgfortran/generated/parity_l8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/parity_l8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/minval_i4.c +=================================================================== +--- libgfortran/generated/minval_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxloc1_8_i2.c +=================================================================== +--- libgfortran/generated/maxloc1_8_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/any_l8.c +=================================================================== +--- libgfortran/generated/any_l8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/any_l8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); + } + else + { +Index: libgfortran/generated/maxloc0_16_r10.c +=================================================================== +--- libgfortran/generated/maxloc0_16_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc0_4_i16.c +=================================================================== +--- libgfortran/generated/minloc0_4_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc0_8_r8.c +=================================================================== +--- libgfortran/generated/maxloc0_8_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc1_4_r10.c +=================================================================== +--- libgfortran/generated/minloc1_4_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc1_8_i16.c +=================================================================== +--- libgfortran/generated/minloc1_8_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/maxloc0_8_r10.c +=================================================================== +--- libgfortran/generated/maxloc0_8_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/unpack_i4.c +=================================================================== +--- libgfortran/generated/unpack_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc1_16_r4.c +=================================================================== +--- libgfortran/generated/minloc1_16_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/product_i8.c +=================================================================== +--- libgfortran/generated/product_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc0_16_r8.c +=================================================================== +--- libgfortran/generated/minloc0_16_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/count_2_l.c +=================================================================== +--- libgfortran/generated/count_2_l.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/count_2_l.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/transpose_r8.c +=================================================================== +--- libgfortran/generated/transpose_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_REAL_8)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/cshift1_8.c +=================================================================== +--- libgfortran/generated/cshift1_8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/cshift1_8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -80,7 +80,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +Index: libgfortran/generated/matmul_i4.c +=================================================================== +--- libgfortran/generated/matmul_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_4)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/pack_r10.c +=================================================================== +--- libgfortran/generated/pack_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_10)); + + if (total == 0) + return; +Index: libgfortran/generated/minloc1_16_i2.c +=================================================================== +--- libgfortran/generated/minloc1_16_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/in_pack_i8.c +=================================================================== +--- libgfortran/generated/in_pack_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_INTEGER_8 *)xmalloc (ssize * sizeof (GFC_INTEGER_8)); ++ destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_8)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/transpose_r16.c +=================================================================== +--- libgfortran/generated/transpose_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_REAL_16)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc1_4_i4.c +=================================================================== +--- libgfortran/generated/minloc1_4_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxval_i1.c +=================================================================== +--- libgfortran/generated/maxval_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/product_c16.c +=================================================================== +--- libgfortran/generated/product_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); + } + else + { +Index: libgfortran/generated/reshape_r4.c +=================================================================== +--- libgfortran/generated/reshape_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_REAL_4); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/iany_i8.c +=================================================================== +--- libgfortran/generated/iany_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iany_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/cshift1_16.c +=================================================================== +--- libgfortran/generated/cshift1_16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/cshift1_16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -80,7 +80,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +Index: libgfortran/generated/maxloc0_4_i1.c +=================================================================== +--- libgfortran/generated/maxloc0_4_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc0_4_i8.c +=================================================================== +--- libgfortran/generated/minloc0_4_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/spread_c16.c +=================================================================== +--- libgfortran/generated/spread_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_16)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_16)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_16)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_16)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/maxval_r4.c +=================================================================== +--- libgfortran/generated/maxval_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); + } + else + { +Index: libgfortran/generated/minval_r8.c +=================================================================== +--- libgfortran/generated/minval_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + } + else + { +Index: libgfortran/generated/minloc1_16_r16.c +=================================================================== +--- libgfortran/generated/minloc1_16_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/unpack_i16.c +=================================================================== +--- libgfortran/generated/unpack_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/sum_i8.c +=================================================================== +--- libgfortran/generated/sum_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/pack_i1.c +=================================================================== +--- libgfortran/generated/pack_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_1) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_1)); + + if (total == 0) + return; +Index: libgfortran/generated/any_l16.c +=================================================================== +--- libgfortran/generated/any_l16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/any_l16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); + } + else + { +Index: libgfortran/generated/spread_i8.c +=================================================================== +--- libgfortran/generated/spread_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_8)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_8)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_8)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_8)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/maxval_i2.c +=================================================================== +--- libgfortran/generated/maxval_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/maxloc1_8_i4.c +=================================================================== +--- libgfortran/generated/maxloc1_8_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/unpack_r8.c +=================================================================== +--- libgfortran/generated/unpack_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8)); + } + else + { +Index: libgfortran/generated/maxloc0_4_r4.c +=================================================================== +--- libgfortran/generated/maxloc0_4_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/all_l1.c +=================================================================== +--- libgfortran/generated/all_l1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/all_l1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); + } + else + { +Index: libgfortran/generated/matmul_r8.c +=================================================================== +--- libgfortran/generated/matmul_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_8)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minloc0_4_r16.c +=================================================================== +--- libgfortran/generated/minloc0_4_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_4_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc0_4_i2.c +=================================================================== +--- libgfortran/generated/maxloc0_4_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc1_8_r16.c +=================================================================== +--- libgfortran/generated/minloc1_8_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/pack_c10.c +=================================================================== +--- libgfortran/generated/pack_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_10)); + + if (total == 0) + return; +Index: libgfortran/generated/pack_r4.c +=================================================================== +--- libgfortran/generated/pack_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_4)); + + if (total == 0) + return; +Index: libgfortran/generated/transpose_c16.c +=================================================================== +--- libgfortran/generated/transpose_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_COMPLEX_16)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc0_8_i8.c +=================================================================== +--- libgfortran/generated/maxloc0_8_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc1_4_r8.c +=================================================================== +--- libgfortran/generated/minloc1_4_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc1_16_i4.c +=================================================================== +--- libgfortran/generated/minloc1_16_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/minloc0_16_i8.c +=================================================================== +--- libgfortran/generated/minloc0_16_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/pack_i2.c +=================================================================== +--- libgfortran/generated/pack_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_2) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_2)); + + if (total == 0) + return; +Index: libgfortran/generated/transpose_i8.c +=================================================================== +--- libgfortran/generated/transpose_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_INTEGER_8)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/eoshift1_16.c +=================================================================== +--- libgfortran/generated/eoshift1_16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/eoshift1_16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -105,8 +105,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/all_l2.c +=================================================================== +--- libgfortran/generated/all_l2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/all_l2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); + } + else + { +Index: libgfortran/generated/product_c4.c +=================================================================== +--- libgfortran/generated/product_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); + } + else + { +Index: libgfortran/generated/iall_i1.c +=================================================================== +--- libgfortran/generated/iall_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iall_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/reshape_i4.c +=================================================================== +--- libgfortran/generated/reshape_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_INTEGER_4); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/in_pack_r10.c +=================================================================== +--- libgfortran/generated/in_pack_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_REAL_10 *)xmalloc (ssize * sizeof (GFC_REAL_10)); ++ destptr = xmallocarray (ssize, sizeof (GFC_REAL_10)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/in_pack_c4.c +=================================================================== +--- libgfortran/generated/in_pack_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_COMPLEX_4 *)xmalloc (ssize * sizeof (GFC_COMPLEX_4)); ++ destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_4)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/all_l16.c +=================================================================== +--- libgfortran/generated/all_l16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/all_l16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); + } + else + { +Index: libgfortran/generated/maxloc0_16_i1.c +=================================================================== +--- libgfortran/generated/maxloc0_16_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc1_8_r8.c +=================================================================== +--- libgfortran/generated/maxloc1_8_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minval_i16.c +=================================================================== +--- libgfortran/generated/minval_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/reshape_r10.c +=================================================================== +--- libgfortran/generated/reshape_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_REAL_10); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/unpack_r16.c +=================================================================== +--- libgfortran/generated/unpack_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16)); + } + else + { +Index: libgfortran/generated/maxval_i4.c +=================================================================== +--- libgfortran/generated/maxval_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minval_i8.c +=================================================================== +--- libgfortran/generated/minval_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/maxloc0_16_i16.c +=================================================================== +--- libgfortran/generated/maxloc0_16_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/shape_i4.c +=================================================================== +--- libgfortran/generated/shape_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/shape_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -49,7 +49,7 @@ + { + GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); + ret->offset = 0; +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + + stride = GFC_DESCRIPTOR_STRIDE(ret,0); +Index: libgfortran/generated/minloc1_4_i16.c +=================================================================== +--- libgfortran/generated/minloc1_4_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxloc0_4_r10.c +=================================================================== +--- libgfortran/generated/maxloc0_4_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc0_8_i16.c +=================================================================== +--- libgfortran/generated/maxloc0_8_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/iall_i2.c +=================================================================== +--- libgfortran/generated/iall_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iall_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/maxloc1_8_r10.c +=================================================================== +--- libgfortran/generated/maxloc1_8_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/maxloc0_16_r4.c +=================================================================== +--- libgfortran/generated/maxloc0_16_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc0_8_i1.c +=================================================================== +--- libgfortran/generated/minloc0_8_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/minloc1_16_r8.c +=================================================================== +--- libgfortran/generated/minloc1_16_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/unpack_i8.c +=================================================================== +--- libgfortran/generated/unpack_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/maxloc0_4_i4.c +=================================================================== +--- libgfortran/generated/maxloc0_4_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/count_4_l.c +=================================================================== +--- libgfortran/generated/count_4_l.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/count_4_l.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/sum_r10.c +=================================================================== +--- libgfortran/generated/sum_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + } + else + { +Index: libgfortran/generated/sum_c4.c +=================================================================== +--- libgfortran/generated/sum_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); + } + else + { +Index: libgfortran/generated/maxloc1_16_r10.c +=================================================================== +--- libgfortran/generated/maxloc1_16_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/pack_i16.c +=================================================================== +--- libgfortran/generated/pack_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_16)); + + if (total == 0) + return; +Index: libgfortran/generated/matmul_i8.c +=================================================================== +--- libgfortran/generated/matmul_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_8)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/maxloc0_16_i2.c +=================================================================== +--- libgfortran/generated/maxloc0_16_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/spread_c4.c +=================================================================== +--- libgfortran/generated/spread_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_4)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_4)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_4)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_4)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/maxval_r10.c +=================================================================== +--- libgfortran/generated/maxval_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + } + else + { +Index: libgfortran/generated/pack_i4.c +=================================================================== +--- libgfortran/generated/pack_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_4)); + + if (total == 0) + return; +Index: libgfortran/generated/maxloc1_4_i1.c +=================================================================== +--- libgfortran/generated/maxloc1_4_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/matmul_r10.c +=================================================================== +--- libgfortran/generated/matmul_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_10)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minloc1_4_i8.c +=================================================================== +--- libgfortran/generated/minloc1_4_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc0_8_r4.c +=================================================================== +--- libgfortran/generated/minloc0_8_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/matmul_l4.c +=================================================================== +--- libgfortran/generated/matmul_l4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_l4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -88,7 +88,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_LOGICAL_4) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_4)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/reshape_r8.c +=================================================================== +--- libgfortran/generated/reshape_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_REAL_8); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/in_pack_c10.c +=================================================================== +--- libgfortran/generated/in_pack_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_COMPLEX_10 *)xmalloc (ssize * sizeof (GFC_COMPLEX_10)); ++ destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_10)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/all_l4.c +=================================================================== +--- libgfortran/generated/all_l4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/all_l4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); + } + else + { +Index: libgfortran/generated/minloc0_8_i2.c +=================================================================== +--- libgfortran/generated/minloc0_8_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/norm2_r16.c +=================================================================== +--- libgfortran/generated/norm2_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/norm2_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -105,10 +105,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/reshape_c10.c +=================================================================== +--- libgfortran/generated/reshape_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_COMPLEX_10); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/unpack_c16.c +=================================================================== +--- libgfortran/generated/unpack_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16)); + } + else + { +Index: libgfortran/generated/maxloc1_4_r4.c +=================================================================== +--- libgfortran/generated/maxloc1_4_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxval_r8.c +=================================================================== +--- libgfortran/generated/maxval_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); + } + else + { +Index: libgfortran/generated/transpose_c4.c +=================================================================== +--- libgfortran/generated/transpose_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/transpose_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,8 @@ + GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1, + GFC_DESCRIPTOR_EXTENT(source, 1)); + +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) ret)); ++ ret->base_addr = xmallocarray (size0 ((array_t *) ret), ++ sizeof (GFC_COMPLEX_4)); + ret->offset = 0; + } else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/eoshift1_4.c +=================================================================== +--- libgfortran/generated/eoshift1_4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/eoshift1_4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -105,8 +105,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/minval_r16.c +=================================================================== +--- libgfortran/generated/minval_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minval_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); + } + else + { +Index: libgfortran/generated/iany_i16.c +=================================================================== +--- libgfortran/generated/iany_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iany_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/maxloc1_4_i2.c +=================================================================== +--- libgfortran/generated/maxloc1_4_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxloc1_8_i8.c +=================================================================== +--- libgfortran/generated/maxloc1_8_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/maxloc0_4_r8.c +=================================================================== +--- libgfortran/generated/maxloc0_4_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc0_16_r16.c +=================================================================== +--- libgfortran/generated/maxloc0_16_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/sum_c10.c +=================================================================== +--- libgfortran/generated/sum_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); + } + else + { +Index: libgfortran/generated/iall_i4.c +=================================================================== +--- libgfortran/generated/iall_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iall_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/minloc1_4_r16.c +=================================================================== +--- libgfortran/generated/minloc1_4_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_4_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxloc0_8_r16.c +=================================================================== +--- libgfortran/generated/maxloc0_8_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_8_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/pack_r8.c +=================================================================== +--- libgfortran/generated/pack_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_8)); + + if (total == 0) + return; +Index: libgfortran/generated/matmul_c10.c +=================================================================== +--- libgfortran/generated/matmul_c10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_c10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_10)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/maxloc0_16_i4.c +=================================================================== +--- libgfortran/generated/maxloc0_16_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/pack_r16.c +=================================================================== +--- libgfortran/generated/pack_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_16)); + + if (total == 0) + return; +Index: libgfortran/generated/minloc1_16_i8.c +=================================================================== +--- libgfortran/generated/minloc1_16_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_16_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/minloc0_16_r10.c +=================================================================== +--- libgfortran/generated/minloc0_16_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_16_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/unpack_c4.c +=================================================================== +--- libgfortran/generated/unpack_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/unpack_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -99,7 +99,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4)); + } + else + { +@@ -244,7 +244,7 @@ + rs *= extent[n]; + } + ret->offset = 0; +- ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4)); ++ ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4)); + } + else + { +Index: libgfortran/generated/iparity_i1.c +=================================================================== +--- libgfortran/generated/iparity_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iparity_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/product_c8.c +=================================================================== +--- libgfortran/generated/product_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); + } + else + { +Index: libgfortran/generated/in_pack_i16.c +=================================================================== +--- libgfortran/generated/in_pack_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_INTEGER_16 *)xmalloc (ssize * sizeof (GFC_INTEGER_16)); ++ destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_16)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/minloc0_8_i4.c +=================================================================== +--- libgfortran/generated/minloc0_8_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/matmul_c4.c +=================================================================== +--- libgfortran/generated/matmul_c4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_c4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_4)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/reshape_i8.c +=================================================================== +--- libgfortran/generated/reshape_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_INTEGER_8); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/in_pack_c8.c +=================================================================== +--- libgfortran/generated/in_pack_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_COMPLEX_8 *)xmalloc (ssize * sizeof (GFC_COMPLEX_8)); ++ destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_8)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/bessel_r10.c +=================================================================== +--- libgfortran/generated/bessel_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/bessel_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -55,7 +55,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10)); + ret->offset = 0; + } + +@@ -122,7 +122,7 @@ + { + size_t size = n2 < n1 ? 0 : n2-n1+1; + GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); +- ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size); ++ ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10)); + ret->offset = 0; + } + +@@ -162,7 +162,7 @@ + + x2rev = GFC_REAL_10_LITERAL(2.)/x; + +- for (i = 2; i <= n1+n2; i++) ++ for (i = 2; i <= n2 - n1; i++) + { + #if defined(GFC_REAL_10_INFINITY) + if (unlikely (last2 == -GFC_REAL_10_INFINITY)) +Index: libgfortran/generated/iall_i16.c +=================================================================== +--- libgfortran/generated/iall_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iall_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/maxloc1_16_i1.c +=================================================================== +--- libgfortran/generated/maxloc1_16_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/reshape_i16.c +=================================================================== +--- libgfortran/generated/reshape_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/reshape_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -111,11 +111,11 @@ + ret->offset = 0; + + if (unlikely (rs < 1)) +- alloc_size = 1; ++ alloc_size = 0; + else +- alloc_size = rs * sizeof (GFC_INTEGER_16); ++ alloc_size = rs; + +- ret->base_addr = xmalloc (alloc_size); ++ ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; + } + +Index: libgfortran/generated/count_16_l.c +=================================================================== +--- libgfortran/generated/count_16_l.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/count_16_l.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/minloc1_8_i1.c +=================================================================== +--- libgfortran/generated/minloc1_8_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/maxloc1_4_i4.c +=================================================================== +--- libgfortran/generated/maxloc1_4_i4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_i4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxval_i8.c +=================================================================== +--- libgfortran/generated/maxval_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/eoshift3_16.c +=================================================================== +--- libgfortran/generated/eoshift3_16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/eoshift3_16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -89,7 +89,7 @@ + { + int i; + +- ret->base_addr = xmalloc (size * arraysize); ++ ret->base_addr = xmallocarray (arraysize, size); + ret->offset = 0; + ret->dtype = array->dtype; + for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) +@@ -107,8 +107,8 @@ + GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); + + } +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (size * arraysize); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (arraysize, size); + + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/shape_i8.c +=================================================================== +--- libgfortran/generated/shape_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/shape_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -49,7 +49,7 @@ + { + GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1); + ret->offset = 0; +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + + stride = GFC_DESCRIPTOR_STRIDE(ret,0); +Index: libgfortran/generated/maxloc0_4_i16.c +=================================================================== +--- libgfortran/generated/maxloc0_4_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/maxloc1_4_r10.c +=================================================================== +--- libgfortran/generated/maxloc1_4_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_4_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); + } + else + { +Index: libgfortran/generated/maxloc1_8_i16.c +=================================================================== +--- libgfortran/generated/maxloc1_8_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_8_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc0_8_r10.c +=================================================================== +--- libgfortran/generated/minloc0_8_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/iparity_i2.c +=================================================================== +--- libgfortran/generated/iparity_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/iparity_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); + } + else + { +Index: libgfortran/generated/maxloc1_16_r4.c +=================================================================== +--- libgfortran/generated/maxloc1_16_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/maxloc0_16_r8.c +=================================================================== +--- libgfortran/generated/maxloc0_16_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_16_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/sum_i16.c +=================================================================== +--- libgfortran/generated/sum_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/maxloc0_4_i8.c +=================================================================== +--- libgfortran/generated/maxloc0_4_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc0_4_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/pack_c16.c +=================================================================== +--- libgfortran/generated/pack_c16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_c16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_16)); + + if (total == 0) + return; +Index: libgfortran/generated/maxloc1_16_i16.c +=================================================================== +--- libgfortran/generated/maxloc1_16_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/minloc1_8_r4.c +=================================================================== +--- libgfortran/generated/minloc1_8_r4.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_r4.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/sum_c8.c +=================================================================== +--- libgfortran/generated/sum_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/sum_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); + } + else + { +Index: libgfortran/generated/maxloc1_16_i2.c +=================================================================== +--- libgfortran/generated/maxloc1_16_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxloc1_16_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/parity_l1.c +=================================================================== +--- libgfortran/generated/parity_l1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/parity_l1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +Index: libgfortran/generated/maxval_i16.c +=================================================================== +--- libgfortran/generated/maxval_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/maxval_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -286,8 +285,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -299,7 +297,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + + } + else +@@ -472,8 +470,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -482,7 +479,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); + } + else + { +Index: libgfortran/generated/spread_c8.c +=================================================================== +--- libgfortran/generated/spread_c8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/spread_c8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,8 @@ + } + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_8)); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_8)); + if (rs <= 0) + return; + } +@@ -244,7 +244,7 @@ + + if (ret->base_addr == NULL) + { +- ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_8)); ++ ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_8)); + ret->offset = 0; + GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); + } +Index: libgfortran/generated/matmul_i16.c +=================================================================== +--- libgfortran/generated/matmul_i16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_i16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -124,7 +124,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_16)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/pack_i8.c +=================================================================== +--- libgfortran/generated/pack_i8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/pack_i8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -167,8 +167,8 @@ + + ret->offset = 0; + +- /* xmalloc allocates a single byte for zero size. */ +- ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * total); ++ /* xmallocarray allocates a single byte for zero size. */ ++ ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_8)); + + if (total == 0) + return; +Index: libgfortran/generated/any_l1.c +=================================================================== +--- libgfortran/generated/any_l1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/any_l1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); + } + else + { +Index: libgfortran/generated/minloc1_8_i2.c +=================================================================== +--- libgfortran/generated/minloc1_8_i2.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc1_8_i2.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -98,10 +98,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -294,8 +293,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -307,7 +305,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + + } + else +@@ -485,8 +483,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -495,7 +492,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); + } + else + { +Index: libgfortran/generated/minloc0_8_r8.c +=================================================================== +--- libgfortran/generated/minloc0_8_r8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/minloc0_8_r8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -58,7 +58,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -199,7 +199,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else + { +@@ -367,7 +367,7 @@ + GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); + retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->offset = 0; +- retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); ++ retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); + } + else if (unlikely (compile_options.bounds_check)) + { +Index: libgfortran/generated/matmul_l8.c +=================================================================== +--- libgfortran/generated/matmul_l8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/matmul_l8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -88,7 +88,7 @@ + } + + retarray->base_addr +- = xmalloc (sizeof (GFC_LOGICAL_8) * size0 ((array_t *) retarray)); ++ = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_8)); + retarray->offset = 0; + } + else if (unlikely (compile_options.bounds_check)) +Index: libgfortran/generated/product_r10.c +=================================================================== +--- libgfortran/generated/product_r10.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_r10.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); + } + else + { +Index: libgfortran/generated/product_i1.c +=================================================================== +--- libgfortran/generated/product_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/product_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -97,10 +97,9 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ +@@ -272,8 +271,7 @@ + + } + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; +@@ -285,7 +283,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + + } + else +@@ -430,8 +428,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -440,7 +437,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); + } + else + { +Index: libgfortran/generated/all_l8.c +=================================================================== +--- libgfortran/generated/all_l8.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/all_l8.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -101,8 +101,7 @@ + retarray->offset = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + +- alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) +- * extent[rank-1]; ++ alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; + + if (alloc_size == 0) + { +@@ -111,7 +110,7 @@ + return; + } + else +- retarray->base_addr = xmalloc (alloc_size); ++ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); + } + else + { +Index: libgfortran/generated/in_pack_r16.c +=================================================================== +--- libgfortran/generated/in_pack_r16.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_r16.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_REAL_16 *)xmalloc (ssize * sizeof (GFC_REAL_16)); ++ destptr = xmallocarray (ssize, sizeof (GFC_REAL_16)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/generated/in_pack_i1.c +=================================================================== +--- libgfortran/generated/in_pack_i1.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/generated/in_pack_i1.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -76,7 +76,7 @@ + return source->base_addr; + + /* Allocate storage for the destination. */ +- destptr = (GFC_INTEGER_1 *)xmalloc (ssize * sizeof (GFC_INTEGER_1)); ++ destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_1)); + dest = destptr; + src = source->base_addr; + stride0 = stride[0]; +Index: libgfortran/libgfortran.h +=================================================================== +--- libgfortran/libgfortran.h (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/libgfortran.h (.../branches/gcc-4_8-branch) (revision 217117) +@@ -751,6 +751,9 @@ + extern void *xmalloc (size_t) __attribute__ ((malloc)); + internal_proto(xmalloc); + ++extern void *xmallocarray (size_t, size_t) __attribute__ ((malloc)); ++internal_proto(xmallocarray); ++ + extern void *xcalloc (size_t, size_t) __attribute__ ((malloc)); + internal_proto(xcalloc); + +Index: libgfortran/config.h.in +=================================================================== +--- libgfortran/config.h.in (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/config.h.in (.../branches/gcc-4_8-branch) (revision 217117) +@@ -711,6 +711,9 @@ + /* Define to 1 if you have the `strtof' function. */ + #undef HAVE_STRTOF + ++/* Define to 1 if you have the `strtok_r' function. */ ++#undef HAVE_STRTOK_R ++ + /* Define to 1 if you have the `strtold' function. */ + #undef HAVE_STRTOLD + +Index: libgfortran/io/list_read.c +=================================================================== +--- libgfortran/io/list_read.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/io/list_read.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -2354,7 +2354,7 @@ + { + index_type len = strlen (nl->var_name) + 1; + int dim; +- char * ext_name = (char*)xmalloc (len + 1); ++ char * ext_name = xmalloc (len + 1); + memcpy (ext_name, nl->var_name, len-1); + memcpy (ext_name + len - 1, "%", 2); + for (nl = nl->next; nl; nl = nl->next) +Index: libgfortran/io/unit.c +=================================================================== +--- libgfortran/io/unit.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/io/unit.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -455,7 +455,7 @@ + { + iunit->rank = GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc); + iunit->ls = (array_loop_spec *) +- xmalloc (iunit->rank * sizeof (array_loop_spec)); ++ xmallocarray (iunit->rank, sizeof (array_loop_spec)); + dtp->internal_unit_len *= + init_loop_spec (dtp->internal_unit_desc, iunit->ls, &start_record); + +Index: libgfortran/io/unix.c +=================================================================== +--- libgfortran/io/unix.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/io/unix.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -407,7 +407,9 @@ + { + int retval; + +- if (s->fd != STDOUT_FILENO ++ if (s->fd == -1) ++ retval = -1; ++ else if (s->fd != STDOUT_FILENO + && s->fd != STDERR_FILENO + && s->fd != STDIN_FILENO) + retval = close (s->fd); +@@ -983,7 +985,15 @@ + + /* Get the current length of the file. */ + +- fstat (fd, &statbuf); ++ if (fstat (fd, &statbuf) == -1) ++ { ++ s->st_dev = s->st_ino = -1; ++ s->file_length = 0; ++ if (errno == EBADF) ++ s->fd = -1; ++ raw_init (s); ++ return (stream *) s; ++ } + + s->st_dev = statbuf.st_dev; + s->st_ino = statbuf.st_ino; +Index: libgfortran/io/transfer.c +=================================================================== +--- libgfortran/io/transfer.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/io/transfer.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -3776,9 +3776,9 @@ + if (nml->var_rank > 0) + { + nml->dim = (descriptor_dimension*) +- xmalloc (nml->var_rank * sizeof (descriptor_dimension)); ++ xmallocarray (nml->var_rank, sizeof (descriptor_dimension)); + nml->ls = (array_loop_spec*) +- xmalloc (nml->var_rank * sizeof (array_loop_spec)); ++ xmallocarray (nml->var_rank, sizeof (array_loop_spec)); + } + else + { +Index: libgfortran/io/write.c +=================================================================== +--- libgfortran/io/write.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libgfortran/io/write.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1863,7 +1863,7 @@ + base_var_name_len = base ? strlen (base->var_name) : 0; + ext_name_len = base_name_len + base_var_name_len + + strlen (obj->var_name) + obj->var_rank * NML_DIGITS + 1; +- ext_name = (char*)xmalloc (ext_name_len); ++ ext_name = xmalloc (ext_name_len); + + memcpy (ext_name, base_name, base_name_len); + clen = strlen (obj->var_name + base_var_name_len); +@@ -1892,7 +1892,7 @@ + /* Now obj_name. */ + + obj_name_len = strlen (obj->var_name) + 1; +- obj_name = xmalloc (obj_name_len+1); ++ obj_name = xmalloc (obj_name_len + 1); + memcpy (obj_name, obj->var_name, obj_name_len-1); + memcpy (obj_name + obj_name_len-1, "%", 2); + +Index: libada/Makefile.in +=================================================================== +--- libada/Makefile.in (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libada/Makefile.in (.../branches/gcc-4_8-branch) (revision 217117) +@@ -60,7 +60,7 @@ + PICFLAG = @PICFLAG@ + GNATLIBFLAGS= -W -Wall -gnatpg -nostdinc + GNATLIBCFLAGS= -O2 +-GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) \ ++GNATLIBCFLAGS_FOR_C = -W -Wall $(GNATLIBCFLAGS) $(CFLAGS_FOR_TARGET) \ + -fexceptions -DIN_RTS @have_getipinfo@ + + host_subdir = @host_subdir@ +Index: libada/ChangeLog +=================================================================== +--- libada/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libada/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,7 @@ ++2014-08-12 Joel Sherrill ++ ++ * Makefile.in: Add CFLAGS_FOR_TARGET to GNATLIBCFLAGS_FOR_C. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libffi/src/powerpc/linux64_closure.S +=================================================================== +--- libffi/src/powerpc/linux64_closure.S (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libffi/src/powerpc/linux64_closure.S (.../branches/gcc-4_8-branch) (revision 217117) +@@ -381,7 +381,8 @@ + .align 3 + .LEFDE1: + +-# if defined __ELF__ && defined __linux__ ++#endif ++ ++#if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 + .section .note.GNU-stack,"",@progbits +-# endif + #endif +Index: libffi/src/powerpc/linux64.S +=================================================================== +--- libffi/src/powerpc/linux64.S (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libffi/src/powerpc/linux64.S (.../branches/gcc-4_8-branch) (revision 217117) +@@ -254,7 +254,8 @@ + .align 3 + .LEFDE1: + +-# if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 ++#endif ++ ++#if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 + .section .note.GNU-stack,"",@progbits +-# endif + #endif +Index: libffi/ChangeLog +=================================================================== +--- libffi/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libffi/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,9 @@ ++2014-09-11 Jakub Jelinek ++ ++ * src/powerpc/linux64.S: Emit .note.GNU-stack even when ++ POWERPC64 is not defined. ++ * src/powerpc/linux64_closure.S: Likewise. Also test _CALL_ELF == 2. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libcpp/ChangeLog +=================================================================== +--- libcpp/ChangeLog (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libcpp/ChangeLog (.../branches/gcc-4_8-branch) (revision 217117) +@@ -1,3 +1,14 @@ ++2014-10-12 Bill Schmidt ++ ++ Backport from mainline r215873 ++ 2014-10-03 Bill Schmidt ++ ++ * lex.c (search_line_fast): Add new version to be used for Power8 ++ and later targets when Altivec is enabled. Restrict the existing ++ Altivec version to big-endian systems so that lvsr is not used on ++ little endian, where it is deprecated. Remove LE-specific code ++ from the now-BE-only version. ++ + 2014-05-22 Release Manager + + * GCC 4.8.3 released. +Index: libcpp/lex.c +=================================================================== +--- libcpp/lex.c (.../tags/gcc_4_8_3_release) (revision 217117) ++++ libcpp/lex.c (.../branches/gcc-4_8-branch) (revision 217117) +@@ -515,9 +515,111 @@ + search_line_fast = impl; + } + +-#elif (GCC_VERSION >= 4005) && defined(__ALTIVEC__) ++#elif defined(_ARCH_PWR8) && defined(__ALTIVEC__) + +-/* A vection of the fast scanner using AltiVec vectorized byte compares. */ ++/* A vection of the fast scanner using AltiVec vectorized byte compares ++ and VSX unaligned loads (when VSX is available). This is otherwise ++ the same as the pre-GCC 5 version. */ ++ ++static const uchar * ++search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) ++{ ++ typedef __attribute__((altivec(vector))) unsigned char vc; ++ ++ const vc repl_nl = { ++ '\n', '\n', '\n', '\n', '\n', '\n', '\n', '\n', ++ '\n', '\n', '\n', '\n', '\n', '\n', '\n', '\n' ++ }; ++ const vc repl_cr = { ++ '\r', '\r', '\r', '\r', '\r', '\r', '\r', '\r', ++ '\r', '\r', '\r', '\r', '\r', '\r', '\r', '\r' ++ }; ++ const vc repl_bs = { ++ '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\', ++ '\\', '\\', '\\', '\\', '\\', '\\', '\\', '\\' ++ }; ++ const vc repl_qm = { ++ '?', '?', '?', '?', '?', '?', '?', '?', ++ '?', '?', '?', '?', '?', '?', '?', '?', ++ }; ++ const vc zero = { 0 }; ++ ++ vc data, t; ++ ++ /* Main loop processing 16 bytes at a time. */ ++ do ++ { ++ vc m_nl, m_cr, m_bs, m_qm; ++ ++ data = *((const vc *)s); ++ s += 16; ++ ++ m_nl = (vc) __builtin_vec_cmpeq(data, repl_nl); ++ m_cr = (vc) __builtin_vec_cmpeq(data, repl_cr); ++ m_bs = (vc) __builtin_vec_cmpeq(data, repl_bs); ++ m_qm = (vc) __builtin_vec_cmpeq(data, repl_qm); ++ t = (m_nl | m_cr) | (m_bs | m_qm); ++ ++ /* T now contains 0xff in bytes for which we matched one of the relevant ++ characters. We want to exit the loop if any byte in T is non-zero. ++ Below is the expansion of vec_any_ne(t, zero). */ ++ } ++ while (!__builtin_vec_vcmpeq_p(/*__CR6_LT_REV*/3, t, zero)); ++ ++ /* Restore s to to point to the 16 bytes we just processed. */ ++ s -= 16; ++ ++ { ++#define N (sizeof(vc) / sizeof(long)) ++ ++ union { ++ vc v; ++ /* Statically assert that N is 2 or 4. */ ++ unsigned long l[(N == 2 || N == 4) ? N : -1]; ++ } u; ++ unsigned long l, i = 0; ++ ++ u.v = t; ++ ++ /* Find the first word of T that is non-zero. */ ++ switch (N) ++ { ++ case 4: ++ l = u.l[i++]; ++ if (l != 0) ++ break; ++ s += sizeof(unsigned long); ++ l = u.l[i++]; ++ if (l != 0) ++ break; ++ s += sizeof(unsigned long); ++ case 2: ++ l = u.l[i++]; ++ if (l != 0) ++ break; ++ s += sizeof(unsigned long); ++ l = u.l[i]; ++ } ++ ++ /* L now contains 0xff in bytes for which we matched one of the ++ relevant characters. We can find the byte index by finding ++ its bit index and dividing by 8. */ ++#ifdef __BIG_ENDIAN__ ++ l = __builtin_clzl(l) >> 3; ++#else ++ l = __builtin_ctzl(l) >> 3; ++#endif ++ return s + l; ++ ++#undef N ++ } ++} ++ ++#elif (GCC_VERSION >= 4005) && defined(__ALTIVEC__) && defined (__BIG_ENDIAN__) ++ ++/* A vection of the fast scanner using AltiVec vectorized byte compares. ++ This cannot be used for little endian because vec_lvsl/lvsr are ++ deprecated for little endian and the code won't work properly. */ + /* ??? Unfortunately, attribute(target("altivec")) is not yet supported, + so we can't compile this function without -maltivec on the command line + (or implied by some other switch). */ +@@ -559,13 +661,8 @@ + beginning with all ones and shifting in zeros according to the + mis-alignment. The LVSR instruction pulls the exact shift we + want from the address. */ +-#ifdef __BIG_ENDIAN__ + mask = __builtin_vec_lvsr(0, s); + mask = __builtin_vec_perm(zero, ones, mask); +-#else +- mask = __builtin_vec_lvsl(0, s); +- mask = __builtin_vec_perm(ones, zero, mask); +-#endif + data &= mask; + + /* While altivec loads mask addresses, we still need to align S so +@@ -629,11 +726,7 @@ + /* L now contains 0xff in bytes for which we matched one of the + relevant characters. We can find the byte index by finding + its bit index and dividing by 8. */ +-#ifdef __BIG_ENDIAN__ + l = __builtin_clzl(l) >> 3; +-#else +- l = __builtin_ctzl(l) >> 3; +-#endif + return s + l; + + #undef N +Index: . +=================================================================== +--- . (.../tags/gcc_4_8_3_release) (revision 217117) ++++ . (.../branches/gcc-4_8-branch) (revision 217117) + +Property changes on: . +___________________________________________________________________ +Modified: svn:mergeinfo + Merged /trunk:r211733,215049 -- 2.37.3