diff mbox

[PATCH/IPA] Fix ipa-polymorphic-call when size of Pmode is not the size of pointers in user code

Message ID CA+=Sn1=zo+6_8o-Rg6LEFAod1M-91hpPLfGvhuTvv-f00RJHBA@mail.gmail.com
State New
Headers show

Commit Message

Andrew Pinski Nov. 20, 2014, 12:54 a.m. UTC
Hi,
  For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
breaks ipa-polymorphic-call assumption that Pmode is the correct mode
for pointers.  Right now before this patch we get many testcase
failures in the C++ testsuite due to this.  Some of the tests fail due
to the wrong devirtualization happening (using the base class rather
the current class).

This patch fixes the issue by using POINTER_SIZE in place of
GET_MODE_BITSIZE (Pmode) all over the file.

OK?  Bootstrapped and tested on x86_64 and cross built and tested for
aarch64-elf with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
ipa/63981
* ipa-polymorphic-call.c (possible_placement_new):
Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
(ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
(extr_type_from_vtbl_ptr_store): Likewise.

Comments

H.J. Lu Nov. 20, 2014, 1:11 a.m. UTC | #1
On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
> for pointers.  Right now before this patch we get many testcase
> failures in the C++ testsuite due to this.  Some of the tests fail due
> to the wrong devirtualization happening (using the base class rather
> the current class).
>
> This patch fixes the issue by using POINTER_SIZE in place of
> GET_MODE_BITSIZE (Pmode) all over the file.
>
> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
> aarch64-elf with no regressions.
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
> ipa/63981
> * ipa-polymorphic-call.c (possible_placement_new):
> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
> (extr_type_from_vtbl_ptr_store): Likewise.

Does Pmode affect class layout?
Andrew Pinski Nov. 20, 2014, 1:23 a.m. UTC | #2
On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>> Hi,
>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>> for pointers.  Right now before this patch we get many testcase
>> failures in the C++ testsuite due to this.  Some of the tests fail due
>> to the wrong devirtualization happening (using the base class rather
>> the current class).
>>
>> This patch fixes the issue by using POINTER_SIZE in place of
>> GET_MODE_BITSIZE (Pmode) all over the file.
>>
>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>> aarch64-elf with no regressions.
>>
>> Thanks,
>> Andrew Pinski
>>
>> ChangeLog:
>> ipa/63981
>> * ipa-polymorphic-call.c (possible_placement_new):
>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>> (extr_type_from_vtbl_ptr_store): Likewise.
>
> Does Pmode affect class layout?

No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).

x32 has a similar issue with -maddress-mode=long but the default for
x32 is -maddress-mode=short.

Thanks,
Andrew Pinski

>
>
> --
> H.J.
H.J. Lu Nov. 20, 2014, 1:35 a.m. UTC | #3
On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>> Hi,
>>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>> for pointers.  Right now before this patch we get many testcase
>>> failures in the C++ testsuite due to this.  Some of the tests fail due
>>> to the wrong devirtualization happening (using the base class rather
>>> the current class).
>>>
>>> This patch fixes the issue by using POINTER_SIZE in place of
>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>
>>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>>> aarch64-elf with no regressions.
>>>
>>> Thanks,
>>> Andrew Pinski
>>>
>>> ChangeLog:
>>> ipa/63981
>>> * ipa-polymorphic-call.c (possible_placement_new):
>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>
>> Does Pmode affect class layout?
>
> No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>
> x32 has a similar issue with -maddress-mode=long but the default for
> x32 is -maddress-mode=short.

Pmode shouldn't change class layout, which is determined by ptr_mode.
You can mix  object files compiled by -maddress-mode=long with
-maddress-mode=short.  Do those tests fail with -maddress-mode=long
under x32?
Andrew Pinski Nov. 20, 2014, 1:36 a.m. UTC | #4
On Wed, Nov 19, 2014 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>> Hi,
>>>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>>> for pointers.  Right now before this patch we get many testcase
>>>> failures in the C++ testsuite due to this.  Some of the tests fail due
>>>> to the wrong devirtualization happening (using the base class rather
>>>> the current class).
>>>>
>>>> This patch fixes the issue by using POINTER_SIZE in place of
>>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>>
>>>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>>>> aarch64-elf with no regressions.
>>>>
>>>> Thanks,
>>>> Andrew Pinski
>>>>
>>>> ChangeLog:
>>>> ipa/63981
>>>> * ipa-polymorphic-call.c (possible_placement_new):
>>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>>
>>> Does Pmode affect class layout?
>>
>> No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
>> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>>
>> x32 has a similar issue with -maddress-mode=long but the default for
>> x32 is -maddress-mode=short.
>
> Pmode shouldn't change class layout, which is determined by ptr_mode.
> You can mix  object files compiled by -maddress-mode=long with
> -maddress-mode=short.  Do those tests fail with -maddress-mode=long
> under x32?


I suspect they do fail with -maddress-mode=long but I did not try as I
don't have x32 testing setup right now.

Thanks,
Andrew

