This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, C/C++] Add -fno-float to forbid floating point data types


Hi,

As mentioned in PR60070, there is many cases when a programmer want to ensure
that a program does not use any floating point data type. Other cases to consider
is when a target has several floating point ABI and user want to ensure his/her
is compatible with all available floating point ABI. Adding such a check also  provides
an opportunity to adapt the behavior of the compiler based on its result.

This patch adds the new option -fno-float to request gcc to throw an error if any
float or floating point operation is involved. The patch modifies the C and C++
frontend (others could be modified later if people request it) so as to throw an
error whenever a keyword introducing a float type or a float litteral are
encountered. The check is added to frontend rather middle end as this allow to
do the detection as the file is parsed rather than needing a pass. It also limit the
check to only the place where a float can be declared instead of having to look
at all gimple stmts. Finally, it allows to catch some cases that would be absent
of the middle end due to simplification or limited folding that the front end
might do. Note though that things excluded by the preprocessor (think #ifdef)
would not be analyzed.

Note that the tests were written independently of the code so as to have more
confidence in the patch.

ChangeLog are as follows:

*** gcc/ChangeLog ***

2014-08-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        PR middle-end/60070
        * doc/invoke.texi (fno-float): Add to the list of C options and explain
        its meaning.

*** gcc/c/ChangeLog ***

2014-08-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        PR middle-end/60070
        * c-decl.c (finish_declspecs): Throw an error if -fno-float is
        specified by user and a default complex is encountered.
        * c-parser.c (c_token_starts_typename): Throw an error if -fno-float
        is specified by user and a float type name is encountered.
        (c_parser_declspecs): Memorize token being tested. Throw an error if
        -fno-float is specified by user and a float declaration specifier is
        encountered.
        (c_parser_postfix_expression): Throw an error if -fno-float is
        specified by user and a float litteral is encountered.

*** gcc/c-family/ChangeLog ***

2014-08-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        PR middle-end/60070
        * c.opt (ffloat): New option.

*** gcc/cp/ChangeLog ***

2014-08-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        PR middle-end/60070
        * decl.c (grokdeclarator): Throw an error if -fno-float is
        specified by user and a default complex is encountered.
        * parser.c (cp_parser_primary_expression): Throw an error if -fno-float
        is specified by user and a float litteral is encountered.
        (cp_parser_simple_type_specifier): Throw an error if -fno-float is
        specified by user and a float type specifier is encountered.

*** gcc/testsuite/ChangeLog ***

2014-08-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>

        PR middle-end/60070
        * gcc.dg/fno-float.c: New test case.
        * g++.dg/diagnostic/fno-float.C: Likewise.


diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index c318cad..2d22e15 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1079,6 +1079,10 @@ fnil-receivers
 ObjC ObjC++ Var(flag_nil_receivers) Init(1)
 Assume that receivers of Objective-C messages may be nil
 
+ffloat
+C C++ LTO Var(flag_no_float, 0)
+Allow floating point data types to be used in C/C++
+
 flocal-ivars
 ObjC ObjC++ Var(flag_local_ivars) Init(1)
 Allow access to instance variables as if they were local declarations within instance method implementations.
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 2a4b439..e68f0f3 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -10078,6 +10078,10 @@ finish_declspecs (struct c_declspecs *specs)
 	}
       else if (specs->complex_p)
 	{
+	  if (flag_no_float)
+	    error_at (specs->locations[cdw_complex],
+		      "use of floating points forbidden in this translation "
+		      "unit (-fno-float)");
 	  specs->typespec_word = cts_double;
 	  pedwarn (specs->locations[cdw_complex], OPT_Wpedantic,
 		   "ISO C does not support plain %<complex%> meaning "
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index e32bf04..74ac945 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -486,6 +486,15 @@ c_token_starts_typename (c_token *token)
     case CPP_KEYWORD:
       switch (token->keyword)
 	{
+	case RID_FLOAT:
+	case RID_DOUBLE:
+	case RID_DFLOAT32:
+	case RID_DFLOAT64:
+	case RID_DFLOAT128:
+	  if (flag_no_float)
+	    error_at (token->location, "use of floating points forbidden in "
+				       "this translation unit (-fno-float)");
+	  /* Fall through.  */
 	case RID_UNSIGNED:
 	case RID_LONG:
 	case RID_INT128:
@@ -494,12 +503,7 @@ c_token_starts_typename (c_token *token)
 	case RID_COMPLEX:
 	case RID_INT:
 	case RID_CHAR:
-	case RID_FLOAT:
-	case RID_DOUBLE:
 	case RID_VOID:
-	case RID_DFLOAT32:
-	case RID_DFLOAT64:
-	case RID_DFLOAT128:
 	case RID_BOOL:
 	case RID_ENUM:
 	case RID_STRUCT:
@@ -2188,6 +2192,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
 	 || (c_dialect_objc () && c_parser_next_token_is (parser, CPP_LESS)))
     {
       struct c_typespec t;
+      c_token *token;
       tree attrs;
       tree align;
       location_t loc = c_parser_peek_token (parser)->location;
@@ -2277,7 +2282,8 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
 	  continue;
 	}
       gcc_assert (c_parser_next_token_is (parser, CPP_KEYWORD));
-      switch (c_parser_peek_token (parser)->keyword)
+      token = c_parser_peek_token (parser);
+      switch (token->keyword)
 	{
 	case RID_STATIC:
 	case RID_EXTERN:
@@ -2301,6 +2307,15 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
 	  if (!auto_type_ok)
 	    goto out;
 	  /* Fall through.  */
+	case RID_FLOAT:
+	case RID_DOUBLE:
+	case RID_DFLOAT32:
+	case RID_DFLOAT64:
+	case RID_DFLOAT128:
+	  if (token->keyword != RID_AUTO_TYPE && flag_no_float)
+	    error_at (token->location, "use of floating points forbidden in "
+				       "this translation unit (-fno-float)");
+	  /* Fall through.  */
 	case RID_UNSIGNED:
 	case RID_LONG:
 	case RID_INT128:
@@ -2309,12 +2324,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
 	case RID_COMPLEX:
 	case RID_INT:
 	case RID_CHAR:
-	case RID_FLOAT:
-	case RID_DOUBLE:
 	case RID_VOID:
-	case RID_DFLOAT32:
-	case RID_DFLOAT64:
-	case RID_DFLOAT128:
 	case RID_BOOL:
 	case RID_FRACT:
 	case RID_ACCUM:
@@ -6996,6 +7006,9 @@ c_parser_postfix_expression (c_parser *parser)
 	  error_at (loc, "fixed-point types not supported for this target");
 	  expr.value = error_mark_node;
 	}
+      if (flag_no_float && TREE_CODE (expr.value) == REAL_CST)
+	error_at (loc, "use of floating points forbidden in this translation "
+		       "unit (-fno-float)");
       break;
     case CPP_CHAR:
     case CPP_CHAR16:
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index aafb917..c2f8f87 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9292,7 +9292,12 @@ grokdeclarator (const cp_declarator *declarator,
 	 "complex short int".  */
       else if (defaulted_int && ! longlong && ! explicit_int128
 	       && ! (long_p || short_p || signed_p || unsigned_p))
-	type = complex_double_type_node;
+	{
+	  if (flag_no_float)
+	    error ("use of floating points forbidden in this translation unit "
+		   "(-fno-float)");
+	  type = complex_double_type_node;
+	}
       else if (type == integer_type_node)
 	type = complex_integer_type_node;
       else if (type == float_type_node)
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 32c7a3f..08207dd 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4202,6 +4202,9 @@ cp_parser_primary_expression (cp_parser *parser,
 		    "fixed-point types not supported in C++");
 	  return error_mark_node;
 	}
+      if (flag_no_float && TREE_CODE (token->u.value) == REAL_CST)
+	error_at (token->location, "use of floating points forbidden in this "
+				   "translation unit (-fno-float)");
       /* Floating-point literals are only allowed in an integral
 	 constant expression if they are cast to an integral or
 	 enumeration type.  */
@@ -14787,6 +14790,11 @@ cp_parser_simple_type_specifier (cp_parser* parser,
       break;
     }
 
+  if (flag_no_float
+      && (type == float_type_node || type == double_type_node))
+    error_at (token->location, "use of floating points forbidden in this "
+			       "translation unit (-fno-float)");
+
   /* If token is an already-parsed decltype not followed by ::,
      it's a simple-type-specifier.  */
   if (token->type == CPP_DECLTYPE
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index aaa5a68..e49f120 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -169,7 +169,7 @@ in the following sections.
 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
 -fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
 -fhosted  -ffreestanding -fopenmp -fopenmp-simd -fms-extensions @gol
--fplan9-extensions -trigraphs  -traditional  -traditional-cpp @gol
+-fno-float -fplan9-extensions -trigraphs  -traditional  -traditional-cpp @gol
 -fallow-single-precision  -fcond-mismatch -flax-vector-conversions @gol
 -fsigned-bitfields  -fsigned-char @gol
 -funsigned-bitfields  -funsigned-char}
@@ -1920,6 +1920,14 @@ fields within structs/unions}, for details.
 
 Note that this option is off for all targets but i?86 and x86_64
 targets using ms-abi.
+
+@item -fno-float
+@opindex fno-float
+Allows the compiler to assume that there is no floating point code in
+the translation unit, any use of floating point types detected being
+treated as an error.  Additional action can then be taken, such as
+marking the code unaffected by the choice of floating point ABI.
+
 @item -fplan9-extensions
 Accept some non-standard constructs used in Plan 9 code.
 
diff --git a/gcc/testsuite/g++.dg/diagnostic/fno-float.C b/gcc/testsuite/g++.dg/diagnostic/fno-float.C
new file mode 100644
index 0000000..2abd80f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/diagnostic/fno-float.C
@@ -0,0 +1,102 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-float" } */
+
+namespace float_ns { /* { dg-bogus "use of floating points forbidden" } */
+
+    /* Check float detection in global variable declaration.  */
+    float f_glob; /* { dg-error "use of floating points forbidden" } */
+    double d_glob; /* { dg-error "use of floating points forbidden" } */
+    long double ld_glob; /* { dg-error "use of floating points forbidden" } */
+    _Complex float cf_glob; /* { dg-error "use of floating points forbidden" } */
+    _Complex double cd_glob; /* { dg-error "use of floating points forbidden" } */
+    _Complex long double cld_glob; /* { dg-error "use of floating points forbidden" } */
+
+  class float_cls { /* { dg-bogus "use of floating points forbidden" } */
+
+    /* Check float detection in attribute declaration.  */
+    float f_attr; /* { dg-error "use of floating points forbidden" } */
+    double d_attr; /* { dg-error "use of floating points forbidden" } */
+    long double ld_attr; /* { dg-error "use of floating points forbidden" } */
+    _Complex float cf_attr; /* { dg-error "use of floating points forbidden" } */
+    _Complex double cd_attr; /* { dg-error "use of floating points forbidden" } */
+    _Complex long double cld_attr; /* { dg-error "use of floating points forbidden" } */
+
+    int fct_using_float (void) /* { dg-bogus "use of floating points forbidden" } */
+    {
+      /* Check float detection in local variable declaration.  */
+      float f; /* { dg-error "use of floating points forbidden" } */
+      float *f_ptr; /* { dg-error "use of floating points forbidden" } */
+      double d; /* { dg-error "use of floating points forbidden" } */
+      double *d_ptr; /* { dg-error "use of floating points forbidden" } */
+      long double ld; /* { dg-error "use of floating points forbidden" } */
+      long double *ld_ptr; /* { dg-error "use of floating points forbidden" } */
+      _Complex float cf; /* { dg-error "use of floating points forbidden" } */
+      _Complex float *cf_ptr; /* { dg-error "use of floating points forbidden" } */
+      _Complex double cd; /* { dg-error "use of floating points forbidden" } */
+      _Complex double *cd_ptr; /* { dg-error "use of floating points forbidden" } */
+      _Complex long double cld; /* { dg-error "use of floating points forbidden" } */
+      _Complex long double *cld_ptr; /* { dg-error "use of floating points forbidden" } */
+
+float_ops: /* { dg-bogus "use of floating points forbidden" } */
+
+      /* Check float detection in typename.  */
+      f += sizeof (float); /* { dg-error "use of floating points forbidden" } */
+      f += sizeof (double); /* { dg-error "use of floating points forbidden" } */
+      f += sizeof (long double); /* { dg-error "use of floating points forbidden" } */
+      f += sizeof (_Complex float); /* { dg-error "use of floating points forbidden" } */
+      f += sizeof (_Complex double); /* { dg-error "use of floating points forbidden" } */
+      f += sizeof (_Complex long double); /* { dg-error "use of floating points forbidden" } */
+
+      /* Check float detection in C-style cast.  */
+      f = (float) 4; /* { dg-error "use of floating points forbidden" } */
+      d = (double) 4; /* { dg-error "use of floating points forbidden" } */
+      ld = (long double) 4; /* { dg-error "use of floating points forbidden" } */
+      cf = (_Complex float) cd; /* { dg-error "use of floating points forbidden" } */
+      cd = (_Complex double) cf; /* { dg-error "use of floating points forbidden" } */
+      cld = (_Complex long double) cf; /* { dg-error "use of floating points forbidden" } */
+
+      /* Check float detection in static_cast.  */
+      f = static_cast<float>(4); /* { dg-error "use of floating points forbidden" } */
+      d = static_cast<double>(4); /* { dg-error "use of floating points forbidden" } */
+      ld = static_cast<long double>(4); /* { dg-error "use of floating points forbidden" } */
+      cf = static_cast<_Complex float>(cd); /* { dg-error "use of floating points forbidden" } */
+      cd = static_cast<_Complex double>(cf); /* { dg-error "use of floating points forbidden" } */
+      cld = static_cast<_Complex long double>(cf); /* { dg-error "use of floating points forbidden" } */
+
+      /* Check float detection in const_cast.  */
+      f_ptr = const_cast<float *>(&f); /* { dg-error "use of floating points forbidden" } */
+      d_ptr = const_cast<double *>(&d); /* { dg-error "use of floating points forbidden" } */
+      ld_ptr = const_cast<long double *>(&ld); /* { dg-error "use of floating points forbidden" } */
+      cf_ptr = const_cast<_Complex float *>(&cf); /* { dg-error "use of floating points forbidden" } */
+      cd_ptr = const_cast<_Complex double *>(&cd); /* { dg-error "use of floating points forbidden" } */
+      cld_ptr = const_cast<_Complex long double *>(&cld); /* { dg-error "use of floating points forbidden" } */
+
+      /* Check float detection in reinterpret_cast.  */
+      f_ptr = reinterpret_cast<float *>(4); /* { dg-error "use of floating points forbidden" } */
+      d_ptr = reinterpret_cast<double *>(4); /* { dg-error "use of floating points forbidden" } */
+      ld_ptr = reinterpret_cast<long double *>(4); /* { dg-error "use of floating points forbidden" } */
+      cf_ptr = reinterpret_cast<_Complex float *>(4); /* { dg-error "use of floating points forbidden" } */
+      cd_ptr = reinterpret_cast<_Complex double *>(4); /* { dg-error "use of floating points forbidden" } */
+      cld_ptr = reinterpret_cast<_Complex long double *>(4); /* { dg-error "use of floating points forbidden" } */
+
+      /* Check float detection in litterals.  */
+      return (int) 4.5; /* { dg-error "use of floating points forbidden" } */
+    }
+
+    /* Check float detection in function parameter.  */
+    int float_param (float a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+    int double_param (double a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+    int long double_param (long double a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+    int complex_float_param (_Complex float a) { return (int) __real__ a;} /* { dg-error "use of floating points forbidden" } */
+    int complex_double_param (_Complex double a) { return (int) __real__ a;} /* { dg-error "use of floating points forbidden" } */
+    int complex_long_double_param (_Complex long double a) { return (int) __real__ a;} /* { dg-error "use of floating points forbidden" } */
+
+    /* Check float detection in function return parameter.  */
+    float float_return (void) { return f_attr;} /* { dg-error "use of floating points forbidden" } */
+    double double_return (void) { return d_attr;} /* { dg-error "use of floating points forbidden" } */
+    long double long_double_return (void) { return ld_attr;} /* { dg-error "use of floating points forbidden" } */
+    _Complex float complex_float_return (void) { return cf_attr;} /* { dg-error "use of floating points forbidden" } */
+    _Complex double complex_double_return (void) { return cd_attr;} /* { dg-error "use of floating points forbidden" } */
+    _Complex long double complex_long_double_return (void) { return cld_attr;} /* { dg-error "use of floating points forbidden" } */
+  };
+}
diff --git a/gcc/testsuite/gcc.dg/fno-float.c b/gcc/testsuite/gcc.dg/fno-float.c
new file mode 100644
index 0000000..4d167cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fno-float.c
@@ -0,0 +1,96 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-float" } */
+/* { dg-prune-output "decimal floating point not supported for this target" } */
+
+/* Check float detection in global declaration.  */
+float f_glob; /* { dg-error "use of floating points forbidden" } */
+double d_glob; /* { dg-error "use of floating points forbidden" } */
+long double ld_glob; /* { dg-error "use of floating points forbidden" } */
+_Decimal32 d32_glob; /* { dg-error "use of floating points forbidden" } */
+_Decimal64 d64_glob; /* { dg-error "use of floating points forbidden" } */
+_Decimal128 d128_glob; /* { dg-error "use of floating points forbidden" } */
+_Complex float cf_glob; /* { dg-error "use of floating points forbidden" } */
+_Complex double cd_glob; /* { dg-error "use of floating points forbidden" } */
+_Complex long double cld_glob; /* { dg-error "use of floating points forbidden" } */
+
+/* Check float detection in auto double complex global declaration.  */
+_Complex c_glob; /* { dg-error "use of floating points forbidden" } */
+
+int
+fct_using_float (void) /* { dg-bogus "use of floating points forbidden" } */
+{
+  /* Check float detection in local declaration.  */
+  float f; /* { dg-error "use of floating points forbidden" } */
+  double d; /* { dg-error "use of floating points forbidden" } */
+  long double ld; /* { dg-error "use of floating points forbidden" } */
+  _Decimal32 d32; /* { dg-error "use of floating points forbidden" } */
+  _Decimal64 d64; /* { dg-error "use of floating points forbidden" } */
+  _Decimal128 d128; /* { dg-error "use of floating points forbidden" } */
+  _Complex float cf; /* { dg-error "use of floating points forbidden" } */
+  _Complex double cd; /* { dg-error "use of floating points forbidden" } */
+  _Complex long double cld; /* { dg-error "use of floating points forbidden" } */
+
+  /* Check float detection in auto double complex local declaration.  */
+  _Complex c; /* { dg-error "use of floating points forbidden" } */
+
+float_ops: /* { dg-bogus "use of floating points forbidden" } */
+
+  /* Check float detection in typename.  */
+  f += sizeof (float); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (double); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (long double); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (_Decimal32); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (_Decimal64); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (_Decimal128); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (_Complex float); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (_Complex double); /* { dg-error "use of floating points forbidden" } */
+  f += sizeof (_Complex long double); /* { dg-error "use of floating points forbidden" } */
+
+  /* Check float detection in auto double complex as typename.  */
+  f += sizeof (_Complex); /* { dg-error "use of floating points forbidden" } */
+
+  /* Check float detection in cast.  */
+  f = (float) 4; /* { dg-error "use of floating points forbidden" } */
+  d = (double) 4; /* { dg-error "use of floating points forbidden" } */
+  ld = (long double) 4; /* { dg-error "use of floating points forbidden" } */
+  f = (_Decimal32) 4; /* { dg-error "use of floating points forbidden" } */
+  f = (_Decimal64) 4; /* { dg-error "use of floating points forbidden" } */
+  f = (_Decimal128) 4; /* { dg-error "use of floating points forbidden" } */
+  cf = (_Complex float) cd; /* { dg-error "use of floating points forbidden" } */
+  cd = (_Complex double) cf; /* { dg-error "use of floating points forbidden" } */
+  cld = (_Complex long double) cf; /* { dg-error "use of floating points forbidden" } */
+
+  /* Check float detection in auto double complex in cast.  */
+  __real__ c = (double) 4; /* { dg-error "use of floating points forbidden" } */
+
+  /* Check float detection in litterals.  */
+  return (int) 4.5; /* { dg-error "use of floating points forbidden" } */
+}
+
+/* Check float detection in function parameter.  */
+int float_param (float a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+int double_param (double a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+int long_double_param (long double a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+int decimal32_param (_Decimal32 a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+int decimal64_param (_Decimal64 a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+int decimal128_param (_Decimal128 a) { return (int) a;} /* { dg-error "use of floating points forbidden" } */
+int complex_float_param (_Complex float a) { return (int) __real__ a;} /* { dg-error "use of floating points forbidden" } */
+int complex_double_param (_Complex double a) { return (int) __real__ a;} /* { dg-error "use of floating points forbidden" } */
+int complex_long_double_param (_Complex long double a) { return (int) __real__ a;} /* { dg-error "use of floating points forbidden" } */
+
+/* Check float detection in auto double complex in function parameter.  */
+int complex_param (_Complex a) { return (int) __real__ a;} /* { dg-error "use of floating points forbidden" } */
+
+/* Check float detection in function return parameter.  */
+float float_return (void) { return f_glob;} /* { dg-error "use of floating points forbidden" } */
+double double_return (void) { return d_glob;} /* { dg-error "use of floating points forbidden" } */
+long double long_double_return (void) { return ld_glob;} /* { dg-error "use of floating points forbidden" } */
+_Decimal32 decimal32_return (void) { return f_glob;} /* { dg-error "use of floating points forbidden" } */
+_Decimal64 decimal64_return (void) { return f_glob;} /* { dg-error "use of floating points forbidden" } */
+_Decimal128 decimal128_return (void) { return f_glob;} /* { dg-error "use of floating points forbidden" } */
+_Complex float complex_float_return (void) { return cf_glob;} /* { dg-error "use of floating points forbidden" } */
+_Complex double complex_double_return (void) { return cd_glob;} /* { dg-error "use of floating points forbidden" } */
+_Complex long double complex_long_double_return (void) { return cld_glob;} /* { dg-error "use of floating points forbidden" } */
+
+/* Check float detection in auto double complex in function return parameter.  */
+_Complex complex_return (void) { return c_glob;} /* { dg-error "use of floating points forbidden" } */


Is the approach taken correct? If yes, is this ok for trunk?

Best regards,

Thomas



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]