diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39614-1.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39614-2.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39614-3.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39614-4.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39614-5.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39673-1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39673-2.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gnu89-const-expr-2.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gnu99-const-expr-2.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/overflow-warn-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/overflow-warn-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/overflow-warn-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/overflow-warn-4.c | 2 |
14 files changed, 72 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23564bd..48269e9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2009-04-08 Joseph Myers <joseph@codesourcery.com> + + PR c/39614 + PR c/39673 + * gcc.c-torture/compile/pr39614-1.c, + gcc.c-torture/compile/pr39614-2.c, + gcc.c-torture/compile/pr39614-3.c, + gcc.c-torture/compile/pr39614-4.c, + gcc.c-torture/compile/pr39614-5.c, + gcc.c-torture/compile/pr39673-1.c, + gcc.c-torture/compile/pr39673-2.c: New tests. + * gcc.dg/gnu89-const-expr-2.c, gcc.dg/gnu99-const-expr-2.c: Test + more cases. + * gcc.dg/overflow-warn-1.c, gcc.dg/overflow-warn-2.c, + gcc.dg/overflow-warn-3.c, gcc.dg/overflow-warn-4.c: Update + expected errors. + 2009-04-08 Dodji Seketeli <dodji@redhat.com> PRc++/39637 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c new file mode 100644 index 0000000..a9559c73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-1.c @@ -0,0 +1,7 @@ +typedef struct page { + unsigned long flags; +} mem_map_t; +static inline void set_page_zone(struct page *page, unsigned long zone_num) +{ + page->flags &= ~(~0UL << (64 - 8)); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c new file mode 100644 index 0000000..e3cefb7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-2.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 / 0) / 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c new file mode 100644 index 0000000..f9fa3b9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-3.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 ? 1 / 0 : 1 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c new file mode 100644 index 0000000..2426ee2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-4.c @@ -0,0 +1,6 @@ +int i; +void +f (void) +{ + i = (1 / 0 ? 1 : 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c b/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c new file mode 100644 index 0000000..0cae4de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39614-5.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-w -std=c99" } */ +int i; +void +f (void) +{ + i = (1 / 0, 1 / 0); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39673-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39673-1.c new file mode 100644 index 0000000..d2e0387 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39673-1.c @@ -0,0 +1,6 @@ +unsigned long f1(); +int f2(); + +int store_aff_word(int x) { + return (int) (x ? f1() : f2()); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39673-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39673-2.c new file mode 100644 index 0000000..68407a4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39673-2.c @@ -0,0 +1,6 @@ +unsigned long long f1(); +int f2(); + +int store_aff_word(int x) { + return (int) (x ? f1() : f2()); +} diff --git a/gcc/testsuite/gcc.dg/gnu89-const-expr-2.c b/gcc/testsuite/gcc.dg/gnu89-const-expr-2.c index 3395b55..fd4d18e 100644 --- a/gcc/testsuite/gcc.dg/gnu89-const-expr-2.c +++ b/gcc/testsuite/gcc.dg/gnu89-const-expr-2.c @@ -20,4 +20,7 @@ f (void) a = __builtin_choose_expr ((void *)0, b, c); /* { dg-error "constant" } */ a = __builtin_choose_expr (0 * (INT_MAX + 1), b, c); /* { dg-warning "integer overflow in expression" } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 21 } */ + a = __builtin_choose_expr (1 / 0, 0, 0); /* { dg-warning "division by zero" } */ + /* { dg-error "not a constant" "error" { target *-*-* } 23 } */ + a = __builtin_choose_expr ((1 ? 1 : a), b, c); /* { dg-error "constant" } */ } diff --git a/gcc/testsuite/gcc.dg/gnu99-const-expr-2.c b/gcc/testsuite/gcc.dg/gnu99-const-expr-2.c index f868c53..f9acef8 100644 --- a/gcc/testsuite/gcc.dg/gnu99-const-expr-2.c +++ b/gcc/testsuite/gcc.dg/gnu99-const-expr-2.c @@ -20,4 +20,7 @@ f (void) a = __builtin_choose_expr ((void *)0, b, c); /* { dg-error "constant" } */ a = __builtin_choose_expr (0 * (INT_MAX + 1), b, c); /* { dg-warning "integer overflow in expression" } */ /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 21 } */ + a = __builtin_choose_expr (1 / 0, 0, 0); /* { dg-warning "division by zero" } */ + /* { dg-error "not a constant" "error" { target *-*-* } 23 } */ + a = __builtin_choose_expr ((1 ? 1 : a), b, c); /* { dg-error "constant" } */ } diff --git a/gcc/testsuite/gcc.dg/overflow-warn-1.c b/gcc/testsuite/gcc.dg/overflow-warn-1.c index 633d70b..0cf08a3 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-1.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-1.c @@ -49,7 +49,7 @@ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } 49 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not constant" "constant" { target *-*-* } 51 } */ +/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } 51 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } 51 } */ void *r = (1 ? 0 : INT_MAX+1); diff --git a/gcc/testsuite/gcc.dg/overflow-warn-2.c b/gcc/testsuite/gcc.dg/overflow-warn-2.c index e8bbd24..f6595d5 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-2.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-2.c @@ -49,7 +49,7 @@ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } 49 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not constant" "constant" { target *-*-* } 51 } */ +/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } 51 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } 51 } */ void *r = (1 ? 0 : INT_MAX+1); diff --git a/gcc/testsuite/gcc.dg/overflow-warn-3.c b/gcc/testsuite/gcc.dg/overflow-warn-3.c index d9a3ae4..fae26d4 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-3.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-3.c @@ -55,7 +55,7 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 54 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } 54 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not constant" "constant" { target *-*-* } 57 } */ +/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } 57 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } 57 } */ void *r = (1 ? 0 : INT_MAX+1); diff --git a/gcc/testsuite/gcc.dg/overflow-warn-4.c b/gcc/testsuite/gcc.dg/overflow-warn-4.c index 7b7e23c..464533a 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-4.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-4.c @@ -55,7 +55,7 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 54 } */ /* { dg-error "initialization makes pointer from integer without a cast" "null" { target *-*-* } 54 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not constant" "constant" { target *-*-* } 57 } */ +/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } 57 } */ /* { dg-error "initialization makes pointer from integer without a cast" "null" { target *-*-* } 57 } */ void *r = (1 ? 0 : INT_MAX+1); |