[Bug c++/77748] pr77550.C fails on arm-none-eabi
bernd.edlinger at hotmail dot de
gcc-bugzilla@gcc.gnu.org
Wed Sep 28 01:51:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77748
--- Comment #22 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Christophe Lyon from comment #21)
> Ha, indeed, that's one of the differences between arm-none-eabi and
> arm-none-linux-gnueabi.
>
> Using -fno-short-enums does make execution succeed, unfortunately the linker
> complains because the startup code/libraries are not compiled with this flag:
> ld: warning: /tmp/ccKhI9uW.o uses 32-bit enums yet the output is to use
> variable-size enums; use of enum values across objects may fail
>
> Is there an effective-target to check for short-enums?
target short_enums
but it looks like only checking the diagnostics from the compile
not the link.
Some use -Wl,--no-enum-size-warning which no other target undestands.
Maybe we try this:
Index: pr77550.C
===================================================================
--- pr77550.C (revision 240540)
+++ pr77550.C (working copy)
@@ -1,6 +1,7 @@
// { dg-do run }
// { dg-options "-std=c++14 -O3" }
+#define enum enum __attribute((mode(SI)))
namespace std {
typedef int size_t;
inline namespace __cxx11 {}
@@ -229,15 +230,17 @@
struct _Alloc_hider {
_Alloc_hider(pointer, allocator<char> && = allocator<char>());
} _M_dataplus;
- size_type _M_string_length;
+ size_type _M_string_length = 0;
enum { _S_local_capacity = 15 } _M_local_buf[_S_local_capacity];
- pointer _M_local_data();
- void _M_set_length(size_type);
- basic_string() : _M_dataplus(_M_local_data()) { _M_set_length(0); }
+ basic_string() : _M_dataplus(0) {}
basic_string(const basic_string &) : _M_dataplus(0) {}
size_type size() { return _M_string_length; }
char *data() const {}
};
+//template<> basic_string<char, std::char_traits<char>,
std::allocator<char>>::
+//_Alloc_hider::_Alloc_hider(char*, std::allocator<char>&&) {}
+extern "C" void
+_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC1EPcOS3_
(...) {}
}
template <typename _CharT>
int operator==(basic_string<_CharT> &p1, const basic_string<_CharT> &p2) {
More information about the Gcc-bugs
mailing list