import gcc-8.5.0-2.el8
This commit is contained in:
parent
c0417480ff
commit
f6bbb1a286
137
SOURCES/gcc8-pr100797.patch
Normal file
137
SOURCES/gcc8-pr100797.patch
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
commit ebfe8b28d40746ff33724bd5b9ade2552e619213
|
||||||
|
Author: Jason Merrill <jason@redhat.com>
|
||||||
|
Date: Thu May 27 23:54:52 2021 -0400
|
||||||
|
|
||||||
|
c++: 'this' adjustment for devirtualized call
|
||||||
|
|
||||||
|
My patch for 95719 made us do a better job of finding the actual virtual
|
||||||
|
function we want to call, but didn't update the 'this' pointer adjustment to
|
||||||
|
match.
|
||||||
|
|
||||||
|
This backport also incorporates a bit of the r11-1638 reorganization.
|
||||||
|
|
||||||
|
PR c++/100797
|
||||||
|
PR c++/95719
|
||||||
|
|
||||||
|
gcc/cp/ChangeLog:
|
||||||
|
|
||||||
|
* call.c (build_over_call): Adjust base_binfo in
|
||||||
|
resolves_to_fixed_type_p case.
|
||||||
|
|
||||||
|
gcc/testsuite/ChangeLog:
|
||||||
|
|
||||||
|
* g++.dg/inherit/virtual15.C: New test.
|
||||||
|
* g++.dg/inherit/virtual15a.C: New test.
|
||||||
|
|
||||||
|
--- gcc/cp/call.c
|
||||||
|
+++ gcc/cp/call.c
|
||||||
|
@@ -8309,19 +8309,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
|
||||||
|
|| CLASSTYPE_FINAL (TYPE_METHOD_BASETYPE (TREE_TYPE (fn))))
|
||||||
|
flags |= LOOKUP_NONVIRTUAL;
|
||||||
|
|
||||||
|
- /* If we know the dynamic type of the object, look up the final overrider
|
||||||
|
- in the BINFO. */
|
||||||
|
- if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0
|
||||||
|
- && resolves_to_fixed_type_p (arg))
|
||||||
|
- {
|
||||||
|
- tree binfo = cand->conversion_path;
|
||||||
|
- if (BINFO_TYPE (binfo) != DECL_CONTEXT (fn))
|
||||||
|
- binfo = lookup_base (binfo, DECL_CONTEXT (fn), ba_unique,
|
||||||
|
- NULL, complain);
|
||||||
|
- fn = lookup_vfn_in_binfo (DECL_VINDEX (fn), binfo);
|
||||||
|
- flags |= LOOKUP_NONVIRTUAL;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
/* [class.mfct.nonstatic]: If a nonstatic member function of a class
|
||||||
|
X is called for an object that is not of type X, or of a type
|
||||||
|
derived from X, the behavior is undefined.
|
||||||
|
@@ -8331,10 +8318,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
|
||||||
|
gcc_assert (TYPE_PTR_P (parmtype));
|
||||||
|
/* Convert to the base in which the function was declared. */
|
||||||
|
gcc_assert (cand->conversion_path != NULL_TREE);
|
||||||
|
- converted_arg = build_base_path (PLUS_EXPR,
|
||||||
|
- arg,
|
||||||
|
- cand->conversion_path,
|
||||||
|
- 1, complain);
|
||||||
|
/* Check that the base class is accessible. */
|
||||||
|
if (!accessible_base_p (TREE_TYPE (argtype),
|
||||||
|
BINFO_TYPE (cand->conversion_path), true))
|
||||||
|
@@ -8349,10 +8332,33 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
|
||||||
|
/* If fn was found by a using declaration, the conversion path
|
||||||
|
will be to the derived class, not the base declaring fn. We
|
||||||
|
must convert from derived to base. */
|
||||||
|
- base_binfo = lookup_base (TREE_TYPE (TREE_TYPE (converted_arg)),
|
||||||
|
+ base_binfo = lookup_base (cand->conversion_path,
|
||||||
|
TREE_TYPE (parmtype), ba_unique,
|
||||||
|
NULL, complain);
|
||||||
|
- converted_arg = build_base_path (PLUS_EXPR, converted_arg,
|
||||||
|
+
|
||||||
|
+ /* If we know the dynamic type of the object, look up the final overrider
|
||||||
|
+ in the BINFO. */
|
||||||
|
+ if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0
|
||||||
|
+ && resolves_to_fixed_type_p (arg))
|
||||||
|
+ {
|
||||||
|
+ tree ov = lookup_vfn_in_binfo (DECL_VINDEX (fn), base_binfo);
|
||||||
|
+
|
||||||
|
+ /* And unwind base_binfo to match. If we don't find the type we're
|
||||||
|
+ looking for in BINFO_INHERITANCE_CHAIN, we're looking at diamond
|
||||||
|
+ inheritance; for now do a normal virtual call in that case. */
|
||||||
|
+ tree octx = DECL_CONTEXT (ov);
|
||||||
|
+ tree obinfo = base_binfo;
|
||||||
|
+ while (obinfo && !SAME_BINFO_TYPE_P (BINFO_TYPE (obinfo), octx))
|
||||||
|
+ obinfo = BINFO_INHERITANCE_CHAIN (obinfo);
|
||||||
|
+ if (obinfo)
|
||||||
|
+ {
|
||||||
|
+ fn = ov;
|
||||||
|
+ base_binfo = obinfo;
|
||||||
|
+ flags |= LOOKUP_NONVIRTUAL;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ converted_arg = build_base_path (PLUS_EXPR, arg,
|
||||||
|
base_binfo, 1, complain);
|
||||||
|
|
||||||
|
argarray[j++] = converted_arg;
|
||||||
|
--- /dev/null
|
||||||
|
+++ gcc/testsuite/g++.dg/inherit/virtual15.C
|
||||||
|
@@ -0,0 +1,18 @@
|
||||||
|
+// PR c++/100797
|
||||||
|
+// { dg-do run }
|
||||||
|
+
|
||||||
|
+bool ok = false;
|
||||||
|
+struct S1 { virtual ~S1() {} };
|
||||||
|
+struct S2 { virtual void f1() = 0; };
|
||||||
|
+struct S3: S1, S2 {
|
||||||
|
+ void f1() { f2(); }
|
||||||
|
+ virtual void f2() = 0;
|
||||||
|
+};
|
||||||
|
+struct S4: S3 {
|
||||||
|
+ void f2() { ok = true; }
|
||||||
|
+ using S2::f1;
|
||||||
|
+};
|
||||||
|
+int main() {
|
||||||
|
+ S4().f1();
|
||||||
|
+ if (!ok) __builtin_abort ();
|
||||||
|
+}
|
||||||
|
--- /dev/null
|
||||||
|
+++ gcc/testsuite/g++.dg/inherit/virtual15a.C
|
||||||
|
@@ -0,0 +1,19 @@
|
||||||
|
+// PR c++/100797 plus diamond inheritance
|
||||||
|
+// { dg-do run }
|
||||||
|
+
|
||||||
|
+bool ok = false;
|
||||||
|
+struct S1 { virtual ~S1() {} };
|
||||||
|
+struct S2 { virtual void f1() = 0; };
|
||||||
|
+struct S3: S1, virtual S2 {
|
||||||
|
+ void f1() { f2(); }
|
||||||
|
+ virtual void f2() = 0;
|
||||||
|
+};
|
||||||
|
+struct SX: virtual S2 { };
|
||||||
|
+struct S4: SX, S3 {
|
||||||
|
+ void f2() { ok = true; }
|
||||||
|
+ using S2::f1;
|
||||||
|
+};
|
||||||
|
+int main() {
|
||||||
|
+ S4().f1();
|
||||||
|
+ if (!ok) __builtin_abort ();
|
||||||
|
+}
|
64
SOURCES/gcc8-rh1960701.patch
Normal file
64
SOURCES/gcc8-rh1960701.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
--- gcc/cp/call.c
|
||||||
|
+++ gcc/cp/call.c
|
||||||
|
@@ -6904,7 +6904,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
|
||||||
|
elttype = cp_build_qualified_type
|
||||||
|
(elttype, cp_type_quals (elttype) | TYPE_QUAL_CONST);
|
||||||
|
array = build_array_of_n_type (elttype, len);
|
||||||
|
- array = finish_compound_literal (array, new_ctor, complain, fcl_c99);
|
||||||
|
+ array = finish_compound_literal (array, new_ctor, complain);
|
||||||
|
/* Take the address explicitly rather than via decay_conversion
|
||||||
|
to avoid the error about taking the address of a temporary. */
|
||||||
|
array = cp_build_addr_expr (array, complain);
|
||||||
|
@@ -10984,13 +10984,11 @@ set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups,
|
||||||
|
lvalue-rvalue conversion applied to "a glvalue of literal type
|
||||||
|
that refers to a non-volatile temporary object initialized
|
||||||
|
with a constant expression". Rather than try to communicate
|
||||||
|
- that this VAR_DECL is a temporary, just mark it constexpr.
|
||||||
|
-
|
||||||
|
- Currently this is only useful for initializer_list temporaries,
|
||||||
|
- since reference vars can't appear in constant expressions. */
|
||||||
|
+ that this VAR_DECL is a temporary, just mark it constexpr. */
|
||||||
|
DECL_DECLARED_CONSTEXPR_P (var) = true;
|
||||||
|
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (var) = true;
|
||||||
|
TREE_CONSTANT (var) = true;
|
||||||
|
+ TREE_READONLY (var) = true;
|
||||||
|
}
|
||||||
|
DECL_INITIAL (var) = init;
|
||||||
|
init = NULL_TREE;
|
||||||
|
--- gcc/cp/tree.c
|
||||||
|
+++ gcc/cp/tree.c
|
||||||
|
@@ -442,6 +442,14 @@ build_target_expr (tree decl, tree value, tsubst_flags_t complain)
|
||||||
|
|| useless_type_conversion_p (TREE_TYPE (decl),
|
||||||
|
TREE_TYPE (value)));
|
||||||
|
|
||||||
|
+ /* Set TREE_READONLY for optimization, such as gimplify_init_constructor
|
||||||
|
+ moving a constant aggregate into .rodata. */
|
||||||
|
+ if (CP_TYPE_CONST_NON_VOLATILE_P (type)
|
||||||
|
+ && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
|
||||||
|
+ && !VOID_TYPE_P (TREE_TYPE (value))
|
||||||
|
+ && reduced_constant_expression_p (value))
|
||||||
|
+ TREE_READONLY (decl) = true;
|
||||||
|
+
|
||||||
|
if (complain & tf_no_cleanup)
|
||||||
|
/* The caller is building a new-expr and does not need a cleanup. */
|
||||||
|
t = NULL_TREE;
|
||||||
|
--- /dev/null
|
||||||
|
+++ gcc/testsuite/g++.dg/cpp1y/pr95226.C
|
||||||
|
@@ -0,0 +1,17 @@
|
||||||
|
+// PR c++/95226
|
||||||
|
+// { dg-do run { target c++14 } }
|
||||||
|
+
|
||||||
|
+#include <vector>
|
||||||
|
+
|
||||||
|
+struct T {
|
||||||
|
+ unsigned a;
|
||||||
|
+ float b {8.};
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+int main()
|
||||||
|
+{
|
||||||
|
+ T t = {1};
|
||||||
|
+ std::vector<T> tt = {{1}, {2}};
|
||||||
|
+ if (t.a != 1 || t.b != 8.0f || tt[0].a != 1 || tt[0].b != 8.0f || tt[1].a != 2 || tt[1].b != 8.0f)
|
||||||
|
+ __builtin_abort ();
|
||||||
|
+}
|
@ -4,7 +4,7 @@
|
|||||||
%global gcc_major 8
|
%global gcc_major 8
|
||||||
# Note, gcc_release must be integer, if you want to add suffixes to
|
# Note, gcc_release must be integer, if you want to add suffixes to
|
||||||
# %%{release}, append them after %%{gcc_release} on Release: line.
|
# %%{release}, append them after %%{gcc_release} on Release: line.
|
||||||
%global gcc_release 1
|
%global gcc_release 2
|
||||||
%global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f
|
%global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f
|
||||||
%global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24
|
%global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24
|
||||||
%global _unpackaged_files_terminate_build 0
|
%global _unpackaged_files_terminate_build 0
|
||||||
@ -273,6 +273,8 @@ Patch15: gcc8-rh1670535.patch
|
|||||||
Patch16: gcc8-libgomp-20190503.patch
|
Patch16: gcc8-libgomp-20190503.patch
|
||||||
Patch17: gcc8-libgomp-testsuite.patch
|
Patch17: gcc8-libgomp-testsuite.patch
|
||||||
Patch18: gcc8-remove-old-demangle.patch
|
Patch18: gcc8-remove-old-demangle.patch
|
||||||
|
Patch19: gcc8-rh1960701.patch
|
||||||
|
Patch20: gcc8-pr100797.patch
|
||||||
|
|
||||||
Patch30: gcc8-rh1668903-1.patch
|
Patch30: gcc8-rh1668903-1.patch
|
||||||
Patch31: gcc8-rh1668903-2.patch
|
Patch31: gcc8-rh1668903-2.patch
|
||||||
@ -850,6 +852,8 @@ to NVidia PTX capable devices if available.
|
|||||||
%patch16 -p0 -b .libgomp-20190503~
|
%patch16 -p0 -b .libgomp-20190503~
|
||||||
%patch17 -p0 -b .libgomp-testsuite~
|
%patch17 -p0 -b .libgomp-testsuite~
|
||||||
%patch18 -p0 -b .demangle~
|
%patch18 -p0 -b .demangle~
|
||||||
|
%patch19 -p0 -b .rh1960701~
|
||||||
|
%patch20 -p0 -b .pr100797~
|
||||||
|
|
||||||
%patch30 -p0 -b .rh1668903-1~
|
%patch30 -p0 -b .rh1668903-1~
|
||||||
%patch31 -p0 -b .rh1668903-2~
|
%patch31 -p0 -b .rh1668903-2~
|
||||||
@ -3166,6 +3170,10 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 1 2021 Marek Polacek <polacek@redhat.com> 8.5.0-2
|
||||||
|
- revert upstream PR85873 gcc-8 fix, apply the fix from gcc-9 (#1960701)
|
||||||
|
- fix 'this' adjustment for devirtualized call (PR c++/100797, #1965951)
|
||||||
|
|
||||||
* Fri May 14 2021 Marek Polacek <polacek@redhat.com> 8.5.0-1
|
* Fri May 14 2021 Marek Polacek <polacek@redhat.com> 8.5.0-1
|
||||||
- update from GCC 8.5 release (#1946758)
|
- update from GCC 8.5 release (#1946758)
|
||||||
- this includes a fix for PR target/87839 (#1958295)
|
- this includes a fix for PR target/87839 (#1958295)
|
||||||
|
Loading…
Reference in New Issue
Block a user