>
> --
> H.J.
H.J. Lu Nov. 20, 2014, 1:37 a.m. UTC | #5
On Wed, Nov 19, 2014 at 5:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>> Hi,
>>>>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>>>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>>>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>>>> for pointers.  Right now before this patch we get many testcase
>>>>> failures in the C++ testsuite due to this.  Some of the tests fail due
>>>>> to the wrong devirtualization happening (using the base class rather
>>>>> the current class).
>>>>>
>>>>> This patch fixes the issue by using POINTER_SIZE in place of
>>>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>>>
>>>>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>>>>> aarch64-elf with no regressions.
>>>>>
>>>>> Thanks,
>>>>> Andrew Pinski
>>>>>
>>>>> ChangeLog:
>>>>> ipa/63981
>>>>> * ipa-polymorphic-call.c (possible_placement_new):
>>>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>>>
>>>> Does Pmode affect class layout?
>>>
>>> No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
>>> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>>>
>>> x32 has a similar issue with -maddress-mode=long but the default for
>>> x32 is -maddress-mode=short.
>>
>> Pmode shouldn't change class layout, which is determined by ptr_mode.
>> You can mix  object files compiled by -maddress-mode=long with
>> -maddress-mode=short.  Do those tests fail with -maddress-mode=long
>> under x32?
>
>
> I suspect they do fail with -maddress-mode=long but I did not try as I
> don't have x32 testing setup right now.
>

Which one may fail with -maddress-mode=long?
Andrew Pinski Nov. 20, 2014, 1:39 a.m. UTC | #6
On Wed, Nov 19, 2014 at 5:37 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>> Hi,
>>>>>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>>>>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>>>>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>>>>> for pointers.  Right now before this patch we get many testcase
>>>>>> failures in the C++ testsuite due to this.  Some of the tests fail due
>>>>>> to the wrong devirtualization happening (using the base class rather
>>>>>> the current class).
>>>>>>
>>>>>> This patch fixes the issue by using POINTER_SIZE in place of
>>>>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>>>>
>>>>>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>>>>>> aarch64-elf with no regressions.
>>>>>>
>>>>>> Thanks,
>>>>>> Andrew Pinski
>>>>>>
>>>>>> ChangeLog:
>>>>>> ipa/63981
>>>>>> * ipa-polymorphic-call.c (possible_placement_new):
>>>>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>>>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>>>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>>>>
>>>>> Does Pmode affect class layout?
>>>>
>>>> No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
>>>> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>>>>
>>>> x32 has a similar issue with -maddress-mode=long but the default for
>>>> x32 is -maddress-mode=short.
>>>
>>> Pmode shouldn't change class layout, which is determined by ptr_mode.
>>> You can mix  object files compiled by -maddress-mode=long with
>>> -maddress-mode=short.  Do those tests fail with -maddress-mode=long
>>> under x32?
>>
>>
>> I suspect they do fail with -maddress-mode=long but I did not try as I
>> don't have x32 testing setup right now.
>>
>
> Which one may fail with -maddress-mode=long?

The full list of the failures can be found in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63982 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63981 and below:

FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++98  scan-ipa-dump-times cp
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++11  scan-ipa-dump-times cp
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++14  scan-ipa-dump-times cp
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt
"Speculative targets"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt "1
speculatively devirtualized"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt
"Speculative targets"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt "1
speculatively devirtualized"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt
"Speculative targets"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt "1
speculatively devirtualized"
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (internal compiler error)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (internal compiler error)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (internal compiler error)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (internal compiler error)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (internal compiler error)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (internal compiler error)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2 "No
dynamic type change found."
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
"Checking vtbl store:"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
"Function call may change dynamic type:extcall"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
"converting indirect call to function virtual void"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2 "No
dynamic type change found."
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
"Checking vtbl store:"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
"Function call may change dynamic type:extcall"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
"converting indirect call to function virtual void"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2 "No
dynamic type change found."
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
"Checking vtbl store:"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
"Function call may change dynamic type:extcall"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
"converting indirect call to function virtual void"
FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++98  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++11  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++14  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
"First type is base of second" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-times
optimized "return 2" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-not
optimized "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
"First type is base of second" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-times
optimized "return 2" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-not
optimized "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
"First type is base of second" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-times
optimized "return 2" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-not
optimized "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++98  scan-ipa-dump-not
whole-program "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++11  scan-ipa-dump-not
whole-program "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++14  scan-ipa-dump-not
whole-program "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++98  scan-tree-dump-times
optimized "OBJ_TYPE_REF" 0
FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++11  scan-tree-dump-times
optimized "OBJ_TYPE_REF" 0
FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++14  scan-tree-dump-times
optimized "OBJ_TYPE_REF" 0
FAIL: g++.dg/ipa/pr60600.C  -std=gnu++98  scan-ipa-dump cp "Type
inconsistent devirtualization"
FAIL: g++.dg/ipa/pr60600.C  -std=gnu++11  scan-ipa-dump cp "Type
inconsistent devirtualization"
FAIL: g++.dg/ipa/pr60600.C  -std=gnu++14  scan-ipa-dump cp "Type
inconsistent devirtualization"
FAIL: g++.dg/opt/pr36185.C  -std=gnu++98 execution test
FAIL: g++.dg/opt/pr36185.C  -std=gnu++11 execution test
FAIL: g++.dg/opt/pr36185.C  -std=gnu++14 execution test
FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++98 execution test
FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++11 execution test
FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++14 execution test
FAIL: g++.dg/torture/covariant-1.C   -O2  execution test
FAIL: g++.dg/torture/covariant-1.C   -O3 -fomit-frame-pointer  execution test
FAIL: g++.dg/torture/covariant-1.C   -O3 -g  execution test
FAIL: g++.dg/torture/covariant-1.C   -Os  execution test
FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fno-use-linker-plugin
-flto-partition=none  execution test
FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects  execution test


Thanks,
Andrew


>
>
> --
> H.J.
H.J. Lu Nov. 20, 2014, 1:53 a.m. UTC | #7
On Wed, Nov 19, 2014 at 5:39 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:37 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 5:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>> On Wed, Nov 19, 2014 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>>> Hi,
>>>>>>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>>>>>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>>>>>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>>>>>> for pointers.  Right now before this patch we get many testcase
>>>>>>> failures in the C++ testsuite due to this.  Some of the tests fail due
>>>>>>> to the wrong devirtualization happening (using the base class rather
>>>>>>> the current class).
>>>>>>>
>>>>>>> This patch fixes the issue by using POINTER_SIZE in place of
>>>>>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>>>>>
>>>>>>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>>>>>>> aarch64-elf with no regressions.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Andrew Pinski
>>>>>>>
>>>>>>> ChangeLog:
>>>>>>> ipa/63981
>>>>>>> * ipa-polymorphic-call.c (possible_placement_new):
>>>>>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>>>>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>>>>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>>>>>
>>>>>> Does Pmode affect class layout?
>>>>>
>>>>> No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
>>>>> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>>>>>
>>>>> x32 has a similar issue with -maddress-mode=long but the default for
>>>>> x32 is -maddress-mode=short.
>>>>
>>>> Pmode shouldn't change class layout, which is determined by ptr_mode.
>>>> You can mix  object files compiled by -maddress-mode=long with
>>>> -maddress-mode=short.  Do those tests fail with -maddress-mode=long
>>>> under x32?
>>>
>>>
>>> I suspect they do fail with -maddress-mode=long but I did not try as I
>>> don't have x32 testing setup right now.
>>>
>>
>> Which one may fail with -maddress-mode=long?
>
> The full list of the failures can be found in
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63982 and
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63981 and below:
>
> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++98  scan-ipa-dump-times cp
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++11  scan-ipa-dump-times cp
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++14  scan-ipa-dump-times cp
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt
> "Speculative targets"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt "1
> speculatively devirtualized"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt
> "Speculative targets"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt "1
> speculatively devirtualized"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt
> "Speculative targets"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt "1
> speculatively devirtualized"
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2 "No
> dynamic type change found."
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
> "Checking vtbl store:"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
> "Function call may change dynamic type:extcall"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
> "converting indirect call to function virtual void"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2 "No
> dynamic type change found."
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
> "Checking vtbl store:"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
> "Function call may change dynamic type:extcall"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
> "converting indirect call to function virtual void"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2 "No
> dynamic type change found."
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
> "Checking vtbl store:"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
> "Function call may change dynamic type:extcall"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
> "converting indirect call to function virtual void"
> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++98  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++11  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++14  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
> "First type is base of second" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-times
> optimized "return 2" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-not
> optimized "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
> "First type is base of second" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-times
> optimized "return 2" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-not
> optimized "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
> "First type is base of second" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-times
> optimized "return 2" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-not
> optimized "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++98  scan-ipa-dump-not
> whole-program "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++11  scan-ipa-dump-not
> whole-program "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++14  scan-ipa-dump-not
> whole-program "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++98  scan-tree-dump-times
> optimized "OBJ_TYPE_REF" 0
> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++11  scan-tree-dump-times
> optimized "OBJ_TYPE_REF" 0
> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++14  scan-tree-dump-times
> optimized "OBJ_TYPE_REF" 0
> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++98  scan-ipa-dump cp "Type
> inconsistent devirtualization"
> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++11  scan-ipa-dump cp "Type
> inconsistent devirtualization"
> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++14  scan-ipa-dump cp "Type
> inconsistent devirtualization"
> FAIL: g++.dg/opt/pr36185.C  -std=gnu++98 execution test
> FAIL: g++.dg/opt/pr36185.C  -std=gnu++11 execution test
> FAIL: g++.dg/opt/pr36185.C  -std=gnu++14 execution test
> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++98 execution test
> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++11 execution test
> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++14 execution test
> FAIL: g++.dg/torture/covariant-1.C   -O2  execution test
> FAIL: g++.dg/torture/covariant-1.C   -O3 -fomit-frame-pointer  execution test
> FAIL: g++.dg/torture/covariant-1.C   -O3 -g  execution test
> FAIL: g++.dg/torture/covariant-1.C   -Os  execution test
> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fno-use-linker-plugin
> -flto-partition=none  execution test
> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fuse-linker-plugin
> -fno-fat-lto-objects  execution test
>
>
> Thanks,
> Andrew
>

I saw

make check-c++ RUNTESTFLAGS="--target_board='unix{-mx32\
-maddress-mode=long}' dg.exp=devirt-*.C"
...
Running target unix/-mx32 -maddress-mode=long
Using /usr/share/dejagnu/baseboards/unix.exp as board description file
for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /export/gnu/import/git/gcc/gcc/testsuite/config/default.exp as
tool-and-target-specific interface file.
Running /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/dg.exp ...
FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++98  scan-ipa-dump-times cp
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++11  scan-ipa-dump-times cp
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++14  scan-ipa-dump-times cp
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-29.C  -std=gnu++11 execution test
FAIL: g++.dg/ipa/devirt-29.C  -std=gnu++14 execution test
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt
"Speculative targets"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt "1
speculatively devirtualized"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt
"Speculative targets"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt "1
speculatively devirtualized"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt
"Speculative targets"
FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt "1
speculatively devirtualized"
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (internal compiler error)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (internal compiler error)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (internal compiler error)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (internal compiler error)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (test for excess errors)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (internal compiler error)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (test for excess errors)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (internal compiler error)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (test for excess errors)
FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14  scan-tree-dump fre1
"converting indirect call to function virtual int B::t"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2 "No
dynamic type change found."
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
"Checking vtbl store:"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
"Function call may change dynamic type:extcall"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
"converting indirect call to function virtual void"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2 "No
dynamic type change found."
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
"Checking vtbl store:"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
"Function call may change dynamic type:extcall"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
"converting indirect call to function virtual void"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2 "No
dynamic type change found."
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
"Checking vtbl store:"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
"Function call may change dynamic type:extcall"
FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
"converting indirect call to function virtual void"
FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++98  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++11  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++14  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
"First type is base of second" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-times
optimized "return 2" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-not
optimized "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
"First type is base of second" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-times
optimized "return 2" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-not
optimized "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
"First type is base of second" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target" 2
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-times
optimized "return 2" 3
FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-not
optimized "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump inline
"Second type is base of first"
FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*B::foo" 1
FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++98  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++11  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++14  scan-ipa-dump-times inline
"Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++98  scan-ipa-dump-not
whole-program "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++11  scan-ipa-dump-not
whole-program "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++14  scan-ipa-dump-not
whole-program "OBJ_TYPE_REF"
FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++98  scan-tree-dump-times
optimized "OBJ_TYPE_REF" 0
FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++11  scan-tree-dump-times
optimized "OBJ_TYPE_REF" 0
FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++14  scan-tree-dump-times
optimized "OBJ_TYPE_REF" 0

=== g++ Summary ===

# of expected passes 394
# of unexpected failures 77
# of expected failures 9
# of unresolved testcases 12
# of unsupported tests 2
Andrew Pinski Nov. 20, 2014, 1:55 a.m. UTC | #8
On Wed, Nov 19, 2014 at 5:53 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:39 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 5:37 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Wed, Nov 19, 2014 at 5:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>> On Wed, Nov 19, 2014 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>> On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>>>> Hi,
>>>>>>>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>>>>>>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>>>>>>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>>>>>>> for pointers.  Right now before this patch we get many testcase
>>>>>>>> failures in the C++ testsuite due to this.  Some of the tests fail due
>>>>>>>> to the wrong devirtualization happening (using the base class rather
>>>>>>>> the current class).
>>>>>>>>
>>>>>>>> This patch fixes the issue by using POINTER_SIZE in place of
>>>>>>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>>>>>>
>>>>>>>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>>>>>>>> aarch64-elf with no regressions.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Andrew Pinski
>>>>>>>>
>>>>>>>> ChangeLog:
>>>>>>>> ipa/63981
>>>>>>>> * ipa-polymorphic-call.c (possible_placement_new):
>>>>>>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>>>>>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>>>>>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>>>>>>
>>>>>>> Does Pmode affect class layout?
>>>>>>
>>>>>> No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
>>>>>> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>>>>>>
>>>>>> x32 has a similar issue with -maddress-mode=long but the default for
>>>>>> x32 is -maddress-mode=short.
>>>>>
>>>>> Pmode shouldn't change class layout, which is determined by ptr_mode.
>>>>> You can mix  object files compiled by -maddress-mode=long with
>>>>> -maddress-mode=short.  Do those tests fail with -maddress-mode=long
>>>>> under x32?
>>>>
>>>>
>>>> I suspect they do fail with -maddress-mode=long but I did not try as I
>>>> don't have x32 testing setup right now.
>>>>
>>>
>>> Which one may fail with -maddress-mode=long?
>>
>> The full list of the failures can be found in
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63982 and
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63981 and below:
>>
>> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++98  scan-ipa-dump-times cp
>> "Discovered a virtual call to a known target" 2
>> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++11  scan-ipa-dump-times cp
>> "Discovered a virtual call to a known target" 2
>> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++14  scan-ipa-dump-times cp
>> "Discovered a virtual call to a known target" 2
>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt
>> "Speculative targets"
>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt "1
>> speculatively devirtualized"
>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt
>> "Speculative targets"
>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt "1
>> speculatively devirtualized"
>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt
>> "Speculative targets"
>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt "1
>> speculatively devirtualized"
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (internal compiler error)
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (test for excess errors)
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98  scan-tree-dump fre1
>> "converting indirect call to function virtual int B::t"
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (internal compiler error)
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (test for excess errors)
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11  scan-tree-dump fre1
>> "converting indirect call to function virtual int B::t"
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (internal compiler error)
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (test for excess errors)
>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14  scan-tree-dump fre1
>> "converting indirect call to function virtual int B::t"
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (internal compiler error)
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (test for excess errors)
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98  scan-tree-dump fre1
>> "converting indirect call to function virtual int B::t"
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (internal compiler error)
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (test for excess errors)
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11  scan-tree-dump fre1
>> "converting indirect call to function virtual int B::t"
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (internal compiler error)
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (test for excess errors)
>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14  scan-tree-dump fre1
>> "converting indirect call to function virtual int B::t"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2 "No
>> dynamic type change found."
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
>> "Checking vtbl store:"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
>> "Function call may change dynamic type:extcall"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
>> "converting indirect call to function virtual void"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2 "No
>> dynamic type change found."
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
>> "Checking vtbl store:"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
>> "Function call may change dynamic type:extcall"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
>> "converting indirect call to function virtual void"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2 "No
>> dynamic type change found."
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
>> "Checking vtbl store:"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
>> "Function call may change dynamic type:extcall"
>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
>> "converting indirect call to function virtual void"
>> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++98  scan-ipa-dump inline
>> "Second type is base of first"
>> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++11  scan-ipa-dump inline
>> "Second type is base of first"
>> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++14  scan-ipa-dump inline
>> "Second type is base of first"
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
>> "First type is base of second" 3
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target" 2
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-times
>> optimized "return 2" 3
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-not
>> optimized "OBJ_TYPE_REF"
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
>> "First type is base of second" 3
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target" 2
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-times
>> optimized "return 2" 3
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-not
>> optimized "OBJ_TYPE_REF"
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
>> "First type is base of second" 3
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target" 2
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-times
>> optimized "return 2" 3
>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-not
>> optimized "OBJ_TYPE_REF"
>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump inline
>> "Second type is base of first"
>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump inline
>> "Second type is base of first"
>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump inline
>> "Second type is base of first"
>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++98  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++11  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++14  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++98  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++11  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++14  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++98  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
>> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++11  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
>> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++14  scan-ipa-dump-times inline
>> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
>> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++98  scan-ipa-dump-not
>> whole-program "OBJ_TYPE_REF"
>> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++11  scan-ipa-dump-not
>> whole-program "OBJ_TYPE_REF"
>> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++14  scan-ipa-dump-not
>> whole-program "OBJ_TYPE_REF"
>> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++98  scan-tree-dump-times
>> optimized "OBJ_TYPE_REF" 0
>> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++11  scan-tree-dump-times
>> optimized "OBJ_TYPE_REF" 0
>> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++14  scan-tree-dump-times
>> optimized "OBJ_TYPE_REF" 0
>> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++98  scan-ipa-dump cp "Type
>> inconsistent devirtualization"
>> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++11  scan-ipa-dump cp "Type
>> inconsistent devirtualization"
>> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++14  scan-ipa-dump cp "Type
>> inconsistent devirtualization"
>> FAIL: g++.dg/opt/pr36185.C  -std=gnu++98 execution test
>> FAIL: g++.dg/opt/pr36185.C  -std=gnu++11 execution test
>> FAIL: g++.dg/opt/pr36185.C  -std=gnu++14 execution test
>> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++98 execution test
>> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++11 execution test
>> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++14 execution test
>> FAIL: g++.dg/torture/covariant-1.C   -O2  execution test
>> FAIL: g++.dg/torture/covariant-1.C   -O3 -fomit-frame-pointer  execution test
>> FAIL: g++.dg/torture/covariant-1.C   -O3 -g  execution test
>> FAIL: g++.dg/torture/covariant-1.C   -Os  execution test
>> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fno-use-linker-plugin
>> -flto-partition=none  execution test
>> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fuse-linker-plugin
>> -fno-fat-lto-objects  execution test
>>
>>
>> Thanks,
>> Andrew
>>
>
> I saw

Yes and can you try my patch too?

Thanks,
Andrew Pinski


>
> make check-c++ RUNTESTFLAGS="--target_board='unix{-mx32\
> -maddress-mode=long}' dg.exp=devirt-*.C"
> ...
> Running target unix/-mx32 -maddress-mode=long
> Using /usr/share/dejagnu/baseboards/unix.exp as board description file
> for target.
> Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
> Using /export/gnu/import/git/gcc/gcc/testsuite/config/default.exp as
> tool-and-target-specific interface file.
> Running /export/gnu/import/git/gcc/gcc/testsuite/g++.dg/dg.exp ...
> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++98  scan-ipa-dump-times cp
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++11  scan-ipa-dump-times cp
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++14  scan-ipa-dump-times cp
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-29.C  -std=gnu++11 execution test
> FAIL: g++.dg/ipa/devirt-29.C  -std=gnu++14 execution test
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt
> "Speculative targets"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt "1
> speculatively devirtualized"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt
> "Speculative targets"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt "1
> speculatively devirtualized"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt
> "Speculative targets"
> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt "1
> speculatively devirtualized"
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14  scan-tree-dump fre1
> "converting indirect call to function virtual int B::t"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2 "No
> dynamic type change found."
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
> "Checking vtbl store:"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
> "Function call may change dynamic type:extcall"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
> "converting indirect call to function virtual void"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2 "No
> dynamic type change found."
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
> "Checking vtbl store:"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
> "Function call may change dynamic type:extcall"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
> "converting indirect call to function virtual void"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2 "No
> dynamic type change found."
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
> "Checking vtbl store:"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
> "Function call may change dynamic type:extcall"
> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
> "converting indirect call to function virtual void"
> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++98  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++11  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++14  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
> "First type is base of second" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-times
> optimized "return 2" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-not
> optimized "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
> "First type is base of second" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-times
> optimized "return 2" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-not
> optimized "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
> "First type is base of second" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target" 2
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-times
> optimized "return 2" 3
> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-not
> optimized "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump inline
> "Second type is base of first"
> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++98  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++11  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++14  scan-ipa-dump-times inline
> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++98  scan-ipa-dump-not
> whole-program "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++11  scan-ipa-dump-not
> whole-program "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++14  scan-ipa-dump-not
> whole-program "OBJ_TYPE_REF"
> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++98  scan-tree-dump-times
> optimized "OBJ_TYPE_REF" 0
> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++11  scan-tree-dump-times
> optimized "OBJ_TYPE_REF" 0
> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++14  scan-tree-dump-times
> optimized "OBJ_TYPE_REF" 0
>
> === g++ Summary ===
>
> # of expected passes 394
> # of unexpected failures 77
> # of expected failures 9
> # of unresolved testcases 12
> # of unsupported tests 2
>
>
> --
> H.J.
H.J. Lu Nov. 20, 2014, 2:01 a.m. UTC | #9
On Wed, Nov 19, 2014 at 5:55 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Wed, Nov 19, 2014 at 5:53 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Nov 19, 2014 at 5:39 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>> On Wed, Nov 19, 2014 at 5:37 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Wed, Nov 19, 2014 at 5:36 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>> On Wed, Nov 19, 2014 at 5:35 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>> On Wed, Nov 19, 2014 at 5:23 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>>> On Wed, Nov 19, 2014 at 5:11 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>>> On Wed, Nov 19, 2014 at 4:54 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>>>>> Hi,
>>>>>>>>>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
>>>>>>>>> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
>>>>>>>>> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
>>>>>>>>> for pointers.  Right now before this patch we get many testcase
>>>>>>>>> failures in the C++ testsuite due to this.  Some of the tests fail due
>>>>>>>>> to the wrong devirtualization happening (using the base class rather
>>>>>>>>> the current class).
>>>>>>>>>
>>>>>>>>> This patch fixes the issue by using POINTER_SIZE in place of
>>>>>>>>> GET_MODE_BITSIZE (Pmode) all over the file.
>>>>>>>>>
>>>>>>>>> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
>>>>>>>>> aarch64-elf with no regressions.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>> Andrew Pinski
>>>>>>>>>
>>>>>>>>> ChangeLog:
>>>>>>>>> ipa/63981
>>>>>>>>> * ipa-polymorphic-call.c (possible_placement_new):
>>>>>>>>> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
>>>>>>>>> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
>>>>>>>>> (extr_type_from_vtbl_ptr_store): Likewise.
>>>>>>>>
>>>>>>>> Does Pmode affect class layout?
>>>>>>>
>>>>>>> No only POINTER_SIZE.  ILP32 is one of the few ABIs where Pmode !=
>>>>>>> ptr_mode (sizeof(ptr_mode) == POINTER_SIZE always).
>>>>>>>
>>>>>>> x32 has a similar issue with -maddress-mode=long but the default for
>>>>>>> x32 is -maddress-mode=short.
>>>>>>
>>>>>> Pmode shouldn't change class layout, which is determined by ptr_mode.
>>>>>> You can mix  object files compiled by -maddress-mode=long with
>>>>>> -maddress-mode=short.  Do those tests fail with -maddress-mode=long
>>>>>> under x32?
>>>>>
>>>>>
>>>>> I suspect they do fail with -maddress-mode=long but I did not try as I
>>>>> don't have x32 testing setup right now.
>>>>>
>>>>
>>>> Which one may fail with -maddress-mode=long?
>>>
>>> The full list of the failures can be found in
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63982 and
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63981 and below:
>>>
>>> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++98  scan-ipa-dump-times cp
>>> "Discovered a virtual call to a known target" 2
>>> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++11  scan-ipa-dump-times cp
>>> "Discovered a virtual call to a known target" 2
>>> FAIL: g++.dg/ipa/devirt-10.C  -std=gnu++14  scan-ipa-dump-times cp
>>> "Discovered a virtual call to a known target" 2
>>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt
>>> "Speculative targets"
>>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++98  scan-ipa-dump devirt "1
>>> speculatively devirtualized"
>>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt
>>> "Speculative targets"
>>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++11  scan-ipa-dump devirt "1
>>> speculatively devirtualized"
>>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt
>>> "Speculative targets"
>>> FAIL: g++.dg/ipa/devirt-34.C  -std=gnu++14  scan-ipa-dump devirt "1
>>> speculatively devirtualized"
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (internal compiler error)
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98 (test for excess errors)
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++98  scan-tree-dump fre1
>>> "converting indirect call to function virtual int B::t"
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (internal compiler error)
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11 (test for excess errors)
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++11  scan-tree-dump fre1
>>> "converting indirect call to function virtual int B::t"
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (internal compiler error)
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14 (test for excess errors)
>>> FAIL: g++.dg/ipa/devirt-35.C  -std=gnu++14  scan-tree-dump fre1
>>> "converting indirect call to function virtual int B::t"
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (internal compiler error)
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98 (test for excess errors)
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++98  scan-tree-dump fre1
>>> "converting indirect call to function virtual int B::t"
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (internal compiler error)
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11 (test for excess errors)
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++11  scan-tree-dump fre1
>>> "converting indirect call to function virtual int B::t"
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (internal compiler error)
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14 (test for excess errors)
>>> FAIL: g++.dg/ipa/devirt-36.C  -std=gnu++14  scan-tree-dump fre1
>>> "converting indirect call to function virtual int B::t"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2 "No
>>> dynamic type change found."
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
>>> "Checking vtbl store:"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
>>> "Function call may change dynamic type:extcall"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++98  scan-tree-dump fre2
>>> "converting indirect call to function virtual void"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2 "No
>>> dynamic type change found."
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
>>> "Checking vtbl store:"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
>>> "Function call may change dynamic type:extcall"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++11  scan-tree-dump fre2
>>> "converting indirect call to function virtual void"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2 "No
>>> dynamic type change found."
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
>>> "Checking vtbl store:"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
>>> "Function call may change dynamic type:extcall"
>>> FAIL: g++.dg/ipa/devirt-37.C  -std=gnu++14  scan-tree-dump fre2
>>> "converting indirect call to function virtual void"
>>> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++98  scan-ipa-dump inline
>>> "Second type is base of first"
>>> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++11  scan-ipa-dump inline
>>> "Second type is base of first"
>>> FAIL: g++.dg/ipa/devirt-41.C  -std=gnu++14  scan-ipa-dump inline
>>> "Second type is base of first"
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
>>> "First type is base of second" 3
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target" 2
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-times
>>> optimized "return 2" 3
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++98  scan-tree-dump-not
>>> optimized "OBJ_TYPE_REF"
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
>>> "First type is base of second" 3
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target" 2
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-times
>>> optimized "return 2" 3
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++11  scan-tree-dump-not
>>> optimized "OBJ_TYPE_REF"
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
>>> "First type is base of second" 3
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target" 2
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-times
>>> optimized "return 2" 3
>>> FAIL: g++.dg/ipa/devirt-42.C  -std=gnu++14  scan-tree-dump-not
>>> optimized "OBJ_TYPE_REF"
>>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump inline
>>> "Second type is base of first"
>>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++98  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump inline
>>> "Second type is base of first"
>>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++11  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump inline
>>> "Second type is base of first"
>>> FAIL: g++.dg/ipa/devirt-44.C  -std=gnu++14  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++98  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++11  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-45.C  -std=gnu++14  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++98  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++11  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-46.C  -std=gnu++14  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*B::foo" 1
>>> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++98  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
>>> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++11  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
>>> FAIL: g++.dg/ipa/devirt-47.C  -std=gnu++14  scan-ipa-dump-times inline
>>> "Discovered a virtual call to a known target[^\\n]*C::_ZTh" 1
>>> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++98  scan-ipa-dump-not
>>> whole-program "OBJ_TYPE_REF"
>>> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++11  scan-ipa-dump-not
>>> whole-program "OBJ_TYPE_REF"
>>> FAIL: g++.dg/ipa/devirt-9.C  -std=gnu++14  scan-ipa-dump-not
>>> whole-program "OBJ_TYPE_REF"
>>> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++98  scan-tree-dump-times
>>> optimized "OBJ_TYPE_REF" 0
>>> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++11  scan-tree-dump-times
>>> optimized "OBJ_TYPE_REF" 0
>>> FAIL: g++.dg/ipa/devirt-g-1.C  -std=gnu++14  scan-tree-dump-times
>>> optimized "OBJ_TYPE_REF" 0
>>> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++98  scan-ipa-dump cp "Type
>>> inconsistent devirtualization"
>>> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++11  scan-ipa-dump cp "Type
>>> inconsistent devirtualization"
>>> FAIL: g++.dg/ipa/pr60600.C  -std=gnu++14  scan-ipa-dump cp "Type
>>> inconsistent devirtualization"
>>> FAIL: g++.dg/opt/pr36185.C  -std=gnu++98 execution test
>>> FAIL: g++.dg/opt/pr36185.C  -std=gnu++11 execution test
>>> FAIL: g++.dg/opt/pr36185.C  -std=gnu++14 execution test
>>> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++98 execution test
>>> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++11 execution test
>>> FAIL: g++.dg/tree-ssa/20040317-1.C  -std=gnu++14 execution test
>>> FAIL: g++.dg/torture/covariant-1.C   -O2  execution test
>>> FAIL: g++.dg/torture/covariant-1.C   -O3 -fomit-frame-pointer  execution test
>>> FAIL: g++.dg/torture/covariant-1.C   -O3 -g  execution test
>>> FAIL: g++.dg/torture/covariant-1.C   -Os  execution test
>>> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fno-use-linker-plugin
>>> -flto-partition=none  execution test
>>> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fuse-linker-plugin
>>> -fno-fat-lto-objects  execution test
>>>
>>>
>>> Thanks,
>>> Andrew
>>>
>>
>> I saw
>
> Yes and can you try my patch too?

