[arm] PR target/81497: Fix arm_acle.h for C++
commit1a259ac3e39bf87e6e6a5eface8b0ebc6b2a0dfe
authorktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Jun 2018 09:50:16 +0000 (5 09:50 +0000)
committerktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Jun 2018 09:50:16 +0000 (5 09:50 +0000)
treedee8dcc539595af6124b37bb55f95e418589c30a
parent5860b18540676394c10dab4f52faa1871f52cedc
[arm] PR target/81497: Fix arm_acle.h for C++

When trying to compile something with arm_acle.h using G++ we get a number of nasty errors:
arm_acle.h:48:49: error: invalid conversion from ‘const void*’ to ‘const int*’ [-fpermissive]
    return __builtin_arm_ldc (__coproc, __CRd, __p);

This is because the intrinsics that are supposed to be void return the "result" of their builtin,
which is void. C lets that slide but C++ complains.

After fixing that we run into further errors:
arm_acle.h:48:46: error: invalid conversion from 'const void*' to 'const int*' [-fpermissive]
    return __builtin_arm_ldc (__coproc, __CRd, __p);
                                               ^~~
Because the pointer arguments in these intrinsics are void pointers but the builtin
expects int pointers. So this patch introduces new qualifiers for void pointers and their
const-qualified versions and uses that in the specification of these intrinsics.

This gives us the opportunity of creating an arm subdirectory in g++.dg and inaugurates it
with the first arm-specific C++ tests (in that directory).

PR target/81497
* config/arm/arm-builtins.c (arm_type_qualifiers): Add
qualifier_void_pointer and qualifier_const_void_pointer.
(arm_ldc_qualifiers, arm_stc_qualifiers): Use the above.
(arm_init_builtins): Handle the above.
* config/arm/arm_acle.h (__arm_cdp, __arm_ldc, __arm_ldcl, __arm_stc,
__arm_stcl, __arm_mcr, __arm_cdp2, __arm_ldc2, __arm_ldcl2, __arm_stc2,
__arm_stcl2,__arm_mcr2, __arm_mcrr, __arm_mcrr2): Remove return for
void intrinsics.

* g++.target/arm/arm.exp: New file.
* g++.target/arm/pr81497.C: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261191 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/arm/arm-builtins.c
gcc/config/arm/arm_acle.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/arm/arm.exp [new file with mode: 0644]
gcc/testsuite/g++.target/arm/pr81497.C [new file with mode: 0644]