public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/64554] using _mm_clmulepi64_si128 doesn't error with -O0
Date: Mon, 12 Jan 2015 10:05:00 -0000	[thread overview]
Message-ID: <bug-64554-4-0cdOU68EkN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64554-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64554

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> (In reply to charles from comment #5)
> > No you're right.
> > 
> > I could add, though, that the compiler should have said something.
> > 
> > Also, why did it compile just fine with -O0?
> 
> Sounds like a bug (we should error immediately here IMHO).  Probably
> needs to annotate the CIF codes with whether this is "fatal" (won't
> change with other inlining, IPA or LTO).
> 
> OTOH the headers are also poorly designed to trigger this kind of error.
> 
> Maybe we want to support __attribute__((always_inline("ISA not enabled")))
> instead to be able to print a custom error message?

The difference is that for __OPTIMIZE__   _mm_clmulepi64_si128 is implemented
as always_inline function (surrounded by #pragma GCC target("pclmul")), so for
-O1+ the inlining error is expected, such function can't be inlined into the
current function, and always_inline mandates that it is inlined (without
always_inline it would simply not be inlined, and the out of line
_mm_clmulepi64_si128 would use the pclmul ISA, while the caller would not).

For -O0, this is implemented using a macro, since the last argument must be a
constant, and the reason you get no error is that the function is const and you
don't use the result, so it is DCEd.
If you actually use the result (at -O0 it is enough to store it into say
__m128i c = _mm_clmulepi64_si128(a, b, 1); , for -O1 you'd need something
better, store into volatile var, or global var or otherwise make sure it isn't
DCEd), then you get this diagnosed:

/tmp/z.c: In function ‘main’:
/tmp/z.c:6:11: error: ‘__builtin_ia32_pclmulqdq128’ needs isa option -m32
-mpclmul
   __m128i c = _mm_clmulepi64_si128(a, b, 1);
           ^

So I don't see any bug on the gcc side here.
>From gcc-bugs-return-472775-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jan 12 10:10:57 2015
Return-Path: <gcc-bugs-return-472775-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7619 invoked by alias); 12 Jan 2015 10:10:56 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 7526 invoked by uid 48); 12 Jan 2015 10:10:51 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/64535] Emergency buffer for exception allocation too small
Date: Mon, 12 Jan 2015 10:10:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64535-4-wqB0sXBlBs@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64535-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64535-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg00769.txt.bz2
Content-length: 350

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd535

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If all allocations from the emergency pool are at least
sizeof(__cxa_refcounted_exception) long (or what is the minimum), then trying
to split the memory into smaller chunks (down to sizeof(free_entry)) might be
counter-productive.


      parent reply	other threads:[~2015-01-12 10:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 21:32 [Bug c/64554] New: _mm_clmulepi64_si128 doesn't compile with -O2 charles at kde dot org
2015-01-09 21:37 ` [Bug target/64554] " pinskia at gcc dot gnu.org
2015-01-09 21:43 ` charles at kde dot org
2015-01-09 21:53 ` jakub at gcc dot gnu.org
2015-01-09 21:55 ` charles at kde dot org
2015-01-12  9:41 ` [Bug middle-end/64554] using _mm_clmulepi64_si128 doesn't error with -O0 rguenth at gcc dot gnu.org
2015-01-12 10:05 ` jakub at gcc dot gnu.org [this message]

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-64554-4-0cdOU68EkN@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).