public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
@ 2002-04-24 15:56 Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2002-04-24 15:56 UTC (permalink / raw)
  To: jason; +Cc: gcc-prs

The following reply was made to PR c++/6331; it has been noted by GNATS.

From: Jason Merrill <jason@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
Date: Wed, 24 Apr 2002 23:47:07 +0100

 --=-=-=
 
 Here's the patch to always complain about array assignment, and a fix for
 further fallout.  crash51.C got confused because we passed a STRING_CST
 with a VOIDmode type into the middle-end, as the type was never updated by
 the instantiation.  This patch generates the right ARRAY_TYPE in the
 template for simple cases, so we don't have to fix strings up later.
 
 Tested i686-pc-linux-gnu, applied trunk and 3.1.
 
 2002-04-24  Jason Merrill  <jason@redhat.com>
 
 	* typeck.c (build_modify_expr): The pedwarn for array assignment is 
 	now unconditional.
 	* tree.c (build_cplus_array_type_1): Still process simple array types
 	normally in templates.
 
 
 --=-=-=
 Content-Type: text/x-patch
 Content-Disposition: inline
 
 Index: cp/tree.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
 retrieving revision 1.268.2.2
 diff -c -p -r1.268.2.2 tree.c
 *** cp/tree.c	21 Mar 2002 23:12:40 -0000	1.268.2.2
 --- cp/tree.c	24 Apr 2002 22:31:53 -0000
 *************** build_cplus_array_type_1 (elt_type, inde
 *** 464,470 ****
     if (elt_type == error_mark_node || index_type == error_mark_node)
       return error_mark_node;
   
 !   if (processing_template_decl 
         || uses_template_parms (elt_type) 
         || uses_template_parms (index_type))
       {
 --- 464,475 ----
     if (elt_type == error_mark_node || index_type == error_mark_node)
       return error_mark_node;
   
 !   /* Don't do the minimal thing just because processing_template_decl is
 !      set; we want to give string constants the right type immediately, so
 !      we don't have to fix them up at instantiation time.  */
 !   if ((processing_template_decl
 !        && index_type && TYPE_MAX_VALUE (index_type)
 !        && TREE_CODE (TYPE_MAX_VALUE (index_type)) != INTEGER_CST)
         || uses_template_parms (elt_type) 
         || uses_template_parms (index_type))
       {
 Index: cp/typeck.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
 retrieving revision 1.388.2.8
 diff -c -p -r1.388.2.8 typeck.c
 *** cp/typeck.c	24 Apr 2002 10:49:54 -0000	1.388.2.8
 --- cp/typeck.c	24 Apr 2002 22:31:57 -0000
 *************** build_modify_expr (lhs, modifycode, rhs)
 *** 5665,5671 ****
   	}
   
         /* Allow array assignment in compiler-generated code.  */
 !       if (pedantic && ! DECL_ARTIFICIAL (current_function_decl))
   	pedwarn ("ISO C++ forbids assignment of arrays");
   
         from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
 --- 5665,5671 ----
   	}
   
         /* Allow array assignment in compiler-generated code.  */
 !       if (! DECL_ARTIFICIAL (current_function_decl))
   	pedwarn ("ISO C++ forbids assignment of arrays");
   
         from_array = TREE_CODE (TREE_TYPE (newrhs)) == ARRAY_TYPE
 Index: testsuite/g++.old-deja/g++.benjamin/14664-1.C
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C,v
 retrieving revision 1.2
 diff -c -p -r1.2 14664-1.C
 *** testsuite/g++.old-deja/g++.benjamin/14664-1.C	16 Dec 1998 21:21:42 -0000	1.2
 --- testsuite/g++.old-deja/g++.benjamin/14664-1.C	24 Apr 2002 22:31:58 -0000
 ***************
 *** 1,7 ****
   // 981203 bkoz
   // g++/14664 - test
   // Build don't link: 
 - // Special g++ Options: -fconst-strings
   
   char foo[26];
   
 --- 1,6 ----
 Index: testsuite/g++.old-deja/g++.benjamin/14664-2.C
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C,v
 retrieving revision 1.2
 diff -c -p -r1.2 14664-2.C
 *** testsuite/g++.old-deja/g++.benjamin/14664-2.C	16 Dec 1998 21:21:43 -0000	1.2
 --- testsuite/g++.old-deja/g++.benjamin/14664-2.C	24 Apr 2002 22:31:58 -0000
 ***************
 *** 1,7 ****
   // 981203 bkoz
   // g++/14664 + test
   // Build don't link: 
 ! // Special g++ Options: -fno-const-strings
   
   char foo[26];
   
 --- 1,7 ----
   // 981203 bkoz
   // g++/14664 + test
   // Build don't link: 
 ! // Special g++ Options: -fpermissive -w
   
   char foo[26];
   
 Index: testsuite/g++.old-deja/g++.pt/crash51.C
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.pt/crash51.C,v
 retrieving revision 1.2
 diff -c -p -r1.2 crash51.C
 *** testsuite/g++.old-deja/g++.pt/crash51.C	4 Sep 1999 15:09:07 -0000	1.2
 --- testsuite/g++.old-deja/g++.pt/crash51.C	24 Apr 2002 22:31:59 -0000
 ***************
 *** 1,5 ****
   // Build don't link:
 ! // Special g++ Options: -fno-const-strings
   // Origin: Mark Mitchell <mark@codesourcery.com>
   
   char foo[26];
 --- 1,5 ----
   // Build don't link:
 ! // Special g++ Options: -fpermissive -w
   // Origin: Mark Mitchell <mark@codesourcery.com>
   
   char foo[26];
 
 --=-=-=--


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

* Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
@ 2002-04-25 11:06 Mark Mitchell
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Mitchell @ 2002-04-25 11:06 UTC (permalink / raw)
  To: jason; +Cc: gcc-prs

The following reply was made to PR c++/6331; it has been noted by GNATS.

From: Mark Mitchell <mark@codesourcery.com>
To: Jason Merrill <jason@redhat.com>,
   "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "gcc-gnats@gcc.gnu.org" <gcc-gnats@gcc.gnu.org>
Subject: Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
Date: Thu, 25 Apr 2002 10:59:39 -0700

 > Tested i686-pc-linux-gnu, applied trunk and 3.1.
 
 Thanks!
 
 --
 Mark Mitchell                   mark@codesourcery.com
 CodeSourcery, LLC               http://www.codesourcery.com
 


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

* Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
@ 2002-04-24  3:56 Jason Merrill
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2002-04-24  3:56 UTC (permalink / raw)
  To: jason; +Cc: gcc-prs

The following reply was made to PR c++/6331; it has been noted by GNATS.

From: Jason Merrill <jason@redhat.com>
To: Cc: gcc-patches@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
Date: Wed, 24 Apr 2002 11:46:55 +0100

 --=-=-=
 
 Here's a patch for the World.ii bug.  We were winding up with a bogus
 version of 'const array of float' because we weren't consistently using the
 C++-specific build_qualified_type.
 
 Tested i686-pc-linux-gnu, applied trunk and 3.1.  Test in
 g++.dg/init/array3.C.
 
 2002-04-24  Jason Merrill  <jason@redhat.com>
 
 	PR c++/6331
 	* method.c (do_build_copy_constructor): Use cp_build_qualified_type.
 	* typeck.c (build_modify_expr): Allow arrays to differ in cv-quals.
 
 
 --=-=-=
 Content-Type: text/x-patch
 Content-Disposition: inline
 
 *** method.c.~1~	Sat Apr  6 15:33:41 2002
 --- method.c	Wed Apr 24 09:54:22 2002
 *************** do_build_copy_constructor (fndecl)
 *** 585,591 ****
   	    continue;
   
   	  init = build (COMPONENT_REF,
 ! 	                build_qualified_type (TREE_TYPE (field), cvquals),
   	                init, field);
   	  init = build_tree_list (NULL_TREE, init);
   
 --- 585,591 ----
   	    continue;
   
   	  init = build (COMPONENT_REF,
 ! 	                cp_build_qualified_type (TREE_TYPE (field), cvquals),
   	                init, field);
   	  init = build_tree_list (NULL_TREE, init);
   
 *** typeck.c.~1~	Wed Apr 24 01:02:20 2002
 --- typeck.c	Wed Apr 24 09:56:28 2002
 *************** build_modify_expr (lhs, modifycode, rhs)
 *** 5665,5674 ****
       {
         int from_array;
         
 !       if (!same_or_base_type_p (lhstype, TREE_TYPE (rhs)))
   	{
   	  error ("incompatible types in assignment of `%T' to `%T'",
 ! 		    TREE_TYPE (rhs), lhstype);
   	  return error_mark_node;
   	}
   
 --- 5665,5675 ----
       {
         int from_array;
         
 !       if (!same_or_base_type_p (TYPE_MAIN_VARIANT (lhstype),
 ! 				TYPE_MAIN_VARIANT (TREE_TYPE (rhs))))
   	{
   	  error ("incompatible types in assignment of `%T' to `%T'",
 ! 		 TREE_TYPE (rhs), lhstype);
   	  return error_mark_node;
   	}
   
 
 --=-=-=--


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

end of thread, other threads:[~2002-04-25 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-24 15:56 c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH) Jason Merrill
  -- strict thread matches above, loose matches on Subject: below --
2002-04-25 11:06 Mark Mitchell
2002-04-24  3:56 Jason Merrill

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