diff --git a/modules/arch/x86/x86arch.c b/modules/arch/x86/x86arch.c index ba294e87..ded90840 100644 --- a/modules/arch/x86/x86arch.c +++ b/modules/arch/x86/x86arch.c @@ -109,9 +109,9 @@ x86_set_var(yasm_arch *arch, const char *var, unsigned long val) { yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch; if (yasm__strcasecmp(var, "mode_bits") == 0) - arch_x86->mode_bits = val; + arch_x86->mode_bits = (unsigned char)val; else if (yasm__strcasecmp(var, "force_strict") == 0) - arch_x86->force_strict = val; + arch_x86->force_strict = (unsigned char)val; else return 1; return 0; diff --git a/modules/arch/x86/x86id.c b/modules/arch/x86/x86id.c index 6f332d45..cde34831 100644 --- a/modules/arch/x86/x86id.c +++ b/modules/arch/x86/x86id.c @@ -2998,7 +2998,7 @@ yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc, if (num_segregs > 1) yasm_warn_set(YASM_WARN_GENERAL, N_("multiple segment overrides, using leftmost")); - insn->special_prefix = segregs[num_segregs-1]>>8; + insn->special_prefix = (unsigned char)(segregs[num_segregs-1]>>8); } else if (num_segregs > 0) yasm_internal_error(N_("unhandled segment prefix")); diff --git a/modules/dbgfmts/stabs/stabs-dbgfmt.c b/modules/dbgfmts/stabs/stabs-dbgfmt.c index 2274a0d7..9e2fe271 100644 --- a/modules/dbgfmts/stabs/stabs-dbgfmt.c +++ b/modules/dbgfmts/stabs/stabs-dbgfmt.c @@ -372,8 +372,6 @@ stabs_dbgfmt_generate(yasm_dbgfmt *dbgfmt, yasm_errwarns *errwarns) } } - - /* initial pseudo-stab */ stab = yasm_xmalloc(sizeof(stabs_stab)); dbgbc = yasm_bc_create_common(&stabs_bc_stab_callback, stab, 0); @@ -407,7 +405,12 @@ stabs_dbgfmt_generate(yasm_dbgfmt *dbgfmt, yasm_errwarns *errwarns) stab->bcstr = filebc; stab->type = N_UNDF; stab->other = 0; - stab->desc = info.stabcount; + if (info.stabcount > 0xffff) { + yasm_warn_set(YASM_WARN_GENERAL, N_("over 65535 stabs")); + yasm_errwarn_propagate(errwarns, 0); + stab->desc = 0xffff; + } else + stab->desc = (unsigned short)info.stabcount; } static int