public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32970]  New: C++ frontend can not handle vector pointer constant parameter
@ 2007-08-02 18:37 saliu at de dot ibm dot com
  2007-08-06 16:32 ` [Bug c++/32970] [4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: saliu at de dot ibm dot com @ 2007-08-02 18:37 UTC (permalink / raw)
  To: gcc-bugs

When compiling a function with parameter of a pointer to a vector constant 
type, the compiler calls a recursive function and is not able to get out. 

Concretely, in gcc/cp/mangle.c file, in function write_type:

  if (write_CV_qualifiers_for_type (type) > 0)
    /* If TYPE was CV-qualified, we just wrote the qualifiers; now
       mangle the unqualified type.  The recursive call is needed here
       since both the qualified and unqualified types are substitution
       candidates.  */
    write_type (TYPE_MAIN_VARIANT (type));

But TYPE_MAIN_VARIANT (type) has been set as type itself in gcc/tree.c 
function make_node_stat:
   case tcc_type:
        ...
      TYPE_MAIN_VARIANT (t) = t;

Therefor the write_type function runs into a dead recursion.

The bug was detected on spu, and the same error appears on PowerPC and Intel
too.

The following is a test case on Intel:

void bar(
    int __attribute__((vector_size(16))) * a,
    int __attribute__((vector_size(16))) * const b);

int instance(void)
{
   int __attribute__((vector_size(16))) a[1], b[1];

   bar(a, b);
}


-- 
           Summary: C++ frontend can not handle vector pointer constant
                    parameter
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: saliu at de dot ibm dot com
 GCC build triplet: powerpc64-unknown-linux-gnu
  GCC host triplet: powerpc64-unknown-linux-gnu
GCC target triplet: spu-unknown-elf


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


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

* [Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
@ 2007-08-06 16:32 ` pinskia at gcc dot gnu dot org
  2007-08-06 23:15 ` janis 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-08-06 16:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|powerpc64-unknown-linux-gnu |
   GCC host triplet|powerpc64-unknown-linux-gnu |
 GCC target triplet|spu-unknown-elf             |
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.3.0
      Known to work|                            |4.1.1
            Summary|C++ frontend can not handle |[4.3 Regression] C++
                   |vector pointer constant     |frontend can not handle
                   |parameter                   |vector pointer constant
                   |                            |parameter
   Target Milestone|---                         |4.3.0


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


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

* [Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
  2007-08-06 16:32 ` [Bug c++/32970] [4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2007-08-06 23:15 ` janis at gcc dot gnu dot org
  2007-08-07 11:31 ` saliu at de dot ibm dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janis at gcc dot gnu dot org @ 2007-08-06 23:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from janis at gcc dot gnu dot org  2007-08-06 23:15 -------
A regression hunt of mainline on powerpc-linux identified the following patch,
where the compiler went from compiling in a reasonable time to taking more than
three seconds for the submitter's testcase:

    r117696 | bonzini | 2006-10-13 15:59:03 +0000 (Fri, 13 Oct 2006)

    http://gcc.gnu.org/viewcvs?view=rev&rev=117696


-- 


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


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

* [Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
  2007-08-06 16:32 ` [Bug c++/32970] [4.3 Regression] " pinskia at gcc dot gnu dot org
  2007-08-06 23:15 ` janis at gcc dot gnu dot org
@ 2007-08-07 11:31 ` saliu at de dot ibm dot com
  2007-08-07 23:17 ` janis at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: saliu at de dot ibm dot com @ 2007-08-07 11:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from saliu at de dot ibm dot com  2007-08-07 11:31 -------
Is this really a regression from 4.1.1? 
I got the same error on 4.1.1, before the patch r117696 was applied.


-- 


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


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

* [Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
                   ` (2 preceding siblings ...)
  2007-08-07 11:31 ` saliu at de dot ibm dot com
@ 2007-08-07 23:17 ` janis at gcc dot gnu dot org
  2007-08-08 13:38 ` saliu at de dot ibm dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janis at gcc dot gnu dot org @ 2007-08-07 23:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janis at gcc dot gnu dot org  2007-08-07 23:17 -------
It compiles quickly for me with GCC 4.1.1 for powerpc64-linux and with a 4.1.1
cross compiler for i686-linux.  Is your 4.1.1 compiler from FSF sources, or
might it have additional backports?


-- 


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


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

* [Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
                   ` (3 preceding siblings ...)
  2007-08-07 23:17 ` janis at gcc dot gnu dot org
@ 2007-08-08 13:38 ` saliu at de dot ibm dot com
  2007-08-10  0:59 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: saliu at de dot ibm dot com @ 2007-08-08 13:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from saliu at de dot ibm dot com  2007-08-08 13:38 -------
Okey, I have a Red Hat GCC 4.1.1, which might be different from the FSF one.


-- 


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


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

* [Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
                   ` (4 preceding siblings ...)
  2007-08-08 13:38 ` saliu at de dot ibm dot com
@ 2007-08-10  0:59 ` mmitchel at gcc dot gnu dot org
  2007-08-10 10:13 ` saliu at de dot ibm dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-08-10  0:59 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
                   ` (5 preceding siblings ...)
  2007-08-10  0:59 ` mmitchel at gcc dot gnu dot org
@ 2007-08-10 10:13 ` saliu at de dot ibm dot com
  2007-08-12 23:36 ` [Bug middle-end/32970] " uweigand at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: saliu at de dot ibm dot com @ 2007-08-10 10:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from saliu at de dot ibm dot com  2007-08-10 10:13 -------
This patch can fix the problem:

Index: gcc/tree.c
===================================================================
--- gcc.orig/tree.c
+++ gcc/tree.c
@@ -7609,8 +7609,11 @@ reconstruct_complex_type (tree type, tre
   else
     return bottom;

-  TYPE_READONLY (outer) = TYPE_READONLY (type);
-  TYPE_VOLATILE (outer) = TYPE_VOLATILE (type);
+  if  (TYPE_READONLY (type))
+    build_qualified_type(outer, TYPE_QUAL_CONST);
+
+  if (TYPE_VOLATILE (type))
+    build_qualified_type(outer, TYPE_QUAL_VOLATILE);

   return outer;
 }


-- 


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


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

* [Bug middle-end/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
                   ` (6 preceding siblings ...)
  2007-08-10 10:13 ` saliu at de dot ibm dot com
@ 2007-08-12 23:36 ` uweigand at gcc dot gnu dot org
  2007-08-12 23:43 ` uweigand at gcc dot gnu dot org
  2007-08-17  6:49 ` bje at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: uweigand at gcc dot gnu dot org @ 2007-08-12 23:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from uweigand at gcc dot gnu dot org  2007-08-12 23:35 -------
Changing component to middle-end as the problem is not actually in the C++
front-end.


-- 

uweigand at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |middle-end


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


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

* [Bug middle-end/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
                   ` (7 preceding siblings ...)
  2007-08-12 23:36 ` [Bug middle-end/32970] " uweigand at gcc dot gnu dot org
@ 2007-08-12 23:43 ` uweigand at gcc dot gnu dot org
  2007-08-17  6:49 ` bje at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: uweigand at gcc dot gnu dot org @ 2007-08-12 23:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from uweigand at gcc dot gnu dot org  2007-08-12 23:43 -------
Sa's patch isn't quite correct as it ignores the result of
the build_qualified_type call.  The following patch should
fix that:

diff -urNp toolchain/gcc.orig/gcc/tree.c toolchain/gcc/gcc/tree.c
--- toolchain/gcc.orig/gcc/tree.c       2007-08-12 15:57:05.442520932 +0200
+++ toolchain/gcc/gcc/tree.c    2007-08-12 16:07:42.516093968 +0200
@@ -6554,10 +6554,7 @@ reconstruct_complex_type (tree type, tre
   else
     return bottom;

-  TYPE_READONLY (outer) = TYPE_READONLY (type);
-  TYPE_VOLATILE (outer) = TYPE_VOLATILE (type);
-
-  return outer;
+  return build_qualified_type (outer, TYPE_QUALS (type));
 }

 /* Returns a vector tree node given a mode (integer, vector, or BLKmode) and


-- 


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


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

* [Bug middle-end/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter
  2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
                   ` (8 preceding siblings ...)
  2007-08-12 23:43 ` uweigand at gcc dot gnu dot org
@ 2007-08-17  6:49 ` bje at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: bje at gcc dot gnu dot org @ 2007-08-17  6:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from bje at gcc dot gnu dot org  2007-08-17 06:49 -------
Fixed in r127578.


-- 

bje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-08-17  6:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-02 18:37 [Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter saliu at de dot ibm dot com
2007-08-06 16:32 ` [Bug c++/32970] [4.3 Regression] " pinskia at gcc dot gnu dot org
2007-08-06 23:15 ` janis at gcc dot gnu dot org
2007-08-07 11:31 ` saliu at de dot ibm dot com
2007-08-07 23:17 ` janis at gcc dot gnu dot org
2007-08-08 13:38 ` saliu at de dot ibm dot com
2007-08-10  0:59 ` mmitchel at gcc dot gnu dot org
2007-08-10 10:13 ` saliu at de dot ibm dot com
2007-08-12 23:36 ` [Bug middle-end/32970] " uweigand at gcc dot gnu dot org
2007-08-12 23:43 ` uweigand at gcc dot gnu dot org
2007-08-17  6:49 ` bje 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).