RISC-V: Fix %lo overflow with BLKmode references.
[official-gcc.git] / gcc / testsuite / gcc.target / riscv / losum-overflow.c
blob9c01c7feb545e27453ada1731ddb2923d8950eb3
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gc -mabi=ilp32 -O2 -fno-section-anchors" } */
4 /* Check for %lo overflow. Adding an offset larger than the alignment can
5 overflow if the data is allocated to an address mod 4KB that is between
6 2KB-offset+1 and 2KB-1. */
7 typedef long long int int64_t;
9 #pragma pack(push)
10 #pragma pack(1)
11 struct S0 {
12 signed f0 : 4;
13 const volatile int64_t f1;
14 volatile signed f2 : 1;
15 signed f3 : 31;
16 unsigned f4 : 8;
17 signed f5 : 20;
18 unsigned f6 : 5;
20 #pragma pack(pop)
22 struct S0 g_3030 = {0,-9L,-0,-22553,7,-841,1};
24 int64_t
25 sub (void)
27 return g_3030.f1;
29 /* { dg-final { scan-assembler-not "%lo\\(g_3030\\+4\\)" } } */