annotate gcc/testsuite/gcc.dg/c90-const-expr-11.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test for constant expressions: C90 aggregate initializers requiring
kono
parents:
diff changeset
2 constant expressions. */
kono
parents:
diff changeset
3 /* Origin: Joseph Myers <joseph@codesourcery.com> */
kono
parents:
diff changeset
4 /* { dg-do compile } */
kono
parents:
diff changeset
5 /* { dg-options "-std=iso9899:1990 -pedantic-errors -O2" } */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 #include <float.h>
kono
parents:
diff changeset
8 #include <limits.h>
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 double atan(double);
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 struct s { double d; };
kono
parents:
diff changeset
13 struct t { int i; };
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 void
kono
parents:
diff changeset
16 f (void)
kono
parents:
diff changeset
17 {
kono
parents:
diff changeset
18 /* As in PR 14649 for static initializers. */
kono
parents:
diff changeset
19 struct s a = { atan (1.0) }; /* { dg-error "is not a constant expression|near initialization" } */
kono
parents:
diff changeset
20 /* Overflow. */
kono
parents:
diff changeset
21 struct t b = { INT_MAX + 1 }; /* { dg-warning "integer overflow in expression" } */
kono
parents:
diff changeset
22 /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
kono
parents:
diff changeset
23 struct t c = { DBL_MAX }; /* { dg-warning "overflow in conversion from .double. to .int. changes value " } */
kono
parents:
diff changeset
24 /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */
kono
parents:
diff changeset
25 /* Bad operator outside sizeof. */
kono
parents:
diff changeset
26 struct s d = { 1 ? 1.0 : atan (a.d) }; /* { dg-error "is not a constant expression|near initialization" } */
kono
parents:
diff changeset
27 }