On Thu, Jul 18, 2024 at 09:34:14AM +0200, Uros Bizjak wrote:
> > > +      unsigned int ecx2 = 0, family = 0;
> 
> No need to initialize these two variables.

The function ignores __get_cpuid result, so at least the
FEAT1_REGISTER = 0; is needed before the first __get_cpuid.
Do you mean the ecx2 = 0 initialization is useless because
__get_cpuid (0, ...) on x86_64 will always succeed (especially
when __get_cpuid (1, ...) had to succeed otherwise FEAT1_REGISTER
would be zero)?
I guess that is true, but won't that cause -Wmaybe-uninitialized warnings?

I agree initializing family to 0 is not needed, but I don't understand
why it isn't just
      unsigned family = (eax >> 8) & 0x0f;
Though, guess even that might fail with -Wmaybe-uninitialized too, as
eax isn't unconditionally initialized.

        Jakub

Reply via email to