From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25117 invoked by alias); 12 Aug 2014 09:25:38 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 25105 invoked by uid 89); 12 Aug 2014 09:25:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Aug 2014 09:25:32 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 12 Aug 2014 10:25:29 +0100 Received: from SHAWIN202 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Aug 2014 10:25:29 +0100 From: "Thomas Preud'homme" To: Subject: [PATCH, C/C++] Add -fno-float to forbid floating point data types Date: Tue, 12 Aug 2014 09:25:00 -0000 Message-ID: <000701cfb60f$5b859700$1290c500$@arm.com> MIME-Version: 1.0 X-MC-Unique: 114081210252909201 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg01099.txt.bz2 Hi, As mentioned in PR60070, there is many cases when a programmer want to ensu= re that a program does not use any floating point data type. Other cases to co= nsider 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 al= so 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 thr= ow 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 a= bsent of the middle end due to simplification or limited folding that the front e= nd might do. Note though that things excluded by the preprocessor (think #ifde= f) would not be analyzed. Note that the tests were written independently of the code so as to have mo= re confidence in the patch. ChangeLog are as follows: *** gcc/ChangeLog *** 2014-08-08 Thomas Preud'homme PR middle-end/60070 * doc/invoke.texi (fno-float): Add to the list of C options and exp= lain its meaning. *** gcc/c/ChangeLog *** 2014-08-08 Thomas Preud'homme 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 PR middle-end/60070 * c.opt (ffloat): New option. *** gcc/cp/ChangeLog *** 2014-08-08 Thomas Preud'homme 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-f= loat 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 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 =20 +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 with= in 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 =3D cts_double; pedwarn (specs->locations[cdw_complex], OPT_Wpedantic, "ISO C does not support plain % 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_declsp= ecs *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 =3D c_parser_peek_token (parser)->location; @@ -2277,7 +2282,8 @@ c_parser_declspecs (c_parser *parser, struct c_declsp= ecs *specs, continue; } gcc_assert (c_parser_next_token_is (parser, CPP_KEYWORD)); - switch (c_parser_peek_token (parser)->keyword) + token =3D 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_decls= pecs *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 !=3D 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_decls= pecs *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 =3D error_mark_node; } + if (flag_no_float && TREE_CODE (expr.value) =3D=3D 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 =3D complex_double_type_node; + { + if (flag_no_float) + error ("use of floating points forbidden in this translation unit " + "(-fno-float)"); + type =3D complex_double_type_node; + } else if (type =3D=3D integer_type_node) type =3D complex_integer_type_node; else if (type =3D=3D 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) =3D=3D 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; } =20 + if (flag_no_float + && (type =3D=3D float_type_node || type =3D=3D 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 =3D=3D 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. =20 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. =20 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 forbidde= n" } */ + _Complex double cd_glob; /* { dg-error "use of floating points forbidd= en" } */ + _Complex long double cld_glob; /* { dg-error "use of floating points f= orbidden" } */ + + 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 forbidde= n" } */ + _Complex double cd_attr; /* { dg-error "use of floating points forbidd= en" } */ + _Complex long double cld_attr; /* { dg-error "use of floating points f= orbidden" } */ + + int fct_using_float (void) /* { dg-bogus "use of floating points forbi= dden" } */ + { + /* 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 forbid= den" } */ + _Complex double cd; /* { dg-error "use of floating points forbidden"= } */ + _Complex double *cd_ptr; /* { dg-error "use of floating points forbi= dden" } */ + _Complex long double cld; /* { dg-error "use of floating points forb= idden" } */ + _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 +=3D sizeof (float); /* { dg-error "use of floating points forbidd= en" } */ + f +=3D sizeof (double); /* { dg-error "use of floating points forbid= den" } */ + f +=3D sizeof (long double); /* { dg-error "use of floating points f= orbidden" } */ + f +=3D sizeof (_Complex float); /* { dg-error "use of floating point= s forbidden" } */ + f +=3D sizeof (_Complex double); /* { dg-error "use of floating poin= ts forbidden" } */ + f +=3D sizeof (_Complex long double); /* { dg-error "use of floating= points forbidden" } */ + + /* Check float detection in C-style cast. */ + f =3D (float) 4; /* { dg-error "use of floating points forbidden" } = */ + d =3D (double) 4; /* { dg-error "use of floating points forbidden" }= */ + ld =3D (long double) 4; /* { dg-error "use of floating points forbid= den" } */ + cf =3D (_Complex float) cd; /* { dg-error "use of floating points fo= rbidden" } */ + cd =3D (_Complex double) cf; /* { dg-error "use of floating points f= orbidden" } */ + cld =3D (_Complex long double) cf; /* { dg-error "use of floating po= ints forbidden" } */ + + /* Check float detection in static_cast. */ + f =3D static_cast(4); /* { dg-error "use of floating points f= orbidden" } */ + d =3D static_cast(4); /* { dg-error "use of floating points = forbidden" } */ + ld =3D static_cast(4); /* { dg-error "use of floating p= oints forbidden" } */ + cf =3D static_cast<_Complex float>(cd); /* { dg-error "use of floati= ng points forbidden" } */ + cd =3D static_cast<_Complex double>(cf); /* { dg-error "use of float= ing points forbidden" } */ + cld =3D static_cast<_Complex long double>(cf); /* { dg-error "use of= floating points forbidden" } */ + + /* Check float detection in const_cast. */ + f_ptr =3D const_cast(&f); /* { dg-error "use of floating po= ints forbidden" } */ + d_ptr =3D const_cast(&d); /* { dg-error "use of floating p= oints forbidden" } */ + ld_ptr =3D const_cast(&ld); /* { dg-error "use of flo= ating points forbidden" } */ + cf_ptr =3D const_cast<_Complex float *>(&cf); /* { dg-error "use of = floating points forbidden" } */ + cd_ptr =3D const_cast<_Complex double *>(&cd); /* { dg-error "use of= floating points forbidden" } */ + cld_ptr =3D const_cast<_Complex long double *>(&cld); /* { dg-error = "use of floating points forbidden" } */ + + /* Check float detection in reinterpret_cast. */ + f_ptr =3D reinterpret_cast(4); /* { dg-error "use of floati= ng points forbidden" } */ + d_ptr =3D reinterpret_cast(4); /* { dg-error "use of float= ing points forbidden" } */ + ld_ptr =3D reinterpret_cast(4); /* { dg-error "use of= floating points forbidden" } */ + cf_ptr =3D reinterpret_cast<_Complex float *>(4); /* { dg-error "use= of floating points forbidden" } */ + cd_ptr =3D reinterpret_cast<_Complex double *>(4); /* { dg-error "us= e of floating points forbidden" } */ + cld_ptr =3D reinterpret_cast<_Complex long double *>(4); /* { dg-err= or "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 flo= ating points forbidden" } */ + int double_param (double a) { return (int) a;} /* { dg-error "use of f= loating 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 floa= ting points forbidden" } */ + double double_return (void) { return d_attr;} /* { dg-error "use of fl= oating 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;} /* { d= g-error "use of floating points forbidden" } */ + _Complex long double complex_long_double_return (void) { return cld_at= tr;} /* { dg-error "use of floating points forbidden" } */ + }; +} diff --git a/gcc/testsuite/gcc.dg/fno-float.c b/gcc/testsuite/gcc.dg/fno-fl= oat.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 forbi= dden" } */ + +/* 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 forbidde= n" } */ + + /* 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 +=3D sizeof (float); /* { dg-error "use of floating points forbidden" = } */ + f +=3D sizeof (double); /* { dg-error "use of floating points forbidden"= } */ + f +=3D sizeof (long double); /* { dg-error "use of floating points forbi= dden" } */ + f +=3D sizeof (_Decimal32); /* { dg-error "use of floating points forbid= den" } */ + f +=3D sizeof (_Decimal64); /* { dg-error "use of floating points forbid= den" } */ + f +=3D sizeof (_Decimal128); /* { dg-error "use of floating points forbi= dden" } */ + f +=3D sizeof (_Complex float); /* { dg-error "use of floating points fo= rbidden" } */ + f +=3D sizeof (_Complex double); /* { dg-error "use of floating points f= orbidden" } */ + f +=3D sizeof (_Complex long double); /* { dg-error "use of floating poi= nts forbidden" } */ + + /* Check float detection in auto double complex as typename. */ + f +=3D sizeof (_Complex); /* { dg-error "use of floating points forbidde= n" } */ + + /* Check float detection in cast. */ + f =3D (float) 4; /* { dg-error "use of floating points forbidden" } */ + d =3D (double) 4; /* { dg-error "use of floating points forbidden" } */ + ld =3D (long double) 4; /* { dg-error "use of floating points forbidden"= } */ + f =3D (_Decimal32) 4; /* { dg-error "use of floating points forbidden" }= */ + f =3D (_Decimal64) 4; /* { dg-error "use of floating points forbidden" }= */ + f =3D (_Decimal128) 4; /* { dg-error "use of floating points forbidden" = } */ + cf =3D (_Complex float) cd; /* { dg-error "use of floating points forbid= den" } */ + cd =3D (_Complex double) cf; /* { dg-error "use of floating points forbi= dden" } */ + cld =3D (_Complex long double) cf; /* { dg-error "use of floating points= forbidden" } */ + + /* Check float detection in auto double complex in cast. */ + __real__ c =3D (double) 4; /* { dg-error "use of floating points forbidd= en" } */ + + /* 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 floatin= g points forbidden" } */ +int double_param (double a) { return (int) a;} /* { dg-error "use of float= ing points forbidden" } */ +int long_double_param (long double a) { return (int) a;} /* { dg-error "us= e of floating points forbidden" } */ +int decimal32_param (_Decimal32 a) { return (int) a;} /* { dg-error "use o= f floating points forbidden" } */ +int decimal64_param (_Decimal64 a) { return (int) a;} /* { dg-error "use o= f 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) __re= al__ 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 floati= ng points forbidden" } */ +long double long_double_return (void) { return ld_glob;} /* { dg-error "us= e 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-erro= r "use of floating points forbidden" } */ +_Complex double complex_double_return (void) { return cd_glob;} /* { dg-er= ror "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 paramet= er. */ +_Complex complex_return (void) { return c_glob;} /* { dg-error "use of flo= ating points forbidden" } */ Is the approach taken correct? If yes, is this ok for trunk? Best regards, Thomas