Yes, it fixes those failures.
Jan Hubicka Nov. 20, 2014, 8:07 a.m. UTC | #10
> Hi,
>   For ILP32 on AARCH64, we have ptr_mode != Pmode (we have ptr_mode
> being SImode while Pmode is DImode and POINTER_SIZE is 32).  This
> breaks ipa-polymorphic-call assumption that Pmode is the correct mode
> for pointers.  Right now before this patch we get many testcase
> failures in the C++ testsuite due to this.  Some of the tests fail due
> to the wrong devirtualization happening (using the base class rather
> the current class).
> 
> This patch fixes the issue by using POINTER_SIZE in place of
> GET_MODE_BITSIZE (Pmode) all over the file.
> 
> OK?  Bootstrapped and tested on x86_64 and cross built and tested for
> aarch64-elf with no regressions.
> 
> Thanks,
> Andrew Pinski
> 
> ChangeLog:
> ipa/63981
> * ipa-polymorphic-call.c (possible_placement_new):
> Use POINTER_SIZE instead of GET_MODE_BITSIZE (Pmode).
> (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise.
> (extr_type_from_vtbl_ptr_store): Likewise.

OK,
thanks!
Honza

> diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c
> index 452f2d2..a746c49 100644
> --- a/gcc/ipa-polymorphic-call.c
> +++ b/gcc/ipa-polymorphic-call.c
> @@ -112,7 +112,7 @@ possible_placement_new (tree type, tree expected_type,
>  	      || !tree_fits_shwi_p (TYPE_SIZE (type))
>  	      || (cur_offset
>  		  + (expected_type ? tree_to_uhwi (TYPE_SIZE (expected_type))
> -		     : GET_MODE_BITSIZE (Pmode))
> +		     : POINTER_SIZE)
>  		  <= tree_to_uhwi (TYPE_SIZE (type)))));
>  }
>  
> @@ -155,7 +155,7 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type,
>    HOST_WIDE_INT cur_offset = offset;
>    bool speculative = false;
>    bool size_unknown = false;
> -  unsigned HOST_WIDE_INT otr_type_size = GET_MODE_BITSIZE (Pmode);
> +  unsigned HOST_WIDE_INT otr_type_size = POINTER_SIZE;
>  
>    /* Update OUTER_TYPE to match EXPECTED_TYPE if it is not set.  */
>    if (!outer_type)
> @@ -316,7 +316,7 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type,
>  		
>  	      if (pos <= (unsigned HOST_WIDE_INT)cur_offset
>  		  && (pos + size) >= (unsigned HOST_WIDE_INT)cur_offset
> -				     + GET_MODE_BITSIZE (Pmode)
> +				     + POINTER_SIZE
>  		  && (!otr_type
>  		      || !TYPE_SIZE (TREE_TYPE (fld))
>  		      || !tree_fits_shwi_p (TYPE_SIZE (TREE_TYPE (fld)))
> @@ -1243,7 +1243,7 @@ extr_type_from_vtbl_ptr_store (gimple stmt, struct type_change_info *tci,
>  	      print_generic_expr (dump_file, tci->instance, TDF_SLIM);
>  	      fprintf (dump_file, " with offset %i\n", (int)tci->offset);
>  	    }
> -	  return tci->offset > GET_MODE_BITSIZE (Pmode) ? error_mark_node : NULL_TREE;
> +	  return tci->offset > POINTER_SIZE ? error_mark_node : NULL_TREE;
>  	}
>        if (offset != tci->offset
>  	  || size != POINTER_SIZE
> @@ -1252,9 +1252,9 @@ extr_type_from_vtbl_ptr_store (gimple stmt, struct type_change_info *tci,
>  	  if (dump_file)
>  	    fprintf (dump_file, "    wrong offset %i!=%i or size %i\n",
>  		     (int)offset, (int)tci->offset, (int)size);
> -	  return offset + GET_MODE_BITSIZE (Pmode) <= tci->offset
> +	  return offset + POINTER_SIZE <= tci->offset
>  	         || (max_size != -1
> -		     && tci->offset + GET_MODE_BITSIZE (Pmode) > offset + max_size)
> +		     && tci->offset + POINTER_SIZE > offset + max_size)
>  		 ? error_mark_node : NULL;
>  	}
>      }
diff mbox

