Bug #49363 empty throw in delete for sp_head breaks GCC 2.9.6 systems
Submitted: 2 Dec 2009 19:59 Modified: 1 Feb 2010 19:58
Reporter: Todd Rinaldo Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.43 OS:Linux (redhat 7.3-9.0)
Assigned to: CPU Architecture:Any
Tags: Contribution

[2 Dec 2009 19:59] Todd Rinaldo
Due to a bug in GCC 2.96, the compiler does not recognize the 2 argument delete definition if it has an throw on the end of it. The other solution is to remove "size_t size" since I think it's not even used. 

Since an empty throw is unnecessary, I'd request it be removed from the source. This is the only thing preventing MySQL 5.0 from compiling on these systems

How to repeat:
compile MySQL 5.0 on Redhat 9

Suggested fix:
patch as below from 5.0.88 code:

diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index e32dd75..3fb77e2 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -456,7 +456,7 @@ sp_head::operator new(size_t size) throw()
-sp_head::operator delete(void *ptr, size_t size) throw()
+sp_head::operator delete(void *ptr, size_t size)
   DBUG_ENTER("sp_head::operator delete");
   MEM_ROOT own_root;
diff --git a/sql/sp_head.h b/sql/sp_head.h
index c54dc74..dbfc3e6 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -185,7 +185,7 @@ public:
   operator new(size_t size) throw ();
   static void
-  operator delete(void *ptr, size_t size) throw ();
+  operator delete(void *ptr, size_t size);
[2 Dec 2009 20:11] Todd Rinaldo
tweaked version to help reproduce the issue
[3 Dec 2009 7:20] Valeriy Kravchuk
Bug #49365 was marked as a duplicate of this one. See suggested patch for 5.1.41 there.
[3 Dec 2009 11:53] Sveta Smirnova
Thank you for the report.

But gcc 2.96 is very old and not supported compiler.
[3 Dec 2009 12:03] Sveta Smirnova
After internal discussion we decided since we are not using exceptions the patch is good to implement. Moving bug to "Verified". Thank you for the contribution!
[5 Jan 2010 23:46] Omer Barnir
Issue is supported in 5.0 only and standard support for the release ended
[1 Feb 2010 19:58] Todd Rinaldo
This fix applies to 5.1.43, but has not been applied, I think, because 5.0 was made EOL and therefore this ticket was closed.  Could we either:
1. Re-label this ticket as 5.1.43.
2. re-open as not duplicate: http://bugs.mysql.com/bug.php?id=49365
[22 Feb 2010 14:13] Daniel Fischer

The bug was closed as "won't fix" because this version of gcc is not supported for MySQL 5.1. The patch was previously considered for inclusion in 5.0 only.

While the empty throw() clause makes no semantic difference, it is a hint to the compiler that no exception handling code needs to be created around invocations of a function. Therefore, it's not a completely meaningless.