public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35758]  New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
@ 2008-03-29 18:45 pinskia at gcc dot gnu dot org
  2008-03-29 18:46 ` [Bug c++/35758] " pinskia at gcc dot gnu dot org
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-29 18:45 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

The following testcase used to work in 4.1.1 but no longer does:

#define vector __attribute__((vector_size(16) ))
template<int INDEX>
vector signed int MyFunction(vector float value)  {}

template<int>
void MyFunction(float ){}

int main()
{
    vector float myVector;
    float myFloat;
    MyFunction<1>(myVector);
    MyFunction<1>(myFloat);
}

---- CUT ----
We get:
vector14.C: In function ‘int main()’:
vector14.C:12: error: no matching function for call to ‘MyFunction(float
__vector__&)’
vector14.C:13: error: call of overloaded ‘MyFunction(float&)’ is ambiguous
vector14.C:3: note: candidates are: int MyFunction(float) [with int INDEX = 1]
vector14.C:6: note:                 void MyFunction(float) [with int
<anonymous> = 1]


-- 
           Summary: [4.3/4.4 Regression] vector_size attribute lost in
                    function arguments for templates
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: blocker
          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=35758


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
@ 2008-03-29 18:46 ` pinskia at gcc dot gnu dot org
  2008-03-29 18:47 ` pinskia at gcc dot gnu dot org
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-29 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-03-29 18:45 -------
This is caused by the delaying of vector_size attribute inside templates.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org
   Target Milestone|---                         |4.3.1


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
  2008-03-29 18:46 ` [Bug c++/35758] " pinskia at gcc dot gnu dot org
@ 2008-03-29 18:47 ` pinskia at gcc dot gnu dot org
  2008-03-29 18:48 ` pinskia at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-29 18:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-03-29 18:46 -------
This blocks me from even thinking about updating the PS3 toolchain to 4.3.0.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
  2008-03-29 18:46 ` [Bug c++/35758] " pinskia at gcc dot gnu dot org
  2008-03-29 18:47 ` pinskia at gcc dot gnu dot org
@ 2008-03-29 18:48 ` pinskia at gcc dot gnu dot org
  2008-03-29 18:50 ` pinskia at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-29 18:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-03-29 18:47 -------
This is related to PR 27433 and I bet fixing this one will also fix that one.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-03-29 18:48 ` pinskia at gcc dot gnu dot org
@ 2008-03-29 18:50 ` pinskia at gcc dot gnu dot org
  2008-03-29 18:56 ` rguenth at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-29 18:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-03-29 18:49 -------
It worked with "4.3.0 20070623" and "4.2.0 20061019".


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-03-29 18:50 ` pinskia at gcc dot gnu dot org
@ 2008-03-29 18:56 ` rguenth at gcc dot gnu dot org
  2008-03-31  0:17 ` pinskia at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-29 18:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-03-29 18:55 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.3.0
      Known to work|                            |4.2.3
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-29 18:55:45
               date|                            |


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-03-29 18:56 ` rguenth at gcc dot gnu dot org
@ 2008-03-31  0:17 ` pinskia at gcc dot gnu dot org
  2008-03-31  0:19 ` pinskia at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-31  0:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-03-31 00:16 -------
So what is happening is we are not applying the attribute while doing overload
resolution so we reject the template function then.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-03-31  0:17 ` pinskia at gcc dot gnu dot org
@ 2008-03-31  0:19 ` pinskia at gcc dot gnu dot org
  2008-03-31 11:11 ` jakub at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-31  0:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2008-03-31 00:18 -------
That being said, I think fn_type_unification should apply the attributes but I
don't know/understand the template part of the C++ front-end.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-03-31  0:19 ` pinskia at gcc dot gnu dot org
@ 2008-03-31 11:11 ` jakub at gcc dot gnu dot org
  2008-04-01 13:32 ` jakub at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-03-31 11:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2008-03-31 11:11 -------
I think this shows that "vector_size" attribute can't be a late template
attribute whenever processing_template_decl, it can be only a late template
attribute if the decl is actually type or value dependent.
So I believe we need to remove the vector_size special case from
is_late_template_attribute, but then either something like the
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01020.html (second patch)
hack to reconstruct the types, or use a langhook in
handle_vector_size_attribute
for reconstruct_complex_type (defaulting to tree.c reconstruct_complex_type
everywhere but in C++).


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-03-31 11:11 ` jakub at gcc dot gnu dot org
@ 2008-04-01 13:32 ` jakub at gcc dot gnu dot org
  2008-04-03 10:24 ` jakub at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-01 13:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jakub at gcc dot gnu dot org  2008-04-01 13:31 -------
Testing a patch with a langhook.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-03-29 18:55:45         |2008-04-01 13:31:20
               date|                            |


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-04-01 13:32 ` jakub at gcc dot gnu dot org
@ 2008-04-03 10:24 ` jakub at gcc dot gnu dot org
  2008-04-03 11:29 ` jakub at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-03 10:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jakub at gcc dot gnu dot org  2008-04-03 10:23 -------
See http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00177.html
for details.
I guess before moving further along with this, attributes for parameter packs
should be decided upon.  Do we want to allow them at all?  What actually will
they mean, when they in fact change the type?

#define vector __attribute__((__vector_size__ (16)))

template <typename... T> void foo (int x, vector T... y) { }
void bar (vector long a, vector double b, vector long c, vector double d)
{
  foo<long, double> (5, a, b, c, d);
  foo<long, double, long, double> (6, a, b, c, d);
  foo<long, double> (7, 17, 18.0, 19L, 20.0);
}
ATM g++ will grok just the last foo call (and incorrectly, as the foo function
will expect to get int and 4 vectors as arguments, while the caller passes 5
scalars).


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dgregor at gcc dot gnu dot
                   |                            |org
         AssignedTo|jakub at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-04-03 10:24 ` jakub at gcc dot gnu dot org
@ 2008-04-03 11:29 ` jakub at gcc dot gnu dot org
  2008-04-04 18:11 ` jason at redhat dot com
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-03 11:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jakub at gcc dot gnu dot org  2008-04-03 11:28 -------
Actually, to clarify #c10, attributes on parameter packs just make things
harder on the compiler side, but even in C++98 the same issue is present:
#define vector __attribute__((__vector_size__ (16)))

template <typename T> void foo (int x, vector T y) { }
void bar (vector long a, vector double b)
{
  foo<long> (5, a);
  foo (5, b);
}

If we apply late template attributes in fn_type_unification, then the foo<long>
(5, a); call will work as expected, but should the second call deduce template
parameter double or vector double?  If the latter (which would be weird), then
it will fail, because vector_size attribute can't be applied to a VECTOR_TYPE.

Are there any attributes other than vector_size which affect the decls
similarly?
If not, I'd say that the C++ FE should hardcode some knowledge about this
attribute, e.g. know that it applies to the type, so if
processing_template_decl
move them from DECL_ATTRIBUTES to corresponding type's TYPE_ATTRIBUTES (either
the parameter type such that it would be in TYPE_ARG_TYPES too, or for
FUNCTION_TYPE/METHOD_TYPE stick it into return type's TYPE_ATTRIBUTES).
And in type_unification_real take it into account.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2008-04-03 11:29 ` jakub at gcc dot gnu dot org
@ 2008-04-04 18:11 ` jason at redhat dot com
  2008-04-04 18:18 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at redhat dot com @ 2008-04-04 18:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from jason at redhat dot com  2008-04-04 18:10 -------
Subject: Re:  [4.3/4.4 Regression] vector_size attribute lost
 in function arguments for templates

jakub at gcc dot gnu dot org wrote:
> Actually, to clarify #c10, attributes on parameter packs just make things
> harder on the compiler side, but even in C++98 the same issue is present:
> #define vector __attribute__((__vector_size__ (16)))
> 
> template <typename T> void foo (int x, vector T y) { }
> void bar (vector long a, vector double b)
> {
>   foo<long> (5, a);
>   foo (5, b);
> }

This functionality seems desirable, but cannot be considered a regression.

> Are there any attributes other than vector_size which affect the decls
> similarly?

I don't think so.

> If not, I'd say that the C++ FE should hardcode some knowledge about this
> attribute, e.g. know that it applies to the type, so if
> processing_template_decl
> move them from DECL_ATTRIBUTES to corresponding type's TYPE_ATTRIBUTES (either
> the parameter type such that it would be in TYPE_ARG_TYPES too, or for
> FUNCTION_TYPE/METHOD_TYPE stick it into return type's TYPE_ATTRIBUTES).
> And in type_unification_real take it into account.

This makes sense to me.  Though I think that if we just push the 
attribute down to the type that it actually modifies, we don't have to 
think about TYPE_ARG_TYPES.  That should also avoid the need for 
reconstruct_complex_type.

Jason


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2008-04-04 18:11 ` jason at redhat dot com
@ 2008-04-04 18:18 ` pinskia at gcc dot gnu dot org
  2008-04-04 19:03 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-04 18:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from pinskia at gcc dot gnu dot org  2008-04-04 18:18 -------
We also need to make sure the target specific attribute __altivec__ (powerPC)
and __spu_vector__ (SPU) works correctly just as vector_size works.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2008-04-04 18:18 ` pinskia at gcc dot gnu dot org
@ 2008-04-04 19:03 ` pinskia at gcc dot gnu dot org
  2008-04-07 10:53 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-04-04 19:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from pinskia at gcc dot gnu dot org  2008-04-04 19:02 -------
Hmm, for some reason __spu_vector__ works correctly for my testcase but not
__altivec__; I have not looked into why though.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2008-04-04 19:03 ` pinskia at gcc dot gnu dot org
@ 2008-04-07 10:53 ` jakub at gcc dot gnu dot org
  2008-04-22  9:49 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-07 10:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from jakub at gcc dot gnu dot org  2008-04-07 10:52 -------
I've tried the first step - putting the attributes that require type to
TYPE_ATTRIBUTES rather than DECL_ATTRIBUTES, see below.
Unfortunately tsubst doesn't call apply_late_template_attributes in that case
(the only place which calls it on TYPE_ATTRIBUTES is instantiate_class_template
on the fn type).  So I'm giving up on this.

The patch was:
--- decl2.c.jj  2008-03-25 23:31:25.000000000 +0100
+++ decl2.c     2008-04-07 12:40:19.000000000 +0200
@@ -1041,12 +1041,13 @@ is_late_template_attribute (tree attr, t
    at instantiation time.  */

 static tree
-splice_template_attributes (tree *attr_p, tree decl)
+splice_template_attributes (tree *attr_p, tree *type_attr_p, tree decl)
 {
   tree *p = attr_p;
   tree late_attrs = NULL_TREE;
   tree *q = &late_attrs;

+  *type_attr_p = NULL_TREE;
   if (!p)
     return NULL_TREE;

@@ -1054,11 +1055,28 @@ splice_template_attributes (tree *attr_p
     {
       if (is_late_template_attribute (*p, decl))
        {
-         ATTR_IS_DEPENDENT (*p) = 1;
-         *q = *p;
+         const struct attribute_spec *spec
+           = lookup_attribute_spec (TREE_PURPOSE (*p));
+
+         /* Put attributes that require type into TYPE_ATTRIBUTES,
+            rather than DECL_ATTRIBUTES.  */
+         if (DECL_P (decl)
+             && spec
+             && spec->type_required
+             && !CLASS_TYPE_P (TREE_TYPE (decl)))
+           {
+             *type_attr_p = *p;
+             type_attr_p = &TREE_CHAIN (*type_attr_p);
+             *type_attr_p = NULL_TREE;
+           }
+         else
+           {
+             ATTR_IS_DEPENDENT (*p) = 1;
+             *q = *p;
+             q = &TREE_CHAIN (*q);
+             *q = NULL_TREE;
+           }
          *p = TREE_CHAIN (*p);
-         q = &TREE_CHAIN (*q);
-         *q = NULL_TREE;
        }
       else
        p = &TREE_CHAIN (*p);
@@ -1071,12 +1089,17 @@ splice_template_attributes (tree *attr_p
    DECL_P.  */

 static void
-save_template_attributes (tree *attr_p, tree *decl_p)
+save_template_attributes (tree *attr_p, tree *decl_p, int flags)
 {
-  tree late_attrs = splice_template_attributes (attr_p, *decl_p);
+  tree type_attrs;
+  tree late_attrs = splice_template_attributes (attr_p, &type_attrs, *decl_p);
   tree *q;
   tree old_attrs = NULL_TREE;

+  if (type_attrs)
+    cplus_decl_attributes (&TREE_TYPE (*decl_p), type_attrs,
+                          flags & ~(int) ATTR_FLAG_TYPE_IN_PLACE);
+
   if (!late_attrs)
     return;

@@ -1135,7 +1158,7 @@ cplus_decl_attributes (tree *decl, tree 
       if (check_for_bare_parameter_packs (attributes))
        return;

-      save_template_attributes (&attributes, decl);
+      save_template_attributes (&attributes, decl, flags);
       if (attributes == NULL_TREE)
        return;
     }


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2008-04-07 10:53 ` jakub at gcc dot gnu dot org
@ 2008-04-22  9:49 ` jakub at gcc dot gnu dot org
  2008-04-24 16:31 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-22  9:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jakub at gcc dot gnu dot org  2008-04-22 09:48 -------
Especially for 4.3.x getting rid of the
"HACK. GROSS. This is absolutely disgusting."
might not be something desirable for a stable branch.  We've lived with this
gross absolutely disgusting hack for more than 7 years, and the:
http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00630.html
patch doesn't make the hack IMHO any more disgusting than it was till now,
but fixes an important regression.


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (15 preceding siblings ...)
  2008-04-22  9:49 ` jakub at gcc dot gnu dot org
