public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42338]  New: [c++0x] ICE on decltype usage with templates
@ 2009-12-08 23:37 onay at ee dot bilkent dot edu dot tr
  2009-12-09  9:50 ` [Bug c++/42338] " paolo dot carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: onay at ee dot bilkent dot edu dot tr @ 2009-12-08 23:37 UTC (permalink / raw)
  To: gcc-bugs

The following code causes an ICE with segmentation fault:
----------------------------------------------------------------------
#include <iostream>
#include <vector>

template< typename T1 >
void vadd(const std::vector< T1 > &a, decltype(a[0]) t) {
    std::cout << "-> ICE \n";
}
void vadd(const std::vector< int > &a, decltype(a[0]) t) {
    std::cout << " compiles \n";
}


int main() {
    std::vector< int > a;
    std::vector< float > b;
    int c;
    vadd(b,c); // leads to ICE
//     vadd(a,c); // compiles
}
----------------------------------------------------------------------
Output of 
"g++ -v -save-temps   gcc-error-src.cpp -o gcc-error -std=c++0x"
yields:

Using built-in specs.                                                           
Target: x86_64-linux-gnu                                                        
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.2-3'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--with-arch-32=i486 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu      
Thread model: posix                                                             
gcc version 4.4.2 (Debian 4.4.2-3)                                              
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'gcc-error' '-std=c++0x'
'-shared-libgcc' '-mtune=generic'                                               
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/cc1plus -E -quiet -v -D_GNU_SOURCE
gcc-error-src.cpp -mtune=generic -std=c++0x -fpch-preprocess -o
gcc-error-src.ii                                                                
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"            
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.4.2/../../../../x86_64-linux-gnu/include"      
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"                  
#include "..." search starts here:                                              
#include <...> search starts here:                                              
 /usr/include/c++/4.4                                                           
 /usr/include/c++/4.4/x86_64-linux-gnu                                          
 /usr/include/c++/4.4/backward                                                  
 /usr/local/include                                                             
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include                                    
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/include-fixed                              
 /usr/include                                                                   
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'gcc-error' '-std=c++0x'
'-shared-libgcc' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.4.2/cc1plus -fpreprocessed gcc-error-src.ii
-quiet -dumpbase gcc-error-src.cpp -mtune=generic -auxbase gcc-error-src
-std=c++0x -version -o gcc-error-src.s
GNU C++ (Debian 4.4.2-3) version 4.4.2 (x86_64-linux-gnu)
        compiled by GNU C version 4.4.2, GMP version 4.3.1, MPFR version
2.4.1-p2.
warning: MPFR header version 2.4.1-p2 differs from library version 2.4.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 76c61736f716d7c937923f7eb86174cd
gcc-error-src.cpp:19: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.


-- 
           Summary: [c++0x] ICE on decltype usage with templates
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: onay at ee dot bilkent dot edu dot tr


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


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

* [Bug c++/42338] [c++0x] ICE on decltype usage with templates
  2009-12-08 23:37 [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates onay at ee dot bilkent dot edu dot tr
@ 2009-12-09  9:50 ` paolo dot carlini at oracle dot com
  2009-12-18  0:42 ` redi at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-09  9:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2009-12-09 09:50 -------
Jason, the ICE happens in mangle.c, write_expression gets a null argument. Is
this another variant of c++/38600 and the likes?


-- 

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=42338


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

* [Bug c++/42338] [c++0x] ICE on decltype usage with templates
  2009-12-08 23:37 [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates onay at ee dot bilkent dot edu dot tr
  2009-12-09  9:50 ` [Bug c++/42338] " paolo dot carlini at oracle dot com
@ 2009-12-18  0:42 ` redi at gcc dot gnu dot org
  2010-01-20 22:42 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-12-18  0:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from redi at gcc dot gnu dot org  2009-12-18 00:42 -------
I suspect this is the same issue, as it also passes a null argument to
write_expression

$ cat ice.cc
template<typename T>
auto f(T t) -> decltype(++t, 0)
{
    ++t;
    return 0;
}

int main()
{
    f((int*)0);
}
$ ~/gcc/4.x/bin/g++ -std=c++0x ice.cc
ice.cc: In instantiation of 'decltype (((++ t), 0)) f(T) [with T = int*,
decltype (((++ t), 0)) = int]':
ice.cc:10:14:   instantiated from here
ice.cc:6:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 


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


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

* [Bug c++/42338] [c++0x] ICE on decltype usage with templates
  2009-12-08 23:37 [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates onay at ee dot bilkent dot edu dot tr
  2009-12-09  9:50 ` [Bug c++/42338] " paolo dot carlini at oracle dot com
  2009-12-18  0:42 ` redi at gcc dot gnu dot org
@ 2010-01-20 22:42 ` jason at gcc dot gnu dot org
  2010-01-21  1:59 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-20 22:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-20 22:42:01
               date|                            |


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


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

* [Bug c++/42338] [c++0x] ICE on decltype usage with templates
  2009-12-08 23:37 [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates onay at ee dot bilkent dot edu dot tr
                   ` (2 preceding siblings ...)
  2010-01-20 22:42 ` jason at gcc dot gnu dot org
@ 2010-01-21  1:59 ` jason at gcc dot gnu dot org
  2010-01-21 10:17 ` paolo dot carlini at oracle dot com
  2010-02-09 22:31 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-21  1:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2010-01-21 01:59 -------
Subject: Bug 42338

Author: jason
Date: Thu Jan 21 01:58:53 2010
New Revision: 156103

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156103
Log:
        PR c++/42338
        * mangle.c (write_expression): Handle tree codes that have extra
        arguments in the middle-end.
        * cp-demangle.c (d_print_comp): Fix array index printing.

Added:
    trunk/gcc/testsuite/g++.dg/abi/mangle39.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/libiberty/ChangeLog
    trunk/libiberty/cp-demangle.c


-- 


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


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

* [Bug c++/42338] [c++0x] ICE on decltype usage with templates
  2009-12-08 23:37 [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates onay at ee dot bilkent dot edu dot tr
                   ` (3 preceding siblings ...)
  2010-01-21  1:59 ` jason at gcc dot gnu dot org
@ 2010-01-21 10:17 ` paolo dot carlini at oracle dot com
  2010-02-09 22:31 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-01-21 10:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2010-01-21 10:17 -------
Thus, Jason, it turns out this is *not* a duplicate of c++/38600, doesn't have
to do with mangling template_id_expr, right? By the way, if you have got two
spare minutes, could you maybe add something about the latter in that audit
trail? Duplicates are coming and coming, I'm afraid people (myself included ;)
are a bit confused about why we cannot mangle that.


-- 


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


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

* [Bug c++/42338] [c++0x] ICE on decltype usage with templates
  2009-12-08 23:37 [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates onay at ee dot bilkent dot edu dot tr
                   ` (4 preceding siblings ...)
  2010-01-21 10:17 ` paolo dot carlini at oracle dot com
@ 2010-02-09 22:31 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-09 22:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2010-02-09 22:30 -------
Fixed.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-02-09 22:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-08 23:37 [Bug c++/42338] New: [c++0x] ICE on decltype usage with templates onay at ee dot bilkent dot edu dot tr
2009-12-09  9:50 ` [Bug c++/42338] " paolo dot carlini at oracle dot com
2009-12-18  0:42 ` redi at gcc dot gnu dot org
2010-01-20 22:42 ` jason at gcc dot gnu dot org
2010-01-21  1:59 ` jason at gcc dot gnu dot org
2010-01-21 10:17 ` paolo dot carlini at oracle dot com
2010-02-09 22:31 ` jason 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).