diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-03 01:25:42 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-03 01:25:42 +0000 |
commit | 842414e90d712b26beae8cbe904a42b3ed4f8ec7 (patch) | |
tree | 6c2b69079782b4aa8a161ed35bf198ae14b5ad6e /gcc/testsuite/gcc.dg | |
parent | e51872dac018f73a597deec37dc3ee64e445371e (diff) | |
download | gcc-842414e90d712b26beae8cbe904a42b3ed4f8ec7.tar.gz |
* c-typeck.c (default_function_array_conversion,
build_function_call): Allow for CONVERT_EXPR as well as NOP_EXPR.
(build_conditional_expr): Apply integer_zerop to orig_op1 and
orig_op2. Don't check them for NOP_EXPR.
(build_c_cast, convert_for_assignment): Don't check for NOP_EXPR
around integer zero.
testsuite:
* gcc.dg/c90-const-expr-4.c, gcc.dg/c99-const-expr-4.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107990 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/c90-const-expr-4.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c99-const-expr-4.c | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-4.c b/gcc/testsuite/gcc.dg/c90-const-expr-4.c new file mode 100644 index 00000000000..6a449870ed3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-const-expr-4.c @@ -0,0 +1,11 @@ +/* Test for constant expressions: const variable with value 0 is not a + null pointer constant so the conditional expression should have + type void * and the assignment is OK. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -O2" } */ +int *p; +long *q; +static void *const n = 0; +int j; +void f(void) { q = j ? p : n; } diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-4.c b/gcc/testsuite/gcc.dg/c99-const-expr-4.c new file mode 100644 index 00000000000..f6beaf77a04 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-const-expr-4.c @@ -0,0 +1,11 @@ +/* Test for constant expressions: const variable with value 0 is not a + null pointer constant so the conditional expression should have + type void * and the assignment is OK. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -O2" } */ +int *p; +long *q; +static void *const n = 0; +int j; +void f(void) { q = j ? p : n; } |