https://sourceware.org/bugzilla/show_bug.cgi?id=28762
Bug ID: 28762 Summary: [z80-unknown-elf-as]: assembly fails, but fixed with a blank line Product: binutils Version: 2.36.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: petemoore at gmx dot net CC: nickc at redhat dot com, sergey.belyashov at gmail dot com Target Milestone: --- Created attachment 13898 --> https://sourceware.org/bugzilla/attachment.cgi?id=13898&action=edit Bogus assembly failure fixed by introduction of arbitrary whitespace Attached (rom1.s) is valid assembly code that won't assemble under z80-unknown-elf-as version 2.36.1 on macOS and Linux, yet will assemble with the introduction of almost any (innocuous) change, including non-code changes such as a blank line or a .global directive, anywhere above the reported failure line (10290) of the source code. Since the bogus failure disappears if I delete lines, it is difficult to provide a smaller test case than the full file. However, since I've been able to reproduce it independently on both macOS and Linux, I assume it is nothing to do with my environment, and it should be reasonably easy to reproduce with the exact version of the attached file. To reproduce, download the attached file rom1.s, and run the following: ``` $ # Gas version $ z80-unknown-elf-as --version GNU assembler (GNU Binutils) 2.36.1 Copyright (C) 2021 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `z80-unknown-elf'. $ z80-unknown-elf-as rom1.s rom1.s: Assembler messages: rom1.s:10290: Error: bad instruction syntax $ # Insert blank line at top of file... $ (echo; cat rom1.s) > rom1_fixed.s $ # Assembly now passes, despite no code change! $ z80-unknown-elf-as rom1_fixed.s $ echo $? 0 $ # Show the lines around the reported failure... $ sed -n 10287,10293p rom1.s randomize: CALL find_int2 ; routine FIND-INT2 puts parameter in BC. LD A,B ; test this OR C ; for zero. JR NZ,rand_1 ; forward to RAND-1 if not zero. $ ``` As you see above, the failure "rom1.s:10290: Error: bad instruction syntax" appears to be bogus, since the instruction "LD A,B" is valid, and as shown in the console output above, just inserting a blank line at the top of the file fixes the issue. I haven't yet tried assembling with z80-unknown-elf-as version 2.37, I can do that too, if that is useful. -- You are receiving this mail because: You are on the CC list for the bug.