public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/64044] New: Java emits bogus .class$ decls
Date: Mon, 24 Nov 2014 10:32:00 -0000	[thread overview]
Message-ID: <bug-64044-8172@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64044

            Bug ID: 64044
           Summary: Java emits bogus .class$ decls
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: java
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
                CC: aph at gcc dot gnu.org

Currently the Java FE is lucky that not all -findirect-dispatch testcases are
miscompiled as gimple-fold.c:get_symbol_constant_value has

      /* Variables declared 'const' without an initializer
         have zero as the initializer if they may not be
         overridden at link or run time.  */
      if (!val
          && (INTEGRAL_TYPE_P (TREE_TYPE (sym))
               || SCALAR_FLOAT_TYPE_P (TREE_TYPE (sym))))
        return build_zero_cst (TREE_TYPE (sym));

which for unkown reason avoids to fold the reads from .class$ at the beginning
of all functions to NULL (because the above doesn't allow pointer types).

I ran into this when doing the same during value-numbering but "forgetting"
to paper over the Java FE bug.

The Java FE emits (for example)

 <var_decl 0x7ffff6c6e360 Array_2.class$
    type <pointer_type 0x7ffff6c69a80
        type <record_type 0x7ffff6c69930 java.lang.Class readonly type_4 BLK
            size <integer_cst 0x7ffff6c43858 constant 2240>
            unit size <integer_cst 0x7ffff6c43828 constant 280>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff6c69930 fields
<field_decl 0x7ffff6c521c8 D.89>
            pointer_to_this <pointer_type 0x7ffff6c699d8>>
        readonly public unsigned DI
        size <integer_cst 0x7ffff6c25bb8 constant 64>
        unit size <integer_cst 0x7ffff6c25bd0 constant 8>
        align 64 symtab 0 alias set -1 canonical type 0x7ffff6c69a80
        pointer_to_this <pointer_type 0x7ffff6c7f888>>
    readonly constant addressable public static unsigned ignored DI file
Array_2.java line 4 col 0 size <integer_cst 0x7ffff6c25bb8 64> unit size
<integer_cst 0x7ffff6c25bd0 8>
    align 64 context <record_type 0x7ffff6c5e540 Array_2>
    (mem/u/f/c:DI (symbol_ref:DI ("_ZN7Array_27class$$E") [flags 0x2] 
<var_decl 0x7ffff6c6e360 Array_2.class$>) [2 Array_2.class$+0 S8 A64])>

which misses an initializer (it seems to be not initialized in .s either,
thus the flags on it are wrong?  Probably they get initialized by the
runtime?).


             reply	other threads:[~2014-11-24 10:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24 10:32 rguenth at gcc dot gnu.org [this message]
2014-11-24 10:35 ` [Bug java/64044] " rguenth at gcc dot gnu.org
2014-11-24 10:38 ` aph at redhat dot com
2014-11-24 10:39 ` rguenth at gcc dot gnu.org
2014-11-24 10:50 ` rguenther at suse dot de
2014-11-24 11:28 ` aph at gcc dot gnu.org
2014-11-24 14:02 ` rguenth 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-64044-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).