File: pr60114.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (32 lines) | stat: -rw-r--r-- 1,428 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* PR c/60114 */
/* { dg-do compile } */
/* { dg-options "-Wconversion" } */
/* { dg-require-effective-target int32plus } */

struct S { int n, u[2]; };
const signed char z[] = {
  [0] = 0x100, /* { dg-warning "-Woverflow" } */
  [2] = 0x101, /* { dg-warning "-Woverflow" } */
};
int A[] = {
            0, 0x80000000, /* { dg-warning "16:-Wsign-conversion" } */
            0xA, 0x80000000, /* { dg-warning "18:-Wsign-conversion" } */
            0xA, 0xA, 0x80000000 /* { dg-warning "23:-Wsign-conversion" } */
          };
int *p = (int []) { 0x80000000 }; /* { dg-warning "21:-Wsign-conversion" } */
union { int k; } u = { .k = 0x80000000 }; /* { dg-warning "29:-Wsign-conversion" } */
typedef int H[];
void
foo (void)
{
  signed char a[][3] = { { 0x100, /* { dg-warning "28:-Woverflow" } */
                    1, 0x100 }, /* { dg-warning "24:-Woverflow" } */
                  { '\0', 0x100, '\0' } /* { dg-warning "27:-Woverflow" } */
                };
  (const signed char []) { 0x100 }; /* { dg-warning "28:-Woverflow" } */
  (const float []) { 1e0, 1e1, 1e100 }; /* { dg-warning "32:conversion" } */
  struct S s1 = { 0x80000000 }; /* { dg-warning "19:-Wsign-conversion" } */
  struct S s2 = { .n = 0x80000000 }; /* { dg-warning "24:-Wsign-conversion" } */
  struct S s3 = { .u[1] = 0x80000000 }; /* { dg-warning "27:-Wsign-conversion" } */
  H h = { 1, 2, 0x80000000 }; /* { dg-warning "17:-Wsign-conversion" } */
}