Bug 56998 - [4.8 Regression] ICE in value_dependent_expression_p, at cp/pt.c:19598
Summary: [4.8 Regression] ICE in value_dependent_expression_p, at cp/pt.c:19598
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.1
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2013-04-18 15:06 UTC by Raphael Kubo da Costa
Modified: 2013-05-14 16:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.7.3, 4.9.0
Known to fail: 4.8.0
Last reconfirmed: 2013-04-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raphael Kubo da Costa 2013-04-18 15:06:53 UTC
Building the following program below crashes g++ 4.8.0 here.

--- ice.cc ---

class Secret;
char IsNullLiteralHelper(Secret* p);
char (&IsNullLiteralHelper(...))[2];

struct C
{
    int val() { return 42; }
};

template <typename T>
unsigned f()
{
    return sizeof(IsNullLiteralHelper(C().val()));
}

--- ice.ii ---
# 1 "ice.cc"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "ice.cc"
class Secret;
char IsNullLiteralHelper(Secret* p);
char (&IsNullLiteralHelper(...))[2];

struct C
{
    int val() { return 42; }
};

template <typename T>
unsigned f()
{
    return sizeof(IsNullLiteralHelper(C().val()));
}

--- Compiler output ---
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.8-20130411/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-install-libiberty --disable-multilib --disable-libssp --disable-werror --enable-checking=release
Thread model: posix
gcc version 4.8.0 20130411 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/cc1plus -quiet -v -D_GNU_SOURCE ice.cc -quiet -dumpbase ice.cc -mtune=generic -march=x86-64 -auxbase ice -version -o /tmp/cchdGFwc.s
GNU C++ (GCC) version 4.8.0 20130411 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.0 20130411 (prerelease), GMP version 5.1.1, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/x86_64-unknown-linux-gnu
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/../../../../include/c++/4.8.0/backward
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/include
 /usr/local/include
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.8.0 20130411 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.8.0 20130411 (prerelease), GMP version 5.1.1, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 6f2c8a0d923b5a4be7dedefadd250ed4
ice.cc: In function ‘unsigned int f()’:
ice.cc:13:48: internal compiler error: in value_dependent_expression_p, at cp/pt.c:19598
     return sizeof(IsNullLiteralHelper(C().val()));
                                                ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
Comment 1 Richard Biener 2013-04-19 08:29:54 UTC
Confirmed.
Comment 2 Jason Merrill 2013-05-13 19:35:42 UTC
Fixed for 4.8.1.
Comment 3 Raphael Kubo da Costa 2013-05-14 16:00:03 UTC
For reference, this was fixed in r198882: http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=28038d26df63ee5755da90bb563db4097a9deec0