public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c
@ 2004-03-12 13:09 erwin at klomp dot org
  2004-03-12 13:11 ` [Bug java/14551] " erwin at klomp dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: erwin at klomp dot org @ 2004-03-12 13:09 UTC (permalink / raw)
  To: gcc-bugs

I found a bug in gcj-3.3. It looks like this from the command line:

$ gcj-3.3 -c GcjBug.java
GcjBug.java: In class `GcjBug':
GcjBug.java: In method `GcjBug.getPacketTypeName(int)':
GcjBug.java:62: internal compiler error: in tree_low_cst, at tree.c:3255
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


I've included a test case as an attachment called GcjBug.java. It is derived
from a file in my application that caused this problem, but strips code that
isn't necessary to show the bug.

I've done some analyses in the Java source to find out what might trigger the
bug in particular, and also discovered a workaround.

The bug occurs when there is a switch statement, in which the expression is of
type 'int', and all case labels are constants of type 'byte'.

I've found two requirements to trigger the bug:
- there must be at least 17 case labels (I had plenty more in the original
source, but less than 17 labels doesn't trigger the bug)
- at least one of the case labels must have a negative value as a byte, such as
'(byte) 202'.

The workaround is: cast the expression of the switch statement to type byte,
i.e. change 'switch (type)' to 'switch ((byte)type)' in the GcjBug.java source code.


Hopefully this report is useful enough to fix the bug

P.s.

GCJ version information:

$ gcj-3.3 -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040306)

-- 
           Summary: Switch w sign-extended byte and >16 labels causes error
                    in tree.c
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: erwin at klomp dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug java/14551] Switch w sign-extended byte and >16 labels causes error in tree.c
  2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
@ 2004-03-12 13:11 ` erwin at klomp dot org
  2004-03-12 16:01 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: erwin at klomp dot org @ 2004-03-12 13:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From erwin at klomp dot org  2004-03-12 13:11 -------
Created an attachment (id=5905)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5905&action=view)
Minimized source file that still triggers the bug

All code that could be removed while still triggering the bug has been removed;
the result is a valid Java source file that can (should) be compiled by itself.

-- 


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


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

* [Bug java/14551] Switch w sign-extended byte and >16 labels causes error in tree.c
  2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
  2004-03-12 13:11 ` [Bug java/14551] " erwin at klomp dot org
@ 2004-03-12 16:01 ` pinskia at gcc dot gnu dot org
  2004-03-12 19:00 ` aph at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-12 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-12 16:01 -------
Confirmed on the mainline.
(gdb) p debug_tree(t)
<integer_cst 0x40123050 type <integer_type 0x400503cc int> constant public static overflow 161>

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-12 16:01:37
               date|                            |


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


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

* [Bug java/14551] Switch w sign-extended byte and >16 labels causes error in tree.c
  2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
  2004-03-12 13:11 ` [Bug java/14551] " erwin at klomp dot org
  2004-03-12 16:01 ` pinskia at gcc dot gnu dot org
@ 2004-03-12 19:00 ` aph at gcc dot gnu dot org
  2004-03-15 14:15 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aph at gcc dot gnu dot org @ 2004-03-12 19:00 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |aph at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug java/14551] Switch w sign-extended byte and >16 labels causes error in tree.c
  2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
                   ` (2 preceding siblings ...)
  2004-03-12 19:00 ` aph at gcc dot gnu dot org
@ 2004-03-15 14:15 ` cvs-commit at gcc dot gnu dot org
  2004-03-15 14:16 ` aph at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-15 14:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-15 14:15 -------
Subject: Bug 14551

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2004-03-15 14:15:10

Modified files:
	gcc/java       : ChangeLog typeck.c 

Log message:
	2004-03-12  Andrew Haley  <aph@redhat.com>
	
	PR java/14551
	* typeck.c (convert): Clear TREE_OVERFLOW after an integer
	conversion.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/ChangeLog.diff?cvsroot=gcc&r1=1.1338&r2=1.1339
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/typeck.c.diff?cvsroot=gcc&r1=1.61&r2=1.62



-- 


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


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

* [Bug java/14551] Switch w sign-extended byte and >16 labels causes error in tree.c
  2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
                   ` (3 preceding siblings ...)
  2004-03-15 14:15 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-15 14:16 ` aph at gcc dot gnu dot org
  2004-03-16  1:38 ` pinskia at gcc dot gnu dot org
  2004-04-12 14:00 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: aph at gcc dot gnu dot org @ 2004-03-15 14:16 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING


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


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

* [Bug java/14551] Switch w sign-extended byte and >16 labels causes error in tree.c
  2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
                   ` (4 preceding siblings ...)
  2004-03-15 14:16 ` aph at gcc dot gnu dot org
@ 2004-03-16  1:38 ` pinskia at gcc dot gnu dot org
  2004-04-12 14:00 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-16  1:38 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.5.0


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


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

* [Bug java/14551] Switch w sign-extended byte and >16 labels causes error in tree.c
  2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
                   ` (5 preceding siblings ...)
  2004-03-16  1:38 ` pinskia at gcc dot gnu dot org
@ 2004-04-12 14:00 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-12 14:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-12 12:58 -------
Closing as fixed.

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


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


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

end of thread, other threads:[~2004-04-12 12:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-12 13:09 [Bug java/14551] New: Switch w sign-extended byte and >16 labels causes error in tree.c erwin at klomp dot org
2004-03-12 13:11 ` [Bug java/14551] " erwin at klomp dot org
2004-03-12 16:01 ` pinskia at gcc dot gnu dot org
2004-03-12 19:00 ` aph at gcc dot gnu dot org
2004-03-15 14:15 ` cvs-commit at gcc dot gnu dot org
2004-03-15 14:16 ` aph at gcc dot gnu dot org
2004-03-16  1:38 ` pinskia at gcc dot gnu dot org
2004-04-12 14:00 ` pinskia 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).