public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "luto at mit dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/55307] New: libgcc's __cpu_indicator_init does not check for avx correctly
Date: Tue, 13 Nov 2012 05:21:00 -0000	[thread overview]
Message-ID: <bug-55307-4@http.gcc.gnu.org/bugzilla/> (raw)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55307

             Bug #: 55307
           Summary: libgcc's __cpu_indicator_init does not check for avx
                    correctly
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: luto@mit.edu


[this is a libgcc bug, and I haven't tested it -- the test is a PITA.]

One might expect that __builtin_cpu_supports("avx") would only return true if
avx is usable.  Unfortunately, it returns true iff avx is implemented by the
cpu, regardless of whether it should be expected to work.  The code should
check for osxsave and then use xgetbv to see if ymm state is available.

This is more or less the same bug as glibc bug 13007 [1].  There's an intel
blog post on the subject at [2].  It's likely to result in crashes if old
kernels are run on new hardware.

Curiously, the code in gcc/testsuite/gcc.target/i386/avx-check.h appears
correct.  I suspect it's never been run with ymm state disabled.

[1] http://sourceware.org/bugzilla/show_bug.cgi?id=13007
[2] http://software.intel.com/en-us/blogs/2011/04/14/is-avx-enabled/


             reply	other threads:[~2012-11-13  5:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13  5:21 luto at mit dot edu [this message]
2012-11-13 14:55 ` [Bug target/55307] " hjl.tools at gmail dot com
2013-03-22 14:48 ` jakub at gcc dot gnu.org
2013-05-31 10:59 ` jakub at gcc dot gnu.org
2013-10-16  9:51 ` jakub at gcc dot gnu.org
2015-06-22 14:25 ` rguenth at gcc dot gnu.org
2015-08-19 17:04 ` noloader at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55307-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).