biotrump / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

cpuid build error on windows bots #512

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
source/cpu_id.cc:290:7: error: variable 'cpu_info' is used uninitialized 
whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

  if (TestEnv("LIBYUV_DISABLE_ASM")) {

      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/cpu_id.cc:293:15: note: uninitialized use occurs here

  cpu_info_ = cpu_info;

              ^~~~~~~~

source/cpu_id.cc:290:3: note: remove the 'if' if its condition is always true

  if (TestEnv("LIBYUV_DISABLE_ASM")) {

  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/cpu_id.cc:200:15: note: initialize the variable 'cpu_info' to silence 
this warning

  int cpu_info;

              ^

               = 0

1 error generated.

Original issue reported on code.google.com by fbarch...@chromium.org on 22 Oct 2015 at 9:39

GoogleCodeExporter commented 9 years ago
Switching to zero saves a byte per function call

saves 1 byte per call

Was
  00000074: A1 00 00 00 00     mov         eax,dword ptr [_cpu_info_]
  00000079: 83 F8 01           cmp         eax,1
  0000007C: 75 08              jne         00000086
  0000007E: E8 00 00 00 00     call        _InitCpuFlags
  00000086: A8 40              test        al,40h
  00000088: 74 21              je          000000AB

Now
  00000074: A1 00 00 00 00     mov         eax,dword ptr [_cpu_info_]
  00000079: 85 C0              test        eax,eax
  0000007B: 75 05              jne         00000082
  0000007D: E8 00 00 00 00     call        _InitCpuFlags
  00000082: A8 40              test        al,40h
  00000084: 75 0C              jne         00000092

Original comment by fbarch...@chromium.org on 24 Oct 2015 at 12:16