public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: jason@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c++/6331: g++ 3.1 looses const qualifiers (C++ PATCH)
Date: Wed, 24 Apr 2002 15:56:00 -0000 [thread overview]
Message-ID: <20020424225601.657.qmail@sources.redhat.com> (raw)
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];
--=-=-=--
next reply other threads:[~2002-04-24 22:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-24 15:56 Jason Merrill [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-04-25 11:06 Mark Mitchell
2002-04-24 3:56 Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020424225601.657.qmail@sources.redhat.com \
--to=jason@redhat.com \
--cc=gcc-prs@gcc.gnu.org \
--cc=jason@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).