summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'base/gsfunc4.c')
-rw-r--r--base/gsfunc4.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/base/gsfunc4.c b/base/gsfunc4.c
index 1508d49b..f71fa63a 100644
--- a/base/gsfunc4.c
+++ b/base/gsfunc4.c
@@ -305,9 +305,16 @@ fn_PtCr_evaluate(const gs_function_t *pfn_common, const float *in, float *out)
vsp->value.f = gs_cos_degrees(vsp->value.f);
continue;
case PtCr_cvi:
- vsp->value.i = (int)(vsp->value.f);
+ {
+ /* Strictly speaking assigning one element of union
+ * to another, overlapping element of a different size is
+ * undefined behavior, hence assign to an intermediate variable
+ */
+ int int1 = (int)(vsp->value.f);
+ vsp->value.i = int1;
vsp->type = CVT_INT;
continue;
+ }
case PtCr_cvr:
continue; /* prepare handled it */
case PtCr_div: