Skip to content

[compiler-rt] Undefined Behavior in compiler-rt builtin __divdf3 #166224

@nvetrini

Description

@nvetrini

In the implementation of __divdf3, which defines macro DOUBLE_PRECISION, the macro invocation REP_C(-1) is expanded (see https://github.com/llvm/llvm-project/blame/ca69a8d2f403de3617970dcfa2f84756f7f336dd/compiler-rt/lib/builtins/fp_div_impl.inc#L29). In this context REP_C is defined as UINT64_C, for which the behavior with the constant -1 as argument is undefined for all versions of the C Standard. Given the intent of the problematic use of REP_C, UINT64_MAX could be used instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions