public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843
@ 2005-07-18 17:22 emailwastefilter-bugzillagccorg at yahoo dot com
  2005-07-18 17:27 ` [Bug c++/22551] " emailwastefilter-bugzillagccorg at yahoo dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: emailwastefilter-bugzillagccorg at yahoo dot com @ 2005-07-18 17:22 UTC (permalink / raw)
  To: gcc-bugs

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 <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.

--testcase.cpp--
typedef int value_type;
const value_type b = 0x80000000;
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


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

* [Bug c++/22551] [ICE] in tree_low_cst, at tree.c:3843
  2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
@ 2005-07-18 17:27 ` emailwastefilter-bugzillagccorg at yahoo dot com
  2005-07-18 17:41 ` [Bug c++/22551] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: emailwastefilter-bugzillagccorg at yahoo dot com @ 2005-07-18 17:27 UTC (permalink / raw)
  To: gcc-bugs


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


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

* [Bug c++/22551] [4.0/4.1 Regression] [ICE] in tree_low_cst, at tree.c:3843
  2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
  2005-07-18 17:27 ` [Bug c++/22551] " emailwastefilter-bugzillagccorg at yahoo dot com
@ 2005-07-18 17:41 ` pinskia at gcc dot gnu dot org
  2005-07-18 18:05 ` emailwastefilter-bugzillagccorg at yahoo dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-18 17:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-18 17:27 -------
Hmm, 0x80000000+1 overflows which is invalid for constant expressions and really should be 
rejected.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-18 17:27:27
               date|                            |
            Summary|[ICE] in tree_low_cst, at   |[4.0/4.1 Regression] [ICE]
                   |tree.c:3843                 |in tree_low_cst, at
                   |                            |tree.c:3843
   Target Milestone|---                         |4.0.2


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


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

* [Bug c++/22551] [4.0/4.1 Regression] [ICE] in tree_low_cst, at tree.c:3843
  2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
  2005-07-18 17:27 ` [Bug c++/22551] " emailwastefilter-bugzillagccorg at yahoo dot com
  2005-07-18 17:41 ` [Bug c++/22551] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-07-18 18:05 ` emailwastefilter-bugzillagccorg at yahoo dot com
  2005-07-18 18:07 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: emailwastefilter-bugzillagccorg at yahoo dot com @ 2005-07-18 18:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From emailwastefilter-bugzillagccorg at yahoo dot com  2005-07-18 18:03 -------
(In reply to comment #2)
> Hmm, 0x80000000+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 0xFFFE0000 in place of 0x80000000 and had around 26
warning messages before it crashed.  If there are only 4 warning messages, then
the compiler completes without crashing.  Starting with 0x80000000 - 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


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

* [Bug c++/22551] [4.0/4.1 Regression] [ICE] in tree_low_cst, at tree.c:3843
  2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
                   ` (2 preceding siblings ...)
  2005-07-18 18:05 ` emailwastefilter-bugzillagccorg at yahoo dot com
@ 2005-07-18 18:07 ` pinskia at gcc dot gnu dot org
  2005-09-10  3:17 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-18 18:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-18 18:05 -------
If you add -pedantic and compile your example, you will see that we error out instead of accepting the 
code.

You might want to use unsigned instead of signed as signed overflow is undefined.

-- 


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


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

* [Bug c++/22551] [4.0/4.1 Regression] [ICE] in tree_low_cst, at tree.c:3843
  2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
                   ` (3 preceding siblings ...)
  2005-07-18 18:07 ` pinskia at gcc dot gnu dot org
@ 2005-09-10  3:17 ` pinskia at gcc dot gnu dot org
  2005-09-12 20:48 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-10  3:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-10 03:17 -------
I think the front-end is not remarking the INTEGER_CST's TREE_OVERFLOW to be zero.

-- 


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


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

* [Bug c++/22551] [4.0/4.1 Regression] [ICE] in tree_low_cst, at tree.c:3843
  2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
                   ` (4 preceding siblings ...)
  2005-09-10  3:17 ` pinskia at gcc dot gnu dot org
@ 2005-09-12 20:48 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-12 20:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-12 20:48 -------
: Search converges between 2004-08-05-trunk (#505) and 2004-08-06-trunk (#506).


-- 


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


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

* [Bug c++/22551] [4.0/4.1 Regression] [ICE] in tree_low_cst, at tree.c:3843
  2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
                   ` (5 preceding siblings ...)
  2005-09-12 20:48 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:24 ` mmitchel at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:24 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


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

end of thread, other threads:[~2005-09-27 16:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-18 17:22 [Bug c++/22551] New: [ICE] in tree_low_cst, at tree.c:3843 emailwastefilter-bugzillagccorg at yahoo dot com
2005-07-18 17:27 ` [Bug c++/22551] " emailwastefilter-bugzillagccorg at yahoo dot com
2005-07-18 17:41 ` [Bug c++/22551] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-07-18 18:05 ` emailwastefilter-bugzillagccorg at yahoo dot com
2005-07-18 18:07 ` pinskia at gcc dot gnu dot org
2005-09-10  3:17 ` pinskia at gcc dot gnu dot org
2005-09-12 20:48 ` pinskia at gcc dot gnu dot org
2005-09-27 16:24 ` mmitchel 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).