OSDN Git Service

PR inline-asm/39059
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Feb 2009 17:26:28 +0000 (17:26 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Feb 2009 17:26:28 +0000 (17:26 +0000)
* 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.

* parser.c (cp_parser_primary_expression): Reject FIXED_CSTs.

* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143900 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-parser.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype-38655.C
gcc/testsuite/g++.dg/ext/fixed1.C
gcc/testsuite/g++.dg/ext/fixed2.C
gcc/testsuite/g++.dg/lookup/crash7.C
gcc/testsuite/g++.dg/other/error25.C
gcc/testsuite/gcc.dg/nofixed-point-2.c [new file with mode: 0644]

index e9da880..a92228c 100644 (file)
@@ -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
index 9f65af4..262d9d9 100644 (file)
@@ -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 ();
index 5cb1982..8844769 100644 (file)
@@ -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:
index c84de88..9d425ab 100644 (file)
@@ -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.
index 138fe42..404e45a 100644 (file)
@@ -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.  */
index 128a762..4062c86 100644 (file)
@@ -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.
 
index 689be9f..3b8455b 100644 (file)
@@ -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" }
index 9ee2780..5a479d6 100644 (file)
@@ -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" }
index a4766eb..1ee5538 100644 (file)
@@ -3,5 +3,5 @@
 
 void foo()
 {
-  throw 0r;
+  throw 0r;    // { dg-error "not supported" }
 }
index 1117667..a3389a0 100644 (file)
@@ -5,5 +5,5 @@ void foo(int);
 
 void bar()
 {
-  foo(1r); // { dg-error "unnamed-fixed" }
+  foo(1r); // { dg-error "not supported" }
 }
index 3bd9842..b5b665a 100644 (file)
@@ -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 (file)
index 0000000..97bbf70
--- /dev/null
@@ -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 } */