Skip to content

Warnings about uninitialized variables in bessel_ik #1197

Open
@Lastique

Description

@Lastique

Building Boost.Math 1.86.0 on Ubuntu 24.04, gcc 13.2 produces these warnings:

In file included from ./boost/math/special_functions/bessel.hpp:24,
                 from ./boost/math/special_functions/airy.hpp:12,
                 from ./boost/math/special_functions.hpp:15,
                 from libs/math/build/../src/tr1/pch.hpp:9:
./boost/math/special_functions/detail/bessel_ik.hpp: In function ‘boost_cyl_bessel_k’:
./boost/math/special_functions/detail/bessel_ik.hpp:417:11: warning: ‘u’ may be used uninitialized [-Wmaybe-uninitialized]
  417 |         T z = (u + n % 2);
      |           ^
./boost/math/special_functions/detail/bessel_ik.hpp:304:7: note: ‘u’ was declared here
  304 |     T u, Iv, Kv, Kv1, Ku, Ku1, fv;
      |       ^
./boost/math/special_functions/detail/bessel_ik.hpp:417:22: warning: ‘n’ may be used uninitialized [-Wmaybe-uninitialized]
  417 |         T z = (u + n % 2);
      |                    ~~^~~
./boost/math/special_functions/detail/bessel_ik.hpp:307:14: note: ‘n’ was declared here
  307 |     unsigned n, k;
      |              ^

From a brief look these look legitimate, but I didn't investigate deeply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions