https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54816

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Roger Sayle from comment #5)
> This is now fixed on mainline [but was present in GCC 12.2], and a new test
> case added to ensure this stays fixed.

Hi Roger,

I am having a problem with your new test case in gcc.target/avr/pr54816.c :

When we run the testsuite for any device other than ATmega8, it will fail due
to the explicit -mmcu=atmega8 in dg-options:

xgcc: error: specified option '-mmcu' more than once
compiler exited with status 1
FAIL: gcc.target/avr/pr54816.c (test for excess errors)

Usually, one would run the testsuite several times for a variety of different
devices like ATmega128, ATtiny40, etc. so that explicit -mmcu in dg-options is
to be avoided. (The -mmcu will be provided by the board description file like
atmega128-sim.exp).

If a test requires a specific device, then place it at gcc.target/avr/mmcu/.
The avr-mmcu.exp will care to remove unwanted -mmcu to that testcases can set
-mmcu as they wish.

In your case, as you scan assembly for "muls" instruction, you need some -mmcu
that supports MULS (like ATmega8).

Hence, could you move pr54816.c to the gcc.target/avr/mmcu subfolder?

Alternatively, you can extend lib/target-supports.exp by a new feature like 
check_effective_target_avr_mul.  A new function could be similar to already
existing check_effective_target_avr_tiny, but check for built-in macro
__AVR_HAVE_MUL__.  Then use the new functon as a filter like in

/* { dg-do compile { target { avr_mul } } } */

Reply via email to