Bug 50859 - ICE when creating integral constant from real value in a template
Summary: ICE when creating integral constant from real value in a template
Status: RESOLVED DUPLICATE of bug 49855
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.1
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-10-24 23:30 UTC by bitbucket
Modified: 2011-10-24 23:54 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.7.0
Known to fail:
Last reconfirmed: 2011-10-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bitbucket 2011-10-24 23:30:49 UTC
$ curl 'http://169.254.169.254/latest/meta-data/ami-id' && echo
ami-21f53948
$ cat /etc/issue
Ubuntu 11.10 \n \l

$ uname -a
Linux domU-12-31-39-12-AC-DE 3.0.0-12-virtual #20-Ubuntu SMP Fri Oct 7 18:19:02 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
$ g++ --version
g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat ice.cc 
template <class T>
void f() {
  const int INTEGRAL_CONSTANT = 1.0;
}

$ g++ ice.cc
ice.cc: In function ‘void f()’:
ice.cc:3:33: internal compiler error: in fold_convert_const_int_from_real, at fold-const.c:1562
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccRBRVx3.out file, please attach this to your bugreport.
$ cat /tmp/ccRBRVx3.out
// /usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1plus -quiet -imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE ice.cc -quiet -dumpbase ice.cc -mtune=generic -march=x86-64 -auxbase ice -fstack-protector -o - -frandom-seed=0
# 1 "ice.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "ice.cc"
template <class T>
void f() {
  const int INTEGRAL_CONSTANT = 1.0;
}
$

This error does not appear in g++ 4.4.1
Comment 1 Jonathan Wakely 2011-10-24 23:49:23 UTC
seems to be fixed on the trunk already
Comment 2 Paolo Carlini 2011-10-24 23:54:46 UTC
Duplicate, already fixed for 4.6.2.

*** This bug has been marked as a duplicate of bug 49855 ***