[Bug c++/22551] [4.0/4.1 Regression] [ICE] in tree_low_cst, at tree.c:3843

2005-07-18 Thread emailwastefilter-bugzillagccorg at yahoo dot com

--- Additional Comments From emailwastefilter-bugzillagccorg at yahoo dot 
com  2005-07-18 18:03 ---
(In reply to comment #2)
> Hmm, 0x8000+1 overflows which is invalid for constant expressions and
really should be 
> rejected.

The warnings seem on the money, but they should not cause the compiler to crash,
right?

The original code used 0xFFFE in place of 0x8000 and had around 26
warning messages before it crashed.  If there are only 4 warning messages, then
the compiler completes without crashing.  Starting with 0x8000 - 2 lets the
compiler complete, as does commenting out one of the case statements.

Several obivous ways around this code are to use an enum, an unsigned int, or an
if-else if cascasde.  These all result in no warnings, the first two justly, the
last I'm not so sure.

-- 


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


[Bug c++/22551] [ICE] in tree_low_cst, at tree.c:3843

2005-07-18 Thread emailwastefilter-bugzillagccorg at yahoo dot com

--- Additional Comments From emailwastefilter-bugzillagccorg at yahoo dot 
com  2005-07-18 17:23 ---
Created an attachment (id=9302)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9302&action=view)
Testcase which causes the ICE

Same as the code that was pasted in the report (just possibly more convient?)

-- 


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


[Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843

2005-07-18 Thread emailwastefilter-bugzillagccorg at yahoo dot com
This code was distilled from debian source pose_3.5-7.dsc (The Palm OS 
Emulator).

The bug manifests after a number of "warning: overflow in implicit constant
conversion" and then "internal compiler error: in tree_low_cst, at tree.c:3843".
 There must be at least 5 warnings or the ICE does not appear.

This Debian sid on an AMD64.  g++-3.4 (gcc version 3.4.5 20050706 (prerelease)
(Debian 3.4.4-5)) does NOT exhibit this bug.

command line:
$ g++-4.0 -c testcase.cpp

output:
testcase.cpp: In function 'int main(value_type)':
testcase.cpp:12: warning: overflow in implicit constant conversion
testcase.cpp:13: warning: overflow in implicit constant conversion
testcase.cpp:14: warning: overflow in implicit constant conversion
testcase.cpp:15: warning: overflow in implicit constant conversion
testcase.cpp:16: warning: overflow in implicit constant conversion
testcase.cpp:10: internal compiler error: in tree_low_cst, at tree.c:3843
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see .

--testcase.cpp--
typedef int value_type;
const value_type b = 0x8000;
const value_type e1 = b + 1;
const value_type e2 = b + 2;
const value_type e3 = b + 3;
const value_type e4 = b + 4;
const value_type e5 = b + 5;
int main (value_type error)
{
  switch (error)
  {
   case e1: return 0;
   case e2: return 0;
   case e3: return 0;
   case e4: return 0;
   case e5: return 0;
 }
}
--testcase.cpp--

gcc -v:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk-default
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.0.1 (Debian 4.0.1-2)

-- 
   Summary: [ICE] in tree_low_cst, at tree.c:3843
   Product: gcc
   Version: 4.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: emailwastefilter-bugzillagccorg at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org


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