public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/13720] New: gcc/libjava/java/lang/natSystem.cc: syntax error using "unsigned jint"
@ 2004-01-17 15:21 roland dot illig at gmx dot de
  2004-01-17 17:46 ` [Bug libgcj/13720] " pinskia at gcc dot gnu dot org
  2004-09-22 21:50 ` tromey at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: roland dot illig at gmx dot de @ 2004-01-17 15:21 UTC (permalink / raw)
  To: gcc-bugs

Hello,

I tried to compile libjava to try out the GDK/GTK awt peer. When compiling with
gcc-3.3.3, i got a syntax error in `array_copy', where the source code is:

    ... if ((unsigned jint) src_offset ...

jint is typedef'd to __java_int and so there are two ID tokens in the
parentheses, not one type-ID. Maybe gcc-3.4 can handle this, but I would rather
apply this patch:

Index: natSystem.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/lang/natSystem.cc,v
retrieving revision 1.56
diff -u -r1.56 natSystem.cc
--- natSystem.cc        23 Jul 2003 15:31:43 -0000      1.56
+++ natSystem.cc        17 Jan 2004 15:20:27 -0000
@@ -66,10 +66,12 @@
   __JArray *src_a = (__JArray *) src;
   __JArray *dst_a = (__JArray *) dst;
   if (src_offset < 0 || dst_offset < 0 || count < 0
-      || (unsigned jint) src_offset > (unsigned jint) src_a->length
-      || (unsigned jint) (src_offset + count) > (unsigned jint) src_a->length
-      || (unsigned jint) dst_offset > (unsigned jint) dst_a->length
-      || (unsigned jint) (dst_offset + count) > (unsigned jint) dst_a->length)
+      || src_offset > src_a->length
+      || src_offset - (-count) >= 0 // check for possible integer overflow
+      || src_offset + count > src_a->length
+      || dst_offset > dst_a->length
+      || dst_offset - (-count) >= 0 // check for possible integer overflow
+      || dst_offset + count > dst_a->length)
     throw new ArrayIndexOutOfBoundsException;
 
   // Do-nothing cases.

-- 
           Summary: gcc/libjava/java/lang/natSystem.cc: syntax error using
                    "unsigned jint"
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roland dot illig at gmx dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-debian-linux-gnu
  GCC host triplet: i686-debian-linux-gnu
GCC target triplet: i686-debian-linux-gnu


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


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

end of thread, other threads:[~2004-09-22 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-17 15:21 [Bug java/13720] New: gcc/libjava/java/lang/natSystem.cc: syntax error using "unsigned jint" roland dot illig at gmx dot de
2004-01-17 17:46 ` [Bug libgcj/13720] " pinskia at gcc dot gnu dot org
2004-09-22 21:50 ` tromey 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).