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

* [Bug libgcj/13720] gcc/libjava/java/lang/natSystem.cc: syntax error using "unsigned jint"
  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 ` pinskia at gcc dot gnu dot org
  2004-09-22 21:50 ` tromey at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-17 17:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-17 17:46 -------
Confirmed, always send java patches to both gcc-patches@gcc.gnu.org and java-
patches@gcc.gnu.org with a changelog.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|java                        |libgcj
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-17 17:46:54
               date|                            |


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


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

* [Bug libgcj/13720] gcc/libjava/java/lang/natSystem.cc: syntax error using "unsigned jint"
  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
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-09-22 21:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tromey at gcc dot gnu dot org  2004-09-22 21:50 -------
A couple notes on this patch.

First, we don't support compiling libgcj with a different
version of gcj other than the one it comes with.  The reason
for this is that gcj and libgcj are tightly coupled; for instance
gcj and libgcj both have information about the exact format of
java.lang.Class.

Second, I'm not sure this patch is correct.  E.g.,

+      || src_offset - (-count) >= 0 // check for possible integer overflow

Suppose src_offset==10 and count==3.
Then src_offset-(-count) == 7, which is >= 0,
but no integer overflow has occurred.
(This is a perfectly valid situation if the source
array's length is >= 13)

So, I'm closing this and not checking in the patch.


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


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