public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58422] New: vector shift operations work in C but not C++
@ 2013-09-14 21:11 gabriel at teuton dot org
  2013-09-14 21:42 ` [Bug c++/58422] " glisse at gcc dot gnu.org
  2013-09-14 21:56 ` gabriel at teuton dot org
  0 siblings, 2 replies; 3+ messages in thread
From: gabriel at teuton dot org @ 2013-09-14 21:11 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3901 bytes --]

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

            Bug ID: 58422
           Summary: vector shift operations work in C but not C++
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabriel at teuton dot org

When operating on vectors, the shift operations <<=, >>=, <<, and >> are
recognized in C but not C++.

#include <stdint.h>

typedef int32_t int32x4_t __attribute__((vector_size(16)));

int32x4_t apply_shift(int32x4_t arg)
{
    int32x4_t s = { 1, 1, 1, 1 };

    arg <<= 1;
    arg = arg << 1;
    arg <<= s;
    arg = arg << s;

    return arg;
}

$ g++ -c -o shift.o shift.cpp
shift.cpp: In function ‘int32x4_t apply_shift(int32x4_t)’:
shift.cpp:9:13: error: invalid operands of types ‘int32x4_t {aka __vector(4)
int}’ and ‘int’ to binary ‘operator<<’
shift.cpp:9:13: error:   in evaluation of ‘operator<<=(int32x4_t {aka
__vector(4) int}, int)’
shift.cpp:10:18: error: invalid operands of types ‘int32x4_t {aka __vector(4)
int}’ and ‘int’ to binary ‘operator<<’
shift.cpp:11:13: error: invalid operands of types ‘int32x4_t {aka __vector(4)
int}’ and ‘int32x4_t {aka __vector(4) int}’ to binary ‘operator<<’
shift.cpp:11:13: error:   in evaluation of ‘operator<<=(int32x4_t {aka
__vector(4) int}, int32x4_t {aka __vector(4) int})’
shift.cpp:12:18: error: invalid operands of types ‘int32x4_t {aka __vector(4)
int}’ and ‘int32x4_t {aka __vector(4) int}’ to binary ‘operator<<’

Works fine in C:
$ gcc -c -x c -o shift.o shift.cpp
(no error)

$ g++ --version | head -n 1
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
$ uname -m -p
x86_64 x86_64
>From gcc-bugs-return-429835-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 14 21:14:22 2013
Return-Path: <gcc-bugs-return-429835-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14440 invoked by alias); 14 Sep 2013 21:14:22 -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 14408 invoked by uid 48); 14 Sep 2013 21:14:19 -0000
From: "gabriel at teuton dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58422] vector shift operations work in C but not C++
Date: Sat, 14 Sep 2013 21:14:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: gabriel at teuton dot org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-58422-4-nNe696KKN5@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58422-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58422-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: 2013-09/txt/msg01075.txt.bz2
Content-length: 266

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX422

--- Comment #1 from Gabriel M. Beddingfield <gabriel at teuton dot org> ---
Created attachment 30823
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id0823&actioníit
example program demonstrating the problem.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/58422] vector shift operations work in C but not C++
  2013-09-14 21:11 [Bug c++/58422] New: vector shift operations work in C but not C++ gabriel at teuton dot org
@ 2013-09-14 21:42 ` glisse at gcc dot gnu.org
  2013-09-14 21:56 ` gabriel at teuton dot org
  1 sibling, 0 replies; 3+ messages in thread
From: glisse at gcc dot gnu.org @ 2013-09-14 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |glisse at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Already implemented in 4.8.

*** This bug has been marked as a duplicate of bug 54427 ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/58422] vector shift operations work in C but not C++
  2013-09-14 21:11 [Bug c++/58422] New: vector shift operations work in C but not C++ gabriel at teuton dot org
  2013-09-14 21:42 ` [Bug c++/58422] " glisse at gcc dot gnu.org
@ 2013-09-14 21:56 ` gabriel at teuton dot org
  1 sibling, 0 replies; 3+ messages in thread
From: gabriel at teuton dot org @ 2013-09-14 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Gabriel M. Beddingfield <gabriel at teuton dot org> ---
Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-14 21:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-14 21:11 [Bug c++/58422] New: vector shift operations work in C but not C++ gabriel at teuton dot org
2013-09-14 21:42 ` [Bug c++/58422] " glisse at gcc dot gnu.org
2013-09-14 21:56 ` gabriel at teuton dot org

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).