From: NTOMCZAK@vm.ucs.ualberta.ca (Michal Jaegermann)
Subject: Re: Fatal signal 10 with ObjC.
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 22 Nov 1992 23:45:03 GMT

This is a followup to a report by enelson@apnext1.slac.stanford.edu
(Eric M. Nelson) of cc1obj getting a fatal signal 10 on the following
test program:

#include <stdarg.h>
#include <objc/Object.h>

int main(){
  id anObject;
  anObject=[Object new];
  }

I tried this on my machine and I got the following:

Reading specs from /usr/local/lib/gcc-lib/next/2.3.1/specs
gcc version 2.3.1
 /usr/local/lib/gcc-lib/next/2.3.1/cpp -lang-objc -v -undef -D__OBJC__
-D__GNUC__=2 -Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__
-D__ARCHITECTURE__="m68k" -D__mc68000__ -D__m68k__ -D__NeXT__
-D__unix__ -D__MACH__ -D__ARCHITECTURE__="m68k" -D__mc68000 -D__m68k
-D__NeXT -D__unix -D__MACH__ -D__ARCHITECTURE__="m68k" test2.m
/usr/tmp/cc006781.i
GNU CPP version 2.3.1 (68k, MIT syntax)
 /usr/local/lib/gcc-lib/next/2.3.1/cc1obj /usr/tmp/cc006781.i -quiet
