bug-cssc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-cssc] [bug #54497] [patch] mylist implementation error segfaults wi


From: Yann Dirson
Subject: [Bug-cssc] [bug #54497] [patch] mylist implementation error segfaults with g++-8
Date: Sat, 11 Aug 2018 17:37:54 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0

URL:
  <http://savannah.gnu.org/bugs/?54497>

                 Summary: [patch] mylist implementation error segfaults with
g++-8
                 Project: GNU CSSC
            Submitted by: ydirson
            Submitted on: Sat 11 Aug 2018 11:37:53 PM CEST
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

With g++-8 self-tests fail with:

[ RUN      ] MylistTest.Catenate
Segmentation fault

This is due to operator+= and -= not returning anything, looks like it only
ever worked by chance with previous versions of the compiler - g++ does show a
warning where the problems are:


unit-tests$ make CC=gcc-8 CXX=g++-8 test_mylist
g++-8 -DHAVE_CONFIG_H -I. -I..  -I./googletest//include -pthread -I./../src 
-pthread -DGTEST_HAS_PTHREAD=1 -g -O2 -MT test_mylist.o -MD -MP -MF
.deps/test_mylist.Tpo -c -o test_mylist.o test
_mylist.cc
In file included from test_mylist.cc:24:
./../src/mylist.h: In instantiation of ‘const mylist<TYPE>&
mylist<TYPE>::operator+=(const mylist<TYPE>&) [with TYPE = int]’:
test_mylist.cc:70:8:   required from here
./../src/mylist.h:106:3: warning: no return statement in function returning
non-void [-Wreturn-type]
   }
   ^
./../src/mylist.h: In instantiation of ‘const mylist<TYPE>&
mylist<TYPE>::operator-=(const mylist<TYPE>&) [with TYPE = int]’:
test_mylist.cc:82:8:   required from here
./../src/mylist.h:125:3: warning: no return statement in function returning
non-void [-Wreturn-type]
   }
   ^
mv -f .deps/test_mylist.Tpo .deps/test_mylist.Po


Bug-Debian: https://bugs.debian.org/897731
Last-Update: 2018-08-11

--- cssc-1.4.0.orig/src/mylist.h
+++ cssc-1.4.0/src/mylist.h
@@ -103,6 +103,7 @@ public:
       {
        items_.push_back(*ci);
       }
+    return *this;
   }
 
   const mylist<TYPE>& operator-=(const mylist& other)
@@ -122,6 +123,7 @@ public:
          }
        items_.swap(remaining);
       }
+    return *this;
   }
 
 





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54497>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]