Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODR Violations when building with LTO #156

Open
kostadinsh opened this issue Aug 6, 2023 · 0 comments
Open

ODR Violations when building with LTO #156

kostadinsh opened this issue Aug 6, 2023 · 0 comments

Comments

@kostadinsh
Copy link

Some ODR violations appear as warnings when building with LTO
GCC Version is gcc (Gentoo Hardened 13.2.0 p3) 13.2.0
Steps to reproduce:

  1. git clone https://github.com/mstorsjo/fdk-aac.git
  2. export CXXFLAGS="-O2 -flto=auto"
  3. mkdir fdk-aac/build && cd fdk-aac/build
  4. cmake .. && make VERBOSE=1
libMpegTPDec/src/tpdec_adts.h:141:8: warning: type 'struct STRUCT_ADTS' violates the C++ One Definition Rule [-Wodr]
  141 | struct STRUCT_ADTS {
      |        ^
libMpegTPEnc/src/tpenc_adts.h:133:3: note: a different type is defined in another translation unit
  133 | } STRUCT_ADTS;
      |   ^
libMpegTPDec/src/tpdec_adts.h:142:18: note: the first difference of corresponding definitions is field 'bs'
  142 |   STRUCT_ADTS_BS bs;
      |                  ^
libMpegTPEnc/src/tpenc_adts.h:111:7: note: a field with different name is defined in another translation unit
  111 |   INT sample_freq;
      |       ^
libMpegTPDec/src/tpdec_latm.h:126:3: warning: type 'struct LATM_LAYER_INFO' violates the C++ One Definition Rule [-Wodr]
  126 | } LATM_LAYER_INFO;
      |   ^
libMpegTPEnc/src/tpenc_latm.h:130:3: note: a different type is defined in another translation unit
  130 | } LATM_LAYER_INFO;
      |   ^
libMpegTPDec/src/tpdec_latm.h:122:8: note: the first difference of corresponding definitions is field 'm_frameLengthType'
  122 |   UINT m_frameLengthType;
      |        ^
libMpegTPEnc/src/tpenc_latm.h:126:14: note: a field with different name is defined in another translation unit
  126 |   signed int frameLengthType;
      |              ^
libSACdec/src/sac_dec.h:201:3: warning: type 'struct LOSSLESSDATA' violates the C++ One Definition Rule [-Wodr]
  201 | } LOSSLESSDATA;
      |   ^
libSACenc/src/sacenc_bitstream.h:241:3: note: a different type is defined in another translation unit
  241 | } LOSSLESSDATA;
      |   ^
libSACdec/src/sac_dec.h:196:9: note: the first difference of corresponding definitions is field 'bsXXXDataMode'
  196 |   SCHAR bsXXXDataMode[MAX_PARAMETER_SETS];
      |         ^
libSACenc/src/sacenc_bitstream.h:236:9: note: a field of same name but different type is defined in another translation unit
  236 |   UCHAR bsXXXDataMode[SACENC_MAX_NUM_BOXES][MAX_NUM_PARAMS];
      |         ^
libSACdec/src/sac_dec.h:201:3: note: array types have different bounds
  201 | } LOSSLESSDATA;
      |   ^
./libSBRenc/include/../src/bit_sbr.h:131:8: warning: type 'struct SBR_HEADER_DATA' violates the C++ One Definition Rule [-Wodr]
  131 | struct SBR_HEADER_DATA {
      |        ^
libSBRdec/src/env_extr.h:295:3: note: a different type is defined in another translation unit
  295 | } SBR_HEADER_DATA;
      |   ^
./libSBRenc/include/../src/bit_sbr.h:132:11: note: the first difference of corresponding definitions is field 'sbr_amp_res'
  132 |   AMP_RES sbr_amp_res;
      |           ^
libSBRdec/src/env_extr.h:271:3: note: a field with different name is defined in another translation unit
  271 |   syncState; /*!< The current initialization status of the header */
      |   ^
./libSBRenc/include/../src/ton_corr.h:131:3: warning: type 'struct PATCH_PARAM' violates the C++ One Definition Rule [-Wodr]
  131 | } PATCH_PARAM;
      |   ^
libSBRdec/src/lpp_tran.h:187:3: note: a different type is defined in another translation unit
  187 | } PATCH_PARAM;
      |   ^
./libSBRenc/include/../src/ton_corr.h:120:7: note: the first difference of corresponding definitions is field 'sourceStartBand'
  120 |   INT sourceStartBand; /*!< first band in lowbands where to take the samples
      |       ^
libSBRdec/src/lpp_tran.h:174:9: note: a field of same name but different type is defined in another translation unit
  174 |   UCHAR sourceStartBand; /*!< first band in lowbands where to take the samples
      |         ^
./libSBRenc/include/../src/ton_corr.h:131:3: note: type 'INT' should match type 'UCHAR'
  131 | } PATCH_PARAM;
      |   ^
./libSBRenc/include/../src/sbr.h:129:16: warning: type 'struct SBR_CHANNEL' violates the C++ One Definition Rule [-Wodr]
  129 | typedef struct SBR_CHANNEL {
      |                ^
libSBRdec/src/sbr_dec.h:173:3: note: a different type is defined in another translation unit
  173 | } SBR_CHANNEL;
      |   ^
./libSBRenc/include/../src/sbr.h:130:22: note: the first difference of corresponding definitions is field 'hEnvChannel'
  130 |   struct ENV_CHANNEL hEnvChannel;
      |                      ^
libSBRdec/src/sbr_dec.h:170:18: note: a field with different name is defined in another translation unit
  170 |   SBR_FRAME_DATA frameData[(1) + 1];
      |                  ^
./libFDK/include/nlc_dec.h:129:3: warning: type 'DATA_TYPE' violates the C++ One Definition Rule [-Wodr]
  129 | } DATA_TYPE;
      |   ^
libSACenc/src/sacenc_nlc_enc.h:120:3: note: an enum with different number of values is defined in another translation unit
  120 | } DATA_TYPE;
      |   ^
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Feb 29, 2024
ODR violations and no progress on upstream bug.

Bug: mstorsjo/fdk-aac#156
Closes: https://bugs.gentoo.org/885355
Signed-off-by: Sam James <sam@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant