diff -u gcc-8-8.1.0/debian/changelog gcc-8-8.1.0/debian/changelog --- gcc-8-8.1.0/debian/changelog +++ gcc-8-8.1.0/debian/changelog @@ -1,3 +1,27 @@ +gcc-8 (8.1.0-11ubuntu1) cosmic; urgency=medium + + * Merge with Debian; remaining changes: + - Build from upstream sources. + + -- Matthias Klose Tue, 17 Jul 2018 12:32:11 +0200 + +gcc-8 (8.1.0-11) unstable; urgency=medium + + * Update to SVN 20180717 (r262818) from the gcc-8-branch. + - Fix PR c/86453, PR debug/86452, PR debug/86457, PR middle-end/85974, + PR middle-end/86076, PR tree-optimization/85935, + PR tree-optimization/86514, PR tree-optimization/86274, + PR target/84413 (x86), PR middle-end/86202, PR target/84829, + PR c++/3698, PR c++/86208, PR c++/86374, PR sanitizer/86406, + PR fortran/83184, PR fortran/86417, PR fortran/83183, + PR fortran/86325. + + [ Nicolas Boulenguez ] + * Update the ada-gcc-name patch, not appending the suffix twice. + Addresses: #856274. + + -- Matthias Klose Tue, 17 Jul 2018 14:09:13 +0200 + gcc-8 (8.1.0-10ubuntu1) cosmic; urgency=medium * Merge with Debian; remaining changes: diff -u gcc-8-8.1.0/debian/patches/ada-gcc-name.diff gcc-8-8.1.0/debian/patches/ada-gcc-name.diff --- gcc-8-8.1.0/debian/patches/ada-gcc-name.diff +++ gcc-8-8.1.0/debian/patches/ada-gcc-name.diff @@ -1,84 +1,73 @@ -Description: ensure that gnat tools execute the same GCC version - The "gcc" default compiler may differ from "gcc-BV", where BV is the - GCC base version of the tools. +Description: simplifiy detection of machine and version in command name + The previous algorithm wrongly tests "End_Of_Prefix > 1", + which may happen even if a match has been found. . - Gnatchop already handles this issue by extracting parts of the resolved path - to its command name at run time. -Forwarded: not-needed + Note: for historical reasons, gnatchop carries its own version + of the old algorithm, which seems to work in our case. +Bugs-Debian: https://bugs.debian.org/903694 +Bugs-Debian: https://bugs.debian.org/856274 Author: Ludovic Brenta Author: Nicolas Boulenguez -Index: b/src/gcc/ada/gnatlink.adb -=================================================================== ---- a/src/gcc/ada/gnatlink.adb -+++ b/src/gcc/ada/gnatlink.adb -@@ -136,7 +136,8 @@ procedure Gnatlink is - -- This table collects the arguments to be passed to compile the binder - -- generated file. - -- Gcc : String_Access := Program_Name ("gcc", "gnatlink"); -+ Gcc : String_Access -+ := Program_Name ("gcc-" & Gnatvsn.Library_Version, "gnatlink"); - - Read_Mode : constant String := "r" & ASCII.NUL; - -@@ -1408,7 +1409,8 @@ procedure Gnatlink is - end if; - - Write_Line (" --GCC=comp Use 'comp' as the compiler rather than 'gcc'"); -- Write_Line (" --LINK=lnk Use 'lnk' as the linker rather than 'gcc'"); -+ Write_Line (" --LINK=lnk Use 'lnk' for the linking rather than 'gcc-" -+ & Gnatvsn.Library_Version & "'"); - Write_Eol; - Write_Line (" [non-Ada-objects] list of non Ada object files"); - Write_Line (" [linker-options] other options for the linker"); -Index: b/src/gcc/ada/make.adb -=================================================================== ---- a/src/gcc/ada/make.adb -+++ b/src/gcc/ada/make.adb -@@ -443,9 +443,12 @@ package body Make is - -- Compiler, Binder & Linker Data and Subprograms -- - ---------------------------------------------------- - -- Gcc : String_Access := Program_Name ("gcc", "gnatmake"); -- Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake"); -- Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake"); -+ Gcc : String_Access := Program_Name -+ ("gcc-" & Gnatvsn.Library_Version, "gnatmake"); -+ Gnatbind : String_Access := Program_Name -+ ("gnatbind-" & Gnatvsn.Library_Version, "gnatmake"); -+ Gnatlink : String_Access := Program_Name -+ ("gnatlink-" & Gnatvsn.Library_Version, "gnatmake"); - -- Default compiler, binder, linker programs - - Gcc_Path : String_Access := -Index: b/src/gcc/ada/mdll-utl.adb -=================================================================== ---- a/src/gcc/ada/mdll-utl.adb -+++ b/src/gcc/ada/mdll-utl.adb -@@ -29,6 +29,7 @@ with Ada.Text_IO; - with Ada.Exceptions; - - with GNAT.Directory_Operations; -+with Gnatvsn; - with Osint; - - package body MDLL.Utl is -@@ -39,7 +40,7 @@ package body MDLL.Utl is - Dlltool_Name : constant String := "dlltool"; - Dlltool_Exec : OS_Lib.String_Access; - -- Gcc_Name : constant String := "gcc"; -+ Gcc_Name : constant String := "gcc-" & Gnatvsn.Library_Version; - Gcc_Exec : OS_Lib.String_Access; - - Gnatbind_Name : constant String := "gnatbind"; -@@ -212,7 +213,7 @@ package body MDLL.Utl is - end; - end if; - -- Print_Command ("gcc", Arguments (1 .. A)); -+ Print_Command (Gcc_Name, Arguments (1 .. A)); - - OS_Lib.Spawn (Gcc_Exec.all, Arguments (1 .. A), Success); +--- a/src/gcc/ada/osint.adb ++++ b/src/gcc/ada/osint.adb +@@ -2199,22 +2199,14 @@ + ------------------ + + function Program_Name (Nam : String; Prog : String) return String_Access is +- End_Of_Prefix : Natural := 0; + Start_Of_Prefix : Positive := 1; +- Start_Of_Suffix : Positive; + + begin + -- Get the name of the current program being executed + + Find_Program_Name; + +- Start_Of_Suffix := Name_Len + 1; +- +- -- Find the target prefix if any, for the cross compilation case. +- -- For instance in "powerpc-elf-gcc" the target prefix is +- -- "powerpc-elf-" +- -- Ditto for suffix, e.g. in "gcc-4.1", the suffix is "-4.1" +- ++ -- Find directory part if any, and ignore it from now on. + for J in reverse 1 .. Name_Len loop + if Name_Buffer (J) = '/' + or else Name_Buffer (J) = Directory_Separator +@@ -2223,25 +2215,21 @@ + end if; + end loop; + +- -- Find End_Of_Prefix +- ++ -- Find the target prefix if any, for the cross compilation case. ++ -- For instance in "powerpc-elf-gcc" the target prefix is ++ -- "powerpc-elf-" ++ -- Ditto for suffix, e.g. in "gcc-4.1", the suffix is "-4.1" ++ -- In other terms, search and replace Prog with Nam. + for J in Start_Of_Prefix .. Name_Len - Prog'Length + 1 loop + if Name_Buffer (J .. J + Prog'Length - 1) = Prog then +- End_Of_Prefix := J - 1; +- exit; ++ return new String'(Name_Buffer (Start_Of_Prefix .. J - 1) ++ & Nam ++ & Name_Buffer (J + Prog'Length .. Name_Len)); + end if; + end loop; + +- if End_Of_Prefix > 1 then +- Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1; +- end if; +- +- -- Create the new program name +- +- return new String' +- (Name_Buffer (Start_Of_Prefix .. End_Of_Prefix) +- & Nam +- & Name_Buffer (Start_Of_Suffix .. Name_Len)); ++ -- If no match has been found, return the argument unchanged. ++ return new String'(Nam); + end Program_Name; + ------------------------------ diff -u gcc-8-8.1.0/debian/patches/svn-updates.diff gcc-8-8.1.0/debian/patches/svn-updates.diff --- gcc-8-8.1.0/debian/patches/svn-updates.diff +++ gcc-8-8.1.0/debian/patches/svn-updates.diff @@ -1,10 +1,10 @@ -# DP: updates from the 8 branch upto 20180712 (r262577). +# DP: updates from the 8 branch upto 20180717 (r262818). last_update() { cat > ${dir}LAST_UPDATED ++ ++ * config/abi/post/s390-linux-gnu/baseline_symbols.txt: Update. ++ * config/abi/post/s390x-linux-gnu/32/baseline_symbols.txt: Update. ++ * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update. ++ +2018-07-05 François Dumont + + Backport from mainline @@ -5283,6 +5289,69 @@ OBJECT:0:GLIBCXX_3.4.3 OBJECT:0:GLIBCXX_3.4.4 OBJECT:0:GLIBCXX_3.4.5 +Index: libstdc++-v3/config/abi/post/s390-linux-gnu/baseline_symbols.txt +=================================================================== +--- a/src/libstdc++-v3/config/abi/post/s390-linux-gnu/baseline_symbols.txt (.../tags/gcc_8_1_0_release) ++++ b/src/libstdc++-v3/config/abi/post/s390-linux-gnu/baseline_symbols.txt (.../branches/gcc-8-branch) +@@ -444,6 +444,7 @@ + FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4 + FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4 + FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4 ++FUNC:_ZNKSt13random_device13_M_getentropyEv@@GLIBCXX_3.4.25 + FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4 + FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4 + FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5 +@@ -4237,6 +4238,8 @@ + OBJECT:0:GLIBCXX_3.4.21 + OBJECT:0:GLIBCXX_3.4.22 + OBJECT:0:GLIBCXX_3.4.23 ++OBJECT:0:GLIBCXX_3.4.24 ++OBJECT:0:GLIBCXX_3.4.25 + OBJECT:0:GLIBCXX_3.4.3 + OBJECT:0:GLIBCXX_3.4.4 + OBJECT:0:GLIBCXX_3.4.5 +Index: libstdc++-v3/config/abi/post/s390x-linux-gnu/32/baseline_symbols.txt +=================================================================== +--- a/src/libstdc++-v3/config/abi/post/s390x-linux-gnu/32/baseline_symbols.txt (.../tags/gcc_8_1_0_release) ++++ b/src/libstdc++-v3/config/abi/post/s390x-linux-gnu/32/baseline_symbols.txt (.../branches/gcc-8-branch) +@@ -444,6 +444,7 @@ + FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4 + FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4 + FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4 ++FUNC:_ZNKSt13random_device13_M_getentropyEv@@GLIBCXX_3.4.25 + FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4 + FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4 + FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5 +@@ -4237,6 +4238,8 @@ + OBJECT:0:GLIBCXX_3.4.21 + OBJECT:0:GLIBCXX_3.4.22 + OBJECT:0:GLIBCXX_3.4.23 ++OBJECT:0:GLIBCXX_3.4.24 ++OBJECT:0:GLIBCXX_3.4.25 + OBJECT:0:GLIBCXX_3.4.3 + OBJECT:0:GLIBCXX_3.4.4 + OBJECT:0:GLIBCXX_3.4.5 +Index: libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt +=================================================================== +--- a/src/libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt (.../tags/gcc_8_1_0_release) ++++ b/src/libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt (.../branches/gcc-8-branch) +@@ -444,6 +444,7 @@ + FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6gcountEv@@GLIBCXX_3.4 + FUNC:_ZNKSt13basic_istreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4 + FUNC:_ZNKSt13basic_ostreamIwSt11char_traitsIwEE6sentrycvbEv@@GLIBCXX_3.4 ++FUNC:_ZNKSt13random_device13_M_getentropyEv@@GLIBCXX_3.4.25 + FUNC:_ZNKSt13runtime_error4whatEv@@GLIBCXX_3.4 + FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE5rdbufEv@@GLIBCXX_3.4 + FUNC:_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv@@GLIBCXX_3.4.5 +@@ -4237,6 +4238,8 @@ + OBJECT:0:GLIBCXX_3.4.21 + OBJECT:0:GLIBCXX_3.4.22 + OBJECT:0:GLIBCXX_3.4.23 ++OBJECT:0:GLIBCXX_3.4.24 ++OBJECT:0:GLIBCXX_3.4.25 + OBJECT:0:GLIBCXX_3.4.3 + OBJECT:0:GLIBCXX_3.4.4 + OBJECT:0:GLIBCXX_3.4.5 Index: libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt =================================================================== --- a/src/libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt (.../tags/gcc_8_1_0_release) @@ -5865,7 +5934,22 @@ =================================================================== --- a/src/gcc/c-family/ChangeLog (.../tags/gcc_8_1_0_release) +++ b/src/gcc/c-family/ChangeLog (.../branches/gcc-8-branch) -@@ -1,3 +1,68 @@ +@@ -1,3 +1,83 @@ ++2018-07-19 Richard Biener ++ ++ Backport from mainline ++ 2018-07-12 Richard Biener ++ ++ PR c/86453 ++ * c-attribs.c (handle_packed_attribute): Do not build a variant ++ type with TYPE_PACKED, instead ignore the attribute if we may ++ not apply to the original type. ++ ++2018-07-12 Jakub Jelinek ++ ++ * c-attribs.c (c_common_attribute_table): Add ++ "omp declare target implicit" attribute. ++ +2018-06-20 Jakub Jelinek + + PR c++/86210 @@ -6060,7 +6144,32 @@ handle_no_sanitize_attribute, NULL }, { "no_sanitize_address", 0, 0, true, false, false, false, handle_no_sanitize_address_attribute, NULL }, -@@ -683,8 +683,8 @@ +@@ -445,6 +445,8 @@ + handle_omp_declare_target_attribute, NULL }, + { "omp declare target link", 0, 0, true, false, false, false, + handle_omp_declare_target_attribute, NULL }, ++ { "omp declare target implicit", 0, 0, true, false, false, false, ++ handle_omp_declare_target_attribute, NULL }, + { "alloc_align", 1, 1, false, true, true, false, + handle_alloc_align_attribute, + attr_alloc_exclusions }, +@@ -517,8 +519,13 @@ + if (TYPE_P (*node)) + { + if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) +- *node = build_variant_type_copy (*node); +- TYPE_PACKED (*node) = 1; ++ { ++ warning (OPT_Wattributes, ++ "%qE attribute ignored for type %qT", name, *node); ++ *no_add_attrs = true; ++ } ++ else ++ TYPE_PACKED (*node) = 1; + } + else if (TREE_CODE (*node) == FIELD_DECL) + { +@@ -683,8 +690,8 @@ handle_no_sanitize_attribute (tree *node, tree name, tree args, int, bool *no_add_attrs) { @@ -6070,7 +6179,7 @@ if (TREE_CODE (*node) != FUNCTION_DECL) { warning (OPT_Wattributes, "%qE attribute ignored", name); -@@ -691,15 +691,19 @@ +@@ -691,15 +698,19 @@ return NULL_TREE; } @@ -6148,7 +6257,13 @@ =================================================================== --- a/src/gcc/c/ChangeLog (.../tags/gcc_8_1_0_release) +++ b/src/gcc/c/ChangeLog (.../branches/gcc-8-branch) -@@ -1,3 +1,25 @@ +@@ -1,3 +1,31 @@ ++2018-07-12 Jakub Jelinek ++ ++ * c-decl.c (c_decl_attributes): Don't diagnose vars without mappable ++ type here, instead add "omp declare target implicit" attribute. ++ (finish_decl): Diagnose vars without mappable type here. ++ +2018-06-20 Jakub Jelinek + + Backported from mainline @@ -6201,6 +6316,50 @@ goto return_build_unary_op; } +Index: gcc/c/c-decl.c +=================================================================== +--- a/src/gcc/c/c-decl.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/c/c-decl.c (.../branches/gcc-8-branch) +@@ -4632,8 +4632,8 @@ + { + if (VAR_P (*node) + && !lang_hooks.types.omp_mappable_type (TREE_TYPE (*node))) +- error ("%q+D in declare target directive does not have mappable type", +- *node); ++ attributes = tree_cons (get_identifier ("omp declare target implicit"), ++ NULL_TREE, attributes); + else + attributes = tree_cons (get_identifier ("omp declare target"), + NULL_TREE, attributes); +@@ -5212,7 +5212,27 @@ + diagnose_uninitialized_cst_member (decl, type); + } + +- invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl); ++ if (flag_openmp ++ && VAR_P (decl) ++ && lookup_attribute ("omp declare target implicit", ++ DECL_ATTRIBUTES (decl))) ++ { ++ DECL_ATTRIBUTES (decl) ++ = remove_attribute ("omp declare target implicit", ++ DECL_ATTRIBUTES (decl)); ++ if (!lang_hooks.types.omp_mappable_type (TREE_TYPE (decl))) ++ error ("%q+D in declare target directive does not have mappable type", ++ decl); ++ else if (!lookup_attribute ("omp declare target", ++ DECL_ATTRIBUTES (decl)) ++ && !lookup_attribute ("omp declare target link", ++ DECL_ATTRIBUTES (decl))) ++ DECL_ATTRIBUTES (decl) ++ = tree_cons (get_identifier ("omp declare target"), ++ NULL_TREE, DECL_ATTRIBUTES (decl)); ++ } ++ ++ invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl); + } + + /* Given a parsed parameter declaration, decode it into a PARM_DECL. Index: gcc/cgraph.c =================================================================== --- a/src/gcc/cgraph.c (.../tags/gcc_8_1_0_release) @@ -6262,7 +6421,7 @@ +++ b/src/gcc/DATESTAMP (.../branches/gcc-8-branch) @@ -1 +1 @@ -20180502 -+20180712 ++20180717 Index: gcc/tree-ssa-strlen.c =================================================================== --- a/src/gcc/tree-ssa-strlen.c (.../tags/gcc_8_1_0_release) @@ -6398,6 +6557,166 @@ || TYPE_OVERFLOW_WRAPS (TREE_TYPE (t)) || (TREE_CODE (TREE_OPERAND (t, 1)) == INTEGER_CST && ! integer_onep (TREE_OPERAND (t, 1)))) +Index: gcc/gimple-ssa-sprintf.c +=================================================================== +--- a/src/gcc/gimple-ssa-sprintf.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/gimple-ssa-sprintf.c (.../branches/gcc-8-branch) +@@ -781,15 +781,19 @@ + fmtresult::type_max_digits (tree type, int base) + { + unsigned prec = TYPE_PRECISION (type); +- if (base == 8) +- return (prec + 2) / 3; ++ switch (base) ++ { ++ case 8: ++ return (prec + 2) / 3; ++ case 10: ++ /* Decimal approximation: yields 3, 5, 10, and 20 for precision ++ of 8, 16, 32, and 64 bits. */ ++ return prec * 301 / 1000 + 1; ++ case 16: ++ return prec / 4; ++ } + +- if (base == 16) +- return prec / 4; +- +- /* Decimal approximation: yields 3, 5, 10, and 20 for precision +- of 8, 16, 32, and 64 bits. */ +- return prec * 301 / 1000 + 1; ++ gcc_unreachable (); + } + + static bool +@@ -1759,6 +1763,11 @@ + unsigned flagmin = (1 /* for the first digit */ + + (dir.get_flag ('+') | dir.get_flag (' '))); + ++ /* The minimum is 3 for "inf" and "nan" for all specifiers, plus 1 ++ for the plus sign/space with the '+' and ' ' flags, respectively, ++ unless reduced below. */ ++ res.range.min = 2 + flagmin; ++ + /* When the pound flag is set the decimal point is included in output + regardless of precision. Whether or not a decimal point is included + otherwise depends on the specification and precision. */ +@@ -1775,14 +1784,13 @@ + else if (dir.prec[0] > 0) + minprec = dir.prec[0] + !radix /* decimal point */; + +- res.range.min = (2 /* 0x */ +- + flagmin +- + radix +- + minprec +- + 3 /* p+0 */); ++ res.range.likely = (2 /* 0x */ ++ + flagmin ++ + radix ++ + minprec ++ + 3 /* p+0 */); + + res.range.max = format_floating_max (type, 'a', prec[1]); +- res.range.likely = res.range.min; + + /* The unlikely maximum accounts for the longest multibyte + decimal point character. */ +@@ -1800,15 +1808,14 @@ + non-zero, decimal point. */ + HOST_WIDE_INT minprec = prec[0] ? prec[0] + !radix : 0; + +- /* The minimum output is "[-+]1.234567e+00" regardless ++ /* The likely minimum output is "[-+]1.234567e+00" regardless + of the value of the actual argument. */ +- res.range.min = (flagmin +- + radix +- + minprec +- + 2 /* e+ */ + 2); ++ res.range.likely = (flagmin ++ + radix ++ + minprec ++ + 2 /* e+ */ + 2); + + res.range.max = format_floating_max (type, 'e', prec[1]); +- res.range.likely = res.range.min; + + /* The unlikely maximum accounts for the longest multibyte + decimal point character. */ +@@ -1827,12 +1834,15 @@ + decimal point. */ + HOST_WIDE_INT minprec = prec[0] ? prec[0] + !radix : 0; + +- /* The lower bound when precision isn't specified is 8 bytes +- ("1.23456" since precision is taken to be 6). When precision +- is zero, the lower bound is 1 byte (e.g., "1"). Otherwise, +- when precision is greater than zero, then the lower bound +- is 2 plus precision (plus flags). */ +- res.range.min = flagmin + radix + minprec; ++ /* For finite numbers (i.e., not infinity or NaN) the lower bound ++ when precision isn't specified is 8 bytes ("1.23456" since ++ precision is taken to be 6). When precision is zero, the lower ++ bound is 1 byte (e.g., "1"). Otherwise, when precision is greater ++ than zero, then the lower bound is 2 plus precision (plus flags). ++ But in all cases, the lower bound is no greater than 3. */ ++ unsigned HOST_WIDE_INT min = flagmin + radix + minprec; ++ if (min < res.range.min) ++ res.range.min = min; + + /* Compute the upper bound for -TYPE_MAX. */ + res.range.max = format_floating_max (type, 'f', prec[1]); +@@ -1842,7 +1852,7 @@ + if (dir.prec[0] < 0 && dir.prec[1] > 0) + res.range.likely = 3; + else +- res.range.likely = res.range.min; ++ res.range.likely = min; + + /* The unlikely maximum accounts for the longest multibyte + decimal point character. */ +@@ -1860,7 +1870,9 @@ + the lower bound on the range of bytes (not counting flags + or width) is 1 plus radix (i.e., either "0" or "0." for + "%g" and "%#g", respectively, with a zero argument). */ +- res.range.min = flagmin + radix; ++ unsigned HOST_WIDE_INT min = flagmin + radix; ++ if (min < res.range.min) ++ res.range.min = min; + + char spec = 'g'; + HOST_WIDE_INT maxprec = dir.prec[1]; +@@ -1992,6 +2004,32 @@ + const REAL_VALUE_TYPE *rvp = TREE_REAL_CST_PTR (arg); + const real_format *rfmt = REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (arg))); + ++ if (!real_isfinite (rvp)) ++ { ++ /* The format for Infinity and NaN is "[-]inf"/"[-]infinity" ++ and "[-]nan" with the choice being implementation-defined ++ but not locale dependent. */ ++ bool sign = dir.get_flag ('+') || real_isneg (rvp); ++ res.range.min = 3 + sign; ++ ++ res.range.likely = res.range.min; ++ res.range.max = res.range.min; ++ /* The inlikely maximum is "[-/+]infinity" or "[-/+]nan". */ ++ res.range.unlikely = sign + (real_isinf (rvp) ? 8 : 3); ++ ++ /* The range for infinity and NaN is known unless either width ++ or precision is unknown. Width has the same effect regardless ++ of whether the argument is finite. Precision is either ignored ++ (e.g., Glibc) or can have an effect on the short vs long format ++ such as inf/infinity (e.g., Solaris). */ ++ res.knownrange = dir.known_width_and_precision (); ++ ++ /* Adjust the range for width but ignore precision. */ ++ res.adjust_for_width_or_precision (dir.width); ++ ++ return res; ++ } ++ + char fmtstr [40]; + char *pfmt = fmtstr; + Index: gcc/cgraphunit.c =================================================================== --- a/src/gcc/cgraphunit.c (.../tags/gcc_8_1_0_release) @@ -6415,7 +6734,123 @@ =================================================================== --- a/src/gcc/ChangeLog (.../tags/gcc_8_1_0_release) +++ b/src/gcc/ChangeLog (.../branches/gcc-8-branch) -@@ -1,3 +1,986 @@ +@@ -1,3 +1,1102 @@ ++2018-07-16 Claudiu Zissulescu ++ ++ Backport from mainline ++ 2017-03-24 Claudiu Zissulescu ++ ++ * config/arc/arc-protos.h (arc_pad_return): Remove. ++ * config/arc/arc.c (machine_function): Remove force_short_suffix ++ and size_reason. ++ (arc_print_operand): Adjust printing of '&'. ++ (arc_verify_short): Remove conditional printing of short suffix. ++ (arc_final_prescan_insn): Remove reference to size_reason. ++ (pad_return): New function. ++ (arc_reorg): Call pad_return. ++ (arc_pad_return): Remove. ++ (arc_init_machine_status): Remove reference to force_short_suffix. ++ * config/arc/arc.md (vunspec): Add VUNSPEC_ARC_BLOCKAGE. ++ (attr length): When attribute iscompact is true force to 2 ++ regardless; in the case of maybe check if we want to force the ++ instruction to have 4 bytes length. ++ (nopv): Change it to generate 4 byte long nop as well. ++ (blockage): New pattern. ++ (simple_return): Remove call to arc_pad_return. ++ (p_return_i): Likewise. ++ ++2018-07-19 Richard Biener ++ ++ Backport from mainline ++ 2018-07-13 Richard Biener ++ ++ PR debug/86452 ++ * dwarf2out.c (gen_type_die_with_usage): Use scope_die_for ++ instead of get_context_die. ++ ++ 2018-07-11 Richard Biener ++ ++ PR debug/86457 ++ * dwarf2out.c (init_sections_and_labels): Use ++ output_asm_line_debug_info consistently. ++ (dwarf2out_early_finish): Likewise. ++ (dwarf2out_finish): Remove DW_AT_stmt_list from early generated ++ type units. ++ ++2018-07-16 Richard Biener ++ ++ Backport from mainline ++ 2018-07-13 Richard Biener ++ ++ PR middle-end/85974 ++ * match.pd (addr1 - addr2): Allow either of the operand to ++ have a conversion. ++ ++ 2018-06-15 Richard Biener ++ ++ PR middle-end/86076 ++ * tree-cfg.c (move_stmt_op): unshare invariant addresses ++ before adjusting their block. ++ ++ 2018-06-06 Richard Biener ++ ++ PR tree-optimization/85935 ++ * graphite-scop-detection.c (find_params_in_bb): Analyze ++ condition operands with respect to the correct loop. Assert ++ the analysis doesn't fail. ++ ++2018-07-16 Eric Botcazou ++ ++ PR tree-optimization/86514 ++ * tree-ssa-reassoc.c (init_range_entry) : Return for a ++ conversion to a boolean type from a type with greater precision. ++ ++2018-07-15 Bill Schmidt ++ ++ Backport from mainline ++ 2018-07-13 Bill Schmidt ++ Steve Munroe ++ ++ * config/rs6000/emmintrin.h (_mm_and_si128): New function. ++ (_mm_andnot_si128): Likewise. ++ (_mm_or_si128): Likewise. ++ (_mm_xor_si128): Likewise. ++ ++2018-07-14 Martin Sebor ++ ++ PR tree-optimization/86274 ++ * gimple-ssa-sprintf.c (fmtresult::type_max_digits): Verify ++ precondition. ++ (format_floating): Correct handling of infinities and NaNs. ++ ++2018-07-13 H.J. Lu ++ ++ Backport from mainline ++ 2018-07-13 H.J. Lu ++ Sunil K Pandey ++ ++ PR target/84413 ++ * config/i386/i386.c (m_CORE_AVX512): New. ++ (m_CORE_AVX2): Likewise. ++ (m_CORE_ALL): Add m_CORE_AVX2. ++ * config/i386/x86-tune.def: Replace m_HASWELL with m_CORE_AVX2. ++ Replace m_SKYLAKE_AVX512 with m_CORE_AVX512 on avx256_optimal ++ and remove the rest of m_SKYLAKE_AVX512. ++ ++2018-07-13 Marek Polacek ++ ++ Backport from trunk ++ 2018-07-03 Marek Polacek ++ ++ PR middle-end/86202 ++ * gimple-fold.c (size_must_be_zero_p): Check the type of the size. ++ ++2018-07-12 Richard Biener ++ ++ PR target/84829 ++ * config/gnu-user.h (GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC): ++ Remove -mieee-fp handling. ++ +2018-07-12 Jakub Jelinek + + PR tree-optimization/86492 @@ -8118,6 +8553,52 @@ +/* { dg-final { scan-assembler-not {\m(stfd|stxsd)x?\M} } } */ +/* { dg-final { scan-assembler-not {\m(lfd|lxsd)x?\M} } } */ +/* { dg-final { scan-assembler-not {\m(mtvsrd|mfvsrd)\M} } } */ +Index: gcc/testsuite/gcc.target/powerpc/sse2-pand-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/powerpc/sse2-pand-1.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/powerpc/sse2-pand-1.c (.../branches/gcc-8-branch) +@@ -0,0 +1,41 @@ ++/* { dg-do run } */ ++/* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */ ++/* { dg-require-effective-target lp64 } */ ++/* { dg-require-effective-target p8vector_hw } */ ++ ++#ifndef CHECK_H ++#define CHECK_H "sse2-check.h" ++#endif ++ ++#include CHECK_H ++ ++#ifndef TEST ++#define TEST sse2_test_pand_1 ++#endif ++ ++#include ++ ++static __m128i ++__attribute__((noinline, unused)) ++test (__m128i s1, __m128i s2) ++{ ++ return _mm_and_si128 (s1, s2); ++} ++ ++static void ++TEST (void) ++{ ++ union128i_b u, s1, s2; ++ char e[16]; ++ int i; ++ ++ s1.x = _mm_set_epi8 (1,2,3,4,10,20,30,90,-80,-40,-100,-15,98, 25, 98,7); ++ s2.x = _mm_set_epi8 (88, 44, 33, 22, 11, 98, 76, -100, -34, -78, -39, 6, 3, 4, 5, 119); ++ u.x = test (s1.x, s2.x); ++ ++ for (i = 0; i < 16; i++) ++ e[i] = s1.a[i] & s2.a[i]; ++ ++ if (check_union128i_b (u, e)) ++ abort (); ++} Index: gcc/testsuite/gcc.target/powerpc/pr67808.c =================================================================== --- a/src/gcc/testsuite/gcc.target/powerpc/pr67808.c (.../tags/gcc_8_1_0_release) @@ -8537,6 +9018,54 @@ + return 0; +} +#endif +Index: gcc/testsuite/gcc.target/powerpc/sse2-por-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/powerpc/sse2-por-1.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/powerpc/sse2-por-1.c (.../branches/gcc-8-branch) +@@ -0,0 +1,43 @@ ++/* { dg-do run } */ ++/* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */ ++/* { dg-require-effective-target lp64 } */ ++/* { dg-require-effective-target p8vector_hw } */ ++ ++#ifndef CHECK_H ++#define CHECK_H "sse2-check.h" ++#endif ++ ++#include CHECK_H ++ ++#ifndef TEST ++#define TEST sse2_test_por_1 ++#endif ++ ++#include ++ ++static __m128i ++__attribute__((noinline, unused)) ++test (__m128i s1, __m128i s2) ++{ ++ return _mm_or_si128 (s1, s2); ++} ++ ++static void ++TEST (void) ++{ ++ union128i_w u, s1, s2; ++ short e[8]; ++ int i; ++ ++ s1.x = _mm_set_epi16 (10,20,30,90,-80,-40,-100,-15); ++ s2.x = _mm_set_epi16 (11, 98, 76, -100, -34, -78, -39, 14); ++ u.x = test (s1.x, s2.x); ++ ++ for (i = 0; i < 8; i++) ++ { ++ e[i] = s1.a[i] | s2.a[i]; ++ } ++ ++ if (check_union128i_w (u, e)) ++ abort (); ++} Index: gcc/testsuite/gcc.target/powerpc/pr60203.c =================================================================== --- a/src/gcc/testsuite/gcc.target/powerpc/pr60203.c (.../tags/gcc_8_1_0_release) @@ -8787,6 +9316,98 @@ +} + + +Index: gcc/testsuite/gcc.target/powerpc/sse2-pxor-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/powerpc/sse2-pxor-1.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/powerpc/sse2-pxor-1.c (.../branches/gcc-8-branch) +@@ -0,0 +1,41 @@ ++/* { dg-do run } */ ++/* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */ ++/* { dg-require-effective-target lp64 } */ ++/* { dg-require-effective-target p8vector_hw } */ ++ ++#ifndef CHECK_H ++#define CHECK_H "sse2-check.h" ++#endif ++ ++#include CHECK_H ++ ++#ifndef TEST ++#define TEST sse2_test_pxor_1 ++#endif ++ ++#include ++ ++static __m128i ++__attribute__((noinline, unused)) ++test (__m128i s1, __m128i s2) ++{ ++ return _mm_xor_si128 (s1, s2); ++} ++ ++static void ++TEST (void) ++{ ++ union128i_ub u, s1, s2; ++ unsigned char e[16] = {0}; ++ int i; ++ ++ s1.x = _mm_set_epi8 (1,2,3,4,10,20,30,90,80,40,100,15,98, 25, 98,7); ++ s2.x = _mm_set_epi8 (88, 44, 33, 22, 11, 98, 76, 100, 34, 78, 39, 6, 3, 4, 5, 119); ++ u.x = test (s1.x, s2.x); ++ ++ for (i = 0; i < 16; i++) ++ e[i] = s1.a[i] ^ s2.a[i]; ++ ++ if (check_union128i_ub (u, e)) ++ abort (); ++} +Index: gcc/testsuite/gcc.target/powerpc/sse2-pandn-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/powerpc/sse2-pandn-1.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/powerpc/sse2-pandn-1.c (.../branches/gcc-8-branch) +@@ -0,0 +1,41 @@ ++/* { dg-do run } */ ++/* { dg-options "-O3 -mpower8-vector -Wno-psabi" } */ ++/* { dg-require-effective-target lp64 } */ ++/* { dg-require-effective-target p8vector_hw } */ ++ ++#ifndef CHECK_H ++#define CHECK_H "sse2-check.h" ++#endif ++ ++#include CHECK_H ++ ++#ifndef TEST ++#define TEST sse2_test_pandn_1 ++#endif ++ ++#include ++ ++static __m128i ++__attribute__((noinline, unused)) ++test (__m128i s1, __m128i s2) ++{ ++ return _mm_andnot_si128 (s1, s2); ++} ++ ++static void ++TEST (void) ++{ ++ union128i_b u, s1, s2; ++ char e[16]; ++ int i; ++ ++ s1.x = _mm_set_epi8 (1,2,3,4,10,20,30,90,-80,-40,-100,-15,98, 25, 98,7); ++ s2.x = _mm_set_epi8 (88, 44, 33, 22, 11, 98, 76, -100, -34, -78, -39, 6, 3, 4, 5, 119); ++ u.x = test (s1.x, s2.x); ++ ++ for (i = 0; i < 16; i++) ++ e[i] = (~s1.a[i]) & s2.a[i]; ++ ++ if (check_union128i_b (u, e)) ++ abort (); ++} Index: gcc/testsuite/gcc.target/powerpc/pr70117.c =================================================================== --- a/src/gcc/testsuite/gcc.target/powerpc/pr70117.c (.../tags/gcc_8_1_0_release) @@ -9168,6 +9789,28 @@ +#define AVX512F_LEN 128 +#define AVX512F_LEN_HALF 128 +#include "avx512bw-vpcmpgeuw-2.c" +Index: gcc/testsuite/gcc.target/i386/pr84413-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr84413-1.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr84413-1.c (.../branches/gcc-8-branch) +@@ -0,0 +1,17 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O3 -march=skylake-avx512" } */ ++/* { dg-final { scan-assembler-not "%zmm\[0-9\]+" } } */ ++/* { dg-final { scan-assembler "vmulpd\[ \\t\]+\[^\n\]*%ymm\[0-9\]+" } } */ ++ ++#define N 1024 ++ ++double a[N], b[N], c[N]; ++ ++void ++avx512f_test (void) ++{ ++ int i; ++ ++ for (i = 0; i < N; i++) ++ c[i] = a[i] * b[i]; ++} Index: gcc/testsuite/gcc.target/i386/pr85950.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr85950.c (.../tags/gcc_8_1_0_release) @@ -9189,6 +9832,18 @@ + +/* { dg-final { scan-assembler-times "roundsd" 2 { target ia32 } } } */ +/* { dg-final { scan-assembler-times "roundsd" 4 { target { ! ia32 } } } } */ +Index: gcc/testsuite/gcc.target/i386/pr84829.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr84829.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr84829.c (.../branches/gcc-8-branch) +@@ -0,0 +1,7 @@ ++/* { dg-do link } */ ++/* { dg-options "-mieee-fp" } */ ++ ++int main() ++{ ++ return 0; ++} Index: gcc/testsuite/gcc.target/i386/pr86048.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/pr86048.c (.../tags/gcc_8_1_0_release) @@ -9241,6 +9896,28 @@ +#define AVX512F_LEN 128 +#define AVX512F_LEN_HALF 128 +#include "avx512bw-vpcmpleb-2.c" +Index: gcc/testsuite/gcc.target/i386/pr84413-2.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr84413-2.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr84413-2.c (.../branches/gcc-8-branch) +@@ -0,0 +1,17 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O3 -march=cannonlake" } */ ++/* { dg-final { scan-assembler-not "%zmm\[0-9\]+" } } */ ++/* { dg-final { scan-assembler "vmulpd\[ \\t\]+\[^\n\]*%ymm\[0-9\]+" } } */ ++ ++#define N 1024 ++ ++double a[N], b[N], c[N]; ++ ++void ++avx512f_test (void) ++{ ++ int i; ++ ++ for (i = 0; i < N; i++) ++ c[i] = a[i] * b[i]; ++} Index: gcc/testsuite/gcc.target/i386/xgetsetbv.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/xgetsetbv.c (.../tags/gcc_8_1_0_release) @@ -9412,6 +10089,28 @@ + if (UNION_CHECK (AVX512F_LEN,) (res3, res_ref)) + abort (); +} +Index: gcc/testsuite/gcc.target/i386/pr84413-3.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/i386/pr84413-3.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/i386/pr84413-3.c (.../branches/gcc-8-branch) +@@ -0,0 +1,17 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O3 -march=icelake-server" } */ ++/* { dg-final { scan-assembler-not "%zmm\[0-9\]+" } } */ ++/* { dg-final { scan-assembler "vmulpd\[ \\t\]+\[^\n\]*%ymm\[0-9\]+" } } */ ++ ++#define N 1024 ++ ++double a[N], b[N], c[N]; ++ ++void ++avx512f_test (void) ++{ ++ int i; ++ ++ for (i = 0; i < N; i++) ++ c[i] = a[i] * b[i]; ++} Index: gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltb-2.c =================================================================== --- a/src/gcc/testsuite/gcc.target/i386/avx512vl-vpcmpltb-2.c (.../tags/gcc_8_1_0_release) @@ -9734,6 +10433,62 @@ + + return wk; +} +Index: gcc/testsuite/gcc.target/arc/pr9001107555.c +=================================================================== +--- a/src/gcc/testsuite/gcc.target/arc/pr9001107555.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.target/arc/pr9001107555.c (.../branches/gcc-8-branch) +@@ -0,0 +1,51 @@ ++/* { dg-do assemble } * ++/* { dg-skip-if "" { ! { clmcpu } } } */ ++/* { dg-options "-O3 -funroll-loops -mno-sdata -mcpu=arc700" } */ ++ ++typedef long long a __attribute__((__mode__(__DI__))); ++typedef struct c c; ++ ++struct b ++{ ++ int d; ++ c *e; ++}; ++ ++enum { f }; ++ ++typedef struct ++{ ++ a g; ++ a h; ++ int i; ++} j; ++ ++struct c ++{ ++ int count; ++ int current; ++}; ++ ++int k; ++ ++extern void bar (int, long long); ++int foo (struct b *demux, __builtin_va_list args) ++{ ++ c m = *demux->e; ++ j *n; ++ switch (k) ++ case f: ++ { ++ a o = __builtin_va_arg(args, a); ++ m.current = 0; ++ while (m.current < m.count) ++ { ++ if (n[m.current].h > o) { ++ bar (demux->d, 4 + 128LL * n[m.current].i); ++ break; ++ } ++ m.current++; ++ } ++ return 0; ++ } ++} Index: gcc/testsuite/g++.target/arm/pr81497.C =================================================================== --- a/src/gcc/testsuite/g++.target/arm/pr81497.C (.../tags/gcc_8_1_0_release) @@ -10457,6 +11212,47 @@ + data x /0/ ! { dg-error "GNU Extension: re-initialization" } + print *, x +end subroutine foo +Index: gcc/testsuite/gfortran.dg/init_flag_19.f03 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/init_flag_19.f03 (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gfortran.dg/init_flag_19.f03 (.../branches/gcc-8-branch) +@@ -0,0 +1,36 @@ ++! { dg-do compile } ++! { dg-options "-finit-derived -finit-local-zero -fdump-tree-original" } ++! ++! Test initializers for BT_CLASS components/variables with -finit-derived. ++! ++ ++implicit none ++ ++type :: ty1 ++ integer :: ival ++ real :: rval ++end type ++ ++type :: ty2 ++ type(ty1) :: bt ++ type(ty1), allocatable :: bt_alloc ++ type(ty1), pointer :: bt_ptr ++ class(ty1), allocatable :: class_alloc ++ class(ty1), pointer :: class_ptr ++end type ++ ++type(ty2) basic ++class(ty1), allocatable :: calloc ++ ++print *, basic%bt%ival ++print *, calloc%ival ++ ++end ++ ++! { dg-final { scan-tree-dump-times "\.ival *= *0" 1 "original" } } ++! { dg-final { scan-tree-dump-times "\.rval *= *0" 1 "original" } } ++! { dg-final { scan-tree-dump-times "\.bt_ptr *= *0" 1 "original" } } ++! { dg-final { scan-tree-dump-times "\.bt_alloc *= *0" 1 "original" } } ++! { dg-final { scan-tree-dump-times "\.class_alloc(?: *= *\{)?\._data *= *0" 1 "original" } } ++! { dg-final { scan-tree-dump-times "\.class_ptr(?: *= *\{)?\._data *= *0" 1 "original" } } ++! { dg-final { scan-tree-dump-times "calloc(?: *= *\{)?\._data *= *0" 1 "original" } } Index: gcc/testsuite/gfortran.dg/pr67805.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr67805.f90 (.../tags/gcc_8_1_0_release) @@ -10701,6 +11497,22 @@ + logical :: good + end function checkFmt +end module fox_m_fsys_format +Index: gcc/testsuite/gfortran.dg/assumed_rank_15.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/assumed_rank_15.f90 (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gfortran.dg/assumed_rank_15.f90 (.../branches/gcc-8-branch) +@@ -0,0 +1,11 @@ ++! { dg-do compile } ++! { dg-options "-fdec-structure" } ++! ++! PR fortran/83184 ++! ++ ++structure /s/ ++ integer n(..) /1/ ! { dg-error "must have an explicit shape" } ++end structure ++ ++end Index: gcc/testsuite/gfortran.dg/pr63514.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr63514.f90 (.../tags/gcc_8_1_0_release) @@ -10792,6 +11604,30 @@ + end select + if (section_copy%i .ne. 100) stop 1 +end +Index: gcc/testsuite/gfortran.dg/init_flag_18.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/init_flag_18.f90 (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gfortran.dg/init_flag_18.f90 (.../branches/gcc-8-branch) +@@ -0,0 +1,19 @@ ++! { dg-do compile } ++! { dg-options "-finit-derived" } ++! ++! PR fortran/83183 ++! ++! Test a regression where -finit-derived recursed infinitely generating ++! initializers for allocatable components of the same derived type. ++! ++ ++program pr83183 ++ type :: linked_list ++ type(linked_list), allocatable :: link ++ integer :: value ++ end type ++ type(linked_list) :: test ++ allocate(test % link) ++ print *, test%value ++ print *, test%link%value ++end program Index: gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/allocate_alloc_opt_1.f90 (.../tags/gcc_8_1_0_release) @@ -10950,6 +11786,36 @@ + character :: x = t('a') ! { dg-error "convert TYPE" } + data x /'b'/ +end +Index: gcc/testsuite/gfortran.dg/dec_structure_8.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/dec_structure_8.f90 (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gfortran.dg/dec_structure_8.f90 (.../branches/gcc-8-branch) +@@ -6,7 +6,7 @@ + + ! Old-style (clist) initialization + integer,parameter :: as = 3 +-structure /t1/ ++structure /t1/ ! { dg-error "Type definition.*T1" } + integer*1 a /300_2/ ! { dg-error "Arithmetic overflow" } + integer b // ! { dg-error "Empty old style initializer list" } + integer c /2*3/ ! { dg-error "Repeat spec invalid in scalar" } +@@ -44,14 +44,14 @@ + + structure /t2/ + ENTRY here ! { dg-error "ENTRY statement.*cannot appear" } +- integer a + integer a ! { dg-error "Component.*already declared" } ++ integer a ! { dg-error "Component.*already declared" } + structure $z ! { dg-error "Invalid character in name" } + structure // ! { dg-error "Invalid character in name" } + structure // x ! { dg-error "Invalid character in name" } + structure /t3/ ! { dg-error "Invalid character in name" } + structure /t3/ x,$y ! { dg-error "Invalid character in name" } +- structure /t4/ y ++ structure /t4/ y ! { dg-error "Type definition.*T4" } + integer i, j, k + end structure + structure /t4/ z ! { dg-error "Type definition.*T4" } Index: gcc/testsuite/gfortran.dg/pr85521_2.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/pr85521_2.f90 (.../tags/gcc_8_1_0_release) @@ -11041,6 +11907,22 @@ + character(len=*), intent(in) :: s + end function checkfmt +end module fox_m_fsys_format +Index: gcc/testsuite/gfortran.dg/assumed_rank_14.f90 +=================================================================== +--- a/src/gcc/testsuite/gfortran.dg/assumed_rank_14.f90 (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gfortran.dg/assumed_rank_14.f90 (.../branches/gcc-8-branch) +@@ -0,0 +1,11 @@ ++! { dg-do compile } ++! { dg-options "-std=legacy" } ++! ++! PR fortran/83184 ++! ++ ++integer n1(..) /1/ ++! { dg-error "Assumed-rank array.*must be a dummy argument" "" { target *-*-* } 7 } ++! { dg-error "Assumed-rank variable.*actual argument" "" { target *-*-* } 7 } ++ ++end Index: gcc/testsuite/gfortran.dg/associate_30.f90 =================================================================== --- a/src/gcc/testsuite/gfortran.dg/associate_30.f90 (.../tags/gcc_8_1_0_release) @@ -11373,6 +12255,15 @@ + int t2 = (t1 == 0); + return t2; +} +Index: gcc/testsuite/gcc.c-torture/compile/930326-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.c-torture/compile/930326-1.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.c-torture/compile/930326-1.c (.../branches/gcc-8-branch) +@@ -4,3 +4,4 @@ + } s; + + long i = s.f-&s.b; ++long long j = s.f-&s.b; Index: gcc/testsuite/gcc.c-torture/compile/pr86122.c =================================================================== --- a/src/gcc/testsuite/gcc.c-torture/compile/pr86122.c (.../tags/gcc_8_1_0_release) @@ -11423,6 +12314,45 @@ + function Max return Natural; + +end Discr53_Pkg; +Index: gcc/testsuite/gnat.dg/opt73.adb +=================================================================== +--- a/src/gcc/testsuite/gnat.dg/opt73.adb (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gnat.dg/opt73.adb (.../branches/gcc-8-branch) +@@ -0,0 +1,34 @@ ++-- { dg-do run } ++-- { dg-options "-O" } ++ ++procedure Opt73 is ++ ++ type Terminal_Set_Indexed_By_Non_Terminal is ++ array (Natural range <>, Natural range <>) of Boolean with Pack; ++ ++ type Terminal_Set_Per_Non_Terminal ++ (Last_Terminal : Natural; ++ Last_Non_Terminal : Natural) is ++ record ++ Map : Terminal_Set_Indexed_By_Non_Terminal ++ (1 .. Last_Non_Terminal, 0 .. Last_Terminal); ++ end record; ++ ++ Follow : Terminal_Set_Per_Non_Terminal (5, 4); ++ Expect : Terminal_Set_Per_Non_Terminal := ++ (5, 4, (1 => (2 => True, others => False), ++ others => (others => False))); ++ ++ procedure Get_Follow (Value : out Terminal_Set_Per_Non_Terminal) is ++ begin ++ Value.Map := (others => (others => False)); ++ Value.Map (1, 2) := True; ++ Value.Map (2, 0) := Value.Map (2, 0) or Value.Map (1, 0); ++ end; ++ ++begin ++ Get_Follow (Follow); ++ if Follow /= Expect then ++ raise Program_Error; ++ end if; ++end; Index: gcc/testsuite/gnat.dg/stack_usage1.adb =================================================================== --- a/src/gcc/testsuite/gnat.dg/stack_usage1.adb (.../tags/gcc_8_1_0_release) @@ -11629,6 +12559,27 @@ + function Max return Natural; + +end Opt3_Pkg; +Index: gcc/testsuite/gnat.dg/discr55.adb +=================================================================== +--- a/src/gcc/testsuite/gnat.dg/discr55.adb (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gnat.dg/discr55.adb (.../branches/gcc-8-branch) +@@ -0,0 +1,16 @@ ++-- { dg-do run } ++ ++procedure Discr55 is ++ ++ type Rec (C : Character) is record ++ case C is ++ when 'Z' .. Character'Val (128) => I : Integer; ++ when others => null; ++ end case; ++ end record; ++ ++ R : Rec ('Z'); ++ ++begin ++ R.I := 0; ++end; Index: gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/Walloc-size-larger-than-5.c (.../tags/gcc_8_1_0_release) @@ -11803,6 +12754,67 @@ + n = __SIZE_MAX__; + T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */ +} +Index: gcc/testsuite/gcc.dg/pr86076.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/pr86076.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/pr86076.c (.../branches/gcc-8-branch) +@@ -0,0 +1,26 @@ ++/* { dg-do compile { target pthread } } */ ++/* { dg-options "-O2 -ftree-parallelize-loops=2 -fno-tree-dce -fno-tree-pre -fno-tree-vrp --param max-loop-header-insns=1" } */ ++ ++int __attribute__ ((noinline)) ++lv (int tm) ++{ ++ (void) tm; ++ ++ return 0; ++} ++ ++void ++o7 (int uu) ++{ ++ while (uu < 1) ++ while (uu != 0) ++ { ++ short int ca; ++ ++ ca = lv (0); ++ (void) ca; ++ ++uu; ++ } ++ ++ lv (lv (0)); ++} +Index: gcc/testsuite/gcc.dg/graphite/pr85935.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/graphite/pr85935.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/graphite/pr85935.c (.../branches/gcc-8-branch) +@@ -0,0 +1,25 @@ ++/* { dg-do compile } */ ++/* { dg-options "-O -floop-parallelize-all -fno-tree-loop-im --param scev-max-expr-size=3" } */ ++ ++typedef int dq; ++ ++int gb; ++ ++void ++qq (dq ww, int kk) ++{ ++ dq *up = &ww; ++ ++ (void) *up; ++ ++ while (kk < 1) ++ { ++ ++ww; ++ ++ if (ww == 0) ++ for (gb = 0; gb < 2; ++gb) ++ ; ++ ++ ++kk; ++ } ++} Index: gcc/testsuite/gcc.dg/store_merging_14.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/store_merging_14.c (.../tags/gcc_8_1_0_release) @@ -11875,6 +12887,40 @@ + n = __SIZE_MAX__; + T (__builtin_malloc (n)); /* { dg-warning "exceeds maximum object size" } */ +} +Index: gcc/testsuite/gcc.dg/torture/builtin-sprintf.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/torture/builtin-sprintf.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/torture/builtin-sprintf.c (.../branches/gcc-8-branch) +@@ -0,0 +1,29 @@ ++/* PR tree-optimization/86274 - SEGFAULT when logging std::to_string(NAN) ++ { dg-do run } ++ { dg-options "-O2 -Wall" } */ ++ ++#define X "0xdeadbeef" ++#define nan(x) __builtin_nan (x) ++ ++volatile double nan_0 = nan ("0"); ++volatile double nan_x = nan (X); ++ ++int main (void) ++{ ++ char buf[80]; ++ ++ /* Verify that folded results match those of the library calls. */ ++ int cst_n_0 = __builtin_sprintf (buf, "%g", nan ("0")); ++ int cst_n_x = __builtin_sprintf (buf, "%g", nan (X)); ++ ++ int var_n_0 = __builtin_sprintf (buf, "%g", nan_0); ++ int var_n_x = __builtin_sprintf (buf, "%g", nan_x); ++ ++ if (cst_n_0 != var_n_0) ++ __builtin_abort (); ++ ++ if (cst_n_x != var_n_x) ++ __builtin_abort (); ++ ++ return 0; ++} Index: gcc/testsuite/gcc.dg/torture/pr85615.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/torture/pr85615.c (.../tags/gcc_8_1_0_release) @@ -12368,6 +13414,22 @@ + n = __SIZE_MAX__; + T (__builtin_malloc (n)); +} +Index: gcc/testsuite/gcc.dg/Wint-conversion-2.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/Wint-conversion-2.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/Wint-conversion-2.c (.../branches/gcc-8-branch) +@@ -0,0 +1,11 @@ ++/* PR middle-end/86202 */ ++/* { dg-do compile } */ ++/* { dg-options "-Wint-conversion" } */ ++ ++void *memcpy (void *, void *, __SIZE_TYPE__ *); ++void *a, *b; ++void f (void) ++{ ++ long unsigned int c = 0; ++ memcpy (a, b, c); /* { dg-warning "passing argument" } */ ++} Index: gcc/testsuite/gcc.dg/Walloc-size-larger-than-2.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/Walloc-size-larger-than-2.c (.../tags/gcc_8_1_0_release) @@ -12560,6 +13622,685 @@ + while (tok != ((void *)0) ) + debug_parse_param(tok); +} +Index: gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c (.../branches/gcc-8-branch) +@@ -71,14 +71,14 @@ + T ( 7, "%*a", w, d); + T (21, "%*a", w, 3.141); + +- T (12, "%*e", w, d); /* { dg-warning "writing a terminating nul" } */ +- T (12, "%#*e", w, d); /* { dg-warning "writing a terminating nul" } */ ++ T (12, "%*e", w, d); /* { dg-warning "may write a terminating nul" } */ ++ T (12, "%#*e", w, d); /* { dg-warning "may write a terminating nul" } */ + T (13, "%*e", w, d); + T (13, "%#*e", w, d); + T (13, "%*e", w, 3.141); + +- T ( 8, "%*f", w, d); /* { dg-warning "writing a terminating nul" } */ +- T ( 8, "%#*f", w, d); /* { dg-warning "writing a terminating nul" } */ ++ T ( 8, "%*f", w, d); /* { dg-warning "may write a terminating nul" } */ ++ T ( 8, "%#*f", w, d); /* { dg-warning "may write a terminating nul" } */ + T ( 9, "%*f", w, d); + T ( 9, "%#*f", w, d); + T ( 9, "%*f", w, 3.141); +@@ -106,20 +106,20 @@ + + void test_unknown_precision_floating (int p, double d) + { +- T ( 0, "%.*a", R (-1, 0), d); /* { dg-warning "between 6 and 24 " } */ +- T ( 6, "%.*a", R (-1, 0), d); /* { dg-warning "writing a terminating nul" } */ ++ T ( 0, "%.*a", R (-1, 0), d); /* { dg-warning "between 3 and 24 " } */ ++ T ( 6, "%.*a", R (-1, 0), d); /* { dg-warning "may write a terminating nul" } */ + T ( 7, "%.*a", R (-1, 0), d); + T ( 7, "%.*a", p, d); + T (21, "%.*a", p, 3.141); + +- T ( 0, "%.*e", R (-1, 0), d); /* { dg-warning "between 5 and 14 " } */ +- T ( 0, "%.*e", R (-1, 6), d); /* { dg-warning "between 5 and 14 " } */ +- T ( 5, "%.*e", R (-1, 6), d); /* { dg-warning "writing a terminating nul" } */ ++ T ( 0, "%.*e", R (-1, 0), d); /* { dg-warning "between 3 and 14 " } */ ++ T ( 0, "%.*e", R (-1, 6), d); /* { dg-warning "between 3 and 14 " } */ ++ T ( 5, "%.*e", R (-1, 6), d); /* { dg-warning "may write a terminating nul" } */ + T ( 6, "%.*e", R (-1, 6), d); +- /* "%.0e", 0.0 results in 5 bytes: "0e+00" */ +- T ( 5, "%.*e", p, d); /* { dg-warning "writing a terminating nul" } */ +- /* "%#.0e", 0.0 results in 6 bytes: "0.e+00" */ +- T ( 6, "%#.*e", p, d); /* { dg-warning "writing a terminating nul" } */ ++ /* "%.0e", 0.0 results in 3 or 5 bytes: "inf"/"nan" or "0e+00" */ ++ T ( 5, "%.*e", p, d); /* { dg-warning "may write a terminating nul" } */ ++ /* "%#.0e", 0.0 results in 3 or 6 bytes: "inf"/"nan" or "0.e+00" */ ++ T ( 6, "%#.*e", p, d); /* { dg-warning "may write a terminating nul" } */ + T ( 6, "%.*e", p, d); + T ( 6, "%.*e", p, 3.141); + T ( 6, "%#.*e", p, 3.141); /* { dg-warning "writing a terminating nul" } */ +@@ -183,10 +183,10 @@ + T ( 7, "%*.*a", w, p, d); + T (21, "%*.*a", w, p, 3.141); + +- /* "%0.0e", 0.0 results in 5 bytes: "0e+00" */ +- T ( 5, "%*.*e", w, p, d); /* { dg-warning "writing a terminating nul" } */ +- /* "%#0.0e", 0.0 results in 6 bytes: "0.e+00" */ +- T ( 6, "%#*.*e", w, p, d); /* { dg-warning "writing a terminating nul" } */ ++ /* "%0.0e", 0.0 results in 3 or 5 bytes: "inf"/"nan" or "0e+00" */ ++ T ( 5, "%*.*e", w, p, d); /* { dg-warning "may write a terminating nul" } */ ++ /* "%#0.0e", 0.0 results in 3 or 6 bytes: "inf"/"nan" or "0.e+00" */ ++ T ( 6, "%#*.*e", w, p, d); /* { dg-warning "may write a terminating nul" } */ + T ( 6, "%*.*e", w, p, d); + T ( 6, "%*.*e", w, p, 3.141); + T ( 6, "%#*.*e", w, p, 3.141);/* { dg-warning "writing a terminating nul" } */ +Index: gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c (.../branches/gcc-8-branch) +@@ -479,12 +479,12 @@ + RNG (11, 16, 17, "%.*a", 4, 6.0); /* 0xc.0000p-1 */ + RNG (12, 17, 18, "%.*a", 5, 7.0); /* 0xe.00000p-1 */ + /* d is in [ 0, -DBL_MAX ] */ +- RNG ( 6, 10, 11, "%.0a", d); /* 0x0p+0 ... -0x2p+1023 */ ++ RNG ( 3, 10, 11, "%.0a", d); /* inf/nan or 0x0p+0 ... -0x2p+1023 */ + /* %a is poorly specified and allows for implementations divergence: + some (such as Glibc) trim redundant trailing zeros after decimal + point and others (e.g., Solaris) don't. */ +- RNG ( 8, 30, 31, "%.1a", d); /* 0x0.0p+0 ... -0x2.0...0p+1023 */ +- RNG ( 9, 30, 31, "%.2a", d); /* 0x0.00p+0 ... -0x2.00...0p+1023 */ ++ RNG ( 3, 30, 31, "%.1a", d); /* inf or 0x0.0p+0 ... -0x2.0...0p+1023 */ ++ RNG ( 3, 30, 31, "%.2a", d); /* inf or 0x0.00p+0 ... -0x2.00...0p+1023 */ + } + + static void __attribute__ ((noinline, noclone)) +@@ -522,29 +522,32 @@ + RNG (12, 17, 18, "%e", 1.0e-12); + RNG (13, 18, 19, "%e", 1.0e-123); + +- RNG (12, 19, 20, "%e", d); +- RNG ( 5, 11, 12, "%.e", d); +- RNG ( 5, 12, 13, "%.0e", d); +- RNG ( 7, 14, 15, "%.1e", d); +- RNG ( 8, 15, 16, "%.2e", d); +- RNG ( 9, 16, 17, "%.3e", d); +- RNG (10, 17, 18, "%.4e", d); +- RNG (11, 18, 19, "%.5e", d); +- RNG (12, 19, 20, "%.6e", d); +- RNG (13, 20, 21, "%.7e", d); ++ RNG ( 3, 19, 20, "%e", d); ++ RNG ( 3, 11, 12, "%.e", d); ++ RNG ( 3, 12, 13, "%.0e", d); ++ RNG ( 3, 14, 15, "%.1e", d); ++ RNG ( 3, 15, 16, "%.2e", d); ++ RNG ( 3, 16, 17, "%.3e", d); ++ RNG ( 3, 17, 18, "%.4e", d); ++ RNG ( 3, 18, 19, "%.5e", d); ++ RNG ( 3, 19, 20, "%.6e", d); ++ RNG ( 3, 20, 21, "%.7e", d); + +- RNG (4006, 4013, 4014, "%.4000e", d); ++ RNG ( 3, 4013, 4014, "%.4000e", d); + +- RNG ( 5, 7, 8, "%.*e", 0, d); +- RNG ( 7, 14, 15, "%.*e", 1, d); +- RNG ( 8, 15, 16, "%.*e", 2, d); +- RNG ( 9, 16, 17, "%.*e", 3, d); +- RNG (10, 17, 18, "%.*e", 4, d); +- RNG (11, 18, 19, "%.*e", 5, d); +- RNG (12, 19, 20, "%.*e", 6, d); +- RNG (13, 20, 21, "%.*e", 7, d); ++ RNG ( 3, 7, 8, "%.*e", 0, d); ++ RNG ( 3, 14, 15, "%.*e", 1, d); ++ RNG ( 3, 15, 16, "%.*e", 2, d); ++ RNG ( 3, 16, 17, "%.*e", 3, d); ++ RNG ( 3, 17, 18, "%.*e", 4, d); ++ RNG ( 3, 18, 19, "%.*e", 5, d); ++ RNG ( 3, 19, 20, "%.*e", 6, d); ++ RNG ( 3, 20, 21, "%.*e", 7, d); + +- RNG (4006, 4013, 4014, "%.*e", 4000, d); ++ RNG ( 3, 4013, 4014, "%.*e", 4000, d); ++ RNG ( 4, 4013, 4014, "%+.*e", 4000, d); ++ RNG ( 4, 4013, 4014, "% .*e", 4000, d); ++ RNG ( 3, 4013, 4014, "%#.*e", 4000, d); + } + + static void __attribute__ ((noinline, noclone)) +@@ -584,26 +587,27 @@ + RNG (20, 26, 27, "%.13Le", 1.0e-113L); + + /* The following correspond to the double results plus 1 for the upper +- bound accounting for the four-digit exponent. */ +- RNG (12, 20, 21, "%Le", d); /* 0.000000e+00 ... -1.189732e+4932 */ +- RNG ( 5, 8, 9, "%.Le", d); +- RNG ( 5, 9, 10, "%.0Le", d); +- RNG ( 7, 15, 16, "%.1Le", d); /* 0.0e+00 ... -1.2e+4932 */ +- RNG ( 8, 16, 17, "%.2Le", d); /* 0.00e+00 ... -1.19e+4932 */ +- RNG ( 9, 17, 18, "%.3Le", d); +- RNG (10, 18, 19, "%.4Le", d); +- RNG (11, 19, 20, "%.5Le", d); +- RNG (12, 20, 21, "%.6Le", d); /* same as plain "%Le" */ +- RNG (13, 21, 22, "%.7Le", d); /* 0.0000000e+00 ... -1.1897315e+4932 */ ++ bound accounting for the four-digit exponent. The lower bound is ++ for inf/nan. */ ++ RNG ( 3, 20, 21, "%Le", d); /* inf or 0.000000e+00 ... -1.189732e+4932 */ ++ RNG ( 3, 8, 9, "%.Le", d); ++ RNG ( 3, 9, 10, "%.0Le", d); ++ RNG ( 3, 15, 16, "%.1Le", d); /* inf or 0.0e+00 ... -1.2e+4932 */ ++ RNG ( 3, 16, 17, "%.2Le", d); /* inf or 0.00e+00 ... -1.19e+4932 */ ++ RNG ( 3, 17, 18, "%.3Le", d); ++ RNG ( 3, 18, 19, "%.4Le", d); ++ RNG ( 3, 19, 20, "%.5Le", d); ++ RNG ( 3, 20, 21, "%.6Le", d); /* same as plain "%Le" */ ++ RNG ( 3, 21, 22, "%.7Le", d); /* inf or 0.0000000e+00 ... -1.1897315e+4932 */ + +- RNG ( 5, 9, 10, "%.*Le", 0, d); +- RNG ( 7, 15, 16, "%.*Le", 1, d); +- RNG ( 8, 16, 17, "%.*Le", 2, d); +- RNG ( 9, 17, 18, "%.*Le", 3, d); +- RNG (10, 18, 19, "%.*Le", 4, d); +- RNG (11, 19, 20, "%.*Le", 5, d); +- RNG (12, 20, 21, "%.*Le", 6, d); +- RNG (13, 21, 22, "%.*Le", 7, d); ++ RNG ( 3, 9, 10, "%.*Le", 0, d); ++ RNG ( 3, 15, 16, "%.*Le", 1, d); ++ RNG ( 3, 16, 17, "%.*Le", 2, d); ++ RNG ( 3, 17, 18, "%.*Le", 3, d); ++ RNG ( 3, 18, 19, "%.*Le", 4, d); ++ RNG ( 3, 19, 20, "%.*Le", 5, d); ++ RNG ( 3, 20, 21, "%.*Le", 6, d); ++ RNG ( 3, 21, 22, "%.*Le", 7, d); + } + + static void __attribute__ ((noinline, noclone)) +@@ -626,7 +630,10 @@ + RNG ( 8, 13, 14, "%f", 1.0e-12); + RNG ( 8, 13, 14, "%f", 1.0e-123); + +- RNG ( 8, 322, 323, "%f", d); ++ RNG ( 3, 322, 323, "%f", d); ++ RNG ( 4, 322, 323, "%+f", d); ++ RNG ( 4, 322, 323, "% f", d); ++ RNG ( 3, 322, 323, "%#f", d); + } + + static void __attribute__ ((noinline, noclone)) +Index: gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c (.../branches/gcc-8-branch) +@@ -1377,7 +1377,8 @@ + T (-1, "%*.*E", w, p, d); + T (-1, "%*.*lE", w, p, d); + +- T ( 0, "%E", d); /* { dg-warning "writing between 12 and 14 bytes into a region of size 0" } */ ++ /* The least number of bytes %E can produce is 3 for "inf" and "nan". */ ++ T ( 0, "%E", d); /* { dg-warning "writing between 3 and 14 bytes into a region of size 0" } */ + T ( 0, "%e", d); /* { dg-warning "into a region" } */ + T ( 1, "%E", d); /* { dg-warning "into a region" } */ + T ( 1, "%e", d); /* { dg-warning "into a region" } */ +@@ -1389,22 +1390,22 @@ + T (14, "%E", d); + T (14, "%e", d); + +- T ( 0, "%+E", d); /* { dg-warning "writing between 13 and 14 bytes into a region of size 0" } */ +- T ( 0, "%-e", d); /* { dg-warning "writing between 12 and 14 bytes into a region of size 0" } */ +- T ( 0, "% E", d); /* { dg-warning "writing between 13 and 14 bytes into a region of size 0" } */ ++ T ( 0, "%+E", d); /* { dg-warning "writing between 4 and 14 bytes into a region of size 0" } */ ++ T ( 0, "%-e", d); /* { dg-warning "writing between 3 and 14 bytes into a region of size 0" } */ ++ T ( 0, "% E", d); /* { dg-warning "writing between 4 and 14 bytes into a region of size 0" } */ + +- /* The range of output of "%.0e" is between 5 and 7 bytes (not counting ++ /* The range of output of "%.0e" is between 3 and 7 bytes (not counting + the terminating NUL. */ +- T ( 5, "%.0e", d); /* { dg-warning "writing a terminating nul past the end" } */ ++ T ( 5, "%.0e", d); /* { dg-warning "may write a terminating nul past the end" } */ + T ( 6, "%.0e", d); /* 1e+00 */ + +- /* The range of output of "%.1e" is between 7 and 9 bytes (not counting ++ /* The range of output of "%.1e" is between 3 and 9 bytes (not counting + the terminating NUL. */ +- T ( 7, "%.1e", d); /* { dg-warning "writing a terminating nul past the end" } */ ++ T ( 7, "%.1e", d); /* { dg-warning "may write a terminating nul past the end" } */ + T ( 8, "%.1e", d); + +- T ( 0, "%*e", 0, d); /* { dg-warning "writing between 12 and 14 bytes into a region of size 0" } */ +- T ( 0, "%*e", w, d); /* { dg-warning "writing 12 or more bytes into a region of size 0|writing between 12 and \[0-9\]+ bytes into a region of size 0" } */ ++ T ( 0, "%*e", 0, d); /* { dg-warning "writing between 3 and 14 bytes into a region of size 0" } */ ++ T ( 0, "%*e", w, d); /* { dg-warning "writing 3 or more bytes into a region of size 0|writing between 3 and \[0-9\]+ bytes into a region of size 0" } */ + } + + void test_sprintf_chk_f_nonconst (double d) +Index: gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-7.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-7.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-7.c (.../branches/gcc-8-branch) +@@ -71,16 +71,16 @@ + T (0, "%*a", INT_MIN, x); /* { dg-warning "writing 2147483648 bytes" } */ + T (0, "%*a", INT_MAX, x); /* { dg-warning "writing 2147483647 bytes" } */ + +- T (0, "%.*a", INT_MIN, x); /* { dg-warning "writing between 6 and 24 bytes" } */ ++ T (0, "%.*a", INT_MIN, x); /* { dg-warning "writing between 3 and 24 bytes" } */ + + /* Expected output is "0x0." followed by INT_MAX digits followed by + "p+" followed by 1 to four digits, with a byte count in the range + [3 + INT_MAX + 2 + 1, 3 + INT_MAX + 2 + 4]. */ +- T (0, "%.*a", INT_MAX, x); /* { dg-warning "writing between 2147483654 and 2147483658 bytes" } */ ++ T (0, "%.*a", INT_MAX, x); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ + + T (0, "%*.*a", INT_MIN, INT_MIN, x); /* { dg-warning "writing 2147483648 bytes" } */ + +- T (0, "%*.*a", INT_MAX, INT_MAX, x); /* { dg-warning "writing between 2147483654 and 2147483658 bytes" } */ ++ T (0, "%*.*a", INT_MAX, INT_MAX, x); /* { dg-warning "writing between 2147483647 and 2147483658 bytes" } */ + } + + void test_floating_e_cst (void) +@@ -102,13 +102,13 @@ + T (0, "%*e", INT_MIN, x); /* { dg-warning "writing 2147483648 bytes" } */ + T (0, "%*e", INT_MAX, x); /* { dg-warning "writing 2147483647 bytes" } */ + +- T (0, "%.*e", INT_MIN, x); /* { dg-warning "writing between 12 and 14 bytes" } */ ++ T (0, "%.*e", INT_MIN, x); /* { dg-warning "writing between 3 and 14 bytes" } */ + +- T (0, "%.*e", INT_MAX, x); /* { dg-warning "writing between 2147483653 and 2147483655 bytes" } */ ++ T (0, "%.*e", INT_MAX, x); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ + + T (0, "%*.*e", INT_MIN, INT_MIN, x); /* { dg-warning "writing 2147483648 bytes" } */ + +- T (0, "%*.*e", INT_MAX, INT_MAX, x); /* { dg-warning "writing between 2147483653 and 2147483655 bytes" } */ ++ T (0, "%*.*e", INT_MAX, INT_MAX, x); /* { dg-warning "writing between 2147483647 and 2147483655 bytes" } */ + } + + void test_floating_f_cst (void) +@@ -130,13 +130,13 @@ + T (0, "%*f", INT_MIN, x); /* { dg-warning "writing 2147483648 bytes" } */ + T (0, "%*f", INT_MAX, x); /* { dg-warning "writing 2147483647 bytes" } */ + +- T (0, "%.*f", INT_MIN, x); /* { dg-warning "writing between 8 and 317 bytes" } */ ++ T (0, "%.*f", INT_MIN, x); /* { dg-warning "writing between 3 and 317 bytes" } */ + +- T (0, "%.*f", INT_MAX, x); /* { dg-warning "writing between 2147483649 and 2147483958 bytes" } */ ++ T (0, "%.*f", INT_MAX, x); /* { dg-warning "writing between 3 and 2147483958 bytes" } */ + + T (0, "%*.*f", INT_MIN, INT_MIN, x); /* { dg-warning "writing 2147483648 bytes" } */ + +- T (0, "%*.*f", INT_MAX, INT_MAX, x); /* { dg-warning "writing between 2147483649 and 2147483958 bytes" } */ ++ T (0, "%*.*f", INT_MAX, INT_MAX, x); /* { dg-warning "writing between 2147483647 and 2147483958 bytes" } */ + } + + void test_floating_g_cst (void) +Index: gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-9.c (.../branches/gcc-8-branch) +@@ -0,0 +1,90 @@ ++/* PR tree-optimization/86274 - SEGFAULT when logging std::to_string(NAN) ++ { dg-do compile } ++ { dg-options "-O2 -Wall -fdump-tree-optimized" } */ ++ ++typedef __SIZE_TYPE__ size_t; ++extern int sprintf (char*, const char*, ...); ++extern int snprintf (char*, size_t, const char*, ...); ++ ++#define CAT(x, y) x ## y ++#define CONCAT(x, y) CAT (x, y) ++#define FAILNAME(name) CONCAT (call_ ## name ##_on_line_, __LINE__) ++ ++#define FAIL(name) do { \ ++ extern void FAILNAME (name) (void); \ ++ FAILNAME (name)(); \ ++ } while (0) ++ ++/* Macro to emit a call to funcation named ++ call_in_true_branch_not_eliminated_on_line_NNN() ++ for each expression that's expected to fold to false but that ++ GCC does not fold. The dg-final scan-tree-dump-time directive ++ at the bottom of the test verifies that no such call appears ++ in output. */ ++#define ELIM(expr) \ ++ if ((expr)) FAIL (in_true_branch_not_eliminated); else (void)0 ++ ++/* Macro to emit a call to a function named ++ call_made_in_{true,false}_branch_on_line_NNN() ++ for each call that's expected to be retained. The dg-final ++ scan-tree-dump-time directive at the bottom of the test verifies ++ that the expected number of both kinds of calls appears in output ++ (a pair for each line with the invocation of the KEEP() macro. */ ++#define KEEP(expr) \ ++ if (expr) \ ++ FAIL (made_in_true_branch); \ ++ else \ ++ FAIL (made_in_false_branch) ++ ++extern void sink (int, ...); ++#define sink(...) sink (0, __VA_ARGS__) ++ ++#define WARN(N, expr) \ ++ do { \ ++ char a[N]; \ ++ expr; \ ++ sink (a); \ ++ } while (0) ++ ++ ++void test_elim (double x) ++{ ++ ELIM (snprintf (0, 0, "%a", x) < 3); ++ ELIM (snprintf (0, 0, "%e", x) < 3); ++ ELIM (snprintf (0, 0, "%f", x) < 3); ++ ELIM (snprintf (0, 0, "%g", x) < 1); ++ ++ /* Verify that snprintf knows that NaN cannot result in fewer ++ than three characters on output. */ ++ const double nan = __builtin_nan ("0"); ++ ELIM (snprintf (0, 0, "%a", nan) < 3); ++ ELIM (snprintf (0, 0, "%e", nan) < 3); ++ ELIM (snprintf (0, 0, "%f", nan) < 3); ++ ELIM (snprintf (0, 0, "%g", nan) < 3); ++} ++ ++void test_keep (int p, double x) ++{ ++ KEEP (snprintf (0, 0, "%a", x) == 3); ++ KEEP (snprintf (0, 0, "%e", x) == 3); ++ ++ KEEP (snprintf (0, 0, "%f", x) == 3); ++ KEEP (snprintf (0, 0, "%.*f", p, x) < 3); ++ ++ KEEP (snprintf (0, 0, "%g", x) == 1); ++ KEEP (snprintf (0, 0, "%g", x) == 3); ++} ++ ++void test_warn_sprintf_f (double x) ++{ ++ WARN (4, sprintf (a, "%a", x)); /* { dg-warning "between 3 and 24 bytes" } */ ++ WARN (4, sprintf (a, "%e", x)); /* { dg-warning "between 3 and 14 bytes" } */ ++ WARN (4, sprintf (a, "%f", x)); /* { dg-warning "between 3 and 317 bytes" } */ ++ WARN (4, sprintf (a, "%g", x)); /* { dg-warning "between 1 and 13 bytes" } */ ++} ++ ++ ++/* { dg-final { scan-tree-dump-times "call_in_true_branch_not_eliminated_" 0 "optimized" } } ++ { dg-final { scan-tree-dump-times "call_made_in_true_branch_" 6 "optimized" } } ++ { dg-final { scan-tree-dump-times "call_made_in_false_branch_" 6 "optimized" } } ++ */ +Index: gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-10.c (.../branches/gcc-8-branch) +@@ -25,60 +25,60 @@ + /* Exercise %a. */ + void test_a (int w, int p, double x) + { +- T1 ("%.*a", 0); /* { dg-warning "between 6 and 10 bytes" } */ +- T1 ("%.*a", 1); /* { dg-warning "between 8 and 12 bytes" } */ +- T1 ("%.*a", 2); /* { dg-warning "between 9 and 13 bytes" } */ +- T1 ("%.*a", 99); /* { dg-warning "between 106 and 110 bytes" } */ +- T1 ("%.*a", 199); /* { dg-warning "between 206 and 210 bytes" } */ +- T1 ("%.*a", 1099); /* { dg-warning "between 1106 and 1110 bytes" } */ ++ T1 ("%.*a", 0); /* { dg-warning "between 3 and 10 bytes" } */ ++ T1 ("%.*a", 1); /* { dg-warning "between 3 and 12 bytes" } */ ++ T1 ("%.*a", 2); /* { dg-warning "between 3 and 13 bytes" } */ ++ T1 ("%.*a", 99); /* { dg-warning "between 3 and 110 bytes" } */ ++ T1 ("%.*a", 199); /* { dg-warning "between 3 and 210 bytes" } */ ++ T1 ("%.*a", 1099); /* { dg-warning "between 3 and 1110 bytes" } */ + +- T1 ("%*.a", 0); /* { dg-warning "between 6 and 10 bytes" } */ +- T1 ("%*.a", 1); /* { dg-warning "between 6 and 10 bytes" } */ +- T1 ("%*.a", 3); /* { dg-warning "between 6 and 10 bytes" } */ ++ T1 ("%*.a", 0); /* { dg-warning "between 3 and 10 bytes" } */ ++ T1 ("%*.a", 1); /* { dg-warning "between 3 and 10 bytes" } */ ++ T1 ("%*.a", 3); /* { dg-warning "between 3 and 10 bytes" } */ + T1 ("%*.a", 6); /* { dg-warning "between 6 and 10 bytes" } */ + T1 ("%*.a", 7); /* { dg-warning "between 7 and 10 bytes" } */ + +- T1 ("%*.a", w); /* { dg-warning "writing between 6 and 2147483648 bytes" } */ +- T1 ("%*.0a", w); /* { dg-warning "writing between 6 and 2147483648 bytes" } */ +- T1 ("%*.1a", w); /* { dg-warning "writing between 8 and 2147483648 bytes" } */ +- T1 ("%*.2a", w); /* { dg-warning "writing between 9 and 2147483648 bytes" } */ ++ T1 ("%*.a", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T1 ("%*.0a", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T1 ("%*.1a", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T1 ("%*.2a", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ + +- T1 ("%.*a", p); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ +- T1 ("%1.*a", p); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ +- T1 ("%2.*a", p); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ +- T1 ("%3.*a", p); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ ++ T1 ("%.*a", p); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ ++ T1 ("%1.*a", p); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ ++ T1 ("%2.*a", p); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ ++ T1 ("%3.*a", p); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ + +- T2 ("%*.*a", w, p); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ ++ T2 ("%*.*a", w, p); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ + } + + /* Exercise %e. */ + void test_e (int w, int p, double x) + { +- T1 ("%.*e", 0); /* { dg-warning "between 5 and 7 bytes" } */ +- T1 ("%.*e", 1); /* { dg-warning "between 7 and 9 bytes" } */ +- T1 ("%.*e", 2); /* { dg-warning "between 8 and 10 bytes" } */ +- T1 ("%.*e", 99); /* { dg-warning "between 105 and 107 bytes" } */ +- T1 ("%.*e", 199); /* { dg-warning "between 205 and 207 bytes" } */ +- T1 ("%.*e", 1099); /* { dg-warning "between 1105 and 1107 bytes" } */ ++ T1 ("%.*e", 0); /* { dg-warning "between 3 and 7 bytes" } */ ++ T1 ("%.*e", 1); /* { dg-warning "between 3 and 9 bytes" } */ ++ T1 ("%.*e", 2); /* { dg-warning "between 3 and 10 bytes" } */ ++ T1 ("%.*e", 99); /* { dg-warning "between 3 and 107 bytes" } */ ++ T1 ("%.*e", 199); /* { dg-warning "between 3 and 207 bytes" } */ ++ T1 ("%.*e", 1099); /* { dg-warning "between 3 and 1107 bytes" } */ + +- T1 ("%*.e", 0); /* { dg-warning "between 5 and 7 bytes" } */ +- T1 ("%*.e", 1); /* { dg-warning "between 5 and 7 bytes" } */ +- T1 ("%*.e", 1); /* { dg-warning "between 5 and 7 bytes" } */ +- T1 ("%*.e", 3); /* { dg-warning "between 5 and 7 bytes" } */ ++ T1 ("%*.e", 0); /* { dg-warning "between 3 and 7 bytes" } */ ++ T1 ("%*.e", 1); /* { dg-warning "between 3 and 7 bytes" } */ ++ T1 ("%*.e", 1); /* { dg-warning "between 3 and 7 bytes" } */ ++ T1 ("%*.e", 3); /* { dg-warning "between 3 and 7 bytes" } */ + T1 ("%*.e", 6); /* { dg-warning "between 6 and 7 bytes" } */ + T1 ("%*.e", 7); /* { dg-warning "writing 7 bytes" } */ + +- T1 ("%*.e", w); /* { dg-warning "writing between 5 and 2147483648 bytes" } */ +- T1 ("%*.0e", w); /* { dg-warning "writing between 5 and 2147483648 bytes" } */ +- T1 ("%*.1e", w); /* { dg-warning "writing between 7 and 2147483648 bytes" } */ +- T1 ("%*.2e", w); /* { dg-warning "writing between 8 and 2147483648 bytes" } */ ++ T1 ("%*.e", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T1 ("%*.0e", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T1 ("%*.1e", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T1 ("%*.2e", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ + +- T1 ("%.*e", p); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ +- T1 ("%1.*e", p); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ +- T1 ("%2.*e", p); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ +- T1 ("%3.*e", p); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ ++ T1 ("%.*e", p); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ ++ T1 ("%1.*e", p); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ ++ T1 ("%2.*e", p); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ ++ T1 ("%3.*e", p); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ + +- T2 ("%*.*e", w, p); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ ++ T2 ("%*.*e", w, p); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ + } + + /* Exercise %f. */ +@@ -86,10 +86,10 @@ + { + T1 ("%.*f", 0); /* { dg-warning "between 1 and 310 bytes" } */ + T1 ("%.*f", 1); /* { dg-warning "between 3 and 312 bytes" } */ +- T1 ("%.*f", 2); /* { dg-warning "between 4 and 313 bytes" } */ +- T1 ("%.*f", 99); /* { dg-warning "between 101 and 410 bytes" } */ +- T1 ("%.*f", 199); /* { dg-warning "between 201 and 510 bytes" } */ +- T1 ("%.*f", 1099); /* { dg-warning "between 1101 and 1410 bytes" } */ ++ T1 ("%.*f", 2); /* { dg-warning "between 3 and 313 bytes" } */ ++ T1 ("%.*f", 99); /* { dg-warning "between 3 and 410 bytes" } */ ++ T1 ("%.*f", 199); /* { dg-warning "between 3 and 510 bytes" } */ ++ T1 ("%.*f", 1099); /* { dg-warning "between 3 and 1410 bytes" } */ + + T2 ("%*.*f", 0, 0); /* { dg-warning "between 1 and 310 bytes" } */ + T2 ("%*.*f", 1, 0); /* { dg-warning "between 1 and 310 bytes" } */ +@@ -97,13 +97,13 @@ + T2 ("%*.*f", 3, 0); /* { dg-warning "between 3 and 310 bytes" } */ + T2 ("%*.*f", 310, 0); /* { dg-warning "writing 310 bytes" } */ + T2 ("%*.*f", 311, 0); /* { dg-warning "writing 311 bytes" } */ +- T2 ("%*.*f", 312, 312); /* { dg-warning "between 314 and 623 bytes" } */ +- T2 ("%*.*f", 312, 313); /* { dg-warning "between 315 and 624 bytes" } */ ++ T2 ("%*.*f", 312, 312); /* { dg-warning "between 312 and 623 bytes" } */ ++ T2 ("%*.*f", 312, 313); /* { dg-warning "between 312 and 624 bytes" } */ + + T1 ("%*.f", w); /* { dg-warning "writing between 1 and 2147483648 bytes" } */ + T1 ("%*.0f", w); /* { dg-warning "writing between 1 and 2147483648 bytes" } */ + T1 ("%*.1f", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ +- T1 ("%*.2f", w); /* { dg-warning "writing between 4 and 2147483648 bytes" } */ ++ T1 ("%*.2f", w); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ + + T1 ("%.*f", p); /* { dg-warning "writing between 1 and 2147483958 bytes" } */ + T1 ("%1.*f", p); /* { dg-warning "writing between 1 and 2147483958 bytes" } */ +@@ -138,85 +138,85 @@ + /* Exercise %a. */ + void test_a_va (va_list va) + { +- T ("%.0a"); /* { dg-warning "between 6 and 10 bytes" } */ +- T ("%.1a"); /* { dg-warning "between 8 and 12 bytes" } */ +- T ("%.2a"); /* { dg-warning "between 9 and 13 bytes" } */ +- T ("%.99a"); /* { dg-warning "between 106 and 110 bytes" } */ +- T ("%.199a"); /* { dg-warning "between 206 and 210 bytes" } */ +- T ("%.1099a"); /* { dg-warning "between 1106 and 1110 bytes" } */ ++ T ("%.0a"); /* { dg-warning "between 3 and 10 bytes" } */ ++ T ("%.1a"); /* { dg-warning "between 3 and 12 bytes" } */ ++ T ("%.2a"); /* { dg-warning "between 3 and 13 bytes" } */ ++ T ("%.99a"); /* { dg-warning "between 3 and 110 bytes" } */ ++ T ("%.199a"); /* { dg-warning "between 3 and 210 bytes" } */ ++ T ("%.1099a"); /* { dg-warning "between 3 and 1110 bytes" } */ + +- T ("%0.a"); /* { dg-warning "between 6 and 10 bytes" } */ +- T ("%1.a"); /* { dg-warning "between 6 and 10 bytes" } */ +- T ("%3.a"); /* { dg-warning "between 6 and 10 bytes" } */ ++ T ("%0.a"); /* { dg-warning "between 3 and 10 bytes" } */ ++ T ("%1.a"); /* { dg-warning "between 3 and 10 bytes" } */ ++ T ("%3.a"); /* { dg-warning "between 3 and 10 bytes" } */ + T ("%6.a"); /* { dg-warning "between 6 and 10 bytes" } */ + T ("%7.a"); /* { dg-warning "between 7 and 10 bytes" } */ + +- T ("%*.a"); /* { dg-warning "writing between 6 and 2147483648 bytes" } */ +- T ("%*.0a"); /* { dg-warning "writing between 6 and 2147483648 bytes" } */ +- T ("%*.1a"); /* { dg-warning "writing between 8 and 2147483648 bytes" } */ +- T ("%*.2a"); /* { dg-warning "writing between 9 and 2147483648 bytes" } */ ++ T ("%*.a"); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T ("%*.0a"); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T ("%*.1a"); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ ++ T ("%*.2a"); /* { dg-warning "writing between 3 and 2147483648 bytes" } */ + +- T ("%.*a"); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ +- T ("%1.*a"); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ +- T ("%2.*a"); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ ++ T ("%.*a"); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ ++ T ("%1.*a"); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ ++ T ("%2.*a"); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ + T ("%6.*a"); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ + T ("%9.*a"); /* { dg-warning "writing between 9 and 2147483658 bytes" } */ + +- T ("%*.*a"); /* { dg-warning "writing between 6 and 2147483658 bytes" } */ ++ T ("%*.*a"); /* { dg-warning "writing between 3 and 2147483658 bytes" } */ + } + + /* Exercise %e. */ + void test_e_va (va_list va) + { +- T ("%e"); /* { dg-warning "between 12 and 14 bytes" } */ +- T ("%+e"); /* { dg-warning "between 13 and 14 bytes" } */ +- T ("% e"); /* { dg-warning "between 13 and 14 bytes" } */ +- T ("%#e"); /* { dg-warning "between 12 and 14 bytes" } */ +- T ("%#+e"); /* { dg-warning "between 13 and 14 bytes" } */ +- T ("%# e"); /* { dg-warning "between 13 and 14 bytes" } */ ++ T ("%e"); /* { dg-warning "between 3 and 14 bytes" } */ ++ T ("%+e"); /* { dg-warning "between 4 and 14 bytes" } */ ++ T ("% e"); /* { dg-warning "between 4 and 14 bytes" } */ ++ T ("%#e"); /* { dg-warning "between 3 and 14 bytes" } */ ++ T ("%#+e"); /* { dg-warning "between 4 and 14 bytes" } */ ++ T ("%# e"); /* { dg-warning "between 4 and 14 bytes" } */ + +- T ("%.e"); /* { dg-warning "between 5 and 7 bytes" } */ +- T ("%.0e"); /* { dg-warning "between 5 and 7 bytes" } */ +- T ("%.1e"); /* { dg-warning "between 7 and 9 bytes" } */ +- T ("%.2e"); /* { dg-warning "between 8 and 10 bytes" } */ +- T ("%.99e"); /* { dg-warning "between 105 and 107 bytes" } */ +- T ("%.199e"); /* { dg-warning "between 205 and 207 bytes" } */ +- T ("%.1099e"); /* { dg-warning "between 1105 and 1107 bytes" } */ ++ T ("%.e"); /* { dg-warning "between 3 and 7 bytes" } */ ++ T ("%.0e"); /* { dg-warning "between 3 and 7 bytes" } */ ++ T ("%.1e"); /* { dg-warning "between 3 and 9 bytes" } */ ++ T ("%.2e"); /* { dg-warning "between 3 and 10 bytes" } */ ++ T ("%.99e"); /* { dg-warning "between 3 and 107 bytes" } */ ++ T ("%.199e"); /* { dg-warning "between 3 and 207 bytes" } */ ++ T ("%.1099e"); /* { dg-warning "between 3 and 1107 bytes" } */ + +- T ("%0.e"); /* { dg-warning "between 5 and 7 bytes" } */ +- T ("%1.e"); /* { dg-warning "between 5 and 7 bytes" } */ +- T ("%1.e"); /* { dg-warning "between 5 and 7 bytes" } */ +- T ("%3.e"); /* { dg-warning "between 5 and 7 bytes" } */ ++ T ("%0.e"); /* { dg-warning "between 3 and 7 bytes" } */ ++ T ("%1.e"); /* { dg-warning "between 3 and 7 bytes" } */ ++ T ("%1.e"); /* { dg-warning "between 3 and 7 bytes" } */ ++ T ("%3.e"); /* { dg-warning "between 3 and 7 bytes" } */ + T ("%6.e"); /* { dg-warning "between 6 and 7 bytes" } */ + T ("%7.e"); /* { dg-warning "writing 7 bytes" } */ + +- T ("%.*e"); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ +- T ("%1.*e"); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ ++ T ("%.*e"); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ ++ T ("%1.*e"); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ + T ("%6.*e"); /* { dg-warning "writing between 6 and 2147483655 bytes" } */ + T ("%9.*e"); /* { dg-warning "writing between 9 and 2147483655 bytes" } */ + +- T ("%*.*e"); /* { dg-warning "writing between 5 and 2147483655 bytes" } */ ++ T ("%*.*e"); /* { dg-warning "writing between 3 and 2147483655 bytes" } */ + } + + /* Exercise %f. */ + void test_f_va (va_list va) + { +- T ("%f"); /* { dg-warning "between 8 and 317 bytes" } */ +- T ("%+f"); /* { dg-warning "between 9 and 317 bytes" } */ +- T ("% f"); /* { dg-warning "between 9 and 317 bytes" } */ +- T ("%#f"); /* { dg-warning "between 8 and 317 bytes" } */ +- T ("%+f"); /* { dg-warning "between 9 and 317 bytes" } */ +- T ("% f"); /* { dg-warning "between 9 and 317 bytes" } */ +- T ("%#+f"); /* { dg-warning "between 9 and 317 bytes" } */ +- T ("%# f"); /* { dg-warning "between 9 and 317 bytes" } */ ++ T ("%f"); /* { dg-warning "between 3 and 317 bytes" } */ ++ T ("%+f"); /* { dg-warning "between 4 and 317 bytes" } */ ++ T ("% f"); /* { dg-warning "between 4 and 317 bytes" } */ ++ T ("%#f"); /* { dg-warning "between 3 and 317 bytes" } */ ++ T ("%+f"); /* { dg-warning "between 4 and 317 bytes" } */ ++ T ("% f"); /* { dg-warning "between 4 and 317 bytes" } */ ++ T ("%#+f"); /* { dg-warning "between 4 and 317 bytes" } */ ++ T ("%# f"); /* { dg-warning "between 4 and 317 bytes" } */ + + T ("%.f"); /* { dg-warning "between 1 and 310 bytes" } */ + T ("%.0f"); /* { dg-warning "between 1 and 310 bytes" } */ + T ("%.1f"); /* { dg-warning "between 3 and 312 bytes" } */ +- T ("%.2f"); /* { dg-warning "between 4 and 313 bytes" } */ +- T ("%.99f"); /* { dg-warning "between 101 and 410 bytes" } */ +- T ("%.199f"); /* { dg-warning "between 201 and 510 bytes" } */ +- T ("%.1099f"); /* { dg-warning "between 1101 and 1410 bytes" } */ ++ T ("%.2f"); /* { dg-warning "between 3 and 313 bytes" } */ ++ T ("%.99f"); /* { dg-warning "between 3 and 410 bytes" } */ ++ T ("%.199f"); /* { dg-warning "between 3 and 510 bytes" } */ ++ T ("%.1099f"); /* { dg-warning "between 3 and 1410 bytes" } */ + + T ("%0.0f"); /* { dg-warning "between 1 and 310 bytes" } */ + T ("%1.0f"); /* { dg-warning "between 1 and 310 bytes" } */ +@@ -224,8 +224,8 @@ + T ("%3.0f"); /* { dg-warning "between 3 and 310 bytes" } */ + T ("%310.0f"); /* { dg-warning "writing 310 bytes" } */ + T ("%311.0f"); /* { dg-warning "writing 311 bytes" } */ +- T ("%312.312f"); /* { dg-warning "between 314 and 623 bytes" } */ +- T ("%312.313f"); /* { dg-warning "between 315 and 624 bytes" } */ ++ T ("%312.312f"); /* { dg-warning "between 312 and 623 bytes" } */ ++ T ("%312.313f"); /* { dg-warning "between 312 and 624 bytes" } */ + + T ("%.*f"); /* { dg-warning "writing between 1 and 2147483958 bytes" } */ + T ("%1.*f"); /* { dg-warning "writing between 1 and 2147483958 bytes" } */ Index: gcc/testsuite/gcc.dg/tree-ssa/vrp119.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/tree-ssa/vrp119.c (.../tags/gcc_8_1_0_release) @@ -12585,6 +14326,35 @@ + link_error (); + return e; +} +Index: gcc/testsuite/gcc.dg/tree-ssa/pr83198.c +=================================================================== +--- a/src/gcc/testsuite/gcc.dg/tree-ssa/pr83198.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/gcc.dg/tree-ssa/pr83198.c (.../branches/gcc-8-branch) +@@ -7,10 +7,14 @@ + void link_error (void); + + void +-foo (char *x) ++foo (char *x, double y) + { ++ /* The expected result should not be constant but rather that ++ of the %f directive with an unknown argument, i.e., at least ++ [3, 317] (but in reality [3, 322] when taking into account ++ that the decimal point can be up to MB_LEN_MAX bytes long). */ + int a = __builtin_sprintf (x, "%f", 1.0Q); +- if (a < 8) ++ if (a < 3) + link_error (); + if (a > 13) + bar (); +@@ -18,6 +22,6 @@ + link_error (); + } + +-/* Verify we don't optimize return value to [8, 13]. */ ++/* Verify we don't optimize return value to [3, 13]. */ + /* { dg-final { scan-tree-dump-not "link_error \\(\\);" "optimized" } } */ + /* { dg-final { scan-tree-dump "bar \\(\\);" "optimized" } } */ Index: gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c =================================================================== --- a/src/gcc/testsuite/gcc.dg/Walloc-size-larger-than-4.c (.../tags/gcc_8_1_0_release) @@ -12696,7 +14466,125 @@ =================================================================== --- a/src/gcc/testsuite/ChangeLog (.../tags/gcc_8_1_0_release) +++ b/src/gcc/testsuite/ChangeLog (.../branches/gcc-8-branch) -@@ -1,3 +1,778 @@ +@@ -1,3 +1,896 @@ ++2018-07-17 Eric Botcazou ++ ++ * gnat.dg/discr55.adb: New test. ++ ++2018-07-16 Fritz Reese ++ ++ PR fortran/83184 ++ * gfortran.dg/dec_structure_23.f90: Oops, "un-fix" error messages. ++ ++2018-07-16 Fritz Reese ++ ++ PR fortran/83184 ++ Backport from trunk. ++ * gfortran.dg/assumed_rank_14.f90: New testcase. ++ * gfortran.dg/assumed_rank_15.f90: New testcase. ++ * gfortran.dg/dec_structure_8.f90: Update error messages. ++ * gfortran.dg/dec_structure_23.f90: Update error messages. ++ ++2018-07-16 Fritz Reese ++ ++ Backport from trunk: ++ ++ PR fortran/83183 ++ PR fortran/86325 ++ * gfortran.dg/init_flag_18.f90: New testcase. ++ * gfortran.dg/init_flag_19.f03: New testcase. ++ ++2018-06-12 Claudiu Zissulescu ++ ++ Backport from mainline ++ x2018-06-12 Claudiu Zissulescu ++ ++ * gcc.target/arc/pr9001107555.c: New file. ++ ++2018-07-19 Richard Biener ++ ++ Backport from mainline ++ 2018-07-12 Richard Biener ++ ++ PR c/86453 ++ * g++.dg/warn/pr86453.C: New testcase. ++ ++2018-07-16 Richard Biener ++ ++ Backport from mainline ++ 2018-07-13 Richard Biener ++ ++ PR middle-end/85974 ++ * gcc.c-torture/compile/930326-1.c: Adjust to cover widening. ++ ++ 2018-06-15 Richard Biener ++ ++ PR middle-end/86076 ++ * gcc.dg/pr86076.c: New testcase. ++ ++ 2018-06-06 Richard Biener ++ ++ PR tree-optimization/85935 ++ * gcc.dg/graphite/pr85935.c: New testcase. ++ ++2018-07-16 Eric Botcazou ++ ++ * gnat.dg/opt73.adb: New test. ++ ++2018-07-16 Jakub Jelinek ++ ++ PR c++/3698 ++ PR c++/86208 ++ * g++.dg/opt/pr3698.C: New test. ++ ++2018-07-15 Bill Schmidt ++ ++ Backport from mainline ++ 2018-07-13 Bill Schmidt ++ Steve Munroe ++ ++ * gcc.target/powerpc/sse2-pand-1.c: New file. ++ * gcc.target/powerpc/sse2-pandn-1.c: Likewise. ++ * gcc.target/powerpc/sse2-por-1.c: Likewise. ++ * gcc.target/powerpc/sse2-pxor-1.c: Likewise. ++ ++2018-07-14 Martin Sebor ++ ++ PR tree-optimization/86274 ++ * gcc.dg/tree-ssa/builtin-sprintf-9.c: New test. ++ * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust. ++ * gcc.dg/tree-ssa/builtin-sprintf-warn-10.c: Same. ++ * gcc.dg/tree-ssa/builtin-sprintf-warn-15.c: Same. ++ * gcc.dg/tree-ssa/builtin-sprintf-warn-7.c: Same. ++ * gcc.dg/tree-ssa/builtin-sprintf.c: Same. ++ * gcc.dg/tree-ssa/pr83198.c: Same. ++ ++2018-07-13 H.J. Lu ++ ++ Backport from mainline ++ 2018-07-13 H.J. Lu ++ Sunil K Pandey ++ ++ PR target/84413 ++ * gcc.target/i386/pr84413-1.c: New test. ++ * gcc.target/i386/pr84413-2.c: Likewise. ++ * gcc.target/i386/pr84413-3.c: Likewise. ++ ++2018-07-13 Nathan Sidwell ++ ++ PR c++/86374 ++ * g++.dg/pr86374.C: New. ++ ++2018-07-12 Jakub Jelinek ++ ++ * c-c++-common/gomp/declare-target-3.c: New test. ++ * g++.dg/gomp/declare-target-2.C: New test. ++ ++2018-07-12 Richard Biener ++ ++ PR target/84829 ++ * gcc.target/i386/pr84829.c: New testcase. ++ +2018-07-12 Jakub Jelinek + + PR tree-optimization/86492 @@ -13576,6 +15464,31 @@ +} + +template void Frob(); +Index: gcc/testsuite/g++.dg/pr86374.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/pr86374.C (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/g++.dg/pr86374.C (.../branches/gcc-8-branch) +@@ -0,0 +1,20 @@ ++// pr C++/86374 ++// bogus lookup error ++template ++struct list { ++ static const int index = 1; ++ template struct addWithChecking {}; ++}; ++ ++template ++struct find { ++ static const int result = 0; ++}; ++ ++template ++template ++struct list::addWithChecking ++{ ++ static const int xres = ++ find >::result; // bogus error about index here. ++}; Index: gcc/testsuite/g++.dg/lto/pr85655_0.C =================================================================== --- a/src/gcc/testsuite/g++.dg/lto/pr85655_0.C (.../tags/gcc_8_1_0_release) @@ -13749,6 +15662,16 @@ +{ + std::memset(mA, 0, 2); +} +Index: gcc/testsuite/g++.dg/warn/pr86453.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/warn/pr86453.C (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/g++.dg/warn/pr86453.C (.../branches/gcc-8-branch) +@@ -0,0 +1,5 @@ ++// { dg-do compile } ++// { dg-additional-options "-flto" { target lto } } ++struct X { ++ int *__attribute__((aligned(2), packed)) a; // { dg-warning "attribute ignored" } ++} b; Index: gcc/testsuite/g++.dg/warn/Wctor-dtor2.C =================================================================== --- a/src/gcc/testsuite/g++.dg/warn/Wctor-dtor2.C (.../tags/gcc_8_1_0_release) @@ -13776,6 +15699,32 @@ + +// With -std=c++17 we get another warning deep under operator+=. +// { dg-prune-output __builtin_memcpy } +Index: gcc/testsuite/g++.dg/opt/pr3698.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/opt/pr3698.C (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/g++.dg/opt/pr3698.C (.../branches/gcc-8-branch) +@@ -0,0 +1,21 @@ ++// PR c++/3698 ++// { dg-do link } ++// { dg-options "-O0" } ++ ++struct X { ++ int i; ++}; ++ ++inline const int& ++OHashKey (const X& x) ++{ ++ return x.i; ++} ++ ++int ++main () ++{ ++ extern const int& OHashKey (const X& x); ++ X x; ++ return OHashKey (x); ++} Index: gcc/testsuite/g++.dg/cpp0x/temp-extend1.C =================================================================== --- a/src/gcc/testsuite/g++.dg/cpp0x/temp-extend1.C (.../tags/gcc_8_1_0_release) @@ -14554,6 +16503,29 @@ +{ + return s; +} +Index: gcc/testsuite/g++.dg/gomp/declare-target-2.C +=================================================================== +--- a/src/gcc/testsuite/g++.dg/gomp/declare-target-2.C (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/g++.dg/gomp/declare-target-2.C (.../branches/gcc-8-branch) +@@ -0,0 +1,18 @@ ++// { dg-do compile } ++// { dg-options "-fopenmp" } ++ ++#pragma omp declare target ++template ++struct S { T a; }; ++template ++struct U { T a; }; ++template ++struct V { T a; }; ++template ++struct W { T a; }; ++ ++S d; ++U e[10]; ++extern V f[5]; ++extern W g[]; // { dg-error "'g' in declare target directive does not have mappable type" } ++#pragma omp end declare target Index: gcc/testsuite/g++.dg/tree-ssa/array-temp1.C =================================================================== --- a/src/gcc/testsuite/g++.dg/tree-ssa/array-temp1.C (.../tags/gcc_8_1_0_release) @@ -14760,6 +16732,64 @@ + i++; + } +} +Index: gcc/testsuite/c-c++-common/gomp/declare-target-3.c +=================================================================== +--- a/src/gcc/testsuite/c-c++-common/gomp/declare-target-3.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/testsuite/c-c++-common/gomp/declare-target-3.c (.../branches/gcc-8-branch) +@@ -0,0 +1,53 @@ ++/* { dg-do compile } */ ++/* { dg-options "-fopenmp" } */ ++ ++#pragma omp declare target ++int a[] = { 1, 2, 3 }; ++extern int b[]; /* { dg-error "'b' in declare target directive does not have mappable type" } */ ++extern int c[]; /* { dg-error "'c' in declare target directive does not have mappable type" } */ ++extern int d[]; /* { dg-error "'d' in declare target directive does not have mappable type" } */ ++int d[3]; ++#pragma omp end declare target ++int c[3]; ++int e[] = { 1, 2, 3 }; ++#pragma omp declare target to (e) ++extern int f[]; ++#pragma omp declare target to (f) /* { dg-error "'f' does not have a mappable type in 'to' clause" } */ ++extern int g[]; ++#pragma omp declare target to (g) /* { dg-error "'g' does not have a mappable type in 'to' clause" } */ ++int g[3]; ++extern int h[]; ++int h[3]; ++#pragma omp declare target to (h) ++ ++int i[] = { 1, 2, 3 }; ++int j[] = { 1, 2, 3 }; ++extern int k[]; ++extern int l[]; ++extern int m[]; ++extern int n[]; ++extern int o[]; ++extern int p[]; ++int k[3]; ++int l[3]; ++int q; ++ ++void ++foo (void) ++{ ++ #pragma omp target update to (q) to (i) ++ #pragma omp target map (tofrom: j) ++ ; ++ #pragma omp target update from (q) from (k) ++ #pragma omp target map (to: l) ++ ; ++ #pragma omp target update from (q) from (m) /* { dg-error "'m' does not have a mappable type in 'from' clause" } */ ++ #pragma omp target map (from: n) /* { dg-error "'n' does not have a mappable type in 'map' clause" } */ ++ ; ++ #pragma omp target update to (q) to (o) /* { dg-error "'o' does not have a mappable type in 'to' clause" } */ ++ #pragma omp target map (from: p) /* { dg-error "'p' does not have a mappable type in 'map' clause" } */ ++ ; ++} ++ ++int o[3]; ++int p[3]; Index: gcc/testsuite/c-c++-common/attr-nonstring-4.c =================================================================== --- a/src/gcc/testsuite/c-c++-common/attr-nonstring-4.c (.../tags/gcc_8_1_0_release) @@ -15342,7 +17372,35 @@ =================================================================== --- a/src/gcc/cp/decl.c (.../tags/gcc_8_1_0_release) +++ b/src/gcc/cp/decl.c (.../branches/gcc-8-branch) -@@ -10255,6 +10255,9 @@ +@@ -7305,6 +7305,27 @@ + if (was_readonly) + TREE_READONLY (decl) = 1; + ++ if (flag_openmp ++ && VAR_P (decl) ++ && lookup_attribute ("omp declare target implicit", ++ DECL_ATTRIBUTES (decl))) ++ { ++ DECL_ATTRIBUTES (decl) ++ = remove_attribute ("omp declare target implicit", ++ DECL_ATTRIBUTES (decl)); ++ complete_type (TREE_TYPE (decl)); ++ if (!cp_omp_mappable_type (TREE_TYPE (decl))) ++ error ("%q+D in declare target directive does not have mappable type", ++ decl); ++ else if (!lookup_attribute ("omp declare target", ++ DECL_ATTRIBUTES (decl)) ++ && !lookup_attribute ("omp declare target link", ++ DECL_ATTRIBUTES (decl))) ++ DECL_ATTRIBUTES (decl) ++ = tree_cons (get_identifier ("omp declare target"), ++ NULL_TREE, DECL_ATTRIBUTES (decl)); ++ } ++ + invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl); + } + +@@ -10255,6 +10276,9 @@ break; if (qualifying_scope) { @@ -15553,7 +17611,29 @@ =================================================================== --- a/src/gcc/cp/ChangeLog (.../tags/gcc_8_1_0_release) +++ b/src/gcc/cp/ChangeLog (.../branches/gcc-8-branch) -@@ -1,3 +1,254 @@ +@@ -1,3 +1,276 @@ ++2018-07-16 Jakub Jelinek ++ ++ PR c++/3698 ++ PR c++/86208 ++ * cp-gimplify.c (cp_genericize_r): When using extern_decl_map, or ++ in TREE_USED flag from stmt to h->to. ++ ++2018-07-13 Nathan Sidwell ++ ++ PR c++/86374 ++ * pt.c (lookup_template_class_1): Use tsubst_aggr_type for ++ contexts that are classes. ++ ++2018-07-12 Jakub Jelinek ++ ++ * decl2.c (cplus_decl_attributes): Don't diagnose vars without mappable ++ type here, instead add "omp declare target implicit" attribute. Add ++ that attribute instead of "omp declare target" also when ++ processing_template_decl. ++ * decl.c (cp_finish_decl): Diagnose vars without mappable type here, ++ and before calling cp_omp_mappable_type call complete_type. ++ +2018-07-10 Jakub Jelinek + + PR sanitizer/86406 @@ -15841,7 +17921,15 @@ =================================================================== --- a/src/gcc/cp/cp-gimplify.c (.../tags/gcc_8_1_0_release) +++ b/src/gcc/cp/cp-gimplify.c (.../branches/gcc-8-branch) -@@ -1463,6 +1463,7 @@ +@@ -1085,6 +1085,7 @@ + if (h) + { + *stmt_p = h->to; ++ TREE_USED (h->to) |= TREE_USED (stmt); + *walk_subtrees = 0; + return NULL; + } +@@ -1463,6 +1464,7 @@ case OMP_FOR: case OMP_SIMD: case OMP_DISTRIBUTE: @@ -15849,7 +17937,7 @@ genericize_omp_for_stmt (stmt_p, walk_subtrees, data); break; -@@ -1621,6 +1622,13 @@ +@@ -1621,6 +1623,13 @@ case STATEMENT_LIST: { tree_stmt_iterator i = tsi_last (t); @@ -15863,7 +17951,7 @@ if (!tsi_end_p (i)) { t = tsi_stmt (i); -@@ -1957,7 +1965,7 @@ +@@ -1957,7 +1966,7 @@ /* True if OpenMP sharing attribute of DECL is predetermined. */ enum omp_clause_default_kind @@ -15872,7 +17960,7 @@ { /* Static data members are predetermined shared. */ if (TREE_STATIC (decl)) -@@ -1975,6 +1983,32 @@ +@@ -1975,6 +1984,32 @@ return OMP_CLAUSE_DEFAULT_UNSPECIFIED; } @@ -15905,7 +17993,7 @@ /* Finalize an implicitly determined clause. */ void -@@ -2232,7 +2266,7 @@ +@@ -2232,7 +2267,7 @@ val = TREE_OPERAND (val, 0); STRIP_NOPS (val); if (TREE_CODE (val) == INTEGER_CST) @@ -15990,7 +18078,25 @@ error_at (loc, "parameter packs not expanded with %<...%>:"); while (parameter_packs) { -@@ -9829,6 +9832,7 @@ +@@ -9370,8 +9373,15 @@ + return found; + } + +- context = tsubst (DECL_CONTEXT (gen_tmpl), arglist, +- complain, in_decl); ++ context = DECL_CONTEXT (gen_tmpl); ++ if (context && TYPE_P (context)) ++ { ++ context = tsubst_aggr_type (context, arglist, complain, in_decl, true); ++ context = complete_type (context); ++ } ++ else ++ context = tsubst (context, arglist, complain, in_decl); ++ + if (context == error_mark_node) + return error_mark_node; + +@@ -9829,6 +9839,7 @@ break; case TYPEOF_TYPE: @@ -15998,7 +18104,7 @@ case UNDERLYING_TYPE: if (pfd->include_nondeduced_p && for_each_template_parm (TYPE_VALUES_RAW (t), fn, data, -@@ -9836,6 +9840,7 @@ +@@ -9836,6 +9847,7 @@ pfd->include_nondeduced_p, pfd->any_fn)) return error_mark_node; @@ -16006,7 +18112,7 @@ break; case FUNCTION_DECL: -@@ -10852,6 +10857,10 @@ +@@ -10852,6 +10864,10 @@ /* Mark the type as in the process of being defined. */ TYPE_BEING_DEFINED (type) = 1; @@ -16017,7 +18123,7 @@ /* Determine what specialization of the original template to instantiate. */ t = most_specialized_partial_spec (type, tf_warning_or_error); -@@ -10891,10 +10900,6 @@ +@@ -10891,10 +10907,6 @@ if (! push_tinst_level (type)) return type; @@ -16028,7 +18134,7 @@ int saved_unevaluated_operand = cp_unevaluated_operand; int saved_inhibit_evaluation_warnings = c_inhibit_evaluation_warnings; -@@ -11375,7 +11380,6 @@ +@@ -11375,7 +11387,6 @@ maximum_field_alignment = saved_maximum_field_alignment; if (!fn_context) pop_from_top_level (); @@ -16036,7 +18142,7 @@ pop_tinst_level (); /* The vtable for a template class can be emitted in any translation -@@ -16683,7 +16687,7 @@ +@@ -16683,7 +16694,7 @@ do. */ if (VAR_P (decl)) DECL_TEMPLATE_INSTANTIATED (decl) = 1; @@ -16045,7 +18151,7 @@ && ANON_AGGR_TYPE_P (TREE_TYPE (decl))) /* Anonymous aggregates are a special case. */ finish_anon_union (decl); -@@ -17528,7 +17532,11 @@ +@@ -17528,7 +17539,11 @@ LAMBDA_EXPR_MUTABLE_P (r) = LAMBDA_EXPR_MUTABLE_P (t); if (LAMBDA_EXPR_EXTRA_SCOPE (t) == NULL_TREE) @@ -16058,7 +18164,7 @@ else record_lambda_scope (r); -@@ -17633,6 +17641,17 @@ +@@ -17633,6 +17648,17 @@ register_parameter_specializations (oldfn, fn); @@ -16076,7 +18182,7 @@ tsubst_expr (DECL_SAVED_TREE (oldfn), args, complain, r, /*constexpr*/false); -@@ -18427,7 +18446,9 @@ +@@ -18427,7 +18453,9 @@ /* Unsupported internal function with arguments. */ gcc_unreachable (); } @@ -16087,7 +18193,7 @@ ret = build_offset_ref_call_from_tree (function, &call_args, complain); else if (TREE_CODE (function) == COMPONENT_REF) -@@ -18493,6 +18514,7 @@ +@@ -18493,6 +18521,7 @@ case COND_EXPR: { tree cond = RECUR (TREE_OPERAND (t, 0)); @@ -16095,7 +18201,7 @@ tree folded_cond = fold_non_dependent_expr (cond); tree exp1, exp2; -@@ -20114,6 +20136,24 @@ +@@ -20114,6 +20143,24 @@ /*nondeduced*/false, array_deduction_r); } @@ -16120,7 +18226,7 @@ /* Most parms like fn_type_unification. If SUBR is 1, we're being called recursively (to unify the -@@ -20349,6 +20389,10 @@ +@@ -20349,6 +20396,10 @@ if (uses_template_parms (parm)) continue; @@ -16131,7 +18237,7 @@ if (check_non_deducible_conversion (parm, arg, strict, flags, explain_p)) return 1; -@@ -20368,8 +20412,6 @@ +@@ -20368,8 +20419,6 @@ location_t save_loc = input_location; if (DECL_P (parm)) input_location = DECL_SOURCE_LOCATION (parm); @@ -16140,7 +18246,7 @@ if (saw_undeduced == 1 && TREE_CODE (parm) == PARM_DECL -@@ -20377,11 +20419,14 @@ +@@ -20377,11 +20426,14 @@ { /* The type of this non-type parameter depends on undeduced parameters. Don't try to use its default argument yet, @@ -16155,7 +18261,7 @@ if (type == error_mark_node) arg = error_mark_node; else -@@ -20389,10 +20434,27 @@ +@@ -20389,10 +20441,27 @@ } else { @@ -16186,7 +18292,7 @@ complain, i, NULL_TREE); else if (saw_undeduced == 1) arg = NULL_TREE; -@@ -20400,8 +20462,6 @@ +@@ -20400,8 +20469,6 @@ arg = error_mark_node; } @@ -16195,7 +18301,7 @@ input_location = save_loc; *checks = get_deferred_access_checks (); pop_deferring_access_checks (); -@@ -25203,6 +25263,7 @@ +@@ -25203,6 +25270,7 @@ TREE_TYPE. */ case TREE_LIST: case TREE_VEC: @@ -16203,7 +18309,7 @@ return NULL_TREE; case TEMPLATE_PARM_INDEX: -@@ -26865,7 +26926,7 @@ +@@ -26865,7 +26933,7 @@ them. */ if (uses_template_parms (type)) return for_each_template_parm (type, is_auto_r, /*data*/NULL, @@ -16247,6 +18353,23 @@ =================================================================== --- a/src/gcc/cp/decl2.c (.../tags/gcc_8_1_0_release) +++ b/src/gcc/cp/decl2.c (.../branches/gcc-8-branch) +@@ -1514,11 +1514,11 @@ + && DECL_CLASS_SCOPE_P (*decl)) + error ("%q+D static data member inside of declare target directive", + *decl); +- else if (!processing_template_decl +- && VAR_P (*decl) +- && !cp_omp_mappable_type (TREE_TYPE (*decl))) +- error ("%q+D in declare target directive does not have mappable type", +- *decl); ++ else if (VAR_P (*decl) ++ && (processing_template_decl ++ || !cp_omp_mappable_type (TREE_TYPE (*decl)))) ++ attributes = tree_cons (get_identifier ("omp declare target implicit"), ++ NULL_TREE, attributes); + else + attributes = tree_cons (get_identifier ("omp declare target"), + NULL_TREE, attributes); @@ -1939,10 +1939,13 @@ { if (!TREE_PUBLIC (decl)) @@ -16779,6 +18902,51 @@ && current_function_decl) { endname = cfun->fde->dw_fde_end; +@@ -25364,11 +25378,8 @@ + generate debug info for the typedef. */ + if (is_naming_typedef_decl (TYPE_NAME (type))) + { +- /* Use the DIE of the containing namespace as the parent DIE of +- the type description DIE we want to generate. */ +- if (DECL_CONTEXT (TYPE_NAME (type)) +- && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL) +- context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type))); ++ /* Give typedefs the right scope. */ ++ context_die = scope_die_for (type, context_die); + + gen_decl_die (TYPE_NAME (type), NULL, NULL, context_die); + return; +@@ -28461,7 +28472,7 @@ + debug_str_section = get_section (DEBUG_LTO_STR_SECTION, + DEBUG_STR_SECTION_FLAGS + | SECTION_EXCLUDE, NULL); +- if (!dwarf_split_debug_info && !dwarf2out_as_loc_support) ++ if (!dwarf_split_debug_info && !output_asm_line_debug_info ()) + debug_line_str_section + = get_section (DEBUG_LTO_LINE_STR_SECTION, + DEBUG_STR_SECTION_FLAGS | SECTION_EXCLUDE, NULL); +@@ -31044,9 +31055,9 @@ + if (*slot != HTAB_EMPTY_ENTRY) + continue; + +- /* Add a pointer to the line table for the main compilation unit +- so that the debugger can make sense of DW_AT_decl_file +- attributes. */ ++ /* Remove the pointer to the line table. */ ++ remove_AT (ctnode->root_die, DW_AT_stmt_list); ++ + if (debug_info_level >= DINFO_LEVEL_TERSE) + reset_dies (ctnode->root_die); + +@@ -31710,7 +31721,7 @@ + + /* When emitting DWARF5 .debug_line_str, move DW_AT_name and + DW_AT_comp_dir into .debug_line_str section. */ +- if (!dwarf2out_as_loc_support ++ if (!output_asm_line_debug_info () + && dwarf_version >= 5 + && DWARF5_USE_DEBUG_LINE_STR) + { Index: gcc/match.pd =================================================================== --- a/src/gcc/match.pd (.../tags/gcc_8_1_0_release) @@ -16802,6 +18970,24 @@ && (VECTOR_TYPE_P (type) || !VECTOR_TYPE_P (TREE_TYPE (@0)))) (ocmp @0 @1)))) +@@ -1589,7 +1590,7 @@ + (if (ptr_difference_const (@0, @1, &diff)) + { build_int_cst_type (type, diff); })))) + (simplify +- (pointer_diff (convert?@2 ADDR_EXPR@0) (convert?@3 @1)) ++ (pointer_diff (convert?@2 ADDR_EXPR@0) (convert1?@3 @1)) + (if (tree_nop_conversion_p (TREE_TYPE(@2), TREE_TYPE (@0)) + && tree_nop_conversion_p (TREE_TYPE(@3), TREE_TYPE (@1))) + (with { poly_int64 diff; } +@@ -1596,7 +1597,7 @@ + (if (ptr_difference_const (@0, @1, &diff)) + { build_int_cst_type (type, diff); })))) + (simplify +- (pointer_diff (convert?@2 @0) (convert?@3 ADDR_EXPR@1)) ++ (pointer_diff (convert?@2 @0) (convert1?@3 ADDR_EXPR@1)) + (if (tree_nop_conversion_p (TREE_TYPE(@2), TREE_TYPE (@0)) + && tree_nop_conversion_p (TREE_TYPE(@3), TREE_TYPE (@1))) + (with { poly_int64 diff; } @@ -1759,10 +1760,11 @@ (neg_inner_op @0 { wide_int_to_tree (type, wi::to_wide (cst)); }) /* Last resort, use some unsigned type. */ @@ -16879,11 +19065,23 @@ =================================================================== --- a/src/gcc/ada/ChangeLog (.../tags/gcc_8_1_0_release) +++ b/src/gcc/ada/ChangeLog (.../branches/gcc-8-branch) -@@ -1,3 +1,94 @@ -+2018-07-06 Sebastian Huber +@@ -1,3 +1,106 @@ ++2018-07-17 Eric Botcazou + -+ Backport from mainline -+ 2018-07-06 Sebastian Huber ++ * gcc-interface/decl.c (choices_to_gnu): Rename parameters. Deal with ++ an operand of Character type. Factor out range generation to the end. ++ Check that the bounds are literals and convert them to the type of the ++ operand before building the ranges. ++ * gcc-interface/utils.c (make_dummy_type): Minor tweak. ++ (make_packable_type): Propagate TYPE_DEBUG_TYPE. ++ (maybe_pad_type): Likewise. ++ ++2018-07-17 Eric Botcazou ++ ++ * gcc-interface/decl.c (gnat_to_gnu_entity) : Deal with ++ more rvalues in the expression of a renaming. ++ ++2018-07-06 Sebastian Huber + + * libgnat/system-rtems.ads (Frontend_Exceptions): Set to False. + (ZCX_By_Default): Set to True. @@ -16978,6 +19176,44 @@ =================================================================== --- a/src/gcc/ada/gcc-interface/utils.c (.../tags/gcc_8_1_0_release) +++ b/src/gcc/ada/gcc-interface/utils.c (.../branches/gcc-8-branch) +@@ -391,15 +391,13 @@ + + SET_DUMMY_NODE (gnat_equiv, gnu_type); + +- /* Create a debug type so that debug info consumers only see an unspecified +- type. */ ++ /* Create a debug type so that debuggers only see an unspecified type. */ + if (Needs_Debug_Info (gnat_type)) + { + debug_type = make_node (LANG_TYPE); +- SET_TYPE_DEBUG_TYPE (gnu_type, debug_type); +- + TYPE_NAME (debug_type) = TYPE_NAME (gnu_type); + TYPE_ARTIFICIAL (debug_type) = TYPE_ARTIFICIAL (gnu_type); ++ SET_TYPE_DEBUG_TYPE (gnu_type, debug_type); + } + + return gnu_type; +@@ -1056,7 +1054,9 @@ + + finish_record_type (new_type, nreverse (new_field_list), 2, false); + relate_alias_sets (new_type, type, ALIAS_SET_COPY); +- if (TYPE_STUB_DECL (type)) ++ if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) ++ SET_TYPE_DEBUG_TYPE (new_type, TYPE_DEBUG_TYPE (type)); ++ else if (TYPE_STUB_DECL (type)) + SET_DECL_PARALLEL_TYPE (TYPE_STUB_DECL (new_type), + DECL_PARALLEL_TYPE (TYPE_STUB_DECL (type))); + +@@ -1413,7 +1413,7 @@ + } + + if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) +- SET_TYPE_DEBUG_TYPE (record, type); ++ SET_TYPE_DEBUG_TYPE (record, maybe_debug_type (type)); + + /* Unless debugging information isn't being written for the input type, + write a record that shows what we are a subtype of and also make a @@ -3312,9 +3312,12 @@ DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (type); DECL_RESULT (decl) = result_decl; @@ -17061,7 +19297,41 @@ /* ... fall through ... */ -@@ -2044,11 +2048,16 @@ +@@ -946,8 +950,7 @@ + function call is a constant object. Therefore, it can be the + inner object of a constant renaming and the renaming must be + fully instantiated, i.e. it cannot be a reference to (part of) +- an existing object. And treat other rvalues (addresses, null +- expressions, constructors and literals) the same way. */ ++ an existing object. And treat other rvalues the same way. */ + tree inner = gnu_expr; + while (handled_component_p (inner) || CONVERT_EXPR_P (inner)) + inner = TREE_OPERAND (inner, 0); +@@ -958,11 +961,11 @@ + inner = TREE_OPERAND (inner, 1); + if ((TREE_CODE (inner) == CALL_EXPR + && !call_is_atomic_load (inner)) +- || TREE_CODE (inner) == ADDR_EXPR +- || TREE_CODE (inner) == NULL_EXPR +- || TREE_CODE (inner) == PLUS_EXPR + || TREE_CODE (inner) == CONSTRUCTOR + || CONSTANT_CLASS_P (inner) ++ || COMPARISON_CLASS_P (inner) ++ || BINARY_CLASS_P (inner) ++ || EXPRESSION_CLASS_P (inner) + /* We need to detect the case where a temporary is created to + hold the return value, since we cannot safely rename it at + top level as it lives only in the elaboration routine. */ +@@ -984,7 +987,7 @@ + underlying object lives only in the elaboration routine. */ + || (TREE_CODE (inner) == INDIRECT_REF + && (inner +- = remove_conversions (TREE_OPERAND (inner, 0), true)) ++ = remove_conversions (TREE_OPERAND (inner, 0), true)) + && TREE_CODE (inner) == VAR_DECL + && DECL_RETURN_VALUE_P (inner))) + ; +@@ -2044,11 +2047,16 @@ { gnu_fat_type = TYPE_MAIN_VARIANT (TYPE_POINTER_TO (gnu_type)); TYPE_NAME (gnu_fat_type) = NULL_TREE; @@ -17081,7 +19351,7 @@ } else { -@@ -2069,29 +2078,39 @@ +@@ -2069,29 +2077,39 @@ /* Build the fat pointer type. Use a "void *" object instead of a pointer to the array type since we don't have the array type @@ -17137,7 +19407,7 @@ finish_fat_pointer_type (gnu_fat_type, tem); SET_TYPE_UNCONSTRAINED_ARRAY (gnu_fat_type, gnu_type); } -@@ -3385,20 +3404,6 @@ +@@ -3385,20 +3403,6 @@ break; } @@ -17158,7 +19428,7 @@ /* When the subtype has discriminants and these discriminants affect the initial shape it has inherited, factor them in. But for an Unchecked_Union (it must be an Itype), just return the type. */ -@@ -4436,7 +4441,7 @@ +@@ -4436,7 +4440,7 @@ /* If this is not an unconstrained array type, set some flags. */ if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE) { @@ -17167,7 +19437,7 @@ be properly aligned. This is necessary because conversions to the class-wide type are translated into conversions to the root type, which can be less aligned than some of its derived types. */ -@@ -5028,17 +5033,6 @@ +@@ -5028,17 +5032,6 @@ Is_Bit_Packed_Array (gnat_array) ? TYPE_DECL : VAR_DECL, true, Has_Component_Size_Clause (gnat_array)); @@ -17185,7 +19455,7 @@ /* If the component type is a RECORD_TYPE that has a self-referential size, then use the maximum size for the component size. */ if (!gnu_comp_size -@@ -5046,6 +5040,13 @@ +@@ -5046,6 +5039,13 @@ && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type))) gnu_comp_size = max_size (TYPE_SIZE (gnu_type), true); @@ -17199,7 +19469,7 @@ /* Honor the component size. This is not needed for bit-packed arrays. */ if (gnu_comp_size && !Is_Bit_Packed_Array (gnat_array)) { -@@ -5068,6 +5069,30 @@ +@@ -5068,6 +5068,30 @@ gnat_array); } @@ -17230,7 +19500,7 @@ if (Has_Atomic_Components (gnat_array) || Is_Atomic_Or_VFA (gnat_type)) check_ok_for_atomic_type (gnu_type, gnat_array, true); -@@ -6034,19 +6059,6 @@ +@@ -6034,19 +6058,6 @@ return gnu_ext_name; } @@ -17250,6 +19520,156 @@ /* Set TYPE_NONALIASED_COMPONENT on an array type built by means of build_nonshared_array_type. */ +@@ -6627,65 +6638,44 @@ + the value passed against the list of choices. */ + + static tree +-choices_to_gnu (tree operand, Node_Id choices) ++choices_to_gnu (tree gnu_operand, Node_Id gnat_choices) + { +- Node_Id choice; +- Node_Id gnat_temp; +- tree result = boolean_false_node; +- tree this_test, low = 0, high = 0, single = 0; ++ tree gnu_result = boolean_false_node, gnu_type; + +- for (choice = First (choices); Present (choice); choice = Next (choice)) ++ gnu_operand = maybe_character_value (gnu_operand); ++ gnu_type = TREE_TYPE (gnu_operand); ++ ++ for (Node_Id gnat_choice = First (gnat_choices); ++ Present (gnat_choice); ++ gnat_choice = Next (gnat_choice)) + { +- switch (Nkind (choice)) ++ tree gnu_low = NULL_TREE, gnu_high = NULL_TREE; ++ tree gnu_test; ++ ++ switch (Nkind (gnat_choice)) + { + case N_Range: +- low = gnat_to_gnu (Low_Bound (choice)); +- high = gnat_to_gnu (High_Bound (choice)); +- +- this_test +- = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, +- build_binary_op (GE_EXPR, boolean_type_node, +- operand, low, true), +- build_binary_op (LE_EXPR, boolean_type_node, +- operand, high, true), +- true); +- ++ gnu_low = gnat_to_gnu (Low_Bound (gnat_choice)); ++ gnu_high = gnat_to_gnu (High_Bound (gnat_choice)); + break; + + case N_Subtype_Indication: +- gnat_temp = Range_Expression (Constraint (choice)); +- low = gnat_to_gnu (Low_Bound (gnat_temp)); +- high = gnat_to_gnu (High_Bound (gnat_temp)); +- +- this_test +- = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, +- build_binary_op (GE_EXPR, boolean_type_node, +- operand, low, true), +- build_binary_op (LE_EXPR, boolean_type_node, +- operand, high, true), +- true); ++ gnu_low = gnat_to_gnu (Low_Bound (Range_Expression ++ (Constraint (gnat_choice)))); ++ gnu_high = gnat_to_gnu (High_Bound (Range_Expression ++ (Constraint (gnat_choice)))); + break; + + case N_Identifier: + case N_Expanded_Name: +- /* This represents either a subtype range, an enumeration +- literal, or a constant Ekind says which. If an enumeration +- literal or constant, fall through to the next case. */ +- if (Ekind (Entity (choice)) != E_Enumeration_Literal +- && Ekind (Entity (choice)) != E_Constant) ++ /* This represents either a subtype range or a static value of ++ some kind; Ekind says which. */ ++ if (Is_Type (Entity (gnat_choice))) + { +- tree type = gnat_to_gnu_type (Entity (choice)); ++ tree gnu_type = get_unpadded_type (Entity (gnat_choice)); + +- low = TYPE_MIN_VALUE (type); +- high = TYPE_MAX_VALUE (type); +- +- this_test +- = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, +- build_binary_op (GE_EXPR, boolean_type_node, +- operand, low, true), +- build_binary_op (LE_EXPR, boolean_type_node, +- operand, high, true), +- true); ++ gnu_low = TYPE_MIN_VALUE (gnu_type); ++ gnu_high = TYPE_MAX_VALUE (gnu_type); + break; + } + +@@ -6693,13 +6683,10 @@ + + case N_Character_Literal: + case N_Integer_Literal: +- single = gnat_to_gnu (choice); +- this_test = build_binary_op (EQ_EXPR, boolean_type_node, operand, +- single, true); ++ gnu_low = gnat_to_gnu (gnat_choice); + break; + + case N_Others_Choice: +- this_test = boolean_true_node; + break; + + default: +@@ -6706,14 +6693,39 @@ + gcc_unreachable (); + } + +- if (result == boolean_false_node) +- result = this_test; ++ /* Everything should be folded into constants at this point. */ ++ gcc_assert (!gnu_low || TREE_CODE (gnu_low) == INTEGER_CST); ++ gcc_assert (!gnu_high || TREE_CODE (gnu_high) == INTEGER_CST); ++ ++ if (gnu_low && TREE_TYPE (gnu_low) != gnu_type) ++ gnu_low = convert (gnu_type, gnu_low); ++ if (gnu_high && TREE_TYPE (gnu_high) != gnu_type) ++ gnu_high = convert (gnu_type, gnu_high); ++ ++ if (gnu_low && gnu_high) ++ gnu_test ++ = build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node, ++ build_binary_op (GE_EXPR, boolean_type_node, ++ gnu_operand, gnu_low, true), ++ build_binary_op (LE_EXPR, boolean_type_node, ++ gnu_operand, gnu_high, true), ++ true); ++ else if (gnu_low) ++ gnu_test ++ = build_binary_op (EQ_EXPR, boolean_type_node, gnu_operand, gnu_low, ++ true); + else +- result = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, result, +- this_test, true); ++ gnu_test = boolean_true_node; ++ ++ if (gnu_result == boolean_false_node) ++ gnu_result = gnu_test; ++ else ++ gnu_result ++ = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_result, ++ gnu_test, true); + } + +- return result; ++ return gnu_result; + } + + /* Adjust PACKED setting as passed to gnat_to_gnu_field for a field of @@ -7234,31 +7246,44 @@ if (!Comes_From_Source (gnat_record_type)) return; @@ -18105,7 +20525,138 @@ =================================================================== --- a/src/gcc/fortran/decl.c (.../tags/gcc_8_1_0_release) +++ b/src/gcc/fortran/decl.c (.../branches/gcc-8-branch) -@@ -3226,12 +3226,20 @@ +@@ -521,6 +521,7 @@ + newdata = gfc_get_data (); + newdata->var = gfc_get_data_variable (); + newdata->var->expr = gfc_get_variable_expr (st); ++ newdata->var->expr->where = sym->declared_at; + newdata->where = gfc_current_locus; + + /* Match initial value list. This also eats the terminal '/'. */ +@@ -646,7 +647,7 @@ + { + gfc_constructor_base array_head = NULL; + gfc_expr *expr = NULL; +- match m; ++ match m = MATCH_ERROR; + locus where; + mpz_t repeat, cons_size, as_size; + bool scalar; +@@ -654,18 +655,27 @@ + + gcc_assert (ts); + +- mpz_init_set_ui (repeat, 0); +- scalar = !as || !as->rank; +- + /* We have already matched '/' - now look for a constant list, as with + top_val_list from decl.c, but append the result to an array. */ + if (gfc_match ("/") == MATCH_YES) + { + gfc_error ("Empty old style initializer list at %C"); +- goto cleanup; ++ return MATCH_ERROR; + } + + where = gfc_current_locus; ++ scalar = !as || !as->rank; ++ ++ if (!scalar && !spec_size (as, &as_size)) ++ { ++ gfc_error ("Array in initializer list at %L must have an explicit shape", ++ as->type == AS_EXPLICIT ? &as->upper[0]->where : &where); ++ /* Nothing to cleanup yet. */ ++ return MATCH_ERROR; ++ } ++ ++ mpz_init_set_ui (repeat, 0); ++ + for (;;) + { + m = match_data_constant (&expr); +@@ -695,7 +705,10 @@ + + m = match_data_constant (&expr); + if (m == MATCH_NO) +- gfc_error ("Expected data constant after repeat spec at %C"); ++ { ++ m = MATCH_ERROR; ++ gfc_error ("Expected data constant after repeat spec at %C"); ++ } + if (m != MATCH_YES) + goto cleanup; + } +@@ -738,6 +751,9 @@ + goto syntax; + } + ++ /* If we break early from here out, we encountered an error. */ ++ m = MATCH_ERROR; ++ + /* Set up expr as an array constructor. */ + if (!scalar) + { +@@ -750,25 +766,13 @@ + + /* Validate sizes. We built expr ourselves, so cons_size will be + constant (we fail above for non-constant expressions). +- We still need to verify that the array-spec has constant size. */ +- cmp = 0; ++ We still need to verify that the sizes match. */ + gcc_assert (gfc_array_size (expr, &cons_size)); +- if (!spec_size (as, &as_size)) +- { +- gfc_error ("Expected constant array-spec in initializer list at %L", +- as->type == AS_EXPLICIT ? &as->upper[0]->where : &where); +- cmp = -1; +- } +- else +- { +- /* Make sure the specs are of the same size. */ +- cmp = mpz_cmp (cons_size, as_size); +- if (cmp < 0) +- gfc_error ("Not enough elements in array initializer at %C"); +- else if (cmp > 0) +- gfc_error ("Too many elements in array initializer at %C"); +- mpz_clear (as_size); +- } ++ cmp = mpz_cmp (cons_size, as_size); ++ if (cmp < 0) ++ gfc_error ("Not enough elements in array initializer at %C"); ++ else if (cmp > 0) ++ gfc_error ("Too many elements in array initializer at %C"); + mpz_clear (cons_size); + if (cmp) + goto cleanup; +@@ -783,10 +787,11 @@ + expr->ts.u.cl->length_from_typespec = 1; + + *result = expr; +- mpz_clear (repeat); +- return MATCH_YES; ++ m = MATCH_YES; ++ goto done; + + syntax: ++ m = MATCH_ERROR; + gfc_error ("Syntax error in old style initializer list at %C"); + + cleanup: +@@ -794,8 +799,12 @@ + expr->value.constructor = NULL; + gfc_free_expr (expr); + gfc_constructor_free (array_head); ++ ++done: + mpz_clear (repeat); +- return MATCH_ERROR; ++ if (!scalar) ++ mpz_clear (as_size); ++ return m; + } + + +@@ -3226,12 +3235,20 @@ cl->length = gfc_get_int_expr (gfc_charlen_int_kind, NULL, 1); else { @@ -18129,7 +20680,7 @@ e = gfc_copy_expr (len); gfc_reduce_init_expr (e); if (e->expr_type == EXPR_CONSTANT) -@@ -3242,10 +3250,12 @@ +@@ -3242,10 +3259,12 @@ } else gfc_free_expr (e); @@ -18145,7 +20696,7 @@ } ts->u.cl = cl; -@@ -9779,9 +9789,9 @@ +@@ -9779,9 +9798,9 @@ /* This function does some work to determine which matcher should be used to @@ -18157,7 +20708,7 @@ match gfc_match_type (gfc_statement *st) -@@ -9808,11 +9818,7 @@ +@@ -9808,11 +9827,7 @@ /* If we see an attribute list before anything else it's definitely a derived * type declaration. */ if (gfc_match (" ,") == MATCH_YES || gfc_match (" ::") == MATCH_YES) @@ -18170,7 +20721,7 @@ /* By now "TYPE" has already been matched. If we do not see a name, this may * be something like "TYPE *" or "TYPE ". */ -@@ -9827,30 +9833,12 @@ +@@ -9827,30 +9842,12 @@ *st = ST_WRITE; return MATCH_YES; } @@ -18204,7 +20755,7 @@ /* By now we have "TYPE ". Check first if the name is an * intrinsic typename - if so let gfc_match_derived_decl dump an error. * Otherwise if gfc_match_derived_decl fails it's probably an existing -@@ -9862,12 +9850,36 @@ +@@ -9862,12 +9859,36 @@ *st = ST_DERIVED_DECL; return m; } @@ -18245,7 +20796,7 @@ } -@@ -9961,8 +9973,12 @@ +@@ -9961,8 +9982,12 @@ if (!gensym->attr.generic && gensym->ts.type != BT_UNKNOWN) { @@ -18317,7 +20868,33 @@ =================================================================== --- a/src/gcc/fortran/ChangeLog (.../tags/gcc_8_1_0_release) +++ b/src/gcc/fortran/ChangeLog (.../branches/gcc-8-branch) -@@ -1,3 +1,268 @@ +@@ -1,3 +1,294 @@ ++2018-07-16 Fritz Reese ++ ++ PR fortran/83184 ++ Backport from trunk. ++ * decl.c (match_old_style_init): Initialize locus of variable expr when ++ creating a data variable. ++ (match_clist_expr): Verify array is explicit shape/size before ++ attempting to allocate constant array constructor. ++ ++2018-07-16 Fritz Reese ++ ++ Backport from trunk: ++ ++ PR fortran/86417 ++ * module.c (mio_component): Set component->loc when loading from module. ++ ++ PR fortran/83183 ++ PR fortran/86325 ++ * expr.c (class_allocatable, class_pointer, comp_allocatable, ++ comp_pointer): New helpers. ++ (component_initializer): Generate EXPR_NULL for allocatable or pointer ++ components. Do not generate initializers for components within BT_CLASS. ++ Do not assign to comp->initializer. ++ (gfc_generate_initializer): Use new helpers; move code to generate ++ EXPR_NULL for class allocatable components into component_initializer(). ++ +2018-07-02 Paul Thomas + + PR fortran/82969 @@ -18702,16 +21279,77 @@ gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts)); return false; -@@ -4490,7 +4493,7 @@ - gfc_apply_init (&c->ts, &c->attr, init); - } - -- return init; -+ return (c->initializer = init); +@@ -4424,25 +4427,60 @@ + return init; } ++static bool ++class_allocatable (gfc_component *comp) ++{ ++ return comp->ts.type == BT_CLASS && CLASS_DATA (comp) ++ && CLASS_DATA (comp)->attr.allocatable; ++} ++ ++static bool ++class_pointer (gfc_component *comp) ++{ ++ return comp->ts.type == BT_CLASS && CLASS_DATA (comp) ++ && CLASS_DATA (comp)->attr.pointer; ++} ++ ++static bool ++comp_allocatable (gfc_component *comp) ++{ ++ return comp->attr.allocatable || class_allocatable (comp); ++} ++ ++static bool ++comp_pointer (gfc_component *comp) ++{ ++ return comp->attr.pointer ++ || comp->attr.pointer ++ || comp->attr.proc_pointer ++ || comp->attr.class_pointer ++ || class_pointer (comp); ++} ++ + /* Fetch or generate an initializer for the given component. + Only generate an initializer if generate is true. */ + + static gfc_expr * +-component_initializer (gfc_typespec *ts, gfc_component *c, bool generate) ++component_initializer (gfc_component *c, bool generate) + { + gfc_expr *init = NULL; + +- /* See if we can find the initializer immediately. +- Some components should never get initializers. */ +- if (c->initializer || !generate +- || (ts->type == BT_CLASS && !c->attr.allocatable) +- || c->attr.pointer +- || c->attr.class_pointer +- || c->attr.proc_pointer) ++ /* Allocatable components always get EXPR_NULL. ++ Pointer components are only initialized when generating, and only if they ++ do not already have an initializer. */ ++ if (comp_allocatable (c) || (generate && comp_pointer (c) && !c->initializer)) ++ { ++ init = gfc_get_null_expr (&c->loc); ++ init->ts = c->ts; ++ return init; ++ } ++ ++ /* See if we can find the initializer immediately. */ ++ if (c->initializer || !generate) + return c->initializer; + + /* Recursively handle derived type components. */ +- if (c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS) ++ else if (c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS) + init = gfc_generate_initializer (&c->ts, true); -@@ -4502,7 +4505,33 @@ + else if (c->ts.type == BT_UNION && c->ts.u.derived->components) +@@ -4502,7 +4540,33 @@ return gfc_generate_initializer (ts, false); } @@ -18745,7 +21383,7 @@ /* Get or generate an expression for a default initializer of a derived type. If -finit-derived is specified, generate default initialization expressions for components that lack them when generate is set. */ -@@ -4512,8 +4541,12 @@ +@@ -4512,8 +4576,12 @@ { gfc_expr *init, *tmp; gfc_component *comp; @@ -18758,6 +21396,65 @@ /* See if we have a default initializer in this, but not in nested types (otherwise we could use gfc_has_default_initializer()). We don't need to check if we are going to generate them. */ +@@ -4521,9 +4589,7 @@ + if (!generate) + { + for (; comp; comp = comp->next) +- if (comp->initializer || comp->attr.allocatable +- || (comp->ts.type == BT_CLASS && CLASS_DATA (comp) +- && CLASS_DATA (comp)->attr.allocatable)) ++ if (comp->initializer || comp_allocatable (comp)) + break; + } + +@@ -4539,7 +4605,7 @@ + gfc_constructor *ctor = gfc_constructor_get(); + + /* Fetch or generate an initializer for the component. */ +- tmp = component_initializer (ts, comp, generate); ++ tmp = component_initializer (comp, generate); + if (tmp) + { + /* Save the component ref for STRUCTUREs and UNIONs. */ +@@ -4549,8 +4615,7 @@ + + /* If the initializer was not generated, we need a copy. */ + ctor->expr = comp->initializer ? gfc_copy_expr (tmp) : tmp; +- if ((comp->ts.type != tmp->ts.type +- || comp->ts.kind != tmp->ts.kind) ++ if ((comp->ts.type != tmp->ts.type || comp->ts.kind != tmp->ts.kind) + && !comp->attr.pointer && !comp->attr.proc_pointer) + { + bool val; +@@ -4560,15 +4625,6 @@ + } + } + +- if (comp->attr.allocatable +- || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->attr.allocatable)) +- { +- ctor->expr = gfc_get_expr (); +- ctor->expr->expr_type = EXPR_NULL; +- ctor->expr->where = init->where; +- ctor->expr->ts = comp->ts; +- } +- + gfc_constructor_append (&init->value.constructor, ctor); + } + +Index: gcc/fortran/module.c +=================================================================== +--- a/src/gcc/fortran/module.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/fortran/module.c (.../branches/gcc-8-branch) +@@ -2848,6 +2848,8 @@ + if (c->attr.proc_pointer) + mio_typebound_proc (&c->tb); + ++ c->loc = gfc_current_locus; ++ + mio_rparen (); + } + Index: gcc/fortran/trans-types.c =================================================================== --- a/src/gcc/fortran/trans-types.c (.../tags/gcc_8_1_0_release) @@ -19224,6 +21921,27 @@ TREE_OPERAND (*expr_p, 0) = val; SAVE_EXPR_RESOLVED_P (*expr_p) = 1; +Index: gcc/graphite-scop-detection.c +=================================================================== +--- a/src/gcc/graphite-scop-detection.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/graphite-scop-detection.c (.../branches/gcc-8-branch) +@@ -1176,13 +1176,15 @@ + + /* Find parameters in conditional statements. */ + gimple *stmt; +- loop_p loop = GBB_BB (gbb)->loop_father; + FOR_EACH_VEC_ELT (GBB_CONDITIONS (gbb), i, stmt) + { ++ loop_p loop = gimple_bb (stmt)->loop_father; + tree lhs = scalar_evolution_in_region (region->region, loop, + gimple_cond_lhs (stmt)); + tree rhs = scalar_evolution_in_region (region->region, loop, + gimple_cond_rhs (stmt)); ++ gcc_assert (!chrec_contains_undetermined (lhs) ++ && !chrec_contains_undetermined (rhs)); + + scan_tree_for_params (region, lhs); + scan_tree_for_params (region, rhs); Index: gcc/calls.c =================================================================== --- a/src/gcc/calls.c (.../tags/gcc_8_1_0_release) @@ -19519,6 +22237,15 @@ =================================================================== --- a/src/gcc/gimple-fold.c (.../tags/gcc_8_1_0_release) +++ b/src/gcc/gimple-fold.c (.../branches/gcc-8-branch) +@@ -645,7 +645,7 @@ + if (integer_zerop (size)) + return true; + +- if (TREE_CODE (size) != SSA_NAME) ++ if (TREE_CODE (size) != SSA_NAME || !INTEGRAL_TYPE_P (TREE_TYPE (size))) + return false; + + wide_int min, max; @@ -3546,9 +3546,10 @@ return true; } @@ -465817,6 +468544,49 @@ ;; s390*-*-*) +Index: gcc/tree-cfg.c +=================================================================== +--- a/src/gcc/tree-cfg.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/tree-cfg.c (.../branches/gcc-8-branch) +@@ -6925,7 +6925,16 @@ + ; + else if (block == p->orig_block + || p->orig_block == NULL_TREE) +- TREE_SET_BLOCK (t, p->new_block); ++ { ++ /* tree_node_can_be_shared says we can share invariant ++ addresses but unshare_expr copies them anyways. Make sure ++ to unshare before adjusting the block in place - we do not ++ always see a copy here. */ ++ if (TREE_CODE (t) == ADDR_EXPR ++ && is_gimple_min_invariant (t)) ++ *tp = t = unshare_expr (t); ++ TREE_SET_BLOCK (t, p->new_block); ++ } + else if (flag_checking) + { + while (block && TREE_CODE (block) == BLOCK && block != p->orig_block) +Index: gcc/tree-ssa-reassoc.c +=================================================================== +--- a/src/gcc/tree-ssa-reassoc.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/tree-ssa-reassoc.c (.../branches/gcc-8-branch) +@@ -2168,9 +2168,14 @@ + continue; + CASE_CONVERT: + if (is_bool) +- goto do_default; +- if (TYPE_PRECISION (TREE_TYPE (arg0)) == 1) + { ++ if ((TYPE_PRECISION (exp_type) == 1 ++ || TREE_CODE (exp_type) == BOOLEAN_TYPE) ++ && TYPE_PRECISION (TREE_TYPE (arg0)) > 1) ++ return; ++ } ++ else if (TYPE_PRECISION (TREE_TYPE (arg0)) == 1) ++ { + if (TYPE_UNSIGNED (TREE_TYPE (arg0))) + is_bool = true; + else Index: gcc/config/s390/s390-builtin-types.def =================================================================== --- a/src/gcc/config/s390/s390-builtin-types.def (.../tags/gcc_8_1_0_release) @@ -466371,24 +469141,90 @@ =================================================================== --- a/src/gcc/config/i386/x86-tune.def (.../tags/gcc_8_1_0_release) +++ b/src/gcc/config/i386/x86-tune.def (.../branches/gcc-8-branch) -@@ -48,7 +48,7 @@ +@@ -48,9 +48,9 @@ over partial stores. For example preffer MOVZBL or MOVQ to load 8bit value over movb. */ DEF_TUNE (X86_TUNE_PARTIAL_REG_DEPENDENCY, "partial_reg_dependency", - m_P4_NOCONA | m_CORE2 | m_NEHALEM | m_SANDYBRIDGE -+ m_P4_NOCONA | m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_HASWELL ++ m_P4_NOCONA | m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BONNELL | m_SILVERMONT | m_INTEL - | m_KNL | m_KNM | m_AMD_MULTIPLE | m_SKYLAKE_AVX512 | m_GENERIC) +- | m_KNL | m_KNM | m_AMD_MULTIPLE | m_SKYLAKE_AVX512 | m_GENERIC) ++ | m_KNL | m_KNM | m_AMD_MULTIPLE | m_GENERIC) -@@ -84,7 +84,7 @@ + /* X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY: This knob promotes all store + destinations to be 128bit to allow register renaming on 128bit SSE units, +@@ -84,8 +84,8 @@ partial dependencies. */ DEF_TUNE (X86_TUNE_MOVX, "movx", m_PPRO | m_P4_NOCONA | m_CORE2 | m_NEHALEM | m_SANDYBRIDGE - | m_BONNELL | m_SILVERMONT | m_KNL | m_KNM | m_INTEL -+ | m_BONNELL | m_SILVERMONT | m_KNL | m_KNM | m_INTEL | m_HASWELL - | m_GEODE | m_AMD_MULTIPLE | m_SKYLAKE_AVX512 | m_GENERIC) +- | m_GEODE | m_AMD_MULTIPLE | m_SKYLAKE_AVX512 | m_GENERIC) ++ | m_BONNELL | m_SILVERMONT | m_KNL | m_KNM | m_INTEL | m_CORE_AVX2 ++ | m_GEODE | m_AMD_MULTIPLE | m_GENERIC) /* X86_TUNE_MEMORY_MISMATCH_STALL: Avoid partial stores that are followed by + full sized loads. */ +@@ -101,19 +101,19 @@ + /* X86_TUNE_FUSE_CMP_AND_BRANCH_64: Fuse compare with a subsequent + conditional jump instruction for TARGET_64BIT. */ + DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_64, "fuse_cmp_and_branch_64", +- m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_BDVER | m_ZNVER1 | m_GENERIC) ++ m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BDVER | m_ZNVER1 | m_GENERIC) + + /* X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS: Fuse compare with a + subsequent conditional jump instruction when the condition jump + check sign flag (SF) or overflow flag (OF). */ + DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS, "fuse_cmp_and_branch_soflags", +- m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_BDVER | m_ZNVER1 | m_GENERIC) ++ m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BDVER | m_ZNVER1 | m_GENERIC) + + /* X86_TUNE_FUSE_ALU_AND_BRANCH: Fuse alu with a subsequent conditional + jump instruction when the alu instruction produces the CCFLAG consumed by + the conditional jump instruction. */ + DEF_TUNE (X86_TUNE_FUSE_ALU_AND_BRANCH, "fuse_alu_and_branch", +- m_SANDYBRIDGE | m_HASWELL | m_GENERIC) ++ m_SANDYBRIDGE | m_CORE_AVX2 | m_GENERIC) + + + /*****************************************************************************/ +@@ -286,7 +286,7 @@ + /* X86_TUNE_AVOID_FALSE_DEP_FOR_BMI: Avoid false dependency + for bit-manipulation instructions. */ + DEF_TUNE (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI, "avoid_false_dep_for_bmi", +- m_SANDYBRIDGE | m_HASWELL | m_GENERIC) ++ m_SANDYBRIDGE | m_CORE_AVX2 | m_GENERIC) + + /* X86_TUNE_ADJUST_UNROLL: This enables adjusting the unroll factor based + on hardware capabilities. Bdver3 hardware has a loop buffer which makes +@@ -335,15 +335,15 @@ + /* X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL: Use movups for misaligned loads instead + of a sequence loading registers by parts. */ + DEF_TUNE (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL, "sse_unaligned_load_optimal", +- m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_SILVERMONT | m_KNL | m_KNM +- | m_INTEL | m_SKYLAKE_AVX512 | m_AMDFAM10 | m_BDVER | m_BTVER ++ m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_SILVERMONT | m_KNL | m_KNM ++ | m_INTEL | m_AMDFAM10 | m_BDVER | m_BTVER + | m_ZNVER1 | m_GENERIC) + + /* X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL: Use movups for misaligned stores instead + of a sequence loading registers by parts. */ + DEF_TUNE (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL, "sse_unaligned_store_optimal", +- m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_SILVERMONT | m_KNL | m_KNM +- | m_INTEL | m_SKYLAKE_AVX512 | m_BDVER | m_ZNVER1 | m_GENERIC) ++ m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_SILVERMONT | m_KNL | m_KNM ++ | m_INTEL | m_BDVER | m_ZNVER1 | m_GENERIC) + + /* Use packed single precision instructions where posisble. I.e. movups instead + of movupd. */ +@@ -429,7 +429,7 @@ + + /* X86_TUNE_AVX256_OPTIMAL: Use 256-bit AVX instructions instead of 512-bit AVX + instructions in the auto-vectorizer. */ +-DEF_TUNE (X86_TUNE_AVX256_OPTIMAL, "avx256_optimal", m_SKYLAKE_AVX512) ++DEF_TUNE (X86_TUNE_AVX256_OPTIMAL, "avx256_optimal", m_CORE_AVX512) + + /*****************************************************************************/ + /* Historical relics: tuning flags that helps a specific old CPU designs */ Index: gcc/config/i386/avx512vbmi2vlintrin.h =================================================================== --- a/src/gcc/config/i386/avx512vbmi2vlintrin.h (.../tags/gcc_8_1_0_release) @@ -466673,7 +469509,26 @@ =================================================================== --- a/src/gcc/config/i386/i386.c (.../tags/gcc_8_1_0_release) +++ b/src/gcc/config/i386/i386.c (.../branches/gcc-8-branch) -@@ -13328,7 +13328,7 @@ +@@ -139,7 +139,6 @@ + #define m_NEHALEM (HOST_WIDE_INT_1U<is_leaf && crtl->sp_is_unchanging -@@ -37042,7 +37042,7 @@ +@@ -37042,7 +37045,7 @@ case IX86_BUILTIN_RDPID: @@ -466691,7 +469546,7 @@ if (TARGET_64BIT) { -@@ -37051,18 +37051,16 @@ +@@ -37051,18 +37054,16 @@ } else insn = gen_rdpid (op0); @@ -466716,7 +469571,7 @@ case IX86_BUILTIN_RDPMC: case IX86_BUILTIN_RDTSC: case IX86_BUILTIN_RDTSCP: -@@ -37121,14 +37119,9 @@ +@@ -37121,14 +37122,9 @@ emit_move_insn (gen_rtx_MEM (SImode, op4), op2); } @@ -466734,7 +469589,7 @@ if (TARGET_64BIT) { -@@ -37217,25 +37210,23 @@ +@@ -37217,25 +37213,23 @@ if (!REG_P (op0)) op0 = copy_to_mode_reg (SImode, op0); @@ -466956,6 +469811,19 @@ (define_insn "trap" [(trap_if (const_int 1) (const_int 0))] "" +Index: gcc/config/gnu-user.h +=================================================================== +--- a/src/gcc/config/gnu-user.h (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/config/gnu-user.h (.../branches/gcc-8-branch) +@@ -123,7 +123,7 @@ + + #define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \ + "%{shared:-lc} \ +- %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" ++ %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + + #define GNU_USER_TARGET_LIB_SPEC \ + "%{pthread:-lpthread} " \ Index: gcc/config/rtems.h =================================================================== --- a/src/gcc/config/rtems.h (.../tags/gcc_8_1_0_release) @@ -468083,6 +470951,46 @@ #define LONG_DOUBLE_TYPE_SIZE rs6000_long_double_type_size /* Work around rs6000_long_double_type_size dependency in ada/targtyps.c. */ +Index: gcc/config/rs6000/emmintrin.h +=================================================================== +--- a/src/gcc/config/rs6000/emmintrin.h (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/config/rs6000/emmintrin.h (.../branches/gcc-8-branch) +@@ -1884,6 +1884,30 @@ + } + + extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) ++_mm_and_si128 (__m128i __A, __m128i __B) ++{ ++ return (__m128i)vec_and ((__v2di) __A, (__v2di) __B); ++} ++ ++extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) ++_mm_andnot_si128 (__m128i __A, __m128i __B) ++{ ++ return (__m128i)vec_andc ((__v2di) __B, (__v2di) __A); ++} ++ ++extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) ++_mm_or_si128 (__m128i __A, __m128i __B) ++{ ++ return (__m128i)vec_or ((__v2di) __A, (__v2di) __B); ++} ++ ++extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) ++_mm_xor_si128 (__m128i __A, __m128i __B) ++{ ++ return (__m128i)vec_xor ((__v2di) __A, (__v2di) __B); ++} ++ ++extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) + _mm_cmpeq_epi8 (__m128i __A, __m128i __B) + { + return (__m128i) vec_cmpeq ((__v16qi) __A, (__v16qi)__B); +@@ -2333,3 +2357,4 @@ + } + + #endif /* EMMINTRIN_H_ */ ++ Index: gcc/config/rs6000/rs6000.md =================================================================== --- a/src/gcc/config/rs6000/rs6000.md (.../tags/gcc_8_1_0_release) @@ -468258,6 +471166,329 @@ "!TARGET_FLOAT128_HW && FLOAT128_IEEE_P (mode)" "xscpsgndp %x3,%x2,%x1\;xxpermdi %x0,%x3,%x1,1" [(set_attr "type" "veccomplex") +Index: gcc/config/arc/arc.c +=================================================================== +--- a/src/gcc/config/arc/arc.c (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/config/arc/arc.c (.../branches/gcc-8-branch) +@@ -2564,8 +2564,6 @@ + struct arc_frame_info frame_info; + /* To keep track of unalignment caused by short insns. */ + int unalign; +- int force_short_suffix; /* Used when disgorging return delay slot insns. */ +- const char *size_reason; + struct arc_ccfsm ccfsm_current; + /* Map from uid to ccfsm state during branch shortening. */ + rtx ccfsm_current_insn; +@@ -4220,7 +4218,7 @@ + } + break; + case '&': +- if (TARGET_ANNOTATE_ALIGN && cfun->machine->size_reason) ++ if (TARGET_ANNOTATE_ALIGN) + fprintf (file, "; unalign: %d", cfun->machine->unalign); + return; + case '+': +@@ -4906,7 +4904,6 @@ + arc_verify_short (rtx_insn *insn, int, int check_attr) + { + enum attr_iscompact iscompact; +- struct machine_function *machine; + + if (check_attr > 0) + { +@@ -4914,11 +4911,7 @@ + if (iscompact == ISCOMPACT_FALSE) + return 0; + } +- machine = cfun->machine; + +- if (machine->force_short_suffix >= 0) +- return machine->force_short_suffix; +- + return (get_attr_length (insn) & 2) != 0; + } + +@@ -4956,8 +4949,6 @@ + cfun->machine->prescan_initialized = 1; + } + arc_ccfsm_advance (insn, &arc_ccfsm_current); +- +- cfun->machine->size_reason = 0; + } + + /* Given FROM and TO register numbers, say whether this elimination is allowed. +@@ -7599,6 +7590,76 @@ + } + } + ++/* Add padding if necessary to avoid a mispredict. A return could ++ happen immediately after the function start. A call/return and ++ return/return must be 6 bytes apart to avoid mispredict. */ ++ ++static void ++pad_return (void) ++{ ++ rtx_insn *insn; ++ long offset; ++ ++ if (!TARGET_PAD_RETURN) ++ return; ++ ++ for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) ++ { ++ rtx_insn *prev0 = prev_active_insn (insn); ++ bool wantlong = false; ++ ++ if (!INSN_P (insn) || GET_CODE (PATTERN (insn)) != SIMPLE_RETURN) ++ continue; ++ ++ if (!prev0) ++ { ++ prev0 = emit_insn_before (gen_nopv (), insn); ++ /* REG_SAVE_NOTE is used by Haifa scheduler, we are in reorg ++ so it is safe to reuse it for forcing a particular length ++ for an instruction. */ ++ add_reg_note (prev0, REG_SAVE_NOTE, GEN_INT (1)); ++ emit_insn_before (gen_nopv (), insn); ++ continue; ++ } ++ offset = get_attr_length (prev0); ++ ++ if (get_attr_length (prev0) == 2 ++ && get_attr_iscompact (prev0) != ISCOMPACT_TRUE) ++ { ++ /* Force long version of the insn. */ ++ wantlong = true; ++ offset += 2; ++ } ++ ++ rtx_insn *prev = prev_active_insn (prev0); ++ if (prev) ++ offset += get_attr_length (prev); ++ ++ prev = prev_active_insn (prev); ++ if (prev) ++ offset += get_attr_length (prev); ++ ++ switch (offset) ++ { ++ case 2: ++ prev = emit_insn_before (gen_nopv (), insn); ++ add_reg_note (prev, REG_SAVE_NOTE, GEN_INT (1)); ++ break; ++ case 4: ++ emit_insn_before (gen_nopv (), insn); ++ break; ++ default: ++ continue; ++ } ++ ++ if (wantlong) ++ add_reg_note (prev0, REG_SAVE_NOTE, GEN_INT (1)); ++ ++ /* Emit a blockage to avoid delay slot scheduling. */ ++ emit_insn_before (gen_blockage (), insn); ++ } ++} ++ + static int arc_reorg_in_progress = 0; + + /* ARC's machince specific reorg function. */ +@@ -7624,6 +7685,7 @@ + + workaround_arc_anomaly (); + jli_call_scan (); ++ pad_return (); + + /* FIXME: should anticipate ccfsm action, generate special patterns for + to-be-deleted branches that have no delay slot and have at least the +@@ -9332,79 +9394,6 @@ + return !optimize_size && arc_reorg_in_progress; + } + +-/* We are about to output a return insn. Add padding if necessary to avoid +- a mispredict. A return could happen immediately after the function +- start, but after a call we know that there will be at least a blink +- restore. */ +- +-void +-arc_pad_return (void) +-{ +- rtx_insn *insn = current_output_insn; +- rtx_insn *prev = prev_active_insn (insn); +- int want_long; +- +- if (!prev) +- { +- fputs ("\tnop_s\n", asm_out_file); +- cfun->machine->unalign ^= 2; +- want_long = 1; +- } +- /* If PREV is a sequence, we know it must be a branch / jump or a tailcall, +- because after a call, we'd have to restore blink first. */ +- else if (GET_CODE (PATTERN (prev)) == SEQUENCE) +- return; +- else +- { +- want_long = (get_attr_length (prev) == 2); +- prev = prev_active_insn (prev); +- } +- if (!prev +- || ((NONJUMP_INSN_P (prev) && GET_CODE (PATTERN (prev)) == SEQUENCE) +- ? CALL_ATTR (as_a (PATTERN (prev))->insn (0), +- NON_SIBCALL) +- : CALL_ATTR (prev, NON_SIBCALL))) +- { +- if (want_long) +- cfun->machine->size_reason +- = "call/return and return/return must be 6 bytes apart to avoid mispredict"; +- else if (TARGET_UNALIGN_BRANCH && cfun->machine->unalign) +- { +- cfun->machine->size_reason +- = "Long unaligned jump avoids non-delay slot penalty"; +- want_long = 1; +- } +- /* Disgorge delay insn, if there is any, and it may be moved. */ +- if (final_sequence +- /* ??? Annulled would be OK if we can and do conditionalize +- the delay slot insn accordingly. */ +- && !INSN_ANNULLED_BRANCH_P (insn) +- && (get_attr_cond (insn) != COND_USE +- || !reg_set_p (gen_rtx_REG (CCmode, CC_REG), +- XVECEXP (final_sequence, 0, 1)))) +- { +- prev = as_a (XVECEXP (final_sequence, 0, 1)); +- gcc_assert (!prev_real_insn (insn) +- || !arc_hazard (prev_real_insn (insn), prev)); +- cfun->machine->force_short_suffix = !want_long; +- rtx save_pred = current_insn_predicate; +- final_scan_insn (prev, asm_out_file, optimize, 1, NULL); +- cfun->machine->force_short_suffix = -1; +- prev->set_deleted (); +- current_output_insn = insn; +- current_insn_predicate = save_pred; +- } +- else if (want_long) +- fputs ("\tnop\n", asm_out_file); +- else +- { +- fputs ("\tnop_s\n", asm_out_file); +- cfun->machine->unalign ^= 2; +- } +- } +- return; +-} +- + /* The usual; we set up our machine_function data. */ + + static struct machine_function * +@@ -9413,7 +9402,6 @@ + struct machine_function *machine; + machine = ggc_cleared_alloc (); + machine->fn_type = ARC_FUNCTION_UNKNOWN; +- machine->force_short_suffix = -1; + + return machine; + } +Index: gcc/config/arc/arc.md +=================================================================== +--- a/src/gcc/config/arc/arc.md (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/config/arc/arc.md (.../branches/gcc-8-branch) +@@ -161,6 +161,7 @@ + VUNSPEC_ARC_CAS + VUNSPEC_ARC_SC + VUNSPEC_ARC_LL ++ VUNSPEC_ARC_BLOCKAGE + ]) + + (define_constants +@@ -384,13 +385,18 @@ + ;; and insn lengths: insns with shimm values cannot be conditionally executed. + (define_attr "length" "" + (cond +- [(eq_attr "iscompact" "true,maybe") ++ [(eq_attr "iscompact" "true") ++ (const_int 2) ++ ++ (eq_attr "iscompact" "maybe") + (cond + [(eq_attr "type" "sfunc") + (cond [(match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") + (const_int 12)] + (const_int 10)) +- (match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 4)] ++ (match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 4) ++ (match_test "find_reg_note (insn, REG_SAVE_NOTE, GEN_INT (1))") ++ (const_int 4)] + (const_int 2)) + + (eq_attr "iscompact" "true_limm") +@@ -4438,9 +4444,17 @@ + "" + "nop%?" + [(set_attr "type" "misc") +- (set_attr "iscompact" "true") +- (set_attr "length" "2")]) ++ (set_attr "iscompact" "maybe") ++ (set_attr "length" "*")]) + ++(define_insn "blockage" ++ [(unspec_volatile [(const_int 0)] VUNSPEC_ARC_BLOCKAGE)] ++ "" ++ "" ++ [(set_attr "length" "0") ++ (set_attr "type" "block")] ++) ++ + ;; Split up troublesome insns for better scheduling. + + ;; Peepholes go at the end. +@@ -4984,8 +4998,6 @@ + { + return \"rtie\"; + } +- if (TARGET_PAD_RETURN) +- arc_pad_return (); + output_asm_insn (\"j%!%* [%0]%&\", ®); + return \"\"; + } +@@ -5029,8 +5041,6 @@ + arc_return_address_register (arc_compute_function_type + (cfun))); + +- if (TARGET_PAD_RETURN) +- arc_pad_return (); + output_asm_insn (\"j%d0%!%# [%1]%&\", xop); + /* record the condition in case there is a delay insn. */ + arc_ccfsm_record_condition (xop[0], false, insn, 0); +Index: gcc/config/arc/arc-protos.h +=================================================================== +--- a/src/gcc/config/arc/arc-protos.h (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/config/arc/arc-protos.h (.../branches/gcc-8-branch) +@@ -93,7 +93,6 @@ + extern void arc_toggle_unalign (void); + extern void split_addsi (rtx *); + extern void split_subsi (rtx *); +-extern void arc_pad_return (void); + extern void arc_split_move (rtx *); + extern const char *arc_short_long (rtx_insn *insn, const char *, const char *); + extern rtx arc_regno_use_in (unsigned int, rtx); +Index: gcc/config/arc/t-multilib +=================================================================== +--- a/src/gcc/config/arc/t-multilib (.../tags/gcc_8_1_0_release) ++++ b/src/gcc/config/arc/t-multilib (.../branches/gcc-8-branch) +@@ -21,9 +21,9 @@ + # along with GCC; see the file COPYING3. If not see + # . + +-MULTILIB_OPTIONS = mcpu=em/mcpu=em_mini/mcpu=arcem/mcpu=em4/mcpu=em4_dmips/mcpu=em4_fpus/mcpu=em4_fpuda/mcpu=quarkse_em/mcpu=hs/mcpu=archs/mcpu=hs34/mcpu=hs38/mcpu=hs38_linux/mcpu=hs4x/mcpu=hs4xd/mcpu=arc600/mcpu=arc600_norm/mcpu=arc600_mul64/mcpu=arc600_mul32x16/mcpu=arc601/mcpu=arc601_norm/mcpu=arc601_mul64/mcpu=arc601_mul32x16/mcpu=arc700/mcpu=nps400 ++MULTILIB_OPTIONS = mcpu=em/mcpu=em_mini/mcpu=arcem/mcpu=em4/mcpu=em4_dmips/mcpu=em4_fpus/mcpu=em4_fpuda/mcpu=quarkse_em/mcpu=hs/mcpu=archs/mcpu=hs34/mcpu=hs38/mcpu=hs38_linux/mcpu=arc600/mcpu=arc600_norm/mcpu=arc600_mul64/mcpu=arc600_mul32x16/mcpu=arc601/mcpu=arc601_norm/mcpu=arc601_mul64/mcpu=arc601_mul32x16/mcpu=arc700/mcpu=nps400 + +-MULTILIB_DIRNAMES = em em_mini arcem em4 em4_dmips em4_fpus em4_fpuda quarkse_em hs archs hs34 hs38 hs38_linux hs4x hs4xd arc600 arc600_norm arc600_mul64 arc600_mul32x16 arc601 arc601_norm arc601_mul64 arc601_mul32x16 arc700 nps400 ++MULTILIB_DIRNAMES = em em_mini arcem em4 em4_dmips em4_fpus em4_fpuda quarkse_em hs archs hs34 hs38 hs38_linux arc600 arc600_norm arc600_mul64 arc600_mul32x16 arc601 arc601_norm arc601_mul64 arc601_mul32x16 arc700 nps400 + + # Aliases: + MULTILIB_MATCHES = mcpu?arc600=mcpu?ARC600 Index: gcc/config/arm/arm-builtins.c =================================================================== --- a/src/gcc/config/arm/arm-builtins.c (.../tags/gcc_8_1_0_release) @@ -481181 +484412 @@ - Merged /trunk:r262104,262221 + Merged /trunk:r262104,262221,262442,262744 diff -u gcc-8-8.1.0/debian/rules.parameters gcc-8-8.1.0/debian/rules.parameters --- gcc-8-8.1.0/debian/rules.parameters +++ gcc-8-8.1.0/debian/rules.parameters @@ -2,14 +2,14 @@ GCC_VERSION := 8.1.0 NEXT_GCC_VERSION := 8.1.1 BASE_VERSION := 8 -SOURCE_VERSION := 8.1.0-10ubuntu1 -DEB_VERSION := 8.1.0-10ubuntu1 -DEB_EVERSION := 1:8.1.0-10ubuntu1 -DEB_GDC_VERSION := 8.1.0-10ubuntu1 +SOURCE_VERSION := 8.1.0-11ubuntu1 +DEB_VERSION := 8.1.0-11ubuntu1 +DEB_EVERSION := 1:8.1.0-11ubuntu1 +DEB_GDC_VERSION := 8.1.0-11ubuntu1 DEB_SOVERSION := 5 DEB_SOEVERSION := 1:5 DEB_LIBGCC_SOVERSION := -DEB_LIBGCC_VERSION := 1:8.1.0-10ubuntu1 +DEB_LIBGCC_VERSION := 1:8.1.0-11ubuntu1 DEB_STDCXX_SOVERSION := 5 DEB_GOMP_SOVERSION := 5 GCC_SONAME := 1