public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40512]  New: Compilation stops on valid code with ICE
@ 2009-06-21 21:32 gcc-bugzilla at gcc dot gnu dot org
  2009-06-21 22:09 ` [Bug c++/40512] " rguenth at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2009-06-21 21:32 UTC (permalink / raw)
  To: gcc-bugs


        compile the attached code with the -std=c++0x flag.

Environment:
System: Linux x 2.6.26-2-686 #1 SMP Thu Mar 26 01:08:11 UTC 2009 i686 GNU/Linux



host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --prefix=/home/x/gcc-4.4-20090616
--enable-languages=,c,c++,

How-To-Repeat:
template <unsigned width, unsigned height, typename T>
class M {
                T v;
        public:
                T & operator[](unsigned) { return v; } 
                T const & operator[](unsigned) const { return v; }

                template <typename oT, unsigned owidth>
                auto mggggg(M<owidth, width, oT> o)
                -> M<owidth, height, decltype(T()*o[0])>
                {
                        typedef M<owidth, height, decltype(T()*oT())> res_t;
                        return res_t();
                }
                template <typename oT, unsigned owidth>
                auto operator*(M<owidth, width, oT> const & o) const
                        -> M<owidth, height, decltype(T()*oT())>
                {
                        typedef M<owidth, height, decltype(T()*oT())> res_t;
                        return res_t();
                }
};

int main(int, char *[])
{
        typedef M<2, 2, int> xt;
        M<3, 2, xt> hv;
        M<4, 3, xt> vv;
        hv.mggggg(vv);
}


------- Comment #1 from pooly at ural2 dot hszk dot bme dot hu  2009-06-21 21:32 -------
Fix:
        Replace o[0] with oT() on line 10.


-- 
           Summary: Compilation stops on valid code with ICE
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pooly at ural2 dot hszk dot bme dot hu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/40512] Compilation stops on valid code with ICE
  2009-06-21 21:32 [Bug c++/40512] New: Compilation stops on valid code with ICE gcc-bugzilla at gcc dot gnu dot org
@ 2009-06-21 22:09 ` rguenth at gcc dot gnu dot org
  2010-05-05  0:44 ` paolo dot carlini at oracle dot com
  2010-05-11 10:11 ` paolo dot carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-21 22:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-06-21 22:09 -------
Confirmed.  We ICE mangling trying to mangle decltype(T()*o[0])

#1  0x082ec4c0 in write_expression (expr=0xb7fdeed4)
    at /home/richard/src/trunk/gcc/cp/mangle.c:2415
2415                  write_expression (operand);
(gdb) p expr
$1 = (tree) 0xb7fdeed4
(gdb) call debug_generic_expr (expr)
o[0
Breakpoint 2, internal_error (

because that ARRAY_REF has a non-array object that is referenced:

(gdb) call debug_tree (expr)
 <array_ref 0xb7fdeed4
    arg 0 <parm_decl 0xb7d7039c o
        type <record_type 0xb7d6e380 M type_0 type_5 type_6 VOID
            align 8 symtab 0 alias set -1 canonical type 0xb7d6e380
            full-name "class M<owidth, 3u, oT>"
            no-binfo use_template=1 interface-unknown
            chain <type_decl 0xb7d6e3f0 M>>
        used VOID file t.ii line 9 col 35
        align 8 context <function_decl 0xb7d53280 mggggg> arg-type <record_type
0xb7d6e380 M>>
    arg 1 <integer_cst 0xb7cbf8a4 type <integer_type 0xb7ccf310 int> constant
0>>


likely this testcase should be diagnosed as invalid.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-21 22:09:02
               date|                            |
            Version|unknown                     |4.5.0


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


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

* [Bug c++/40512] Compilation stops on valid code with ICE
  2009-06-21 21:32 [Bug c++/40512] New: Compilation stops on valid code with ICE gcc-bugzilla at gcc dot gnu dot org
  2009-06-21 22:09 ` [Bug c++/40512] " rguenth at gcc dot gnu dot org
@ 2010-05-05  0:44 ` paolo dot carlini at oracle dot com
  2010-05-11 10:11 ` paolo dot carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-05-05  0:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2010-05-05 00:44 -------
Jason, this one seems fixed both in mainline and 4_5-branch as part of the
mangling updates. Can you confirm?


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


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


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

* [Bug c++/40512] Compilation stops on valid code with ICE
  2009-06-21 21:32 [Bug c++/40512] New: Compilation stops on valid code with ICE gcc-bugzilla at gcc dot gnu dot org
  2009-06-21 22:09 ` [Bug c++/40512] " rguenth at gcc dot gnu dot org
  2010-05-05  0:44 ` paolo dot carlini at oracle dot com
@ 2010-05-11 10:11 ` paolo dot carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-05-11 10:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2010-05-11 10:11 -------
I think this can be safely closed as fixed for 4.5.0.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.5.0 4.5.1 4.6.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2010-05-11 10:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-21 21:32 [Bug c++/40512] New: Compilation stops on valid code with ICE gcc-bugzilla at gcc dot gnu dot org
2009-06-21 22:09 ` [Bug c++/40512] " rguenth at gcc dot gnu dot org
2010-05-05  0:44 ` paolo dot carlini at oracle dot com
2010-05-11 10:11 ` paolo dot carlini at oracle dot com

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