diff mbox series

[PR,c++/82836] Fixe testcase

Message ID 6e4b7c0a-6dc8-2958-7c92-d7304902113f@acm.org
State New
Headers show
Series [PR,c++/82836] Fixe testcase | expand

Commit Message

Nathan Sidwell Nov. 17, 2017, 4:52 p.m. UTC
The 82836 testcase fell out of creduce.  In c++17 mode it fails horribly 
with missing return errors.

Applying this fix, so it's valid in c++17.  It still ICEs (in both 14 
and 17 modes) with the 82836 fix removed.

nathan

Comments

Rainer Orth Nov. 19, 2017, 12:38 p.m. UTC | #1
Hi Nathan,

> The 82836 testcase fell out of creduce.  In c++17 mode it fails horribly
> with missing return errors.
>
> Applying this fix, so it's valid in c++17.  It still ICEs (in both 14 and
> 17 modes) with the 82836 fix removed.

unfortunately, the testcase has several more problems:

* It fails on 32-bit Solaris/SPARC:

Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:12:3: error: expected unqualified-id before '__int128'
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:13:3: error: '__float128' does not name a type; did you mean 'float'?
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:158:31: error: 'operator new' takes type 'size_t' ('unsigned int') as first parameter [-fpermissive]
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:159:33: error: 'operator new' takes type 'size_t' ('unsigned int') as first parameter [-fpermissive]
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:285:37: error: template argument 1 is invalid
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:288:46: error: template argument 1 is invalid

* Likewise on 64-bit Solaris/SPARC:

Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:13:3: error: '__float128' does not name a type; did you mean 'float'?

* And again on 32-bit x86 (both Solaris and Linux):

Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:12:3: error: expected unqualified-id before '__int128'
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:158:31: error: 'operator new' takes type 'size_t' ('unsigned int') as first parameter [-fpermissive]
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:159:33: error: 'operator new' takes type 'size_t' ('unsigned int') as first parameter [-fpermissive]
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:285:37: error: template argument 1 is invalid
/vol/gcc/src/hg/trunk/local/gcc/testsuite/g++.dg/pr82836.C:288:46: error: template argument 1 is invalid

All of those are fixed as follows.  Tested with the appropriate runtest
invocations on i386-pc-solaris2.11, sparc-sun-solaris2.11, and
x86_64-pc-linux-gnu.

Ok for mainline, or would you rather make the use of __int128 and
__float128 conditional?

Thanks.
        Rainer
Nathan Sidwell Nov. 20, 2017, 12:52 p.m. UTC | #2
On 11/19/2017 07:38 AM, Rainer Orth wrote:

> Ok for mainline, or would you rather make the use of __int128 and
> __float128 conditional?

Patch is good.  I'd rather perturb the source itself as little as 
possible, and I've verified it still ICEs an unfixed x86_64 compiler.

thanks,

nathan
diff mbox series

Patch

2017-11-17  Nathan Sidwell  <nathan@acm.org>

	* g++.dg/pr82836.C: Fix for c++17.

Index: g++.dg/pr82836.C
==================================================================
--- g++.dg/pr82836.C	(revision 254867)
+++ g++.dg/pr82836.C	(working copy)
@@ -8,9 +8,9 @@ 
 namespace std {
 typedef long unsigned size_t;
 inline namespace __cxx11 {}
-double abs() {}
-__int128 abs(__int128 ) {}
-__float128 abs(__float128 ) {}
+  double abs() {return 0;}
+  __int128 abs(__int128 ) {return 0;}
+  __float128 abs(__float128 ) {return 0;}
 
   
 #pragma weak pthread_create
@@ -82,37 +82,37 @@  namespace std {
     typedef char char_type;
     typedef int int_type;
     void assign() {}
-    bool eq() {}
-    bool lt() {}
-    int compare() {}
-    size_t length() {}
-    char_type find() {}
-    char_type move() {}
-    char_type copy() {}
-    char_type assign(char_type ) {}
-    char_type to_char_type() {}
-    int_type to_int_type() {}
-    bool eq_int_type() {}
-    int_type eof() {}
-    int_type not_eof() {}
+    bool eq() {return 0;}
+    bool lt() {return 0;}
+    int compare() {return 0;}
+    size_t length() {return 0;}
+    char_type find() {return 0;}
+    char_type move() {return 0;}
+    char_type copy() {return 0;}
+    char_type assign(char_type ) {return 0;}
+    char_type to_char_type() {return 0;}
+    int_type to_int_type() {return 0;}
+    bool eq_int_type() {return 0;}
+    int_type eof() {return 0;}
+    int_type not_eof() {return 0;}
   };
   template <> struct char_traits< wchar_t > {
     typedef wchar_t char_type;
     typedef int int_type;
     void assign() {}
-    bool eq() {}
-    bool lt() {}
-    int compare() {}
-    size_t length() {}
-    char_type find() {}
-    char_type move() {}
-    char_type copy() {}
-    char_type assign(char_type ) {}
-    char_type to_char_type() {}
-    int_type to_int_type() {}
-    bool eq_int_type() {}
-    int_type eof() {}
-    int_type not_eof() {}
+    bool eq() {return 0;}
+    bool lt() {return 0;}
+    int compare() {return 0;}
+    size_t length() {return 0;}
+    char_type find() {return 0;}
+    char_type move() {return 0;}
+    char_type copy() {return 0;}
+    char_type assign(char_type ) {return 0;}
+    char_type to_char_type() {return 0;}
+    int_type to_int_type() {return 0;}
+    bool eq_int_type() {return 0;}
+    int_type eof() {return 0;}
+    int_type not_eof() {return 0;}
   };
 }
 typedef int uint_least16_t;
