https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119555
Bug ID: 119555
Summary: [avr] const _Fract: Wrong warning: variable 'f0' set
but not used
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: gjl at gcc dot gnu.org
Target Milestone: ---
This warning seems to only occur when const is specified, and when the variable
f0 is a fixed-point type:
#define T _Fract
T line1 (T);
T func1 (T t)
{
const T f0 = line1 (t);
return f0;
}
$ avr-gcc-15 warn.c -Wall -fsyntax-only
$ avr-gcc-15 warn.c -Wall -fsyntax-only -Os
warn.c: In function 'func1':
warn.c:7:11: warning: variable 'f0' set but not used
[-Wunused-but-set-variable]
7 | const T f0 = line1 (t);
| ^~
Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls
--with-dwarf2 --with-gnu-as --with-gnu-ld --with-long-double=64
--disable-libcc1 --disable-shared --enable-languages=c,c++
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 15.0.1 20250323 (experimental) (GCC)