Skip to content

[BUG]: stdlib_float16_bits_t is conditionally undefined on compilers with native Float16 support #13147

Description

@officiallyanee

Description

Encountered an error when attempting to use stdlib_float16_bits_t on a compiler with native _Float16 support. The typedef for stdlib_float16_bits_t in ctor.h is placed inside the #else branch of the native Float16 detection block, meaning it is only defined when no native _Float16 support is detected. On such compilers, attempting to use it as shown in the README results in an "undeclared identifier" error. It's documentation says to prefer explicit helpers but doesn't mention that it's not supported on devices with native float16 support.

Related Issues

none.

Questions

No.

Reproduction

Running the readme usage example with appropriate headers.

Expected Results

For it to compile without errors.

Actual Results

example.c:28:23: error: expected ';' after expression
   28 |         stdlib_float16_bits_t y;
      |                              ^
      |                              ;
example.c:28:2: error: use of undeclared identifier 'stdlib_float16_bits_t'; did you mean 'stdlib_float16_to_bits'?
   28 |         stdlib_float16_bits_t y;
      |         ^~~~~~~~~~~~~~~~~~~~~
      |         stdlib_float16_to_bits

I ran it in the example file using make command.

Checklist

  • Read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions