This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java/3602: Problems with bytes



>Number:         3602
>Category:       java
>Synopsis:       Problems with bytes
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 07 02:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Anthony Green
>Release:        3.1 20010705 (experimental)
>Organization:
>Environment:
System: Linux fencer.cygnus.com 2.2.12-20smp #1 SMP Mon Sep 27 10:34:45 EDT 1999 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-language=c,c++,java --enable-threads --prefix=/horton/green/net/i : (reconfigured) 
>Description:
	gcj is having problems with bytes.  See the attached program.  I'm seeing..
OK
Bad
-73

	That last number should be 0xB7.  -73 is 0xFFFFFFB7. :-(

	I don't think there's any work-around.
>How-To-Repeat:
	Compile the following and run...

public class Bytes {

  public static void foo (byte b)
  {
    if (b == (byte)0xB7)
      {
	System.out.println ("OK");
      }
    
    switch (b)
      {
      case INVOKESPECIAL:
	System.out.println ("Match");
      default:
	System.out.println ("Bad");
      }

    System.out.println (b);
  }

  public static void main (String args[])
  {
    foo (INVOKESPECIAL);
  }

  public static final byte
    PUTSTATIC = (byte)0xB3,
    GETFIELD = (byte)0xB4,
    PUTFIELD = (byte)0xB5,
    INVOKEVIRTUAL = (byte)0xB6,
    INVOKESPECIAL = (byte)0xB7,
    INVOKESTATIC = (byte)0xB8,
    INVOKEINTERFACE = (byte)0xB9,
    XXXUNUSEDXXX = (byte)0xBA,
    NEW = (byte)0xBB,
    NEWARRAY = (byte)0xBC,
    ANEWARRAY = (byte)0xBD,
    ARRAYLENGTH = (byte)0xBE,
    ATHROW = (byte)0xBF;
}


>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]