Bug 13438

Summary: objc forward core dump using system cc
Product: Base System Reporter: Yuan-Chen Cheng <ycheng>
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Yuan-Chen Cheng 1999-08-28 09:30:01 UTC
objc forward feature not work.

How-To-Repeat: 
mkdir test
cd test
patch < following_patch
cc *.m -Wall -lobjc
./a.out

core dump with message:
Inv val is 134561320
Floating point exception (core dumped)

--- /dev/null	Wed May  6 04:32:27 1998
+++ DelegatePool.h	Wed Aug 11 08:34:58 1999
@@ -0,0 +1,10 @@
+#include <objc/Object.h>
+
+@interface DelegatePool : Object
+{
+  id a;
+}
+- (void) setDeleGate: anObject;
+- forward:(SEL)aSel :(arglist_t)argFrame;
+@end
+
--- /dev/null	Wed May  6 04:32:27 1998
+++ DelegatePool.m	Wed Aug 11 08:34:58 1999
@@ -0,0 +1,22 @@
+
+#include "DelegatePool.h"
+
+@implementation DelegatePool
+
+- (void) setDeleGate: anObject
+{
+  a = anObject;
+}
+
+- forward: (SEL)aSel :(arglist_t)argFrame
+{
+  void *ret = 0;
+  
+  if ([a respondsTo:aSel]) 
+    {
+      ret = [a performv:aSel :argFrame];
+    }
+  return ret;
+}
+
+@end
--- /dev/null	Wed May  6 04:32:27 1998
+++ Int.h	Wed Aug 11 08:34:58 1999
@@ -0,0 +1,11 @@
+
+#include <objc/Object.h>
+
+@interface Int : Object
+{
+  int i;
+}
+- (void) set: (int) val;
+- (void) print;
+@end
+
--- /dev/null	Wed May  6 04:32:27 1998
+++ Int.m	Wed Aug 11 08:34:58 1999
@@ -0,0 +1,17 @@
+
+#include "Int.h"
+
+@implementation Int
+
+- (void) set: (int) val
+{
+  i = val;
+}
+
+- (void) print
+{
+  printf("Inv val is %i\n", i);
+}
+
+@end
+
--- /dev/null	Wed May  6 04:32:27 1998
+++ main.m	Wed Aug 11 08:34:57 1999
@@ -0,0 +1,16 @@
+#include "Int.h"
+#include "DelegatePool.h"
+
+int main()
+{
+  id i;
+  id d;
+
+  i = [[Int new] init] ;
+  d = [[DelegatePool new] init];
+  [d setDeleGate: i];
+  [d print];
+  return 0;
+}
+
+
Comment 1 ycheng 2000-03-27 11:09:15 UTC
no more core dump on freebsd 4.0-RELEASE (on K6)
but the output value is still wrong.
Comment 2 Mike Barcroft freebsd_committer freebsd_triage 2001-07-21 01:35:32 UTC
State Changed
From-To: open->feedback


Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE?
Comment 3 Sheldon Hearn freebsd_committer freebsd_triage 2002-01-17 16:12:05 UTC
State Changed
From-To: feedback->closed

Automatic feedback timeout.  If additional feedback that warrants 
the re-opening of this PR is available but not included in the 
audit trail, please include the feedback in a reply to this message 
(preserving the Subject line) and ask that the PR be re-opened.