Fix : MSVC7 wrongly optimizes zpcolor.c .
"Dan Coby" <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Igor, Similar situations also occurs in: zsetseparationspace in zcssepr.c zsetindexedspace in zcsindex.c zsetdevnspace in zcsdevn.c zseticcspace in zicc.c These cases are already using a memmove. The best comments are in zcsindex.c. I have not found similar code in the CIE color spaces. Dan -----Original Message----- From: [email protected] [mailto:[email protected]]On Behalf Of Igor Melichev Sent: Tuesday, February 17, 2004 7:01 AM To: [email protected] Subject: [gs-cvs] gs/src Update of /cvs/ghostscript/gs/src In directory casper:/tmp/cvs-serv6293/gs/src Modified Files: Tag: GS_8_1X zpcolor.c int.mak Log Message: Fix : MSVC7 wrongly optimizes zpcolor.c . DETAILS : It's an aliasing problem in the optimizer. See comment in code. EXPECTED DIFFERENCES : None. Index: zpcolor.c =================================================================== RCS file: /cvs/ghostscript/gs/src/zpcolor.c,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -u -d -r1.7.2.1 -r1.7.2.2 --- zpcolor.c 12 Dec 2003 22:08:06 -0000 1.7.2.1 +++ zpcolor.c 17 Feb 2004 15:00:40 -0000 1.7.2.2 @@ -39,6 +39,7 @@ #include "igstate.h" #include "ipcolor.h" #include "store.h" +#include "memory_.h" /* Imported from gspcolor.c */ extern const gs_color_space_type gs_color_space_type_Pattern; @@ -146,13 +147,12 @@ cs = *gs_currentcolorspace(igs); if (cs_num_components(&cs) < 0) /* i.e., Pattern space */ return_error(e_rangecheck); - /* We can't count on C compilers to recognize the aliasing */ - /* that would be involved in a direct assignment, so.... */ { - gs_paint_color_space cs_paint; - - cs_paint = *(gs_paint_color_space *) & cs; - cs.params.pattern.base_space = cs_paint; + /* We can't count on C compilers to recognize the aliasing */ + /* that would be involved in a direct assignment + /* cs.params.pattern.base_space = *(gs_paint_color_space *)&cs; */ + /* At least MSVC7 chocks with it. */ + memmove(&cs.params.pattern.base_space, &cs, sizeof(gs_paint_color_space)); } cs.params.pattern.has_base_space = true; } Index: int.mak =================================================================== RCS file: /cvs/ghostscript/gs/src/int.mak,v retrieving revision 1.108.2.2 retrieving revision 1.108.2.3 diff -u -d -r1.108.2.2 -r1.108.2.3 --- int.mak 5 Jan 2004 23:32:04 -0000 1.108.2.2 +++ int.mak 17 Feb 2004 15:00:40 -0000 1.108.2.3 @@ -1528,7 +1528,7 @@ $(estack_h)\ $(ialloc_h) $(icremap_h) $(idict_h) $(idparam_h) $(igstate_h)\ $(ipcolor_h) $(istruct_h)\ - $(store_h) + $(store_h) $(memory__h) $(PSCC) $(PSO_)zpcolor.$(OBJ) $(C_) $(PSSRC)zpcolor.c # ---------------- Separation color ---------------- # _______________________________________________ gs-cvs mailing list [email protected] http://www.ghostscript.com/mailman/listinfo/gs-cvs