public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/25407]  New: ICE when assigning value of variable passed to template as reference
@ 2005-12-14  6:20 eteran at alum dot rit dot edu
  2005-12-14 15:15 ` [Bug c++/25407] [3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: eteran at alum dot rit dot edu @ 2005-12-14  6:20 UTC (permalink / raw)
  To: gcc-bugs

The following code produces an ICE in both gcc-3.4.4 and gcc-3.4.5, I've been
told it compiles fine in a 4.x version of the compiler.

int var1 = 0;
template <int &v> inline void get_data() { int var2; var2 = v; }
int main() {
        get_data<var1>();
        return 0;
}

preprocessed source is as followes:

// /usr/libexec/gcc/i686-pc-linux-gnu/3.4.5/cc1plus -quiet -D_GNU_SOURCE
test.cc -quiet -dumpbase test.cc -mtune=pentiumpro -auxbase test -Wall -W -o -
-frandom-seed=0
# 1 "test.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cc"


int var1 = 0;
template <int &v> inline void get_data() { int var2; var2 = v; }
int main() {
 get_data<var1>();
 return 0;
}


it produces the following output when compiled with "g++ -Wall -W test.cc -c":

test.cc: In function `void get_data() [with int&v = ((int&)(&var1))]':
test.cc:6:   instantiated from here
test.cc:4: internal compiler error: in build_modify_expr, at cp/typeck.c:5190
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccNxQKpG.out file, please attach this to
your bugreport.

I am not sure if it matters, but I am running a gentoo installation, gcc was
compiled with the following CFLAGS/CXXFLAGS:

-march=pentium-m -pipe -O2

My system is running on the following kernel:

System uname: 2.6.14-gentoo-r4 i686 Intel(R) Pentium(R) M processor 2.00GHz

If there is anything else you need, I'll be more than happy to provide it.

Evan Teran


-- 
           Summary: ICE when assigning value of variable passed to template
                    as reference
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eteran at alum dot rit dot edu


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


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

* [Bug c++/25407] [3.4 Regression] ICE when assigning value of variable passed to template as reference
  2005-12-14  6:20 [Bug c++/25407] New: ICE when assigning value of variable passed to template as reference eteran at alum dot rit dot edu
@ 2005-12-14 15:15 ` pinskia at gcc dot gnu dot org
  2005-12-14 22:49 ` reichelt at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-14 15:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-12-14 15:15 -------
Confirmed a regression from 3.0.4.  Only a 3.4.x regression.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |3.3.3 3.2.3 3.4.0
      Known to work|                            |3.0.4 4.0.0 4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-12-14 15:15:12
               date|                            |
            Summary|ICE when assigning value of |[3.4 Regression] ICE when
                   |variable passed to template |assigning value of variable
                   |as reference                |passed to template as
                   |                            |reference
   Target Milestone|---                         |3.4.6


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


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

* [Bug c++/25407] [3.4 Regression] ICE when assigning value of variable passed to template as reference
  2005-12-14  6:20 [Bug c++/25407] New: ICE when assigning value of variable passed to template as reference eteran at alum dot rit dot edu
  2005-12-14 15:15 ` [Bug c++/25407] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2005-12-14 22:49 ` reichelt at gcc dot gnu dot org
  2005-12-22 13:18 ` reichelt at gcc dot gnu dot org
  2005-12-22 13:22 ` reichelt at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-12-14 22:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from reichelt at gcc dot gnu dot org  2005-12-14 22:48 -------
Probably related to PR19982.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
OtherBugsDependingO|                            |19982
              nThis|                            |
           Keywords|                            |monitored


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


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

* [Bug c++/25407] [3.4 Regression] ICE when assigning value of variable passed to template as reference
  2005-12-14  6:20 [Bug c++/25407] New: ICE when assigning value of variable passed to template as reference eteran at alum dot rit dot edu
  2005-12-14 15:15 ` [Bug c++/25407] [3.4 Regression] " pinskia at gcc dot gnu dot org
  2005-12-14 22:49 ` reichelt at gcc dot gnu dot org
@ 2005-12-22 13:18 ` reichelt at gcc dot gnu dot org
  2005-12-22 13:22 ` reichelt at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-12-22 13:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from reichelt at gcc dot gnu dot org  2005-12-22 13:18 -------
Created an attachment (id=10550)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10550&action=view)
Patch


-- 


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


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

* [Bug c++/25407] [3.4 Regression] ICE when assigning value of variable passed to template as reference
  2005-12-14  6:20 [Bug c++/25407] New: ICE when assigning value of variable passed to template as reference eteran at alum dot rit dot edu
                   ` (2 preceding siblings ...)
  2005-12-22 13:18 ` reichelt at gcc dot gnu dot org
@ 2005-12-22 13:22 ` reichelt at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-12-22 13:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from reichelt at gcc dot gnu dot org  2005-12-22 13:22 -------
The patch above fixes PR c++/25407 (ice-on-valid-code regression)
on the 3.4 branch. It is a backport of Nathan's patch for PR c++/18803
including the fixes for its fallout PR c++/18949, PR c++/19298, and
PR c++/23044.

The patch also includes testcases for PR c++/25407, PR c++/18949
PR c++/19298, and PR c++/23044. (The testcase for PR c++/18803
is already present on the 3.4 branch.)

Gaby and Nathan agreed that the patch is too intrusive for inclusion
into the 3.4 branch. Therefore I'm attaching this patch only for
reference for those in need of a fix for the problem on the 3.4 branch.

The bug will remain unfixed on the 3.4 branch.
It is fixed in GCC 4.0.0 and later.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |12/msg01683.html
             Status|NEW                         |RESOLVED
           Keywords|                            |patch
         Resolution|                            |FIXED
   Target Milestone|3.4.6                       |4.0.0


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


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

end of thread, other threads:[~2005-12-22 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-14  6:20 [Bug c++/25407] New: ICE when assigning value of variable passed to template as reference eteran at alum dot rit dot edu
2005-12-14 15:15 ` [Bug c++/25407] [3.4 Regression] " pinskia at gcc dot gnu dot org
2005-12-14 22:49 ` reichelt at gcc dot gnu dot org
2005-12-22 13:18 ` reichelt at gcc dot gnu dot org
2005-12-22 13:22 ` reichelt 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).