@@ -122,41 +122,41 @@  template <> struct char_traits< char16_t
   typedef char16_t char_type;
   typedef uint_least16_t int_type;
   void assign() {}
-  bool eq() {}
-  bool lt() {}
-  int compare() {}
-  size_t length() {}
-  char_type find() {}
-  char_type move() {}
-  char_type copy() {}
-  char_type assign(char_type ) {}
-  char_type to_char_type() {}
-  int_type to_int_type() {}
-  bool eq_int_type() {}
-  int_type eof() {}
-  int_type not_eof() {}
+  bool eq() {return false;}
+  bool lt() {return false;}
+  int compare() {return 0;}
+  size_t length() {return 0;}
+  char_type find() {return 0;}
+  char_type move() {return 0;}
+  char_type copy() {return 0;}
+  char_type assign(char_type ) {return 0;}
+  char_type to_char_type() {return 0;}
+  int_type to_int_type() {return 0;}
+  bool eq_int_type() {return false;}
+  int_type eof() {return 0;}
+  int_type not_eof() {return 0;}
 };
 template <> struct char_traits< char32_t > {
   typedef char32_t char_type;
   typedef uint_least32_t int_type;
   void assign() {}
-  bool eq() {}
-  bool lt() {}
-  int compare() {}
-  size_t length() {}
-  char_type find() {}
-  char_type move() {}
-  char_type copy() {}
-  char_type assign(char_type ) {}
-  char_type to_char_type() {}
-  int_type to_int_type() {}
-  bool eq_int_type() {}
-  int_type eof() {}
-  int_type not_eof() {}
+  bool eq() {return false;}
+  bool lt() {return false;}
+  int compare() {return 0;}
+  size_t length() {return 0;}
+  char_type find() {return 0;}
+  char_type move() {return 0;}
+  char_type copy() {return 0;}
+  char_type assign(char_type ) {return 0;}
+  char_type to_char_type() {return 0;}
+  int_type to_int_type() {return 0;}
+  bool eq_int_type() {return false;}
+  int_type eof() {return 0;}
+  int_type not_eof() {return 0;}
 };
 }
-void *operator new(std::size_t) {}
-void *operator new[](std::size_t) {}
+void *operator new(std::size_t) {return (void *)1;}
+void *operator new[](std::size_t) {return (void *)1;}
 void operator delete(void *){}
 void operator delete[](void *) {}
 namespace  {
@@ -173,7 +173,7 @@  public:
 ;
 template < typename _Tp >
 struct less {
-  bool operator()( _Tp ,  _Tp ) {}
+  bool operator()( _Tp ,  _Tp ) {return false;}
 };
 }
 typedef int _Atomic_word;
@@ -225,6 +225,7 @@  namespace std {
         
        (__gnu_cxx::__numeric_traits< int >::__min)
         ;
+      return 0;
     }
   };
   }
