--- ./src/sysfiles.h.orig 2008-09-02 10:50:38.000000000 -0600 +++ ./src/sysfiles.h 2011-08-04 13:57:32.717487674 -0600 @@ -46,7 +46,7 @@ extern Int SyFindOrLinkGapRootFile ( Char * filename, Int4 crc_gap, - Char * result, + union StringOrInitInfo * result, Int len ); --- ./src/sysfiles.c.orig 2008-12-14 14:25:54.000000000 -0700 +++ ./src/sysfiles.c 2011-08-04 14:07:06.846239128 -0600 @@ -191,7 +191,7 @@ Int SyFindOrLinkGapRootFile ( Char * filename, Int4 crc_gap, - Char * result, + union StringOrInitInfo * result, Int len ) { UInt4 crc_dyn = 0; @@ -215,19 +215,19 @@ #endif /* find the GAP file */ - result[0] = '\0'; + result->string[0] = '\0'; tmp = SyFindGapRootFile(filename); if ( tmp ) { - SyStrncat( result, tmp, len ); + SyStrncat( result->string, tmp, len ); name[0] = '\0'; SyStrncat( name, tmp, 255 ); } - if ( result[0] ) { - if ( SyIsReadableFile(result) == 0 ) { + if ( result->string[0] ) { + if ( SyIsReadableFile(result->string) == 0 ) { found_gap = 1; } else { - result[0] = '\0'; + result->string[0] = '\0'; } } if ( ! SyUseModule ) { @@ -389,11 +389,11 @@ if (found_dyn) syUnloadLastModule (); #endif - *(StructInitInfo**)result = info_sta; + result->info = info_sta; return 2; } if ( found_gap && found_dyn ) { - *(StructInitInfo**)result = info_dyn; + result->info = info_dyn; return 1; } if ( found_gap ) { @@ -404,11 +404,11 @@ if (found_dyn) syUnloadLastModule (); #endif - *(StructInitInfo**)result = info_sta; + result->info = info_sta; return 2; } if ( found_dyn ) { - *(StructInitInfo**)result = info_dyn; + result->info = info_dyn; return 1; } return 0; --- ./src/gap.c.orig 2007-10-04 09:05:16.000000000 -0600 +++ ./src/gap.c 2011-08-04 14:09:27.815182164 -0600 @@ -1650,7 +1650,7 @@ StructInitInfo * info; Int4 crc1; Int4 crc2; - Char result[256]; + union StringOrInitInfo result; Int res; @@ -1670,7 +1670,7 @@ /* check if have a statically or dynamically loadable module */ crc1 = INT_INTOBJ(crc); - res = SyFindOrLinkGapRootFile(CSTR_STRING(filename), crc1, result, 256); + res = SyFindOrLinkGapRootFile(CSTR_STRING(filename), crc1, &result, 256); /* not found */ if ( res == 0 ) { @@ -1685,7 +1685,7 @@ Pr( "#I READ_GAP_ROOT: loading '%s' dynamically\n", (Int)CSTR_STRING(filename), 0L ); } - info = *(StructInitInfo**)result; + info = result.info; res = info->initKernel(info); UpdateCopyFopyInfo(); res = res || info->initLibrary(info); @@ -1703,7 +1703,7 @@ Pr( "#I READ_GAP_ROOT: loading '%s' statically\n", (Int)CSTR_STRING(filename), 0L ); } - info = *(StructInitInfo**)result; + info = result.info; res = info->initKernel(info); UpdateCopyFopyInfo(); res = res || info->initLibrary(info); @@ -1721,15 +1721,15 @@ /* compute the crc value of the original and compare */ if ( SyCheckCompletionCrcComp ) { - crc2 = SyGAPCRC(result); + crc2 = SyGAPCRC(result.string); if ( crc1 != crc2 ) { return INTOBJ_INT(4); } } - /*CCC filename = NEW_STRING( SyStrlen(result) ); + /*CCC filename = NEW_STRING( SyStrlen(result.string) ); SyStrncat( CSTR_STRING(filename), result, SyStrlen(result) );CCC*/ - len = SyStrlen(result); - C_NEW_STRING(filename, len, result); + len = SyStrlen(result.string); + C_NEW_STRING(filename, len, result.string); CompThenFuncs = NEW_PLIST( T_PLIST, COMP_THEN_OFFSET ); SET_LEN_PLIST( CompThenFuncs, COMP_THEN_OFFSET ); --- ./src/system.h.orig 2007-10-06 16:53:20.000000000 -0600 +++ ./src/system.h 2011-08-04 14:04:52.971092306 -0600 @@ -1105,6 +1105,10 @@ typedef StructInitInfo* (*InitInfoFunc)(void); +union StringOrInitInfo { + Char string[256]; + StructInitInfo * info; +}; /**************************************************************************** ** --- ./src/saveload.c.orig 2002-06-16 06:37:20.000000000 -0600 +++ ./src/saveload.c 2011-08-04 13:41:46.547763965 -0600 @@ -37,6 +37,11 @@ #include "saveload.h" /* saving and loading */ #undef INCLUDE_DECLARATION_PART +union double_bytes { + Double d; + UInt1 bytes[sizeof(Double)]; +}; + /*************************************************************************** ** @@ -438,19 +443,19 @@ void SaveDouble( Double d) { UInt i; - UInt1 buf[sizeof(Double)]; - *(Double *)buf = d; + union double_bytes buf; + buf.d = d; for (i = 0; i < sizeof(Double); i++) - SAVE_BYTE(buf[i]); + SAVE_BYTE(buf.bytes[i]); } Double LoadDouble( void) { UInt i; - UInt1 buf[sizeof(Double)]; + union double_bytes buf; for (i = 0; i < sizeof(Double); i++) - buf[i] = LOAD_BYTE(); - return *(Double *)buf; + buf.bytes[i] = LOAD_BYTE(); + return buf.d; } /*************************************************************************** --- ./src/streams.c.orig 2008-09-02 10:52:34.000000000 -0600 +++ ./src/streams.c 2011-08-04 14:10:55.735229846 -0600 @@ -316,13 +316,13 @@ Int READ_GAP_ROOT ( Char * filename ) { - Char result[256]; + union StringOrInitInfo result; Int res; UInt type; StructInitInfo * info; /* try to find the file */ - res = SyFindOrLinkGapRootFile( filename, 0L, result, 256 ); + res = SyFindOrLinkGapRootFile( filename, 0L, &result, 256 ); /* not found */ if ( res == 0 ) { @@ -335,7 +335,7 @@ Pr( "#I READ_GAP_ROOT: loading '%s' dynamically\n", (Int)filename, 0L ); } - info = *(StructInitInfo**)result; + info = result.info; res = info->initKernel(info); if (!SyRestoring) { UpdateCopyFopyInfo(); @@ -356,7 +356,7 @@ Pr( "#I READ_GAP_ROOT: loading '%s' statically\n", (Int)filename, 0L ); } - info = *(StructInitInfo**)result; + info = result.info; res = info->initKernel(info); if (!SyRestoring) { UpdateCopyFopyInfo(); @@ -388,7 +388,7 @@ Pr( "#I READ_GAP_ROOT: loading '%s' as GAP file\n", (Int)filename, 0L ); } - if ( OpenInput(result) ) { + if ( OpenInput(result.string) ) { SySetBuffering(Input->file); while ( 1 ) { ClearError();