diff options
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/c-decl.c | 22 | ||||
-rw-r--r-- | gcc/c-parser.c | 11 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype-38655.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/fixed1.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/fixed2.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/crash7.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/error25.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/nofixed-point-2.c | 30 |
12 files changed, 89 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e9da880..a92228c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2009-02-03 Jakub Jelinek <jakub@redhat.com> + + PR inline-asm/39059 + * c-parser.c (c_parser_postfix_expression): If fixed point is not + supported, don't accept FIXED_CSTs. + * c-decl.c (finish_declspecs): Error if fixed point is not supported + and _Sat is used without _Fract/_Accum. Set specs->type to + integer_type_node for cts_fract/cts_accum if fixed point is not + supported. + 2009-02-02 Catherine Moore <clm@codesourcery.com> * sde.h (SUBTARGET_ARM_SPEC): Don;t assemble -fpic code as diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9f65af4..262d9d9 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -7772,6 +7772,8 @@ finish_declspecs (struct c_declspecs *specs) if (specs->saturating_p) { error ("%<_Sat%> is used without %<_Fract%> or %<_Accum%>"); + if (!targetm.fixed_point_supported_p ()) + error ("fixed-point types not supported for this target"); specs->typespec_word = cts_fract; } else if (specs->long_p || specs->short_p @@ -7894,8 +7896,10 @@ finish_declspecs (struct c_declspecs *specs) specs->type = dfloat128_type_node; break; case cts_fract: - gcc_assert (!specs->complex_p); - if (specs->saturating_p) + gcc_assert (!specs->complex_p); + if (!targetm.fixed_point_supported_p ()) + specs->type = integer_type_node; + else if (specs->saturating_p) { if (specs->long_long_p) specs->type = specs->unsigned_p @@ -7913,7 +7917,7 @@ finish_declspecs (struct c_declspecs *specs) specs->type = specs->unsigned_p ? sat_unsigned_fract_type_node : sat_fract_type_node; - } + } else { if (specs->long_long_p) @@ -7932,11 +7936,13 @@ finish_declspecs (struct c_declspecs *specs) specs->type = specs->unsigned_p ? unsigned_fract_type_node : fract_type_node; - } + } break; case cts_accum: - gcc_assert (!specs->complex_p); - if (specs->saturating_p) + gcc_assert (!specs->complex_p); + if (!targetm.fixed_point_supported_p ()) + specs->type = integer_type_node; + else if (specs->saturating_p) { if (specs->long_long_p) specs->type = specs->unsigned_p @@ -7954,7 +7960,7 @@ finish_declspecs (struct c_declspecs *specs) specs->type = specs->unsigned_p ? sat_unsigned_accum_type_node : sat_accum_type_node; - } + } else { if (specs->long_long_p) @@ -7973,7 +7979,7 @@ finish_declspecs (struct c_declspecs *specs) specs->type = specs->unsigned_p ? unsigned_accum_type_node : accum_type_node; - } + } break; default: gcc_unreachable (); diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 5cb1982..8844769 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -5089,6 +5089,17 @@ c_parser_postfix_expression (c_parser *parser) switch (c_parser_peek_token (parser)->type) { case CPP_NUMBER: + expr.value = c_parser_peek_token (parser)->value; + expr.original_code = ERROR_MARK; + loc = c_parser_peek_token (parser)->location; + c_parser_consume_token (parser); + if (TREE_CODE (expr.value) == FIXED_CST + && !targetm.fixed_point_supported_p ()) + { + error_at (loc, "fixed-point types not supported for this target"); + expr.value = error_mark_node; + } + break; case CPP_CHAR: case CPP_CHAR16: case CPP_CHAR32: diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c84de88..9d425ab 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2009-02-03 Jakub Jelinek <jakub@redhat.com> + PR inline-asm/39059 + * parser.c (cp_parser_primary_expression): Reject FIXED_CSTs. + PR c++/39056 * typeck2.c (digest_init_r): Don't call process_init_constructor for COMPLEX_TYPE. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 138fe42..404e45a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3144,6 +3144,12 @@ cp_parser_primary_expression (cp_parser *parser, case CPP_WCHAR: case CPP_NUMBER: token = cp_lexer_consume_token (parser->lexer); + if (TREE_CODE (token->u.value) == FIXED_CST) + { + error ("%Hfixed-point types not supported in C++", + &token->location); + return error_mark_node; + } /* Floating-point literals are only allowed in an integral constant expression if they are cast to an integral or enumeration type. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 128a762..4062c86 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2009-02-03 Jakub Jelinek <jakub@redhat.com> + PR inline-asm/39059 + * gcc.dg/nofixed-point-2.c: New test. + * g++.dg/ext/fixed1.C: Adjust expected diagnostics. + * g++.dg/ext/fixed2.C: Likewise. + * g++.dg/other/error25.C: Likewise. + * g++.dg/lookup/crash7.C: Likewise. + * g++.dg/cpp0x/decltype-38655.C: Likewise. + PR c++/39056 * g++.dg/cpp0x/initlist13.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C b/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C index 689be9f..3b8455b 100644 --- a/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-38655.C @@ -1,4 +1,4 @@ // PR c++/38655 // { dg-options "" } -__decltype(0r)* p = 1; // { dg-error "unnamed-fixed" } +__decltype(0r)* p = 1; // { dg-error "not supported|invalid" } diff --git a/gcc/testsuite/g++.dg/ext/fixed1.C b/gcc/testsuite/g++.dg/ext/fixed1.C index 9ee2780..5a479d6 100644 --- a/gcc/testsuite/g++.dg/ext/fixed1.C +++ b/gcc/testsuite/g++.dg/ext/fixed1.C @@ -3,6 +3,6 @@ template<int> struct A {}; -template<typename> struct B : A<sizeof(0=0r)> {}; +template<typename> struct B : A<sizeof(0=0r)> {}; // { dg-error "not supported" } -template<typename> struct C : A<sizeof(0=0r)> {}; +template<typename> struct C : A<sizeof(0=0r)> {}; // { dg-error "not supported" } diff --git a/gcc/testsuite/g++.dg/ext/fixed2.C b/gcc/testsuite/g++.dg/ext/fixed2.C index a4766eb..1ee5538 100644 --- a/gcc/testsuite/g++.dg/ext/fixed2.C +++ b/gcc/testsuite/g++.dg/ext/fixed2.C @@ -3,5 +3,5 @@ void foo() { - throw 0r; + throw 0r; // { dg-error "not supported" } } diff --git a/gcc/testsuite/g++.dg/lookup/crash7.C b/gcc/testsuite/g++.dg/lookup/crash7.C index 1117667..a3389a0 100644 --- a/gcc/testsuite/g++.dg/lookup/crash7.C +++ b/gcc/testsuite/g++.dg/lookup/crash7.C @@ -5,5 +5,5 @@ void foo(int); void bar() { - foo(1r); // { dg-error "unnamed-fixed" } + foo(1r); // { dg-error "not supported" } } diff --git a/gcc/testsuite/g++.dg/other/error25.C b/gcc/testsuite/g++.dg/other/error25.C index 3bd9842..b5b665a 100644 --- a/gcc/testsuite/g++.dg/other/error25.C +++ b/gcc/testsuite/g++.dg/other/error25.C @@ -1,5 +1,5 @@ // PR c++/35338 // { dg-options "" } -int i = 0r; // { dg-error "unnamed-fixed" } -bool b = !0r; // { dg-error "0.0|argument" } +int i = 0r; // { dg-error "not supported" } +bool b = !0r; // { dg-error "not supported" } diff --git a/gcc/testsuite/gcc.dg/nofixed-point-2.c b/gcc/testsuite/gcc.dg/nofixed-point-2.c new file mode 100644 index 0000000..97bbf70 --- /dev/null +++ b/gcc/testsuite/gcc.dg/nofixed-point-2.c @@ -0,0 +1,30 @@ +/* PR inline-asm/39059 */ +/* { dg-do compile { target {! fixed_point} } } */ +/* { dg-options "-std=gnu99" } */ + +void +f1 (void) +{ + asm ("" : : "r" (0r)); /* { dg-error "not supported" "reject fixed-point" } */ +} + +__typeof (0r) /* { dg-error "not supported" "reject fixed-point" } */ +b2 (void) +{ + return 0r; /* { dg-error "not supported" "reject fixed-point" } */ +} + +_Accum /* { dg-error "not supported" "reject fixed-point" } */ +f3 (void) +{ + return 0k; /* { dg-error "not supported" "reject fixed-point" } */ +} + +_Sat +f4 (void) /* { dg-error "not supported" "reject fixed-point" } */ +{ + return 0k; /* { dg-error "not supported" "reject fixed-point" } */ +} + +/* { dg-warning "defaults to" "" { target *-*-* } 13 } */ +/* { dg-error "is used without" "" { target *-*-* } 24 } */ |