https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98681
Bug ID: 98681
Summary: aarch64: Invalid ubfiz instruction rejected by
assembler
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: acoplan at gcc dot gnu.org
Target Milestone: ---
AArch64 GCC generates an invalid ubfiz instruction for the following testcase:
extern unsigned char a[];
int b;
void c() {
for (int d; d < 120; d += 6)
a[d] = b << -64;
}
$ aarch64-elf-gcc -c test.c -O3
test.c: In function 'c':
test.c:5:14: warning: left shift count is negative [-Wshift-count-negative]
5 | a[d] = b << -64;
| ^~
/tmp/ccelsQle.s: Assembler messages:
/tmp/ccelsQle.s:14: Error: immediate value out of range 0 to 31 at operand 3 --
`ubfiz w1,w1,-64,8'
Although this testcase invokes UB, it was reduced from a testcase which
ostensibly does not. In any case, we should not generate invalid assembly here.