From fcf32bad2d611add21e748b4fd93d7cf63660a43 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Wed, 28 Sep 2016 12:11:57 +0000 Subject: [PATCH] re PR c++/77748 (pr77550.C fails on arm-none-eabi) 2016-09-28 Bernd Edlinger PR c++/77748 * g++.dg/pr77550.C: Avoid undefined behavior. From-SVN: r240573 --- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/pr77550.C | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa03b6d4d81..b942bd65b7f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-09-28 Bernd Edlinger + PR c++/77748 + * g++.dg/pr77550.C: Avoid undefined behavior. + * gcc.dg/tree-ssa/pr68198.c: Fix dg-final. 2016-09-28 Wilco Dijkstra diff --git a/gcc/testsuite/g++.dg/pr77550.C b/gcc/testsuite/g++.dg/pr77550.C index 4035674daaa..a1064737a67 100644 --- a/gcc/testsuite/g++.dg/pr77550.C +++ b/gcc/testsuite/g++.dg/pr77550.C @@ -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 @@ template struct basic_string { struct _Alloc_hider { _Alloc_hider(pointer, allocator && = allocator()); } _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, std::allocator>:: +//_Alloc_hider::_Alloc_hider(char*, std::allocator&&) {} +extern "C" void +_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderC1EPcOS3_ (...) {} } template int operator==(basic_string<_CharT> &p1, const basic_string<_CharT> &p2) { -- 2.30.2