public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20073] New: [4.0 regression] ICE initializing const array
@ 2005-02-19 18:15 reichelt at gcc dot gnu dot org
  2005-02-19 20:09 ` [Bug c++/20073] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-19 18:15 UTC (permalink / raw)
  To: gcc-bugs

The following valid code snippet causes an ICE when compiled with mainline:

==============================
template<int> struct A
{
    A();
};

const A<0> x[] = { A<0>() };
==============================

bug.cc:7: internal compiler error: in set_mem_attributes_minus_bitpos, at
emit-rtl.c:1539
Please submit a full bug report, [etc.]

This is a relitively new regression (the compiler from 2005-02-16works fine).

-- 
           Summary: [4.0 regression] ICE initializing const array
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/20073] [4.0 regression] ICE initializing const array
  2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
@ 2005-02-19 20:09 ` pinskia at gcc dot gnu dot org
  2005-02-19 22:38 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-19 20:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-19 13:07 -------
Caused By:
2005-02-18  Jakub Jelinek  <jakub@redhat.com>
        
        PR c++/19813
        * decl.c (start_decl_1): Clear TREE_READONLY flag if
        its type has TYPE_NEEDS_CONSTRUCTING.
        (complete_vars): Likewise.
2005-02-18  Jakub Jelinek  <jakub@redhat.com>

        PR c++/19813
        * emit-rtl.c (set_mem_attributes_minus_bitpos): Add assertion
        that ref to be marked MEM_READONLY_P doesn't have base that needs
        constructing.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-19 13:07:41
               date|                            |
   Target Milestone|---                         |4.0.0


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


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

* [Bug c++/20073] [4.0 regression] ICE initializing const array
  2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
  2005-02-19 20:09 ` [Bug c++/20073] " pinskia at gcc dot gnu dot org
@ 2005-02-19 22:38 ` jakub at gcc dot gnu dot org
  2005-02-21 21:08 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-02-19 22:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2005-02-19 16:47 -------
Testing a patch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-02-19 13:07:41         |2005-02-19 16:47:38
               date|                            |


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


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

* [Bug c++/20073] [4.0 regression] ICE initializing const array
  2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
  2005-02-19 20:09 ` [Bug c++/20073] " pinskia at gcc dot gnu dot org
  2005-02-19 22:38 ` jakub at gcc dot gnu dot org
@ 2005-02-21 21:08 ` jakub at gcc dot gnu dot org
  2005-02-23 14:03 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-02-21 21:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2005-02-21 12:43 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01138.html>
Mark's request: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01162.html>
Unfortunately, I'm afraid I don't know the C++ frontend enough to handle that.
TREE_READONLY flag is set in code common to C/C++, c_apply_type_quals_to_decl.
For C/ObjC, we know that the type will never have TYPE_NEEDS_CONSTRUCTING,
so it is fine that way, but for C++ if the type is not yet complete
at the c_apply_type_quals_to_decl (for C++ this is the usual case), we might
set TREE_READONLY flag prematurely and the type when completed might have
TYPE_NEEDS_CONSTRUCTING.
Now, if we want to avoid setting it until we know it doesn't need constructing,
we could e.g. wrap c_apply_type_quals_to_decl into cp_apply_type_quals_to_decl
that will avoid marking it TREE_READONLY if the type is not yet complete and
in say complete_vars and cp_finish_decl mark it readonly if cp_type_quals (type)
& TYPE_QUAL_CONST and !TYPE_NEEDS_CONSTRUCTING (type).  Unfortunately, e.g.
split_nonconstant_init clears this flag even for vars that don't have
TYPE_NEEDS_CONSTRUCTNG set, so if we did that, we'd suddenly change the variable
back to have TREE_READONLY set while it should have it set.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com,
                   |                            |mark at codesourcery dot com
         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=20073


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

* [Bug c++/20073] [4.0 regression] ICE initializing const array
  2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-02-21 21:08 ` jakub at gcc dot gnu dot org
@ 2005-02-23 14:03 ` mmitchel at gcc dot gnu dot org
  2005-02-23 14:06 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-02-23 14:03 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/20073] [4.0 regression] ICE initializing const array
  2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-02-23 14:03 ` mmitchel at gcc dot gnu dot org
@ 2005-02-23 14:06 ` cvs-commit at gcc dot gnu dot org
  2005-02-23 14:11 ` cvs-commit at gcc dot gnu dot org
  2005-02-23 14:12 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-23 14:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-02-23 06:52 -------
Subject: Bug 20073

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-02-23 06:52:09

Modified files:
	gcc/cp         : decl.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/init: const1.C 

Log message:
	PR c++/20073
	* decl.c (start_decl_1): Don't clear TREE_READONLY.
	(cp_finish_decl): Likewise.
	(complete_vars): Call cp_apply_type_quals_to_decl.
	* typeck.c (cp_apply_type_quals): Avoid setting TREE_READONLY in
	cases where that's not valid.
	
	PR c++/20073
	* g++.dg/init/const1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1367&r2=1.1368
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.615&r2=1.616
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5073&r2=1.5074
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/const1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/20073] [4.0 regression] ICE initializing const array
  2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-02-23 14:06 ` cvs-commit at gcc dot gnu dot org
@ 2005-02-23 14:11 ` cvs-commit at gcc dot gnu dot org
  2005-02-23 14:12 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-23 14:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-02-23 06:55 -------
Subject: Bug 20073

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-02-23 06:55:11

Modified files:
	gcc/cp         : ChangeLog 

Log message:
	PR c++/20073
	* decl.c (start_decl_1): Don't clear TREE_READONLY.
	(cp_finish_decl): Likewise.
	(complete_vars): Call cp_apply_type_quals_to_decl.
	* typeck.c (cp_apply_type_quals): Avoid setting TREE_READONLY in
	cases where that's not valid.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4642&r2=1.4643



-- 


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


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

* [Bug c++/20073] [4.0 regression] ICE initializing const array
  2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-02-23 14:11 ` cvs-commit at gcc dot gnu dot org
@ 2005-02-23 14:12 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-02-23 14:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-02-23 06:58 -------
Fixed in 4.0.

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


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


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

end of thread, other threads:[~2005-02-23  6:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-19 18:15 [Bug c++/20073] New: [4.0 regression] ICE initializing const array reichelt at gcc dot gnu dot org
2005-02-19 20:09 ` [Bug c++/20073] " pinskia at gcc dot gnu dot org
2005-02-19 22:38 ` jakub at gcc dot gnu dot org
2005-02-21 21:08 ` jakub at gcc dot gnu dot org
2005-02-23 14:03 ` mmitchel at gcc dot gnu dot org
2005-02-23 14:06 ` cvs-commit at gcc dot gnu dot org
2005-02-23 14:11 ` cvs-commit at gcc dot gnu dot org
2005-02-23 14:12 ` mmitchel 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).