Patch

diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c
index 452f2d2..a746c49 100644
--- a/gcc/ipa-polymorphic-call.c
+++ b/gcc/ipa-polymorphic-call.c
@@ -112,7 +112,7 @@  possible_placement_new (tree type, tree expected_type,
 	      || !tree_fits_shwi_p (TYPE_SIZE (type))
 	      || (cur_offset
 		  + (expected_type ? tree_to_uhwi (TYPE_SIZE (expected_type))
-		     : GET_MODE_BITSIZE (Pmode))
+		     : POINTER_SIZE)
 		  <= tree_to_uhwi (TYPE_SIZE (type)))));
 }
 
@@ -155,7 +155,7 @@  ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type,
   HOST_WIDE_INT cur_offset = offset;
   bool speculative = false;
   bool size_unknown = false;
-  unsigned HOST_WIDE_INT otr_type_size = GET_MODE_BITSIZE (Pmode);
+  unsigned HOST_WIDE_INT otr_type_size = POINTER_SIZE;
 
   /* Update OUTER_TYPE to match EXPECTED_TYPE if it is not set.  */
   if (!outer_type)
@@ -316,7 +316,7 @@  ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type,
 		
 	      if (pos <= (unsigned HOST_WIDE_INT)cur_offset
 		  && (pos + size) >= (unsigned HOST_WIDE_INT)cur_offset
-				     + GET_MODE_BITSIZE (Pmode)
+				     + POINTER_SIZE
 		  && (!otr_type
 		      || !TYPE_SIZE (TREE_TYPE (fld))
 		      || !tree_fits_shwi_p (TYPE_SIZE (TREE_TYPE (fld)))
@@ -1243,7 +1243,7 @@  extr_type_from_vtbl_ptr_store (gimple stmt, struct type_change_info *tci,
 	      print_generic_expr (dump_file, tci->instance, TDF_SLIM);
 	      fprintf (dump_file, " with offset %i\n", (int)tci->offset);
 	    }
-	  return tci->offset > GET_MODE_BITSIZE (Pmode) ? error_mark_node : NULL_TREE;
+	  return tci->offset > POINTER_SIZE ? error_mark_node : NULL_TREE;
 	}
       if (offset != tci->offset
 	  || size != POINTER_SIZE
@@ -1252,9 +1252,9 @@  extr_type_from_vtbl_ptr_store (gimple stmt, struct type_change_info *tci,
 	  if (dump_file)
 	    fprintf (dump_file, "    wrong offset %i!=%i or size %i\n",
 		     (int)offset, (int)tci->offset, (int)size);
-	  return offset + GET_MODE_BITSIZE (Pmode) <= tci->offset
+	  return offset + POINTER_SIZE <= tci->offset
 	         || (max_size != -1
-		     && tci->offset + GET_MODE_BITSIZE (Pmode) > offset + max_size)
+		     && tci->offset + POINTER_SIZE > offset + max_size)
 		 ? error_mark_node : NULL;
 	}
     }