public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/60667] New: Undefined behavior in Java FE
Date: Wed, 26 Mar 2014 08:45:00 -0000	[thread overview]
Message-ID: <bug-60667-8172@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 60667
           Summary: Undefined behavior in Java FE
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: aph at gcc dot gnu.org

Undefined behavior in java FE.

In --with-build-config=bootstrap-ubsan i686 trunk bootstrap I'm getting
several:
../../gcc/double-int.c:1064:33: runtime error: shift exponent -65 is negative
errors (and similar), e.g. on:
/usr/src/gcc/obj985a/./gcc/gcj
-B/usr/src/gcc/obj985a/i686-pc-linux-gnu/libjava/ -B/usr/src/gcc/obj985a/./gcc/
-B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/
-isystem /usr/local/i686-pc-linux-gnu/include -isystem
/usr/local/i686-pc-linux-gnu/sys-include -ffloat-store -fomit-frame-pointer
-Usun -fclasspath= -fbootclasspath=../../../libjava/classpath/lib
--encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c
-fsource-filename=/usr/src/gcc/obj985a/i686-pc-linux-gnu/libjava/classpath/lib/classes
-MT gnu/java/awt.lo -MD -MP -MF gnu/java/awt.deps @gnu/java/awt.list -fPIC -o
gnu/java/.libs/awt.o

This happens on:
#0  double_int::set_bit (this=0xffffc920, bitpos=4294967295) at
../../gcc/double-int.c:1064
#1  0x08258b8a in mark_reference_fields (field=0xf79c1844, mask=<optimized
out>, pointer_after_end=0xffffc920, all_bits_set=0x8258e06, 
    last_set_index=0xffffc90c, last_view_index=0xffffc910, ubit=32) at
../../gcc/java/boehm.c:110

p int_byte_position (field)
$12 = 128
p ubit
$13 = 32
p int_size_in_bytes (field->typed.type)
$17 = 4
Thus count is 32, ubit 32, size_words 1 and ubit - count - i - 1 is -1,
thus
*mask = (*mask).set_bit (ubit - count - i - 1);
is set_bit (0xffffffff) and attempts to shift up by (int) (0xffffffff - 64).

p debug_tree (field)
 <field_decl 0xf79c1844 focusListener
    type <pointer_type 0xf79b1c00
        type <record_type 0xf79b1ba0 java.awt.event.FocusListener type_2 type_4
SI
            size <integer_cst 0xf78e3540 constant 32>
            unit size <integer_cst 0xf78e3e54 constant 4>
            align 32 symtab 0 alias set -1 canonical type 0xf79b1ba0 fields
<field_decl 0xf7a0c958 D.1856>
            pointer_to_this <pointer_type 0xf79b1c00> chain <type_decl
0xf79a5ca8 java.awt.event.FocusListener>>
        unsigned SI size <integer_cst 0xf78e3540 32>
        unit size <integer_cst 0xf78e355c constant 4>
        align 32 symtab 0 alias set -1 canonical type 0xf79b1c00
        pointer_to_this <pointer_type 0xf79b1d80>>
    unsigned decl_5 SI file
/usr/src/gcc/libjava/classpath/java/awt/Component.java line 0 col 0 size
<integer_cst 0xf78e3540 32> unit size <integer_cst 0xf78e355c 4>
    align 32 offset_align 128
    offset <integer_cst 0xf78fe1c0 type <integer_type 0xf78f4000 sizetype>
constant 128>
    bit offset <integer_cst 0xf78e35e8 type <integer_type 0xf78f4060
bitsizetype> constant 0> context <record_type 0xf7908720 java.awt.Component>
chain <field_decl 0xf79c18a0 keyListener>>
$18 = void


Can you please fix this, I have no idea what this code tries to do and why.


             reply	other threads:[~2014-03-26  8:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26  8:45 jakub at gcc dot gnu.org [this message]
2014-03-26  8:47 ` [Bug java/60667] " jakub at gcc dot gnu.org
2014-03-26  9:27 ` aph at redhat dot com
2014-03-28 15:11 ` aph at gcc dot gnu.org
2014-03-28 15:35 ` jakub at gcc dot gnu.org
2014-03-28 15:36 ` aph at gcc dot gnu.org
2014-03-28 16:06 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-60667-8172@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).