Skip to content

awkward-cpp: error: dereferencing type-punned pointer will break strict-aliasing rules #3504

@APN-Pucky

Description

@APN-Pucky

Version of Awkward Array

2.8.2

Version of Awkward-cpp

45

Description and code to reproduce

src/libawkward/forth/ForthInputBuffer.cpp:196:31: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  196 |   double positive_infinity = *(double*)&bits_infinity;
      |                               ^~~~~~~~~~~~~~~~~~~~~~~

The line is

double positive_infinity = *(double*)&bits_infinity;

I think the better way to do this is:

double positive_infinity = std::numeric_limits<double>::infinity();
double negative_infinity = -std::numeric_limits<double>::infinity();

See-also: https://bugs.gentoo.org/955697

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe problem described is something that must be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions