Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 863392 - sys-devel/gcc: cross-avr/gcc-12.1.0 incorrectly reports illegal opcode "asr" instead of "jmp" on non-supporting architectures
Summary: sys-devel/gcc: cross-avr/gcc-12.1.0 incorrectly reports illegal opcode "asr" ...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-03 14:57 UTC by Vince C.
Modified: 2023-02-09 01:17 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vince C. 2022-08-03 14:57:35 UTC
Running the following command line

    echo -e "#include <avr/io.h>\nvoid main() { __asm__ (\".L%=: jmp .L%=\" :: ); }" | \
    avr-gcc -x c -mmcu=attiny2313 -pipe -Os -o bugtest.elf -

fails with the following, misleading error message:

    {standard input}:17: Error: illegal opcode asr for mcu avr25

The correct error message should be:

    {standard input}:17: Error: illegal opcode jmp for mcu avr25

The compiler version in question is avr-gcc-12.1.0:

~$ avr-gcc --version
avr-gcc (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The instruction "jmp" is indeed unsupported on avr25, such as ATtiny2313, for instance. I hit that bug trying to debug my code and spent hours figuring out where I could have used the "ASR" instruction ("Arithmetic Shift Right" on the AVR platform). Turned out I didn't and it's only by tediously narrowing down the instruction using dichotomy reduction across hundreds of lines that I finally isolated the JMP instruction, which I had completely forgotten I had used...

Fixing this bug may save several hours of vain searches, IMHO.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-04 02:18:39 UTC
Thanks for the report. This sounds like a bug in GCC itself. Could you report it on their Bugzilla at https://gcc.gnu.org/bugzilla and link it here?

It would be worth trying 12.1.1_p20220730 too.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-09 01:17:29 UTC
ping. Did you have a chance to report it upstream?