Skip to content

FLT16_MAX is defined but _Float16 is not supported: confused #51874

@llvmbot

Description

@llvmbot
Bugzilla Link 52532
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid,@xtkoba

Extended Description

Notes:

  1. This may not be a bug. Just want to draw attention to it.
  2. This may not be a bug in clang itself, but rather in the system / C standard library headers. Feel free to move it.

This code:
#define STDC_WANT_IEC_60559_TYPES_EXT
#include <float.h>
#ifdef FLT16_MAX
_Float16 f16;
#endif

compiled with [1]:
clang -std=c11 -Wall -Wextra

leads to:
t0.c:4:1: error: _Float16 is not supported on this target

which is confusing because FLT16_MAX is defined.

Per IEC 60559 interchange and extended types [2] it seems that if FLT16_MAX is defined, then _Float16 is supported. Otherwise, how to correctly determine at compile time that _Float16 is supported?

Thanks for the attention.

[1] Version: clang trunk on linux on x86_64
[2] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2601.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacclang:headersHeaders provided by Clang, e.g. for intrinsicsfloating-pointFloating-point math

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions