OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c90-const-expr-11.c] - Blame information for rev 753

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test for constant expressions: C90 aggregate initializers requiring
2
   constant expressions.  */
3
/* Origin: Joseph Myers <joseph@codesourcery.com> */
4
/* { dg-do compile } */
5
/* { dg-options "-std=iso9899:1990 -pedantic-errors -O2" } */
6
 
7
#include <float.h>
8
#include <limits.h>
9
 
10
double atan(double);
11
 
12
struct s { double d; };
13
struct t { int i; };
14
 
15
void
16
f (void)
17
{
18
  /* As in PR 14649 for static initializers.  */
19
  struct s a = { atan (1.0) }; /* { dg-error "is not a constant expression|near initialization" } */
20
  /* Overflow.  */
21
  struct t b = { INT_MAX + 1 }; /* { dg-warning "integer overflow in expression" } */
22
  /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 21 } */
23
  struct t c = { DBL_MAX }; /* { dg-warning "overflow in implicit constant conversion" } */
24
  /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 23 } */
25
  /* Bad operator outside sizeof.  */
26
  struct s d = { 1 ? 1.0 : atan (a.d) }; /* { dg-error "is not a constant expression|near initialization" } */
27
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.