$ avr-as frag.s -o frag.o && avr-objdump -d frag.o == frag.s == .text cpse 0,0 .subsection 1 lds 0,0 .previous clc .text cpse 1,1 .subsection 1 sec .previous lds 1,1 == gas output == frag.s: Assembler messages: frag.s:4: Warning: skipping two-word instruction The first snip should *not* issue a skip warning whereas the second one *should* issue one for the last line. Due to the .subsection, the insn following CPSE in the source is not the one which is skipped. FYI, objdump's ouput is: 00000000 <.text>: 0: 00 10 cpse r0, r0 2: 88 94 clc 4: 11 10 cpse r1, r1 6: 10 90 01 00 lds r1, 0x0001 ; 0x800001 a: 00 90 00 00 lds r0, 0x0000 ; 0x800000 e: 08 94 sec The problem is in tc-avr.c::avr_operands() which holds static state on previous opcode in "prev". However, this state should go into the current fragment's target-specific info in .tc_frag_data. (The right place would actually be the respective fragment chain, not the fragment itself, but the chain doesn't allow to add target-specific extensions whereas struct frag does.)
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=95e42ad4425f0ab0ebfb90035a891be576f9fca4 commit 95e42ad4425f0ab0ebfb90035a891be576f9fca4 Author: Nick Clifton <nickc@redhat.com> Date: Thu Oct 19 16:21:51 2017 +0100 Fix the AVR assembler so that it will correctly issue warnings about skipped instructions even if subsections are used. PR 21621 * config/tc-avr.h (struct avr_frag_data): Add prev_opcode field. (TC_FRAG_INIT): Define. (avr_frag_init): Add prototype. * config/tc-avr.c (avr_frag_init): New function. (avr_operands): Replace static local 'prev' variable with prev_opcode field in current frag. * testsuite/gas/avr/pr21621.s: New test source file. * testsuite/gas/avr/pr21621.d: New test driver file. * testsuite/gas/avr/pr21621.s: New test error output file.
Hi Georg-Johann, Fixed as you suggested. :-) Cheers Nick