Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

The build fails with GCC 12 due to the newly added array-compare warning. #892

Open
issuefiler opened this issue Feb 18, 2023 · 1 comment

Comments

@issuefiler
Copy link

The issue

The new warning array-compare, which warns about comparisons between two operands of the array type, was added in GCC 12 (PR97573).

GCC 12 is producing the array-compare warning for

#define transform_coefficients_for_frame_macroblocks(dest, src, len, mode) \
{ \
if ((dest) != (src)) { \

#define transform_coefficients_for_frame_macroblocks(dest, src, len, mode) \
    {                                                                      \
        if ((dest) != (src)) {                                             \

, resulting in build failure.

My log

$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0
  CXX      libyami_decoder_la-vaapidecoder_h264.lo
In file included from vaapidecoder_h264.h:20,
                 from vaapidecoder_h264.cpp:21:
vaapidecoder_h264.cpp: In function 'void YamiMediaCodec::fillScalingList4x4(VAIQMatrixBufferH264*, std::shared_ptr<YamiParser::H264::PPS>)':
../codecparsers/h264Parser.h:101:20: error: comparison between two arrays [-Werror=array-compare]
  101 |         if ((dest) != (src)) {                                             \
      |             ~~~~~~~^~~~~~~~
vaapidecoder_h264.cpp:1247:13: note: in expansion of macro 'transform_coefficients_for_frame_macroblocks'
 1247 |             transform_coefficients_for_frame_macroblocks(                      \
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vaapidecoder_h264.cpp:1253:1: note: in expansion of macro 'FILL_SCALING_LIST'
 1253 | FILL_SCALING_LIST(4x4, 16)
      | ^~~~~~~~~~~~~~~~~
../codecparsers/h264Parser.h:101:20: note: use unary '+' which decays operands to pointers or '&'component_ref' not supported by dump_decl<declaration error>['view_convert_expr' not supported by dump_decl<declaration error>][0] != &'component_ref' not supported by dump_decl<declaration error>['view_convert_expr' not supported by dump_decl<declaration error>][0]' to compare the addresses
  101 |         if ((dest) != (src)) {                                             \
      |             ~~~~~~~^~~~~~~~
vaapidecoder_h264.cpp:1247:13: note: in expansion of macro 'transform_coefficients_for_frame_macroblocks'
 1247 |             transform_coefficients_for_frame_macroblocks(                      \
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vaapidecoder_h264.cpp:1253:1: note: in expansion of macro 'FILL_SCALING_LIST'
 1253 | FILL_SCALING_LIST(4x4, 16)
      | ^~~~~~~~~~~~~~~~~
vaapidecoder_h264.cpp: In function 'void YamiMediaCodec::fillScalingList8x8(VAIQMatrixBufferH264*, std::shared_ptr<YamiParser::H264::PPS>)':
../codecparsers/h264Parser.h:101:20: error: comparison between two arrays [-Werror=array-compare]
  101 |         if ((dest) != (src)) {                                             \
      |             ~~~~~~~^~~~~~~~
vaapidecoder_h264.cpp:1247:13: note: in expansion of macro 'transform_coefficients_for_frame_macroblocks'
 1247 |             transform_coefficients_for_frame_macroblocks(                      \
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vaapidecoder_h264.cpp:1254:1: note: in expansion of macro 'FILL_SCALING_LIST'
 1254 | FILL_SCALING_LIST(8x8, 64)
      | ^~~~~~~~~~~~~~~~~
../codecparsers/h264Parser.h:101:20: note: use unary '+' which decays operands to pointers or '&'component_ref' not supported by dump_decl<declaration error>['view_convert_expr' not supported by dump_decl<declaration error>][0] != &'component_ref' not supported by dump_decl<declaration error>['view_convert_expr' not supported by dump_decl<declaration error>][0]' to compare the addresses
  101 |         if ((dest) != (src)) {                                             \
      |             ~~~~~~~^~~~~~~~
vaapidecoder_h264.cpp:1247:13: note: in expansion of macro 'transform_coefficients_for_frame_macroblocks'
 1247 |             transform_coefficients_for_frame_macroblocks(                      \
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vaapidecoder_h264.cpp:1254:1: note: in expansion of macro 'FILL_SCALING_LIST'
 1254 | FILL_SCALING_LIST(8x8, 64)
      | ^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [Makefile:753: libyami_decoder_la-vaapidecoder_h264.lo] Error 1
@issuefiler
Copy link
Author

CFLAGS=-Wno-array-compare CXXFLAGS=-Wno-array-compare ./configure

was my temporary solution.

But please, modify those parts of code to comply with the standard C++, rather than suppressing the warning.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant