openh264 icon indicating copy to clipboard operation
openh264 copied to clipboard

2.1.1: compile time warnings

Open kloczek opened this issue 4 years ago • 8 comments

gcc 11.2.1 On the begging just summary metrics:

[tkloczko@barrel SPECS]$ rpmbuild -ba --with check --with failing_tests openh264.spec 2>&1 | grep -- \\[-W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
     32 -Wstrict-aliasing
     14 -Wmisleading-indentation
      3 -Wdangling-else

I would suggest that on the beggining warnings in tests/ can be for now ignored :)

[tkloczko@barrel SPECS]$ rpmbuild -ba --with check --with failing_tests openh264.spec 2>&1 | grep -- \\[-W
../codec/encoder/core/src/mv_pred.cpp:138:33: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/encoder/core/src/mv_pred.cpp:139:33: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:232:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:250:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:287:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:287:26: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:962:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:976:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:991:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:1000:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:794:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:794:30: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:837:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:837:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:881:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:881:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:1035:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:1035:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1414:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1472:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1528:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1694:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/decode_slice.cpp:1374:52: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/decode_slice.cpp:2485:54: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:46:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:47:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:48:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:52:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:338:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:356:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:390:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:390:26: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_ParseSyntax.cpp:284:11: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
../test/decoder/DecUT_ParseSyntax.cpp:350:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
../test/decoder/DecUT_ParseSyntax.cpp:357:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
../test/decoder/DecUT_IntraPrediction.cpp:401:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:401:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:401:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:401:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:401:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:401:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:401:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:537:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:537:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:537:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:537:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:537:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:537:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
../test/decoder/DecUT_IntraPrediction.cpp:537:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]

kloczek avatar Sep 12 '21 21:09 kloczek

is it still existing in latest version? There should be no issues with default build/link options in CI.

huili2 avatar Dec 06 '22 01:12 huili2

Just checked 2.3.1

[tkloczko@pers-jacek SPECS]$ rpmbuild -ba openh264.spec 2>&1 | grep -- \\[-W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
     32 -Wstrict-aliasing
      5 -Wmaybe-uninitialized
[tkloczko@pers-jacek SPECS]$ rpmbuild -ba openh264.spec 2>&1 | grep -- \\[-W
../codec/encoder/core/src/mv_pred.cpp:138:33: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/encoder/core/src/mv_pred.cpp:139:33: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:232:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:250:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:287:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:287:26: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:962:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:976:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:991:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/mv_pred.cpp:1000:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:795:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:795:30: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:839:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:839:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:884:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:884:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:1039:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cabac.cpp:1039:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1415:11: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1474:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1531:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/parse_mb_syn_cavlc.cpp:1698:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/decode_slice.cpp:1374:52: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../codec/decoder/core/src/decode_slice.cpp:2485:54: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:46:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:47:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:48:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:52:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:338:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:356:32: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:390:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:390:26: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../test/decoder/DecUT_PredMv.cpp:103:18: warning: ‘sAncMvPred’ may be used uninitialized [-Wmaybe-uninitialized]
../test/decoder/DecUT_PredMv.cpp:109:18: warning: ‘sAncMvPred’ may be used uninitialized [-Wmaybe-uninitialized]
../test/decoder/DecUT_PredMv.cpp:79:18: warning: ‘sAncMvPred’ may be used uninitialized [-Wmaybe-uninitialized]
../test/decoder/DecUT_PredMv.cpp:85:12: warning: ‘sAncMvPred’ may be used uninitialized [-Wmaybe-uninitialized]
../test/decoder/DecUT_PredMv.cpp:88:20: warning: ‘sAncMvPred’ may be used uninitialized [-Wmaybe-uninitialized]

kloczek avatar Dec 06 '22 11:12 kloczek

Thanks for the prompt information and verification. For codec operations, it is very effective to do some "non-strict-aliasing" copy as in above MV copy. So this warning type is not required in our compiler options. For the final warnings, it is actually false warning from the codec. We can ignore it.

huili2 avatar Dec 07 '22 01:12 huili2

OK. What about iuse some pragmas to disable those warnings? 🤔

kloczek avatar Dec 07 '22 02:12 kloczek

actually in build/platform-linux.mk, it already has CFLAGS += -fno-strict-aliasing. If there's still something missed, we could consider add this option.

huili2 avatar Dec 07 '22 03:12 huili2

I'm uning meson to build openh264.

kloczek avatar Dec 07 '22 10:12 kloczek

hi @kloczek which build script did you pick up? the -Wno-strict-aliasing has been included in the default meson build script. could you please share the details? or how did you compile the openh264?

GuangweiWang avatar Dec 15 '22 07:12 GuangweiWang

Usually Im testing remove all -W flags (I forgot to mtion about that .. sorry). I would understand if it will be used -fno-strict-aliasing however disabling that exactly warnings is ually asking for troubles.

kloczek avatar Jan 19 '23 05:01 kloczek