diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ipa-devirt.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/pr85405_0.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/pr85405_1.C | 9 |
5 files changed, 47 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a96c8de..4ba0f0f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-04-17 Jan Hubicka <jh@suse.cz> + + PR lto/85405 + * ipa-devirt.c (odr_types_equivalent_p): Handle bit fields. + 2018-04-17 Martin Liska <mliska@suse.cz> PR ipa/85329 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index fa9380c..5da0f72 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -1587,8 +1587,15 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, "in another translation unit")); return false; } - gcc_assert (DECL_NONADDRESSABLE_P (f1) - == DECL_NONADDRESSABLE_P (f2)); + if (DECL_BIT_FIELD (f1) != DECL_BIT_FIELD (f2)) + { + warn_odr (t1, t2, f1, f2, warn, warned, + G_ ("one field is bitfield while other is not ")); + return false; + } + else + gcc_assert (DECL_NONADDRESSABLE_P (f1) + == DECL_NONADDRESSABLE_P (f2)); } /* If one aggregate has more fields than the other, they diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7dd355..23c519e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2018-04-17 Martin Liska <mliska@suse.cz> + PR lto/85405 + * g++.dg/lto/pr85405_0.C: New test. + * g++.dg/lto/pr85405_1.C: New test. + +2018-04-17 Martin Liska <mliska@suse.cz> + PR ipa/85329 * g++.dg/ext/pr85329-2.C: New test. * g++.dg/ext/pr85329.C: New test. diff --git a/gcc/testsuite/g++.dg/lto/pr85405_0.C b/gcc/testsuite/g++.dg/lto/pr85405_0.C new file mode 100644 index 0000000..1a41d81 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr85405_0.C @@ -0,0 +1,18 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC -shared -flto}} } + +class VclReferenceBase { // { dg-lto-warning "7: type 'struct VclReferenceBase' violates the C\\+\\+ One Definition Rule" } + int mnRefCnt; + bool mbDisposed : 1; + virtual ~VclReferenceBase(); +}; +class a; +class b { + a &e; + bool c(); +}; +class B { + VclReferenceBase d; +}; +class a : B {}; +bool b::c() { return false; } diff --git a/gcc/testsuite/g++.dg/lto/pr85405_1.C b/gcc/testsuite/g++.dg/lto/pr85405_1.C new file mode 100644 index 0000000..7860618 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr85405_1.C @@ -0,0 +1,9 @@ +class VclReferenceBase { + int mnRefCnt; + bool mbDisposed; + +protected: + virtual ~VclReferenceBase(); +}; +class : VclReferenceBase { +} a; |