https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100677

            Bug ID: 100677
           Summary: False positive unused-but-set-parameter warning when
                    using VSX intrinsics
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexander.gr...@tu-dresden.de
  Target Milestone: ---

On some code like the below the unused-but-set-parameter warning is incorrectly
triggered:

class Vec256 {
  union {
    struct {
      vfloat32 _vec0;
      vfloat32 _vec1;
    };
    struct {
      vbool32 _vecb0;
      vbool32 _vecb1;
    };

  } __attribute__((__may_alias__));
  Vec256(float scalar)
      : _vec0{vec_splats(scalar)}, _vec1{vec_splats(scalar)} {}
};

GCC seems to think "scalar" is unused even though it is passed to "vec_splats"
which is defined as "#define vec_splats __builtin_vec_splats"

This seems to also apply to other intrinsics, see e.g.
https://qlf-gitlab.inria.fr/guenneba/eigenci-junit-test/-/blob/85330d21b58bccbf95c90e874db2a0f6775ff63b/Eigen/src/Core/arch/AltiVec/PacketMath.h#L271-275

Reply via email to