@@ -252,10 +253,10 @@  namespace std {
     void operator0() {}
   };
   template <> struct __hash_base< size_t, char16_t > {
-    size_t operator0() {}
+    size_t operator0() {return 0;}
   };
   template <> struct __hash_base< size_t, char32_t > {
-    size_t operator0() {}
+    size_t operator0() {return 0;}
   };
   template <> struct hash< short > {
     void operator0() {}
@@ -292,11 +293,11 @@  namespace std {
      ;
     _Bit_type _M_mask;
     _Bit_reference  () {}
-    operator bool() {}
+    operator bool() {return false;}
     _Bit_reference (bool ) {}
-    _Bit_reference operator=(_Bit_reference ) {}
-    bool operator==(_Bit_reference ) {}
-    bool operator<(_Bit_reference ) {}
+    _Bit_reference operator=(_Bit_reference ) {return *this;}
+    bool operator==(_Bit_reference ) {return false;}
+    bool operator<(_Bit_reference ) {return false;}
     void flip() {}
   };
   void swap() {}
@@ -311,21 +312,21 @@  namespace std {
     void _M_bump_up() {}
     void _M_bump_down() {}
     void _M_incr() {}
-    bool operator==(_Bit_iterator_base ) {}
-    bool operator<(_Bit_iterator_base ) {}
-    bool operator!=(_Bit_iterator_base ) {}
-    bool operator>(_Bit_iterator_base ) {}
-    bool operator<=(_Bit_iterator_base ) {}
-    bool operator>=(_Bit_iterator_base ) {}
+    bool operator==(_Bit_iterator_base ) {return false;}
+    bool operator<(_Bit_iterator_base ) {return false;}
+    bool operator!=(_Bit_iterator_base ) {return false;}
+    bool operator>(_Bit_iterator_base ) {return false;}
+    bool operator<=(_Bit_iterator_base ) {return false;}
+    bool operator>=(_Bit_iterator_base ) {return false;}
   };
   struct _Bit_iterator : _Bit_iterator_base {
     _Bit_iterator() : _Bit_iterator_base(0, 0) {}
     _Bit_iterator(_Bit_type *__x, int __y)
         : _Bit_iterator_base(__x, __y) {}
-    iterator _M_const_cast() {}
-    iterator operator+() {}
-    iterator operator-() {}
-    reference operator[](difference_type ) {}
+    iterator _M_const_cast() {return iterator ();}
+    iterator operator+() {return iterator ();}
+    iterator operator-() {return iterator ();}
+    reference operator[](difference_type ) {return 0;}
   };
   void operator+(_Bit_iterator ) {}
   struct _Bit_const_iterator : _Bit_iterator_base {
@@ -349,9 +350,10 @@  namespace std {
   class error_category {
     bool operator<(error_category __other) {
       less< error_category * >()(this, &__other);
+      return false;
     }
-    bool operator==(error_category ) {}
-    bool operator!=(error_category ) {}
+    bool operator==(error_category ) {return false;}
+    bool operator!=(error_category ) {return false;}
   };
   }
   struct error_code {
@@ -359,42 +361,42 @@  namespace std {
     error_code(error_category ) : _M_cat() {}
     void assign() {}
     void clear() {}
-    int value() {}
-    error_category category() {}
-    string message() {}
+    int value() {return 0;}
+    error_category category() {return error_category ();}
+    string message() {return string();}
     error_category _M_cat;
   };
-  inline error_code make_error_code() noexcept {}
+  inline error_code make_error_code() noexcept {return error_code ();}
   inline bool operator<(const error_code ,
-                        const error_code ) noexcept {}
+                        const error_code ) noexcept {return false;}
   struct error_condition {
     error_condition() {}
     error_condition(const error_category ) {}
     void assign() noexcept {}
     void clear() noexcept {}
-    int value() {}
-    const error_category &category() {}
+    int value() {return 0;}
+    const error_category category() {return error_category ();}
     string message_M_cat;
   };
-  inline error_condition make_error_condition() noexcept {}
+  inline error_condition make_error_condition() noexcept {return error_condition ();}
   inline bool operator<(const error_condition ,
-                        const error_condition ) noexcept {}
+                        const error_condition ) noexcept {return false;}
   inline bool operator==(const error_code ,
-                         const error_code ) noexcept {}
+                         const error_code ) noexcept {return false;}
   inline bool operator==(const error_code ,
-                         const error_condition ) noexcept {}
+                         const error_condition ) noexcept {return false;}
   inline bool operator==(const error_condition ,
-                         const error_code ) noexcept {}
+                         const error_code ) noexcept {return false;}
   inline bool operator==(const error_condition ,
-                         const error_condition ) noexcept {}
+                         const error_condition ) noexcept {return false;}
   inline bool operator!=(const error_code ,
-                         const error_code ) noexcept {}
+                         const error_code ) noexcept {return false;}
   inline bool operator!=(const error_code ,
-                         const error_condition ) noexcept {}
+                         const error_condition ) noexcept {return false;}
   inline bool operator!=(const error_condition ,
-                         const error_code ) noexcept {}
+                         const error_code ) noexcept {return false;}
   inline bool operator!=(const error_condition ,
-                         const error_condition ) noexcept {}
+                         const error_condition ) noexcept {return false;}
   class system_error : public runtime_error {
   error_code _M_code;
 
@@ -410,47 +412,47 @@  namespace std {
         : runtime_error(error_code().message()) {}
     system_error(const string &__what)
         : runtime_error(error_code().message()) {}
-    const error_code &code() {}
+    const error_code code() {return error_code ();}
     void operator0() {}
   };
   enum _Ios_Fmtflags {};
-  _Ios_Fmtflags operator&(_Ios_Fmtflags __a__b) {}
-  _Ios_Fmtflags operator|(_Ios_Fmtflags __a,
-                                           _Ios_Fmtflags __b) {}
-  _Ios_Fmtflags operator^(_Ios_Fmtflags __a,
-                                           _Ios_Fmtflags __b) {}
-  _Ios_Fmtflags operator~(_Ios_Fmtflags __a) {}
-  _Ios_Fmtflags &operator|=(_Ios_Fmtflags ,
-                                         _Ios_Fmtflags __b) {}
-  _Ios_Fmtflags &operator&=(_Ios_Fmtflags ,
-                                         _Ios_Fmtflags __b) {}
-  _Ios_Fmtflags &operator^=(_Ios_Fmtflags ,
-                                         _Ios_Fmtflags __b) {}
+  _Ios_Fmtflags operator&(_Ios_Fmtflags &__a) {return __a;}
+  _Ios_Fmtflags operator|(_Ios_Fmtflags &__a,
+                                           _Ios_Fmtflags __b) {return __a;}
+  _Ios_Fmtflags operator^(_Ios_Fmtflags &__a,
+                                           _Ios_Fmtflags __b) {return __a;}
+  _Ios_Fmtflags operator~(_Ios_Fmtflags &__a) {return __a;}
+  _Ios_Fmtflags &operator|=(_Ios_Fmtflags &__a,
+                                         _Ios_Fmtflags __b) {return __a;}
+  _Ios_Fmtflags &operator&=(_Ios_Fmtflags &__a,
+                                         _Ios_Fmtflags __b) {return __a;}
+  _Ios_Fmtflags &operator^=(_Ios_Fmtflags &__a,
+                                         _Ios_Fmtflags __b) {return __a;}
   enum _Ios_Openmode {
     _S_ios_openmode_max };
-  _Ios_Openmode operator&(_Ios_Openmode __a__b) {}
-  _Ios_Openmode operator|(_Ios_Openmode __a,
-                                           _Ios_Openmode __b) {}
-  _Ios_Openmode operator^(_Ios_Openmode __a,
-                                           _Ios_Openmode __b) {}
-  _Ios_Openmode operator~(_Ios_Openmode __a) {}
-  _Ios_Openmode &operator|=(_Ios_Openmode ,
-                                         _Ios_Openmode __b) {}
-  _Ios_Openmode &operator&=(_Ios_Openmode ,
-                                         _Ios_Openmode __b) {}
-  _Ios_Openmode &operator^=(_Ios_Openmode ,
-                                         _Ios_Openmode __b) {}
+  _Ios_Openmode operator&(_Ios_Openmode &__a__b) {return __a__b;}
+  _Ios_Openmode operator|(_Ios_Openmode &__a,
+                                           _Ios_Openmode __b) {return __a;}
+  _Ios_Openmode operator^(_Ios_Openmode &__a,
+                                           _Ios_Openmode __b) {return __a;}
+  _Ios_Openmode operator~(_Ios_Openmode &__a) {return __a;}
+  _Ios_Openmode &operator|=(_Ios_Openmode &__a,
+                                         _Ios_Openmode __b) {return __a;}
+  _Ios_Openmode &operator&=(_Ios_Openmode &__a,
+                                         _Ios_Openmode __b) {return __a;}
+  _Ios_Openmode &operator^=(_Ios_Openmode &__a,
+                                         _Ios_Openmode __b) {return __a;}
   enum _Ios_Iostate {
     _S_ios_iostate_max };
-  _Ios_Iostate operator&(_Ios_Iostate __a__b) {}
-  _Ios_Iostate operator|(_Ios_Iostate __a, _Ios_Iostate __b) {}
-  _Ios_Iostate operator^(_Ios_Iostate __a, _Ios_Iostate __b) {}
-  _Ios_Iostate operator~(_Ios_Iostate __a) {}
-  _Ios_Iostate &operator|=(_Ios_Iostate , _Ios_Iostate __b) {}
-  _Ios_Iostate &operator&=(_Ios_Iostate , _Ios_Iostate __b) {}
-  _Ios_Iostate &operator^=(_Ios_Iostate , _Ios_Iostate __b) {}
+  _Ios_Iostate operator&(_Ios_Iostate &__a__b) {return __a__b;}
+  _Ios_Iostate operator|(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;}
+  _Ios_Iostate operator^(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;}
+  _Ios_Iostate operator~(_Ios_Iostate &__a) {return __a;}
+  _Ios_Iostate &operator|=(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;}
+  _Ios_Iostate &operator&=(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;}
+  _Ios_Iostate &operator^=(_Ios_Iostate &__a, _Ios_Iostate __b) {return __a;}
   enum class io_errc;
-  inline error_code make_error_code(io_errc __e) noexcept {}
+  inline error_code make_error_code(io_errc __e) noexcept {return error_code();}
   inline error_condition make_error_condition_wrap_class_string;
 static luaL_Reg swig_ClientProfile_methods;
 static luaL_Reg swig_ClientProfile_meta;