@ 2008-04-24 16:31 ` jakub at gcc dot gnu dot org
  2008-04-24 16:33 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-24 16:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from jakub at gcc dot gnu dot org  2008-04-24 16:30 -------
Subject: Bug 35758

Author: jakub
Date: Thu Apr 24 16:29:40 2008
New Revision: 134639

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134639
Log:
        PR c++/35758
        * c-common.c (handle_vector_size_attribute): Call
        lang_hooks.types.reconstruct_complex_type instead of
        reconstruct_complex_type.
        * config/rs6000/rs6000.c (rs6000_handle_altivec_attribute): Likewise.
        * config/spu/spu.c (spu_handle_vector_attribute): Likewise.
        * langhooks.h (struct lang_hooks_for_types): Add
        reconstruct_complex_type hook.
        * langhooks-def.h (LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE): Define.
        (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it.

        * cp-tree.h (cp_reconstruct_complex_type): New prototype.
        * cp-objcp-common.h (LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE): Define.
        * decl2.c (is_late_template_attribute): Only make vector_size
        late tmpl attribute if argument is type or value dependent.
        (cp_reconstruct_complex_type): New function.

        * g++.dg/ext/vector14.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/vector14.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/config/spu/spu.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-objcp-common.h
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl2.c
    trunk/gcc/langhooks-def.h
    trunk/gcc/langhooks.h
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/35758] [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (16 preceding siblings ...)
  2008-04-24 16:31 ` jakub at gcc dot gnu dot org
@ 2008-04-24 16:33 ` jakub at gcc dot gnu dot org
  2008-04-24 18:49 ` [Bug c++/35758] " jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-24 16:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from jakub at gcc dot gnu dot org  2008-04-24 16:32 -------
Subject: Bug 35758

Author: jakub
Date: Thu Apr 24 16:31:59 2008
New Revision: 134640

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134640
Log:
        PR c++/35758
        * c-common.c (handle_vector_size_attribute): Call
        lang_hooks.types.reconstruct_complex_type instead of
        reconstruct_complex_type.
        * config/rs6000/rs6000.c (rs6000_handle_altivec_attribute): Likewise.
        * config/spu/spu.c (spu_handle_vector_attribute): Likewise.
        * langhooks.h (struct lang_hooks_for_types): Add
        reconstruct_complex_type hook.
        * langhooks-def.h (LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE): Define.
        (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it.

        * cp-tree.h (cp_reconstruct_complex_type): New prototype.
        * cp-objcp-common.h (LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE): Define.
        * decl2.c (is_late_template_attribute): Only make vector_size
        late tmpl attribute if argument is type or value dependent.
        (cp_reconstruct_complex_type): New function.

        * g++.dg/ext/vector14.C: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/ext/vector14.C
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/c-common.c
    branches/gcc-4_3-branch/gcc/config/rs6000/rs6000.c
    branches/gcc-4_3-branch/gcc/config/spu/spu.c
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/cp-objcp-common.h
    branches/gcc-4_3-branch/gcc/cp/cp-tree.h
    branches/gcc-4_3-branch/gcc/cp/decl2.c
    branches/gcc-4_3-branch/gcc/langhooks-def.h
    branches/gcc-4_3-branch/gcc/langhooks.h
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/35758] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (17 preceding siblings ...)
  2008-04-24 16:33 ` jakub at gcc dot gnu dot org
@ 2008-04-24 18:49 ` jakub at gcc dot gnu dot org
  2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-04-24 18:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from jakub at gcc dot gnu dot org  2008-04-24 18:48 -------
With the changes checked in, I believe there is no regression anymore, but
using vector_size, altivec or spu_vector attributes on template parameters will
still do bad and unexpected things.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.3/4.4 Regression]        |vector_size attribute lost
                   |vector_size attribute lost  |in function arguments for
                   |in function arguments for   |templates
                   |templates                   |


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


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

* [Bug c++/35758] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (18 preceding siblings ...)
  2008-04-24 18:49 ` [Bug c++/35758] " jakub at gcc dot gnu dot org
@ 2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
  2008-07-04 19:42 ` jsm28 at gcc dot gnu dot org
  2008-11-14 16:39 ` jason at gcc dot gnu dot org
  21 siblings, 0 replies; 23+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-06-06 15:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from rguenth at gcc dot gnu dot org  2008-06-06 14:59 -------
4.3.1 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.1                       |4.3.2


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


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

* [Bug c++/35758] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (19 preceding siblings ...)
  2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
@ 2008-07-04 19:42 ` jsm28 at gcc dot gnu dot org
  2008-11-14 16:39 ` jason at gcc dot gnu dot org
  21 siblings, 0 replies; 23+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 19:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from jsm28 at gcc dot gnu dot org  2008-07-04 19:42 -------
Comment says "no regression", removing milestone.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.2                       |---


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


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

* [Bug c++/35758] vector_size attribute lost in function arguments for templates
  2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
                   ` (20 preceding siblings ...)
  2008-07-04 19:42 ` jsm28 at gcc dot gnu dot org
@ 2008-11-14 16:39 ` jason at gcc dot gnu dot org
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-14 16:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from jason at gcc dot gnu dot org  2008-11-14 16:38 -------
Downgrading priority/severity since this is no longer a regression.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |normal
           Priority|P1                          |P3


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


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

end of thread, other threads:[~2008-11-14 16:39 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-29 18:45 [Bug c++/35758] New: [4.3/4.4 Regression] vector_size attribute lost in function arguments for templates pinskia at gcc dot gnu dot org
2008-03-29 18:46 ` [Bug c++/35758] " pinskia at gcc dot gnu dot org
2008-03-29 18:47 ` pinskia at gcc dot gnu dot org
2008-03-29 18:48 ` pinskia at gcc dot gnu dot org
2008-03-29 18:50 ` pinskia at gcc dot gnu dot org
2008-03-29 18:56 ` rguenth at gcc dot gnu dot org
2008-03-31  0:17 ` pinskia at gcc dot gnu dot org
2008-03-31  0:19 ` pinskia at gcc dot gnu dot org
2008-03-31 11:11 ` jakub at gcc dot gnu dot org
2008-04-01 13:32 ` jakub at gcc dot gnu dot org
2008-04-03 10:24 ` jakub at gcc dot gnu dot org
2008-04-03 11:29 ` jakub at gcc dot gnu dot org
2008-04-04 18:11 ` jason at redhat dot com
2008-04-04 18:18 ` pinskia at gcc dot gnu dot org
2008-04-04 19:03 ` pinskia at gcc dot gnu dot org
2008-04-07 10:53 ` jakub at gcc dot gnu dot org
2008-04-22  9:49 ` jakub at gcc dot gnu dot org
2008-04-24 16:31 ` jakub at gcc dot gnu dot org
2008-04-24 16:33 ` jakub at gcc dot gnu dot org
2008-04-24 18:49 ` [Bug c++/35758] " jakub at gcc dot gnu dot org
2008-06-06 15:04 ` rguenth at gcc dot gnu dot org
2008-07-04 19:42 ` jsm28 at gcc dot gnu dot org
2008-11-14 16:39 ` jason at gcc dot gnu 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).