This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix for libg++-2.8.1.2 bug



There is a bug in the libg++-2.8.1.2 testsuite in that etc/lf/entry.cc 
does not compile without optimisation, helting the libg++ testsuite
run (as triggered by, in my case, a `make check' of the egcs suite
with libg++ expanded into the top-level directory as normal).

The fix is simple (and may, indeed, even be in the latest libg++
snapshot; I'm not sure):

*** libg++/etc/lf/entry.cc.orig Sun Nov 15 15:10:34 1998
--- libg++/etc/lf/entry.cc      Sun Nov 15 15:14:49 1998
***************
*** 5,10 ****
--- 5,20 ----
  /* Initially provide a medium-sized file entry size. */
  const int Entry_Handler::default_entries = 50;
  
+ /* If -O is *not* enabled then this is defined below its first use, so we
+    need a prototype. */
+ 
+ #ifndef __OPTIMIZE__
+ 
+ void *
+ operator new (size_t size, void *orig, int number);
+ 
+ #endif                          // __OPTIMIZE__
+ 
  /* Print entries to standard output.  The algorithm used to format the files
     in columns is subtle, and worth studying in some detail. */
  
***************
*** 68,73 ****
--- 78,91 ----
  Entry_Handler::entry_number (void)
  {
    return entries;
+ }
+ 
+ /* Allocate a number of new entries at once. */
+ 
+ void *
+ operator new (size_t size, void *orig, int number)
+ {
+   return realloc (orig, size * number);
  }
  
  /* Add an entry to the file class. */

With this in place, the libg++ testsuite runs OK w/o optimisation on
my system.

-- 
`It would be painful to fix, but it's a lot less painful to fix _now_
 rather than later, so maybe the right thing is to just do it and watch
 people scream in agony.' - Linus Torvalds on linux-kernel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]