-dumpbase test2.m -version -lang-objc -o /usr/tmp/cc006781.s
GNU C version 2.3.1 (68k, MIT syntax) compiled by GNU C version 2.3.1.
In file included from /NextDeveloper/Headers/objc/Object.h:14, from test2.m:6:
/NextDeveloper/Headers/objc/objc-class.h:77: invalid Objective C
keyword `@class'
NextDeveloper/Headers/objc/objc-class.h:77: parse error before `@class'
/NextDeveloper/Headers/objc/objc-class.h:82: parse error before `Protocol'
/NextDeveloper/Headers/objc/objc-class.h:82: warning: no semicolon at
end of struct or union
In file included from test2.m:6:
/NextDeveloper/Headers/objc/Object.h:17: invalid Objective C keyword `@class'
/NextDeveloper/Headers/objc/Object.h:17: parse error before `@class'
/NextDeveloper/Headers/objc/Object.h:69: parse error before `Protocol'
/NextDeveloper/Headers/objc/Object.h:70: parse error before `Protocol'

A possible difference is that I got reckless and compiled mine cc1obj
with -O2 optimization option.  Maybe this will help to shed some light.
Compacted results of a preprocessor run are included below.

   Best regards,
   Michal Jaegermann
   ntomczak@vm.ucs.ualberta.ca
   ntomczak@vega.math.ualberta.ca

--------------------------
/* # 1 "test2.m" */
/* # 1 "/NextDeveloper/Headers/ansi/stdarg.h" 1 */
/* # 1 "/NextDeveloper/Headers/ansi/machine/stdarg.h" 1 */
/* # 1 "/NextDeveloper/Headers/architecture/ARCH_INCLUDE.h" 1 */
/* # 9 "/NextDeveloper/Headers/ansi/machine/stdarg.h" 2 */
/* # 1 "/NextDeveloper/Headers/ansi/m68k/stdarg.h" 1 */
typedef char *va_list;
void va_end (va_list);
/* # 11 "/NextDeveloper/Headers/ansi/machine/stdarg.h" 2 */
/* # 7 "/NextDeveloper/Headers/ansi/stdarg.h" 2 */
/* # 5 "test2.m" 2 */
/* # 1 "/NextDeveloper/Headers/objc/Object.h" 1 */
/* # 1 "/NextDeveloper/Headers/objc/objc.h" 1 */
typedef struct objc_class *Class;
typedef struct objc_object {
	Class isa;
} *id;
typedef struct objc_selector 	*SEL;
typedef char *			STR;
typedef id 			(*IMP)(id, SEL, ...);
typedef char			BOOL;
extern BOOL sel_isMapped(SEL sel);
extern const char *sel_getName(SEL sel);
extern SEL sel_getUid(const char *str);
extern SEL sel_registerName(const char *str);
extern const char *object_getClassName(id obj);
extern void *object_getIndexedIvars(id obj);
/* # 13 "/NextDeveloper/Headers/objc/Object.h" 2 */
/* # 1 "/NextDeveloper/Headers/objc/objc-class.h" 1 */
/* # 1 "/NextDeveloper/Headers/objc/zone.h" 1 */
/* # 1 "/NextDeveloper/Headers/ansi/stddef.h" 1 */
/* # 1 "/NextDeveloper/Headers/ansi/machine/stddef.h" 1 */
/* # 1 "/NextDeveloper/Headers/architecture/ARCH_INCLUDE.h" 1 */
/* # 32 "/NextDeveloper/Headers/architecture/ARCH_INCLUDE.h" */
/* # 9 "/NextDeveloper/Headers/ansi/machine/stddef.h" 2 */
/* # 1 "/NextDeveloper/Headers/ansi/m68k/stddef.h" 1 */
typedef long ptrdiff_t;
typedef unsigned long size_t;
typedef unsigned short wchar_t;
/* # 11 "/NextDeveloper/Headers/ansi/machine/stddef.h" 2 */
/* # 4 "/NextDeveloper/Headers/ansi/stddef.h" 2 */
/* # 1 "/NextDeveloper/Headers/objc/zone.h" 2 */
typedef struct _NXZone {
    void *(*realloc)(struct _NXZone *zonep, void *ptr, size_t size);
    void *(*malloc)(struct _NXZone *zonep, size_t size);
    void (*free)(struct _NXZone *zonep, void *ptr);
    void (*destroy)(struct _NXZone *zonep);
} NXZone;
extern NXZone *NXDefaultMallocZone(void);
extern NXZone *NXCreateZone(size_t startSize, size_t granularity, int canFree);
extern NXZone  *NXCreateChildZone(NXZone *parentZone, size_t startSize,
 size_t granularity, int canFree);
extern void NXMergeZone(NXZone *zonep);
extern void *NXZoneCalloc(NXZone *zonep, size_t numElems, size_t byteSize);
extern NXZone *NXZoneFromPtr(void *ptr);
extern void NXZonePtrInfo(void *ptr);
extern int NXMallocCheck(void);
extern void NXNameZone(NXZone *z, const char *name);
/* # 10 "/NextDeveloper/Headers/objc/objc-class.h" 2 */
struct objc_class {			
	struct objc_class *isa;	
	struct objc_class *super_class;	
	const char *name;		
	long version;
	long info;
	long instance_size;
	struct objc_ivar_list *ivars;
	struct objc_method_list *methods;
	struct objc_cache *cache;
 	struct objc_protocol_list *protocols;
};
typedef struct objc_category *Category;
struct objc_category {
	char *category_name;
	char *class_name;
	struct objc_method_list *instance_methods;
	struct objc_method_list *class_methods;
 	struct objc_protocol_list *protocols;
};
typedef struct objc_ivar *Ivar;
struct objc_ivar_list {
	int ivar_count;
	struct objc_ivar {
		char *ivar_name;
		char *ivar_type;
		int ivar_offset;
	} ivar_list[1];			
};
typedef struct objc_method *Method;
struct objc_method_list {
	struct objc_method_list *method_next;
	int method_count;
	struct objc_method {
		SEL method_name;
		char *method_types;
                IMP method_imp;
	} method_list[1];		
};
@class Protocol;
struct objc_protocol_list {
	struct objc_protocol_list *next;
	int count;
	Protocol *list[1];
};
typedef struct objc_cache *Cache;
struct objc_cache {
	unsigned int mask;
	unsigned int occupied;
	Method buckets[1];
};
extern id class_createInstance(Class, unsigned idxIvars);
extern id class_createInstanceFromZone(Class, unsigned idxIvars, NXZone *zone);
extern void class_setVersion(Class, int);
extern int class_getVersion(Class);
extern Ivar class_getInstanceVariable(Class, const char *);
extern Method class_getInstanceMethod(Class, SEL);
extern Method class_getClassMethod(Class, SEL);
extern void class_addMethods(Class, struct objc_method_list *);
extern void class_removeMethods(Class, struct objc_method_list *);
extern Class class_poseAs(Class imposter, Class original);
extern unsigned method_getNumberOfArguments(Method);
extern unsigned method_getSizeOfArguments(Method);
extern unsigned method_getArgumentInfo(Method m, int arg,
 const char **type, int *offset);
typedef void *marg_list;
/* # 14 "/NextDeveloper/Headers/objc/Object.h" 2 */
/* # 1 "/NextDeveloper/Headers/objc/typedstream.h" 1 */
/* # 1 "/NextDeveloper/Headers/streams/streams.h" 1 */
/* # 1 "/NextDeveloper/Headers/mach/port.h" 1 */
typedef int 		port_name_t;		
typedef port_name_t	port_set_name_t;	
typedef port_name_t	*port_name_array_t;
typedef int		port_type_t;		
typedef port_type_t	*port_type_array_t;
typedef	port_name_t	port_t;			
typedef	port_t		port_all_t;		
typedef	port_t		*port_array_t;
/* # 12 "/NextDeveloper/Headers/streams/streams.h" 2 */
/* # 1 "/NextDeveloper/Headers/objc/error.h" 1 */
/* # 1 "/NextDeveloper/Headers/ansi/setjmp.h" 1 */
/* # 1 "/NextDeveloper/Headers/ansi/machine/setjmp.h" 1 */
/* # 1 "/NextDeveloper/Headers/architecture/ARCH_INCLUDE.h" 1 */
/* # 32 "/NextDeveloper/Headers/architecture/ARCH_INCLUDE.h" */
/* # 9 "/NextDeveloper/Headers/ansi/machine/setjmp.h" 2 */
/* # 1 "/NextDeveloper/Headers/ansi/m68k/setjmp.h" 1 */
typedef int jmp_buf[(38 +1) ];
extern int setjmp(jmp_buf env);
extern volatile void longjmp(jmp_buf env, int val);
/* # 11 "/NextDeveloper/Headers/ansi/machine/setjmp.h" 2 */
/* # 4 "/NextDeveloper/Headers/ansi/setjmp.h" 2 */
/* # 14 "/NextDeveloper/Headers/objc/error.h" 2 */
typedef struct _NXHandler {	
    jmp_buf jumpState;			
    struct _NXHandler *next;		
    int code;				
    const void *data1, *data2;		
} NXHandler;
typedef void NXUncaughtExceptionHandler(int code, const void *data1,
						const void *data2);
extern NXUncaughtExceptionHandler *_NXUncaughtExceptionHandler;
extern void _NXAddHandler( NXHandler *handler );
extern void _NXRemoveHandler( NXHandler *handler );
extern _setjmp(jmp_buf env);
__volatile	
extern void _NXRaiseError(int code, const void *data1, const void *data2);
typedef void NXExceptionRaiser(int code, const void *data1, const void *data2);
extern void NXSetExceptionRaiser(NXExceptionRaiser *proc);
extern NXExceptionRaiser *NXGetExceptionRaiser(void);
extern NXExceptionRaiser NXDefaultExceptionRaiser;
extern void NXAllocErrorData(int size, void **data);
extern void NXResetErrorData(void);
/* # 13 "/NextDeveloper/Headers/streams/streams.h" 2 */
typedef struct _NXStream {
	unsigned int	magic_number;	
	unsigned char  *buf_base;	
	unsigned char  *buf_ptr;	
	int		buf_size;	
	int		buf_left;	
	long		offset; 	
	int		flags;		
	int		eof;
	const struct stream_functions
			*functions;	
	void		*info;		
} NXStream;
struct stream_functions {
	int	(*read_bytes)(NXStream *s, void *buf, int count);
	int	(*write_bytes)(NXStream *s, const void *buf, int count);
	int	(*flush_buffer)(NXStream *s);
	int	(*fill_buffer)(NXStream *s);
	void	(*change_buffer)(NXStream *s);
	void	(*seek)(NXStream *s, long offset);
	void	(*destroy)(NXStream *s);
};
extern int _NXStreamFillBuffer(NXStream *s);
extern int _NXStreamFlushBuffer(NXStream *s, unsigned char c);
extern int _NXStreamChangeBuffer(NXStream *s, unsigned char ch);
extern int NXFlush(NXStream *s);		
extern void NXSeek(NXStream *s, long offset, int mode);		
extern long NXTell(NXStream *s);		
extern void NXPrintf(NXStream *s, const char *format, ...);
extern void NXVPrintf(NXStream *s, const char *format, va_list argList);
extern int NXScanf(NXStream *s, const char *format, ...);
extern int NXVScanf(NXStream *s, const char *format, va_list argList);
extern void NXUngetc(NXStream *s);		
extern void NXClose(NXStream *s);		
extern NXStream *NXOpenFile(int fd, int mode);
extern NXStream *NXOpenPort(port_t port, int mode);
extern NXStream *NXOpenMemory(const char *addr, int size, int mode);
extern NXStream *NXMapFile(const char *name, int mode);
extern NXStream *NXGetStreamOnSection(const char *fileName,
 const char *segmentName, const char *sectionName);
extern int NXSaveToFile(NXStream *s, const char *name);
extern void NXGetMemoryBuffer(NXStream *s, char **addr, int *len, int *maxlen);
extern void NXCloseMemory(NXStream *s, int option);
typedef void NXPrintfProc(NXStream *stream, void *item, void *procData);
extern void NXRegisterPrintfProc(char formatChar, NXPrintfProc *proc,
							void *procData);
typedef enum _NXStreamErrors {
    NX_illegalWrite = 2000	,
    NX_illegalRead,
    NX_illegalSeek,
    NX_illegalStream,
    NX_streamVMError
} NXStreamErrors;
/* # 22 "/NextDeveloper/Headers/objc/typedstream.h" 2 */
typedef void NXTypedStream;	
extern NXTypedStream *NXOpenTypedStream (NXStream *physical, int mode);
extern void NXSetTypedStreamZone(NXTypedStream *stream, NXZone *zone);
extern NXZone *NXGetTypedStreamZone(NXTypedStream *stream);
extern BOOL NXEndOfTypedStream (NXTypedStream *stream);
extern void NXFlushTypedStream (NXTypedStream *stream);
extern void NXCloseTypedStream (NXTypedStream *stream);
extern void NXWriteType (NXTypedStream *stream, const char *type,
const void *data);
extern void NXReadType (NXTypedStream *stream, const char *type, void *data);
extern void NXWriteTypes (NXTypedStream *stream, const char *type, ...);
extern void NXReadTypes (NXTypedStream *stream, const char *type, ...);
extern void NXWriteArray (NXTypedStream *stream, const char *itemType,
int count, const void *data);
extern void NXReadArray (NXTypedStream *stream, const char *itemType,
 int count, void *data);
extern void NXWriteObject (NXTypedStream *stream, id object);
extern id NXReadObject (NXTypedStream *stream);
extern void NXWriteRootObject (NXTypedStream *stream, id object);
extern void NXWriteObjectReference (NXTypedStream *stream, id object);
extern NXTypedStream *NXOpenTypedStreamForFile (const char *fileName,
 int mode);
extern char *NXWriteRootObjectToBuffer (id object, int *length);
extern id NXReadObjectFromBuffer (const char *buffer, int length);
extern id NXReadObjectFromBufferWithZone (const char *buffer, int length,
 NXZone *zone);
extern void NXFreeObjectBuffer (char *buffer, int length);
extern int NXSystemVersion (NXTypedStream *stream);
extern int NXTypedStreamClassVersion (NXTypedStream *stream,
 const char *className);
enum TypedstreamErrors {
    TYPEDSTREAM_CALLER_ERROR = 8000 ,
    TYPEDSTREAM_FILE_INCONSISTENCY,
    TYPEDSTREAM_CLASS_ERROR,
    TYPEDSTREAM_TYPE_DESCRIPTOR_ERROR,
    TYPEDSTREAM_WRITE_REFERENCE_ERROR,
    TYPEDSTREAM_INTERNAL_ERROR
};
/* # 15 "/NextDeveloper/Headers/objc/Object.h" 2 */
@class Protocol;
@interface Object
{
	Class isa;	
}
+ initialize;
- init;
+ new;
+ free;
- free;
+ alloc;
- copy;
+ allocFromZone:(NXZone *)zone;
- copyFromZone:(NXZone *)zone;
- (NXZone *)zone;
+ class;
+ superclass;
+ (const char *) name;
- class;
- superclass;
- (const char *) name;
- self;
- (unsigned int) hash;
- (BOOL) isEqual:anObject;
- (BOOL) isKindOf: aClassObject;
- (BOOL) isMemberOf: aClassObject;
- (BOOL) isKindOfClassNamed: (const char *)aClassName;
- (BOOL) isMemberOfClassNamed: (const char *)aClassName;
+ (BOOL) instancesRespondTo:(SEL)aSelector;
- (BOOL) respondsTo:(SEL)aSelector;
- (BOOL) conformsTo: (Protocol *)aProtocolObject;
+ (BOOL) conformsTo: (Protocol *)aProtocolObject;
- (struct objc_method_description *) descriptionForMethod:(SEL)aSel;
+ (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
- (IMP) methodFor:(SEL)aSelector;
+ (IMP) instanceMethodFor:(SEL)aSelector;
- perform:(SEL)aSelector;
- perform:(SEL)aSelector with:anObject;
- perform:(SEL)aSelector with:object1 with:object2;
+ poseAs: aClassObject;
- subclassResponsibility:(SEL)aSelector;
- notImplemented:(SEL)aSelector;
- doesNotRecognize:(SEL)aSelector;
- error:(const char *)aString, ...;
- (void) printForDebugger:(NXStream *)stream;
- awake;
- write:(NXTypedStream *)stream;
- read:(NXTypedStream *)stream;
+ (int) version;
+ setVersion: (int) aVersion;
- forward: (SEL)sel : (marg_list)args;
- performv: (SEL)sel : (marg_list)args;
@end
@interface Object (Archiving)
- startArchiving: (NXTypedStream *)stream;
- finishUnarchiving;
@end
@interface Object (DynamicLoading)
+ finishLoading:(struct mach_header *)header;
+ startUnloading;
@end
extern id object_dispose(Object *anObject);
extern id object_copy(Object *anObject, unsigned nBytes);
extern id object_copyFromZone(Object *anObject, unsigned nBytes, NXZone *);
extern id object_realloc(Object *anObject, unsigned nBytes);
extern id object_reallocFromZone(Object *anObject, unsigned nBytes, NXZone *);
extern Ivar object_setInstanceVariable(id, const char *name, void *);
extern Ivar object_getInstanceVariable(id, const char *name, void **);
/* # 6 "test2.m" 2 */
int main(){
  id anObject;
  anObject=[Object new];
  }

Newsgroups: gnu.gcc.bug