[gcc r17-3008] i386: Fix up recent cpuinfo.h change for FEATURE_AVX10V2AUX

Jakub Jelinek via Gcc-cvs <[email protected]> Thu, 6 Aug 2026 08:46:10 +0000 (GMT)
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:a624395e547a722993c199e0dd37b47ce748c35c

commit r17-3008-ga624395e547a722993c199e0dd37b47ce748c35c
Author: Jakub Jelinek <[email protected]>
Date:   Thu Aug 6 10:42:57 2026 +0200

    i386: Fix up recent cpuinfo.h change for FEATURE_AVX10V2AUX
    
    The r17-2973 change broke
    +FAIL: gcc.target/i386/builtin_target.c (test for excess errors)
    +UNRESOLVED: gcc.target/i386/builtin_target.c compilation failed to produce executable
    Excess errors:
    .../common/config/i386/cpuinfo.h:1127:7: error: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    
    The following patch makes it valid C89 and cleans it up a little bit.
    
    2026-08-06  Jakub Jelinek  <[email protected]>
    
            * common/config/i386/cpuinfo.h (get_available_features): Make
            last change valid C89.  Formatting fix.

Diff:
---
 gcc/common/config/i386/cpuinfo.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h
index f4fd3dbfed04..fef8f90f94ce 100644
--- a/gcc/common/config/i386/cpuinfo.h
+++ b/gcc/common/config/i386/cpuinfo.h
@@ -1123,8 +1123,9 @@ get_available_features (struct __processor_model *cpu_model,
   /* Get Advanced Features at level 0x24 (eax = 0x24, ecx = 0).  */
   if (avx10_set && max_cpuid_level >= 0x24)
     {
-      __cpuid_count (0x24, 0, eax, ebx, ecx, edx);
-      unsigned int max_subleaf_level = eax;
+      unsigned int max_subleaf_level;
+
+      __cpuid_count (0x24, 0, max_subleaf_level, ebx, ecx, edx);
       version = ebx & 0xff;
       switch (version)
 	{
@@ -1138,7 +1139,7 @@ get_available_features (struct __processor_model *cpu_model,
 	  set_feature (FEATURE_AVX10_1);
 	  break;
 	}
-	if (max_subleaf_level>=1)
+      if (max_subleaf_level >= 1)
 	{
 	  __cpuid_count (0x24, 1, eax, ebx, ecx, edx);
 	  if (ecx & bit_AVX10V2AUX)