These are the warning classes currently defined by NASM for the purpose of enabling, disabling and promoting to error. See section 2.1.26 and section 8.14.
This list shows each warning class that can be enabled or disabled
individually. Each warning containing a -
character in the
name can also be enabled or disabled as part of a group, named by removing
one or more -
–delimited suffixes.
db-empty
: no operand for data declaration
Warns about a D
x declaration with no operands,
producing no output. This is permitted, but often indicative of an error.
See section 3.2.1.
ea-absolute
: absolute address cannot be RIP-relative
Warns that an address that is inherently absolute cannot be generated
with RIP-relative encoding using REL
, see
section 8.2.1.
ea-dispsize
: displacement size ignored on absolute address
Warns that NASM does not support generating displacements for inherently absolute addresses that do not match the address size of the instruction.
float-overflow
: floating point overflow
Warns about floating point underflow.
float-toolong
: too many digits in floating-point number
Warns about too many digits in floating-point numbers.
forward
: forward reference may have unpredictable results
Warns that a forward reference is used which may have unpredictable
results, notably in a RESB
–type pseudo-instruction.
These would be critical expressions (see
section 3.8) but are permitted in a
handful of cases for compatibility with older versions of NASM. This
warning should be treated as a severe programming error as the code could
break at any time for any number of reasons.
implicit-abs-deprecated
: implicit DEFAULT ABS is
deprecated
Warns that in a future version of NASM, the 64-bit default addressing
form is likely to change from DEFAULT ABS
to
DEFAULT REL
. If absolute addressing is indeed intended, it is
strongly recommended to specify DEFAULT ABS
explicitly.
label-orphan
: labels alone on lines without trailing
:
Warns about source lines which contain no instruction but define a label without a trailing colon. This is most likely indicative of a typo, but is technically correct NASM syntax (see section 3.1.)
number-deprecated-hex
: $ prefix for hexadecimal is
deprecated
Warns that the $
prefix for hexadecimal numbers is
deprecated, due to the syntactic conflict with $
used as a
symbol escape prefix. This syntax may be disabled by default in a future
version of NASM. Replace $
with 0x
to ensure
compatibility with future versions.
number-overflow
: numeric constant does not fit
Covers warnings about numeric constants which don't fit in 64 bits.
obsolete-nop
: instruction obsolete and is a noop on the
target CPU
Warns for an instruction which has been removed from the architecture, but has been architecturally defined to be a noop for future CPUs.
obsolete-removed
: instruction obsolete and removed on the
target CPU
Warns for an instruction which has been removed from the architecture,
and is no longer included in the CPU definition given in the
[CPU]
directive, for example POP CS
, the opcode
for which, 0Fh
, instead is an opcode prefix on CPUs newer than
the first generation 8086.
obsolete-valid
: instruction obsolete but valid on the
target CPU
Warns for an instruction which has been removed from the architecture,
but is still valid on the specific CPU given in the CPU
directive. Code using these instructions is most likely not forward
compatible.
other
: any warning not assigned to a specific warning
class
Specifies any warning not included in any specific warning class.
pp-else-elif
: %elif
after %else
Warns that an %elif
–type directive was encountered
after %else
has already been encounted. As a result, the
content of the %elif
will never be expanded.
pp-else-else
: %else
after %else
Warns that a second %else
clause was found for the same
%if
statement. The content of this %else
clause
will never be expanded.
pp-empty-braces
: empty %{}
construct
Warns that an empty %{}
was encountered. This expands to a
single %
character, which is normally the %
arithmetic operator.
pp-environment
: nonexistent environment variable
Warns if a nonexistent environment variable is accessed using the
%!
preprocessor construct (see
section 5.13.2.) Such environment
variables are treated as empty (with this warning issued) starting in NASM
2.15; earlier versions of NASM would treat this as an error.
pp-macro-def-case-single
: single-line macro defined both
case sensitive and insensitive
Warns when a single-line macro is defined both case sensitive and case
insensitive. The new macro definition will override (shadow) the original
one, although the original macro is not deleted, and will be re-exposed if
the new macro is deleted with %undef
, or, if the original
macro is the case insensitive one, the macro call is done with a different
case.
pp-macro-def-greedy-single
: single-line macro
Warns that a single-line macro is defined which would match a previously
existing greedy definition. The new macro definition will override (shadow)
the original one, although the original macro is not deleted, and will be
re-exposed if the new macro is deleted with %undef
, and will
be invoked if called with a parameter count that does not match the new
definition.
pp-macro-defaults
: macros with more default than optional
parameters
Warns when a macro has more default parameters than optional parameters. See section 5.5.5 for why one might want to disable this warning.
pp-macro-params-legacy
: improperly calling multi-line
macro for legacy support
Warns about multi-line macros being invoked with the wrong number of parameters, but for bug-compatibility with NASM versions older than 2.15, NASM tried to fix up the parameters to match the legacy behavior and call the macro anyway. This can happen in certain cases where there are empty arguments without braces, sometimes as a result of macro expansion.
The legacy behavior is quite strange and highly context-dependent, and can be disabled with:
%pragma preproc sane_empty_expansion true
It is highly recommended to use this option in new code.
pp-macro-params-multi
: multi-line macro calls with wrong
parameter count
Warns about multi-line macros being invoked with the wrong number of parameters. See section 5.5.1 for an example of why you might want to disable this warning.
pp-macro-params-single
: single-line macro calls with wrong
parameter count
Warns about single-line macros being invoked with the wrong number of parameters.
pp-macro-redef-multi
: redefining multi-line macro
Warns that a multi-line macro is being redefined, without first removing
the old definition with %unmacro
.
pp-open-braces
: unterminated %{...}
Warns that a preprocessor parameter enclosed in braces
%{...}
lacks the terminating }
character.
pp-open-brackets
: unterminated %[...]
Warns that a preprocessor %[...]
construct lacks the
terminating ]
character.
pp-open-string
: unterminated string
Warns that a quoted string without a closing quotation mark was encountered during preprocessing.
pp-rep-negative
: regative %rep
count
Warns about a negative count given to the %rep
preprocessor
directive.
pp-sel-range
: %sel()
argument out of range
Warns that the %sel()
preprocessor function was passed a
value less than 1 or larger than the number of available arguments.
pp-trailing
: trailing garbage ignored
Warns that the preprocessor encountered additional text where no such text was expected. This can sometimes be the result of an incorrectly written expression, or arguments that are inadvertently separated.
prefix-bnd
: invalid BND
prefix
Warns about ineffective use of the BND
prefix when the
JMP
instruction is converted to the SHORT
form.
This should be extremely rare since the short JMP
only is
applicable to jumps inside the same module, but if it is legitimate, it may
be necessary to use bnd jmp dword
.
prefix-hint-dropped
: invalid branch hint prefix dropped
Warns that the {PT
} (predict taken) or {PN
}
(predict not taken) branch prediction hint prefixes are specified on an
instruction that does not take these prefixes. As these prefixes alias the
segment override prefixes, this may be a very serious error, and therefore
NASM will not generate these prefixes. To force these prefixes to be
emitted, use DS
or CS
, instead, respectively.
prefix-hle
: invalid HLE prefix
Warns about invalid use of the HLE XACQUIRE
or
XRELEASE
prefixes.
prefix-invalid
: invalid prefix for instruction
Warns about an instruction which is only valid with certain combinations
of prefixes. The prefix will still be generated as requested, but the
result may be a completely different instruction or result in a
#UD
trap.
prefix-lock-error
: LOCK
prefix on unlockable
instruction
Warns about LOCK
prefixes specified on unlockable
instructions.
prefix-lock-xchg
: superfluous LOCK
prefix on
XCHG
instruction
Warns about a LOCK
prefix added to an XCHG
instruction. The XCHG
instruction is always locking,
and so this prefix is not necessary; however, NASM will generate it if
explicitly provided by the user, so this warning indicates that suboptimal
code is being generated.
prefix-opsize
: invalid operand size prefix
Warns that an operand prefix (o16
, o32
,
o64
, osp
) invalid for the specified instruction
has been specified. The operand prefix will be ignored by the assembler.
prefix-seg
: segment prefix ignored in 64-bit mode
Warns that an es
, cs
, ss
or
ds
segment override prefix has no effect in 64-bit mode. The
prefix will still be generated as requested.
ptr
: non-NASM keyword used in other assemblers
Warns about keywords used in other assemblers that might indicate a
mistake in the source code. Currently only the MASM PTR
keyword is recognized. If (limited) MASM compatibility is desired, the
%use masm
macro package is available, see
section 7.5; however, carefully note
the caveats listed.
regsize
: register size specification ignored
Warns about a register with implicit size (such as EAX
,
which is always 32 bits) been given an explicit size specification which is
inconsistent with the size of the named register, e.g.
WORD EAX
. DWORD EAX
or WORD AX
are
permitted, and do not trigger this warning. Some registers which do
not imply a specific size, such as K0
, may need this
specification unless the instruction itself implies the instruction size:
KMOVW K0,[foo] ; OK: KMOVW = 16 bits KMOV WORD K0,[foo] ; OK: WORD K0 = 16 bits KMOV K0,WORD [foo] ; OK: WORD [foo] = 16 bits KMOV K0,[foo] ; Error: unknown size
section-alignment-rounded
: section alignment rounded up
Warn if a section alignment is specified which is not supported by the underlying object format, but can be rounded up to a supported value.
user
: %warning
directives
Controls output of %warning
directives (see
section 5.11).
warn-stack-empty
: warning stack empty
A [WARNING POP]
directive was executed when the warning
stack is empty. This is treated as a [WARNING *all]
directive.
zeroing
: RES
x in initialized section
becomes zero
A RES
x directive was used in a section which
contains initialized data, and the output format does not support this.
Instead, this will be replaced with explicit zero content, which may
produce a large output file.
zext-reloc
: relocation zero-extended to match output
format
Warns that a relocation has been zero-extended due to limitations in the output format.
directive-garbage-eol
: garbage after directive
Text was found after a directive. This is a warning so it can be suppressed, because previous versions of NASM did not check for this condition.
label-redef-late
: label (re)defined during code generation
The value of a label changed during the final, code-generation pass. This may be the result of strange use of the preprocessor. This is very likely to produce incorrect code and may end up being an unconditional error in a future version of NASM.
pp-macro-def-param-single
: single-line macro defined with
and without parameters
Warns if the same single-line macro is defined with and without
parameters. The new macro definition will override (shadow) the original
one, although the original macro is not deleted, and will be re-exposed if
the new macro is deleted with %undef
.
prefix-badmode-o64
: o64 prefix invalid in 16/32-bit mode
Warns that an a64
prefix was specified in 16- or 32-bit
mode. If the error is demoted to a warning or suppressed, the prefix is
ignored by the assembler, but is likely to trigger futher errors.
float-denorm
: floating point denormal
Warns about denormal floating point constants.
float-underflow
: floating point underflow
Warns about floating point underflow (a nonzero constant rounded to zero.)
label-redef
: label redefined to an identical value
Warns if a label is defined more than once, but the value is identical. It is an unconditional error to define the same label more than once to different values.
phase
: phase error during stabilization
Warns about symbols having changed values during the second-to-last assembly pass. This is not inherently fatal, but may be a source of bugs.
pragma-bad
: malformed %pragma
Warns about a malformed or otherwise unparsable %pragma
directive.
pragma-empty
: empty %pragma
directive
Warns about a %pragma
directive containing nothing. This is
treated identically to %pragma ignore
except for this optional
warning.
pragma-na
: %pragma
not applicable to this
compilation
Warns about a %pragma
directive which is not applicable to
this particular assembly session. This is not yet implemented.
pragma-unknown
: unknown %pragma
facility or
directive
Warns about an unknown %pragma
directive. This is not yet
implemented for most cases.
reloc-abs-byte
: 8-bit absolute section-crossing relocation
Warns that an 8-bit absolute relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
reloc-abs-dword
: 32-bit absolute section-crossing
relocation
Warns that a 32-bit absolute relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
reloc-abs-qword
: 64-bit absolute section-crossing
relocation
Warns that a 64-bit absolute relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
reloc-abs-word
: 16-bit absolute section-crossing
relocation
Warns that a 16-bit absolute relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
reloc-rel-byte
: 8-bit relative section-crossing relocation
Warns that an 8-bit relative relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
reloc-rel-dword
: 32-bit relative section-crossing
relocation
Warns that a 32-bit relative relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
reloc-rel-qword
: 64-bit relative section-crossing
relocation
Warns that an 64-bit relative relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
reloc-rel-word
: 16-bit relative section-crossing
relocation
Warns that a 16-bit relative relocation that could not be resolved at assembly time was generated in the output format.
This is usually normal, but may not be handled by all possible target environments
unknown-warning
: unknown warning in
-W
/-w
or warning directive
Warns about a -w
or -W
option or a
[WARNING]
directive that contains an unknown warning name or
is otherwise not possible to process.
Warning class groups are aliases for all warning classes with a common prefix. This list shows the warnings that are currently included in specific warning groups.
all
: all possible warnings
all
is an group alias for all warning classes.
Thus, -w+all
enables all available warnings, and
-w-all
disables warnings entirely (since NASM 2.13).
ea
: group alias for:
ea-absolute ea-dispsize
float
: group alias for:
float-denorm float-overflow float-toolong float-underflow
label
: group alias for:
label-orphan label-redef label-redef-late
number
: group alias for:
number-deprecated-hex number-overflow
obsolete
: group alias for:
obsolete-nop obsolete-removed obsolete-valid
pp
: group alias for:
pp-else-elif pp-else-else pp-empty-braces pp-environment pp-macro-def-case-single pp-macro-def-greedy-single pp-macro-def-param-single pp-macro-defaults pp-macro-params-legacy pp-macro-params-multi pp-macro-params-single pp-macro-redef-multi pp-open-braces pp-open-brackets pp-open-string pp-rep-negative pp-sel-range pp-trailing
pp-else
: group alias for:
pp-else-elif pp-else-else
pp-macro
: group alias for:
pp-macro-def-case-single pp-macro-def-greedy-single pp-macro-def-param-single pp-macro-defaults pp-macro-params-legacy pp-macro-params-multi pp-macro-params-single pp-macro-redef-multi
pp-macro-def
: group alias for:
pp-macro-def-case-single pp-macro-def-greedy-single pp-macro-def-param-single
pp-macro-params
: group alias for:
pp-macro-params-legacy pp-macro-params-multi pp-macro-params-single
pp-open
: group alias for:
pp-open-braces pp-open-brackets pp-open-string
pragma
: group alias for:
pragma-bad pragma-empty pragma-na pragma-unknown
prefix
: group alias for:
prefix-badmode-o64 prefix-bnd prefix-hint-dropped prefix-hle prefix-invalid prefix-lock-error prefix-lock-xchg prefix-opsize prefix-seg
prefix-lock
: group alias for:
prefix-lock-error prefix-lock-xchg
reloc
: group alias for:
reloc-abs-byte reloc-abs-dword reloc-abs-qword reloc-abs-word reloc-rel-byte reloc-rel-dword reloc-rel-qword reloc-rel-word
reloc-abs
: group alias for:
reloc-abs-byte reloc-abs-dword reloc-abs-qword reloc-abs-word
reloc-rel
: group alias for:
reloc-rel-byte reloc-rel-dword reloc-rel-qword reloc-rel-word
These aliases are defined for compatibility with earlier versions of NASM.
bad-pragma
: malformed %pragma
Alias for pragma-bad
.
bnd
: invalid BND
prefix
Alias for prefix-bnd
.
environment
: nonexistent environment variable
Alias for pp-environment
.
hle
: invalid HLE prefix
Alias for prefix-hle
.
lock
: LOCK
prefix on unlockable instruction
Alias for prefix-lock-error
.
macro-def-case-single
: single-line macro defined both case
sensitive and insensitive
Alias for pp-macro-def-case-single
.
macro-def-greedy-single
: single-line macro
Alias for pp-macro-def-greedy-single
.
macro-def-param-single
: single-line macro defined with and
without parameters
Alias for pp-macro-def-param-single
.
macro-defaults
: macros with more default than optional
parameters
Alias for pp-macro-defaults
.
macro-params-legacy
: improperly calling multi-line macro
for legacy support
Alias for pp-macro-params-legacy
.
macro-params-multi
: multi-line macro calls with wrong
parameter count
Alias for pp-macro-params-multi
.
macro-params-single
: single-line macro calls with wrong
parameter count
Alias for pp-macro-params-single
.
negative-rep
: regative %rep
count
Alias for pp-rep-negative
.
not-my-pragma
: %pragma
not applicable to this
compilation
Alias for pragma-na
.
orphan-labels
: labels alone on lines without trailing
:
Alias for label-orphan
.
unknown-pragma
: unknown %pragma
facility or
directive
Alias for pragma-unknown
.