From: Uros Bizjak Date: Wed, 3 May 2017 20:00:50 +0000 (+0200) Subject: backport: re PR target/68491 (libgcc calls __get_cpuid with 0 level breaks on early... X-Git-Tag: releases/gcc-5.5.0~382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7eb5bd4eca2ff12d0fe4388704062ac0bf61ed2c;p=thirdparty%2Fgcc.git backport: re PR target/68491 (libgcc calls __get_cpuid with 0 level breaks on early 486) Backport from mainline 2017-05-01 Uros Bizjak PR target/68491 * config/i386/cpuid.h (__get_cpuid): Always return 0 when __get_cpuid_max returns 0. From-SVN: r247566 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b592996003ce..fa4ed943ddc9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-05-03 Uros Bizjak + + Backport from mainline + 2017-05-01 Uros Bizjak + + PR target/68491 + * config/i386/cpuid.h (__get_cpuid): Always return 0 when + __get_cpuid_max returns 0. + 2017-04-21 Christophe Lyon Backport from mainline diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h index 1ddc6e2e6a87..c7778d989f56 100644 --- a/gcc/config/i386/cpuid.h +++ b/gcc/config/i386/cpuid.h @@ -234,8 +234,9 @@ __get_cpuid (unsigned int __level, unsigned int *__ecx, unsigned int *__edx) { unsigned int __ext = __level & 0x80000000; + unsigned int __maxlevel = __get_cpuid_max (__ext, 0); - if (__get_cpuid_max (__ext, 0) < __level) + if (__maxlevel == 0 || __maxlevel < __level) return 0; __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);