https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91985
Bug ID: 91985
Summary: Unsupported DFP not diagnosed with constants or
built-in functions
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jsm28 at gcc dot gnu.org
Target Milestone: ---
Code that directly uses _Decimal* types on architectures not supporting DFP is
properly diagnosed ("error: decimal floating-point not supported for this
target"), via a call to targetm.decimal_float_supported_p, if the _Decimal32,
_Decimal64 or _Decimal128 keywords are used to access it. Use via mode
attributes is also diagnosed ("unable to emulate 'SD'"). However, it is
possible to access those types via typeof applied to constants or built-in
functions without such an error.
typedef __typeof (__builtin_fabsd32 (0)) D32;
D32 f (D32 x, D32 y) { return x + y; }
or
typedef __typeof (1.0DF) D32;
D32 f (D32 x, D32 y) { return x + y; }
I'm sure there are ways to get an ICE from this; I didn't try; when it does
compile, of course it uses a completely undefined ABI.
All ways of accessing DFP types should give an error on targets that don't
support DFP.
For built-in functions, the question of whether they should be available in
such cases might be related to that for C++ and _Float* types (bug 85518).