public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30428]  New: vector float | vector float is accepted
@ 2007-01-10 20:54 pinskia at gcc dot gnu dot org
  2007-07-09  8:20 ` [Bug c/30428] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-10 20:54 UTC (permalink / raw)
  To: gcc-bugs

Both the C and C++ front-end accept this:
#define vector __attribute__((vector_size(16) ))

vector float a;
vector float b;

int f(void)
{
 a =  a | b;
}

-------------------
xor and bitwise and is effected too.


-- 
           Summary: vector float | vector float is accepted
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
@ 2007-07-09  8:20 ` pinskia at gcc dot gnu dot org
  2007-07-09  8:24 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-09  8:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-07-09 08:19 -------
Here is a patch for the C front-end:
Index: c-typeck.c
===================================================================
--- c-typeck.c  (revision 126424)
+++ c-typeck.c  (working copy)
@@ -7881,7 +7898,9 @@
     case BIT_XOR_EXPR:
       if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
        shorten = -1;
-      else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+      else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+              && !VECTOR_FLOAT_TYPE_P (type0)
+              && !VECTOR_FLOAT_TYPE_P (type1))
        common = 1;
       break;



-- 


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
  2007-07-09  8:20 ` [Bug c/30428] " pinskia at gcc dot gnu dot org
@ 2007-07-09  8:24 ` pinskia at gcc dot gnu dot org
  2007-08-13 20:17 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-07-09  8:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-07-09 08:24 -------
And one for the C++ front-end:
Index: typeck.c
===================================================================
--- typeck.c    (revision 126424)
+++ typeck.c    (working copy)
@@ -3213,7 +3213,9 @@
     case BIT_IOR_EXPR:
     case BIT_XOR_EXPR:
       if ((code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
-         || (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE))
+         || (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+             && !VECTOR_FLOAT_TYPE_P (type0)
+             && !VECTOR_FLOAT_TYPE_P (type1)))
        shorten = -1;
       break;



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-09 08:24:03
               date|                            |


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
  2007-07-09  8:20 ` [Bug c/30428] " pinskia at gcc dot gnu dot org
  2007-07-09  8:24 ` pinskia at gcc dot gnu dot org
@ 2007-08-13 20:17 ` pinskia at gcc dot gnu dot org
  2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-13 20:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-08-13 20:17 -------
I am testing these patches right now.


-- 


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
@ 2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
  2007-08-23 11:02 ` tbptbp at gmail dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-14  9:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-08-14 09:25 -------
Subject: Bug 30428

Author: pinskia
Date: Tue Aug 14 09:24:26 2007
New Revision: 127477

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127477
Log:
2007-08-14  Andrew Pinski  <pinskia@gmail.com>

        PR c/30428
        * c-typeck.c (build_binary_op): Disallow vector float types with
        BIT_IOR_EXPR, BIT_AND_EXPR, and BIT_XOR_EXPR.

2007-08-14  Andrew Pinski  <pinskia@gmail.com>

        PR c++/30428
        * typeck.c (build_binary_op): Disallow vector float types with
        BIT_IOR_EXPR, BIT_AND_EXPR, and BIT_XOR_EXPR.

2007-08-14  Andrew Pinski  <pinskia@gmail.com>

        PR c/30428
        * gcc.dg/vector-2.c: New test.

        PR c++/30428
        * g++.dg/ext/vector8.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/ext/vector8.C
    trunk/gcc/testsuite/gcc.dg/vector-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-08-13 20:17 ` pinskia at gcc dot gnu dot org
@ 2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
  2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-14  9:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-08-14 09:25 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
@ 2007-08-23 11:02 ` tbptbp at gmail dot com
  2007-08-23 18:31 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tbptbp at gmail dot com @ 2007-08-23 11:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tbptbp at gmail dot com  2007-08-23 11:01 -------
(In reply to comment #5)
> Fixed.
Please fix the extension documentation accordingly.


-- 

tbptbp at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tbptbp at gmail dot com


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-08-23 11:02 ` tbptbp at gmail dot com
@ 2007-08-23 18:31 ` pinskia at gcc dot gnu dot org
  2007-08-23 18:46 ` tbptbp at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-23 18:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2007-08-23 18:31 -------
(In reply to comment #6)
> Please fix the extension documentation accordingly.

The documentation already says:
The operations behave like C++ valarrays. Addition is defined as the addition
of the corresponding elements of the operands. 

So what is "float | float"?


-- 


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-08-23 18:31 ` pinskia at gcc dot gnu dot org
@ 2007-08-23 18:46 ` tbptbp at gmail dot com
  2007-08-23 18:49 ` pinskia at gmail dot com
  2007-08-23 19:42 ` tbptbp at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: tbptbp at gmail dot com @ 2007-08-23 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from tbptbp at gmail dot com  2007-08-23 18:45 -------
Subject: Re:  vector float | vector float is accepted

On 23 Aug 2007 18:31:25 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
> ------- Comment #7 from pinskia at gcc dot gnu dot org  2007-08-23 18:31 -------
> (In reply to comment #6)
> > Please fix the extension documentation accordingly.
>
> The documentation already says:
> The operations behave like C++ valarrays. Addition is defined as the addition
> of the corresponding elements of the operands.
"All the basic integer types can be used as base types, both as signed
and as unsigned: char, short, int, long, long long. In addition, float
and double can be used to build floating-point vector types."
"Currently, GCC will allow using the following operators on these
types: +, -, *, /, unary minus, ^, |, &, ~."
Your patch and documentation conflict . Fix either, at your convenience.


-- 


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-08-23 18:46 ` tbptbp at gmail dot com
@ 2007-08-23 18:49 ` pinskia at gmail dot com
  2007-08-23 19:42 ` tbptbp at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gmail dot com @ 2007-08-23 18:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gmail dot com  2007-08-23 18:49 -------
Subject: Re:  vector float | vector float is accepted

On 23 Aug 2007 18:45:47 -0000, tbptbp at gmail dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
> Your patch and documentation conflict . Fix either, at your convenience.

Read the next line.  That is where my quote is from.  Please read the
whole section before commenting.  Because in fact before my patch, the
documentation did not match the implementation.

Now I am going to say this documentation needs help but that is a
different issue.  Right after my patch, the documentation now follows
the implementation.

-- Pinski


-- 


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


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

* [Bug c/30428] vector float | vector float is accepted
  2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-08-23 18:49 ` pinskia at gmail dot com
@ 2007-08-23 19:42 ` tbptbp at gmail dot com
  9 siblings, 0 replies; 11+ messages in thread
From: tbptbp at gmail dot com @ 2007-08-23 19:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from tbptbp at gmail dot com  2007-08-23 19:42 -------
Subject: Re:  vector float | vector float is accepted

On 23 Aug 2007 18:49:22 -0000, pinskia at gmail dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
> Read the next line.  That is where my quote is from.  Please read the
> whole section before commenting.  Because in fact before my patch, the
> documentation did not match the implementation.
"The operations behave like C++ valarrays. Addition is defined as the
addition of the corresponding elements of the operands. For example,
in the code below...
Subtraction, multiplication, division, and the logical operations
operate in a similar manner."

It's clearly and explicitly stated that
a) float is a legit underlying type
b) operators +, -, *, /, unary minus, ^, |, &, ~ are allowed
c) all those operators work the same way as the described piecewise addition

Do you expect anyone to read into the vague "behave like C++
valarrays" an embargo on "float | float"? I mean, if those vectors are
valarrays where is, say, the operator[]?

But i understand that under your rather peculiar interpretation
everything's fine. I will gladly move along.


-- 


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


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

end of thread, other threads:[~2007-08-23 19:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-10 20:54 [Bug c/30428] New: vector float | vector float is accepted pinskia at gcc dot gnu dot org
2007-07-09  8:20 ` [Bug c/30428] " pinskia at gcc dot gnu dot org
2007-07-09  8:24 ` pinskia at gcc dot gnu dot org
2007-08-13 20:17 ` pinskia at gcc dot gnu dot org
2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
2007-08-14  9:25 ` pinskia at gcc dot gnu dot org
2007-08-23 11:02 ` tbptbp at gmail dot com
2007-08-23 18:31 ` pinskia at gcc dot gnu dot org
2007-08-23 18:46 ` tbptbp at gmail dot com
2007-08-23 18:49 ` pinskia at gmail dot com
2007-08-23 19:42 ` tbptbp at gmail dot com

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