diff mbox

Remove Java references in source code.

Message ID 93263f75-165a-5512-de4e-3d5c6eacb388@suse.cz
State New
Headers show

Commit Message

Martin Liška July 11, 2017, 2:30 p.m. UTC
Hello.

Patch removes some remaining references in gcc/ subfolder.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?

Martin

gcc/ChangeLog:

2017-07-11  Martin Liska  <mliska@suse.cz>

	* cfgexpand.c (expand_gimple_basic_block): Remove dead comment.
	* dwarf2out.c (is_java): Remove the function.
	(output_pubname): Remove usage of the function.
	(lower_bound_default): Remove usage of DW_LANG_Java.
	(gen_compile_unit_die): Likewise.
	* gcc.c: Remove compiler defaults for .java and .zip files.
	* gimple-expr.c (remove_suffix): Change as there's no longer
	extension than 4-letter one.
	* gimplify.c (mostly_copy_tree_r): Remove Java-special part.
	(gimplify_save_expr): Likewise.
	* ipa-utils.h (polymorphic_type_binfo_p): Remove the comment
	as it's possible even for other languages than Java.
	* langhooks.h (struct lang_hooks): Remove Java from a comment.
	* lto-opts.c (lto_write_options): Remove reference to Java.
	* opts.c (strip_off_ending): Update file extension handling.
	* tree-cfg.c (verify_gimple_call): Remove comment with Java.
	* tree-eh.c (lower_resx): Likewise.
	* tree.c (free_lang_data_in_type): Remove dead code.
	(find_decls_types_r): Likewise.
	(build_common_builtin_nodes): Remove Java from a comment.
	(verify_type): Remove dead code.
	* varasm.c (assemble_external): Remove Java from a comment.
---
  gcc/cfgexpand.c   |  2 --
  gcc/dwarf2out.c   | 19 +++----------------
  gcc/gcc.c         |  2 --
  gcc/gimple-expr.c |  4 ++--
  gcc/gimplify.c    | 24 +++++-------------------
  gcc/ipa-utils.h   |  3 ---
  gcc/langhooks.h   |  2 +-
  gcc/lto-opts.c    |  4 ++--
  gcc/opts.c        |  4 ++--
  gcc/tree-cfg.c    |  2 --
  gcc/tree-eh.c     |  8 +-------
  gcc/tree.c        | 48 ++----------------------------------------------
  gcc/varasm.c      |  2 +-
  13 files changed, 19 insertions(+), 105 deletions(-)

Comments

Martin Liška July 11, 2017, 2:35 p.m. UTC | #1
Hi.

There's a small follow-up with remaining occurrences:

1) dwarf2out.c:

  20213	    origin_die = lookup_type_die (origin);
  20214	  else if (TREE_CODE (origin) == BLOCK)
  20215	    origin_die = BLOCK_DIE (origin);
  20216	
  20217	  /* XXX: Functions that are never lowered don't always have correct block
  20218	     trees (in the case of java, they simply have no block tree, in some other
  20219	     languages).  For these functions, there is nothing we can really do to
  20220	     output correct debug info for inlined functions in all cases.  Rather
  20221	     than die, we'll just produce deficient debug info now, in that we will
  20222	     have variables without a proper abstract origin.  In the future, when all
  20223	     functions are lowered, we should re-add a gcc_assert (origin_die)

Probably Jakub can help with that?

2) fold-const.c:

   1882	  /* The following code implements the floating point to integer
   1883	     conversion rules required by the Java Language Specification,
   1884	     that IEEE NaNs are mapped to zero and values that overflow
   1885	     the target precision saturate, i.e. values greater than
   1886	     INT_MAX are mapped to INT_MAX, and values less than INT_MIN
   1887	     are mapped to INT_MIN.  These semantics are allowed by the
   1888	     C and C++ standards that simply state that the behavior of
   1889	     FP-to-integer conversion is unspecified upon overflow.  */
   1890	
   1891	  wide_int val;
   1892	  REAL_VALUE_TYPE r;
   1893	  REAL_VALUE_TYPE x = TREE_REAL_CST (arg1);

Can we somehow remove that Richi?

3) gimplify.c:

   2771	     Java requires that we elaborated nodes in source order.  That
   2772	     means we must gimplify the inner expression followed by each of
   2773	     the indices, in order.  But we can't gimplify the inner
   2774	     expression until we deal with any variable bounds, sizes, or
   2775	     positions in order to deal with PLACEHOLDER_EXPRs.
   2776	
   2777	     So we do this in three steps.  First we deal with the annotations
   2778	     for any variables in the components, then we gimplify the base,
   2779	     then we gimplify any indices, from left to right.  */
   2780	  for (i = expr_stack.length () - 1; i >= 0; i--)

Richi?

4) tree.c:

  13535	  if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t) && TYPE_BINFO (tv)
  13536	      && TYPE_BINFO (t) != TYPE_BINFO (tv)
  13537	      /* FIXME: Java sometimes keep dump TYPE_BINFOs on variant types.
  13538		 Since there is no cheap way to tell C++/Java type w/o LTO, do checking
  13539		 at LTO time only.  */
  13540	      && (in_lto_p && odr_type_p (t)))
  13541	    {
  13542	      error ("type variant has different TYPE_BINFO");
  13543	      debug_tree (tv);
  13544	      error ("type variant's TYPE_BINFO");
  13545	      debug_tree (TYPE_BINFO (tv));
  13546	      error ("type's TYPE_BINFO");
  13547	      debug_tree (TYPE_BINFO (t));
  13548	      return false;

Can we Honza remove that?

Thanks,
Martin
Jeff Law July 14, 2017, 7:34 a.m. UTC | #2
On 07/11/2017 08:30 AM, Martin Liška wrote:
> Hello.
> 
> Patch removes some remaining references in gcc/ subfolder.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
> 
> Martin
> 
> gcc/ChangeLog:
> 
> 2017-07-11  Martin Liska  <mliska@suse.cz>
> 
>     * cfgexpand.c (expand_gimple_basic_block): Remove dead comment.
>     * dwarf2out.c (is_java): Remove the function.
>     (output_pubname): Remove usage of the function.
>     (lower_bound_default): Remove usage of DW_LANG_Java.
>     (gen_compile_unit_die): Likewise.
>     * gcc.c: Remove compiler defaults for .java and .zip files.
>     * gimple-expr.c (remove_suffix): Change as there's no longer
>     extension than 4-letter one.
>     * gimplify.c (mostly_copy_tree_r): Remove Java-special part.
>     (gimplify_save_expr): Likewise.
>     * ipa-utils.h (polymorphic_type_binfo_p): Remove the comment
>     as it's possible even for other languages than Java.
>     * langhooks.h (struct lang_hooks): Remove Java from a comment.
>     * lto-opts.c (lto_write_options): Remove reference to Java.
>     * opts.c (strip_off_ending): Update file extension handling.
>     * tree-cfg.c (verify_gimple_call): Remove comment with Java.
>     * tree-eh.c (lower_resx): Likewise.
>     * tree.c (free_lang_data_in_type): Remove dead code.
>     (find_decls_types_r): Likewise.
>     (build_common_builtin_nodes): Remove Java from a comment.
>     (verify_type): Remove dead code.
>     * varasm.c (assemble_external): Remove Java from a comment.
OK.
jeff
Rainer Orth July 14, 2017, 5:43 p.m. UTC | #3
Hi Martin,

> Hello.
>
> Patch removes some remaining references in gcc/ subfolder.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

not enough, it seems: this patch broke Ada bootstrap at on
x86_64-pc-linux-gnu, sparc-sun-solaris2.12, and i386-pc-solaris2.12
(probably everywhere) during stage2:

+===========================GNAT BUG DETECTED==============================+
| 8.0.0 20170714 (experimental) [trunk revision 250207] (x86_64-pc-linux-gnu) GCC error:|
| in gimplify_save_expr, at gimplify.c:5805                                |
| Error detected around /vol/gcc/src/hg/trunk/local/gcc/ada/butil.adb:40:31|
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact command that you entered.                              |
| Also include sources listed below.                                       |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases,
so please double check that the problem can still
be reproduced with the set of files listed.
Consider also -gnatd.n switch (see debug.adb).

/vol/gcc/src/hg/trunk/local/gcc/ada/system.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/butil.adb
/vol/gcc/src/hg/trunk/local/gcc/ada/butil.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/namet.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/alloc.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/hostparm.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/types.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/unchconv.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/unchdeal.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/table.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/gnat.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/g-table.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/g-dyntab.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/ada.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/a-unccon.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/output.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/s-os_lib.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/s-string.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/s-stalib.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/s-exctab.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/s-unstyp.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/s-conca2.ads
/vol/gcc/src/hg/trunk/local/gcc/ada/s-assert.ads


raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:406
/vol/gcc/src/hg/trunk/local/gcc/ada/gcc-interface/Make-lang.in:119: recipe for target 'ada/butil.o' failed
make[3]: *** [ada/butil.o] Error 1

Reverting ...

> 	* gimplify.c
> 	(gimplify_save_expr): Likewise.

... this part allowed the bootstrap to finish.

	Rainer
Jeff Law July 14, 2017, 6:18 p.m. UTC | #4
On 07/14/2017 11:43 AM, Rainer Orth wrote:
> Hi Martin,
> 
>> Hello.
>>
>> Patch removes some remaining references in gcc/ subfolder.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> not enough, it seems: this patch broke Ada bootstrap at on
> x86_64-pc-linux-gnu, sparc-sun-solaris2.12, and i386-pc-solaris2.12
> (probably everywhere) during stage2:

> 
> +===========================GNAT BUG DETECTED==============================+
> | 8.0.0 20170714 (experimental) [trunk revision 250207] (x86_64-pc-linux-gnu) GCC error:|
> | in gimplify_save_expr, at gimplify.c:5805                                |
> | Error detected around /vol/gcc/src/hg/trunk/local/gcc/ada/butil.adb:40:31|
> | Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
> | Use a subject line meaningful to you and us to track the bug.            |
> | Include the entire contents of this bug box in the report.               |
> | Include the exact command that you entered.                              |
> | Also include sources listed below.                                       |
> +==========================================================================+
> 
> Please include these source files with error report
> Note that list may not be accurate in some cases,
> so please double check that the problem can still
> be reproduced with the set of files listed.
> Consider also -gnatd.n switch (see debug.adb).
> 
> /vol/gcc/src/hg/trunk/local/gcc/ada/system.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/butil.adb
> /vol/gcc/src/hg/trunk/local/gcc/ada/butil.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/namet.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/alloc.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/hostparm.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/types.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/unchconv.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/unchdeal.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/table.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/gnat.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/g-table.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/g-dyntab.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/ada.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/a-unccon.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/output.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/s-os_lib.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/s-string.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/s-stalib.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/s-exctab.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/s-unstyp.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/s-conca2.ads
> /vol/gcc/src/hg/trunk/local/gcc/ada/s-assert.ads
> 
> 
> raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:406
> /vol/gcc/src/hg/trunk/local/gcc/ada/gcc-interface/Make-lang.in:119: recipe for target 'ada/butil.o' failed
> make[3]: *** [ada/butil.o] Error 1
> 
> Reverting ...
> 
>> 	* gimplify.c
>> 	(gimplify_save_expr): Likewise.
> 
> ... this part allowed the bootstrap to finish.
If you wanted to commit that change with a comment somehow indicating
how the code is interacting with the Ada front-end, consider it
pre-approved.  Similarly for you Martin.  No need to get approval for
putting a chunk of code back in :-)

jeff
Eric Botcazou July 15, 2017, 7:37 a.m. UTC | #5
> Patch removes some remaining references in gcc/ subfolder.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

You need to configure with --enable-languages=all for cleanups like this, the 
patch trivially breaks the Ada compiler everywhere:

+===========================GNAT BUG DETECTED==============================+
| 8.0.0 20170715 (experimental) [trunk revision 250221] (x86_64-suse-linux) 
GCC error:|
| in gimplify_save_expr, at gimplify.c:5805                                |
| Error detected around /home/eric/svn/gcc/gcc/ada/butil.adb:40:31         |
| Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
Martin Liška July 17, 2017, 11:33 a.m. UTC | #6
On 07/15/2017 09:37 AM, Eric Botcazou wrote:
>> Patch removes some remaining references in gcc/ subfolder.
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> You need to configure with --enable-languages=all for cleanups like this, the 
> patch trivially breaks the Ada compiler everywhere:

Hi.

Sorry for the breakage. Thanks!

Martin 

> 
> +===========================GNAT BUG DETECTED==============================+
> | 8.0.0 20170715 (experimental) [trunk revision 250221] (x86_64-suse-linux) 
> GCC error:|
> | in gimplify_save_expr, at gimplify.c:5805                                |
> | Error detected around /home/eric/svn/gcc/gcc/ada/butil.adb:40:31         |
> | Please submit a bug report; see https://gcc.gnu.org/bugs/ .              |
>
Richard Biener July 25, 2017, 11:55 a.m. UTC | #7
On Tue, Jul 11, 2017 at 4:35 PM, Martin Liška <mliska@suse.cz> wrote:
> Hi.
>
> There's a small follow-up with remaining occurrences:
>
> 1) dwarf2out.c:
>
>  20213      origin_die = lookup_type_die (origin);
>  20214    else if (TREE_CODE (origin) == BLOCK)
>  20215      origin_die = BLOCK_DIE (origin);
>  20216
>  20217    /* XXX: Functions that are never lowered don't always have correct
> block
>  20218       trees (in the case of java, they simply have no block tree, in
> some other
>  20219       languages).  For these functions, there is nothing we can
> really do to
>  20220       output correct debug info for inlined functions in all cases.
> Rather
>  20221       than die, we'll just produce deficient debug info now, in that
> we will
>  20222       have variables without a proper abstract origin.  In the
> future, when all
>  20223       functions are lowered, we should re-add a gcc_assert
> (origin_die)
>
> Probably Jakub can help with that?

Can you check whether all-language bootstrap passes with the suggested
gcc_assert?

> 2) fold-const.c:
>
>   1882    /* The following code implements the floating point to integer
>   1883       conversion rules required by the Java Language Specification,
>   1884       that IEEE NaNs are mapped to zero and values that overflow
>   1885       the target precision saturate, i.e. values greater than
>   1886       INT_MAX are mapped to INT_MAX, and values less than INT_MIN
>   1887       are mapped to INT_MIN.  These semantics are allowed by the
>   1888       C and C++ standards that simply state that the behavior of
>   1889       FP-to-integer conversion is unspecified upon overflow.  */
>   1890
>   1891    wide_int val;
>   1892    REAL_VALUE_TYPE r;
>   1893    REAL_VALUE_TYPE x = TREE_REAL_CST (arg1);
>
> Can we somehow remove that Richi?

Remove what?  The comment?  It still matches the code and we have to
do sth.  So I don't see why we should change this.

Maybe Joseph knows whether future standards / TRs recommend sth different
or exactly this.

>
> 3) gimplify.c:
>
>   2771       Java requires that we elaborated nodes in source order.  That
>   2772       means we must gimplify the inner expression followed by each of
>   2773       the indices, in order.  But we can't gimplify the inner
>   2774       expression until we deal with any variable bounds, sizes, or
>   2775       positions in order to deal with PLACEHOLDER_EXPRs.
>   2776
>   2777       So we do this in three steps.  First we deal with the
> annotations
>   2778       for any variables in the components, then we gimplify the base,
>   2779       then we gimplify any indices, from left to right.  */
>   2780    for (i = expr_stack.length () - 1; i >= 0; i--)
>
> Richi?

Just change the comment to "We elaborate nodes in source order. [...]"

> 4) tree.c:
>
>  13535    if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t) && TYPE_BINFO
> (tv)
>  13536        && TYPE_BINFO (t) != TYPE_BINFO (tv)
>  13537        /* FIXME: Java sometimes keep dump TYPE_BINFOs on variant
> types.
>  13538           Since there is no cheap way to tell C++/Java type w/o LTO,
> do checking
>  13539           at LTO time only.  */
>  13540        && (in_lto_p && odr_type_p (t)))
>  13541      {
>  13542        error ("type variant has different TYPE_BINFO");
>  13543        debug_tree (tv);
>  13544        error ("type variant's TYPE_BINFO");
>  13545        debug_tree (TYPE_BINFO (tv));
>  13546        error ("type's TYPE_BINFO");
>  13547        debug_tree (TYPE_BINFO (t));
>  13548        return false;
>
> Can we Honza remove that?

Try it? (remove in_lto_p &&)

> Thanks,
> Martin
Jan Hubicka July 25, 2017, 6:47 p.m. UTC | #8
> > 4) tree.c:
> >
> >  13535    if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t) && TYPE_BINFO
> > (tv)
> >  13536        && TYPE_BINFO (t) != TYPE_BINFO (tv)
> >  13537        /* FIXME: Java sometimes keep dump TYPE_BINFOs on variant
> > types.
> >  13538           Since there is no cheap way to tell C++/Java type w/o LTO,
> > do checking
> >  13539           at LTO time only.  */
> >  13540        && (in_lto_p && odr_type_p (t)))
> >  13541      {
> >  13542        error ("type variant has different TYPE_BINFO");
> >  13543        debug_tree (tv);
> >  13544        error ("type variant's TYPE_BINFO");
> >  13545        debug_tree (TYPE_BINFO (tv));
> >  13546        error ("type's TYPE_BINFO");
> >  13547        debug_tree (TYPE_BINFO (t));
> >  13548        return false;
> >
> > Can we Honza remove that?
> 
> Try it? (remove in_lto_p &&)

Yep, I vaguely remember ObjC also doing funny things with BINFOs, but if removing
it breaks nothing I am all for letting it go :)

Honza
> 
> > Thanks,
> > Martin
Martin Liška July 31, 2017, 7:44 a.m. UTC | #9
On 07/25/2017 01:55 PM, Richard Biener wrote:
> On Tue, Jul 11, 2017 at 4:35 PM, Martin Liška <mliska@suse.cz> wrote:
>> Hi.
>>
>> There's a small follow-up with remaining occurrences:
>>
>> 1) dwarf2out.c:
>>
>>  20213      origin_die = lookup_type_die (origin);
>>  20214    else if (TREE_CODE (origin) == BLOCK)
>>  20215      origin_die = BLOCK_DIE (origin);
>>  20216
>>  20217    /* XXX: Functions that are never lowered don't always have correct
>> block
>>  20218       trees (in the case of java, they simply have no block tree, in
>> some other
>>  20219       languages).  For these functions, there is nothing we can
>> really do to
>>  20220       output correct debug info for inlined functions in all cases.
>> Rather
>>  20221       than die, we'll just produce deficient debug info now, in that
>> we will
>>  20222       have variables without a proper abstract origin.  In the
>> future, when all
>>  20223       functions are lowered, we should re-add a gcc_assert
>> (origin_die)
>>
>> Probably Jakub can help with that?
> 
> Can you check whether all-language bootstrap passes with the suggested
> gcc_assert?

No, following simple test-case can break it:

$ cat ice.i
__attribute__ ((__always_inline__)) int a ()
{
  int b = 0;
}
void
c ()
{
  a ();
}

Thus maybe a small adjustment of the comment can be done.

> 
>> 2) fold-const.c:
>>
>>   1882    /* The following code implements the floating point to integer
>>   1883       conversion rules required by the Java Language Specification,
>>   1884       that IEEE NaNs are mapped to zero and values that overflow
>>   1885       the target precision saturate, i.e. values greater than
>>   1886       INT_MAX are mapped to INT_MAX, and values less than INT_MIN
>>   1887       are mapped to INT_MIN.  These semantics are allowed by the
>>   1888       C and C++ standards that simply state that the behavior of
>>   1889       FP-to-integer conversion is unspecified upon overflow.  */
>>   1890
>>   1891    wide_int val;
>>   1892    REAL_VALUE_TYPE r;
>>   1893    REAL_VALUE_TYPE x = TREE_REAL_CST (arg1);
>>
>> Can we somehow remove that Richi?
> 
> Remove what?  The comment?  It still matches the code and we have to
> do sth.  So I don't see why we should change this.

Yep, I just mean comment which says that we do such transformation just
because of Java. Which is probably not true I guess.

> 
> Maybe Joseph knows whether future standards / TRs recommend sth different
> or exactly this.
> 
>>
>> 3) gimplify.c:
>>
>>   2771       Java requires that we elaborated nodes in source order.  That
>>   2772       means we must gimplify the inner expression followed by each of
>>   2773       the indices, in order.  But we can't gimplify the inner
>>   2774       expression until we deal with any variable bounds, sizes, or
>>   2775       positions in order to deal with PLACEHOLDER_EXPRs.
>>   2776
>>   2777       So we do this in three steps.  First we deal with the
>> annotations
>>   2778       for any variables in the components, then we gimplify the base,
>>   2779       then we gimplify any indices, from left to right.  */
>>   2780    for (i = expr_stack.length () - 1; i >= 0; i--)
>>
>> Richi?
> 
> Just change the comment to "We elaborate nodes in source order. [...]"
> 
>> 4) tree.c:
>>
>>  13535    if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t) && TYPE_BINFO
>> (tv)
>>  13536        && TYPE_BINFO (t) != TYPE_BINFO (tv)
>>  13537        /* FIXME: Java sometimes keep dump TYPE_BINFOs on variant
>> types.
>>  13538           Since there is no cheap way to tell C++/Java type w/o LTO,
>> do checking
>>  13539           at LTO time only.  */
>>  13540        && (in_lto_p && odr_type_p (t)))
>>  13541      {
>>  13542        error ("type variant has different TYPE_BINFO");
>>  13543        debug_tree (tv);
>>  13544        error ("type variant's TYPE_BINFO");
>>  13545        debug_tree (TYPE_BINFO (tv));
>>  13546        error ("type's TYPE_BINFO");
>>  13547        debug_tree (TYPE_BINFO (t));
>>  13548        return false;
>>
>> Can we Honza remove that?
> 
> Try it? (remove in_lto_p &&)
> 
>> Thanks,
>> Martin

For the rest, I've been testing patch.

Martin
Joseph Myers July 31, 2017, 10:22 p.m. UTC | #10
On Tue, 25 Jul 2017, Richard Biener wrote:

> > 2) fold-const.c:
> >
> >   1882    /* The following code implements the floating point to integer
> >   1883       conversion rules required by the Java Language Specification,
> >   1884       that IEEE NaNs are mapped to zero and values that overflow
> >   1885       the target precision saturate, i.e. values greater than
> >   1886       INT_MAX are mapped to INT_MAX, and values less than INT_MIN
> >   1887       are mapped to INT_MIN.  These semantics are allowed by the
> >   1888       C and C++ standards that simply state that the behavior of
> >   1889       FP-to-integer conversion is unspecified upon overflow.  */
> >   1890
> >   1891    wide_int val;
> >   1892    REAL_VALUE_TYPE r;
> >   1893    REAL_VALUE_TYPE x = TREE_REAL_CST (arg1);
> >
> > Can we somehow remove that Richi?
> 
> Remove what?  The comment?  It still matches the code and we have to
> do sth.  So I don't see why we should change this.
> 
> Maybe Joseph knows whether future standards / TRs recommend sth different
> or exactly this.

The requirement under Annex F is to return an unspecified value (with 
"invalid" raised) for such overflowing / NaN conversions to integer.

"unspecified value" means that any particular execution of the code must 
behave as if some consistent value was chosen; after

double d;
int i = d;

you can't have one subsequent conditional show i == 0 and another show i 
== INT_MAX.  But it's fine for different executions of that code to use 
different values.
diff mbox

Patch

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index c427a89bab0..3e1d24db876 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -5497,8 +5497,6 @@  expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
       if (elt)
 	emit_label (*elt);
 
-      /* Java emits line number notes in the top of labels.
-	 ??? Make this go away once line number notes are obsoleted.  */
       BB_HEAD (bb) = NEXT_INSN (last);
       if (NOTE_P (BB_HEAD (bb)))
 	BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb));
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c277d27e8e8..491c778d58a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -5049,16 +5049,6 @@  is_cxx (const_tree decl)
   return is_cxx ();
 }
 
-/* Return TRUE if the language is Java.  */
-
-static inline bool
-is_java (void)
-{
-  unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language);
-
-  return lang == DW_LANG_Java;
-}
-
 /* Return TRUE if the language is Fortran.  */
 
 static inline bool
@@ -10756,8 +10746,8 @@  output_pubname (dw_offset die_offset, pubname_entry *entry)
         case DW_TAG_enumerator:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags,
                                           GDB_INDEX_SYMBOL_KIND_VARIABLE);
-          if (!is_cxx () && !is_java ())
-            GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
+	  if (!is_cxx ())
+	    GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
           break;
         case DW_TAG_subprogram:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags,
@@ -10785,7 +10775,7 @@  output_pubname (dw_offset die_offset, pubname_entry *entry)
         case DW_TAG_union_type:
         case DW_TAG_enumeration_type:
           GDB_INDEX_SYMBOL_KIND_SET_VALUE(flags, GDB_INDEX_SYMBOL_KIND_TYPE);
-          if (!is_cxx () && !is_java ())
+	  if (!is_cxx ())
 	    GDB_INDEX_SYMBOL_STATIC_SET_VALUE(flags, 1);
           break;
         default:
@@ -19830,7 +19820,6 @@  lower_bound_default (void)
     case DW_LANG_C_plus_plus_14:
     case DW_LANG_ObjC:
     case DW_LANG_ObjC_plus_plus:
-    case DW_LANG_Java:
       return 0;
     case DW_LANG_Fortran77:
     case DW_LANG_Fortran90:
@@ -23593,8 +23582,6 @@  gen_compile_unit_die (const char *filename)
 		language = DW_LANG_Fortran08;
 	    }
 	}
-      else if (strcmp (language_string, "GNU Java") == 0)
-	language = DW_LANG_Java;
       else if (strcmp (language_string, "GNU Objective-C") == 0)
 	language = DW_LANG_ObjC;
       else if (strcmp (language_string, "GNU Objective-C++") == 0)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index e8e3d6687c3..ea8858da5d1 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1306,8 +1306,6 @@  static const struct compiler default_compilers[] =
   {".f08", "#Fortran", 0, 0, 0}, {".F08", "#Fortran", 0, 0, 0},
   {".r", "#Ratfor", 0, 0, 0},
   {".p", "#Pascal", 0, 0, 0}, {".pas", "#Pascal", 0, 0, 0},
-  {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0},
-  {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0},
   {".go", "#Go", 0, 1, 0},
   /* Next come the entries for C.  */
   {".c", "@c", 0, 0, 1},
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index 9d8034c3192..13e55ef55fe 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -388,14 +388,14 @@  copy_var_decl (tree var, tree name, tree type)
 /* Strip off a legitimate source ending from the input string NAME of
    length LEN.  Rather than having to know the names used by all of
    our front ends, we strip off an ending of a period followed by
-   up to five characters.  (Java uses ".class".)  */
+   up to four characters.  (like ".cpp".)  */
 
 static inline void
 remove_suffix (char *name, int len)
 {
   int i;
 
-  for (i = 2;  i < 8 && len > i;  i++)
+  for (i = 2;  i < 7 && len > i;  i++)
     {
       if (name[len - i] == '.')
 	{
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 641a8210dad..d456c3ef301 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -818,12 +818,7 @@  mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data)
   /* Stop at types, decls, constants like copy_tree_r.  */
   else if (TREE_CODE_CLASS (code) == tcc_type
 	   || TREE_CODE_CLASS (code) == tcc_declaration
-	   || TREE_CODE_CLASS (code) == tcc_constant
-	   /* We can't do anything sensible with a BLOCK used as an
-	      expression, but we also can't just die when we see it
-	      because of non-expression uses.  So we avert our eyes
-	      and cross our fingers.  Silly Java.  */
-	   || code == BLOCK)
+	   || TREE_CODE_CLASS (code) == tcc_constant)
     *walk_subtrees = 0;
 
   /* Cope with the statement expression extension.  */
@@ -5807,19 +5802,10 @@  gimplify_save_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
   /* If the SAVE_EXPR has not been resolved, then evaluate it once.  */
   if (!SAVE_EXPR_RESOLVED_P (*expr_p))
     {
-      /* The operand may be a void-valued expression such as SAVE_EXPRs
-	 generated by the Java frontend for class initialization.  It is
-	 being executed only for its side-effects.  */
-      if (TREE_TYPE (val) == void_type_node)
-	{
-	  ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			       is_gimple_stmt, fb_none);
-	  val = NULL;
-	}
-      else
-	/* The temporary may not be an SSA name as later abnormal and EH
-	   control flow may invalidate use/def domination.  */
-	val = get_initialized_tmp_var (val, pre_p, post_p, false);
+      gcc_assert (TREE_TYPE (val) != void_type_node);
+      /* The temporary may not be an SSA name as later abnormal and EH
+	 control flow may invalidate use/def domination.  */
+      val = get_initialized_tmp_var (val, pre_p, post_p, false);
 
       TREE_OPERAND (*expr_p, 0) = val;
       SAVE_EXPR_RESOLVED_P (*expr_p) = 1;
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index e992f65948b..f061c84c8a9 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -169,9 +169,6 @@  possible_polymorphic_call_target_p (struct cgraph_edge *e,
 inline bool
 polymorphic_type_binfo_p (const_tree binfo)
 {
-  /* See if BINFO's type has an virtual table associtated with it.
-     Check is defensive because of Java FE produces BINFOs
-     without BINFO_TYPE set.   */
   return (BINFO_TYPE (binfo) && TYPE_BINFO (BINFO_TYPE (binfo))
 	  && BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo))));
 }
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index b2f0f922b89..88f6f71b559 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -293,7 +293,7 @@  struct lang_hooks_for_lto
 struct lang_hooks
 {
   /* String identifying the front end and optionally language standard
-     version, e.g. "GNU C++98" or "GNU Java".  */
+     version, e.g. "GNU C++98".  */
   const char *name;
 
   /* sizeof (struct lang_identifier), so make_node () creates
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 9618bfb318f..641b2795b2c 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -108,8 +108,8 @@  lto_write_options (void)
 	gcc_unreachable ();
       }
   /* The default -fmath-errno, -fsigned-zeros and -ftrapping-math change
-     depending on the language (they can be disabled by the Ada and Java
-     front-ends).  Pass thru conservative standard settings.  */
+     depending on the language (they can be disabled by the Ada front-end).
+     Pass thru conservative standard settings.  */
   if (!global_options_set.x_flag_errno_math)
     append_to_collect_gcc_options (&temporary_obstack, &first_p,
 				   global_options.x_flag_errno_math
diff --git a/gcc/opts.c b/gcc/opts.c
index 7555ed55434..12acba1437d 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -139,13 +139,13 @@  set_struct_debug_option (struct gcc_options *opts, location_t loc,
 /* Strip off a legitimate source ending from the input string NAME of
    length LEN.  Rather than having to know the names used by all of
    our front ends, we strip off an ending of a period followed by
-   up to five characters.  (Java uses ".class".)  */
+   up to fource characters.  (C++ uses ".cpp".)  */
 
 void
 strip_off_ending (char *name, int len)
 {
   int i;
-  for (i = 2; i < 6 && len > i; i++)
+  for (i = 2; i < 5 && len > i; i++)
     {
       if (name[len - i] == '.')
 	{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 248373194f5..83e4ee60e9f 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3497,8 +3497,6 @@  verify_gimple_call (gcall *stmt)
       && !useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (fntype))
       /* ???  At least C++ misses conversions at assignments from
 	 void * call results.
-	 ???  Java is completely off.  Especially with functions
-	 returning java.lang.Object.
 	 For now simply allow arbitrary pointer type conversions.  */
       && !(POINTER_TYPE_P (TREE_TYPE (lhs))
 	   && POINTER_TYPE_P (TREE_TYPE (fntype))))
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 79d02adbade..c68d71a5e54 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1564,12 +1564,6 @@  lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
 /* Decide whether or not we are going to duplicate the finally block.
    There are several considerations.
 
-   First, if this is Java, then the finally block contains code
-   written by the user.  It has line numbers associated with it,
-   so duplicating the block means it's difficult to set a breakpoint.
-   Since controlling code generation via -g is verboten, we simply
-   never duplicate code without optimization.
-
    Second, we'd like to prevent egregious code growth.  One way to
    do this is to estimate the size of the finally block, multiply
    that by the number of copies we'd need to make, and compare against
@@ -3286,7 +3280,7 @@  lower_resx (basic_block bb, gresx *stmt,
 	 _Unwind_Resume library function.  */
 
       /* The ARM EABI redefines _Unwind_Resume as __cxa_end_cleanup
-	 with no arguments for C++ and Java.  Check for that.  */
+	 with no arguments for C++.  Check for that.  */
       if (src_r->use_cxa_end_cleanup)
 	{
 	  fn = builtin_decl_implicit (BUILT_IN_CXA_END_CLEANUP);
diff --git a/gcc/tree.c b/gcc/tree.c
index ca28afad0f2..678b2708910 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5162,8 +5162,6 @@  free_lang_data_in_type (tree type)
 	  /* C++ FE uses TREE_PURPOSE to store initial values.  */
 	  TREE_PURPOSE (p) = NULL;
 	}
-      /* Java uses TYPE_MINVAL for TYPE_ARGUMENT_SIGNATURE.  */
-      TYPE_MINVAL (type) = NULL;
     }
   if (TREE_CODE (type) == METHOD_TYPE)
     {
@@ -5174,8 +5172,6 @@  free_lang_data_in_type (tree type)
 	  /* C++ FE uses TREE_PURPOSE to store initial values.  */
 	  TREE_PURPOSE (p) = NULL;
 	}
-      /* Java uses TYPE_MINVAL for TYPE_ARGUMENT_SIGNATURE.  */
-      TYPE_MINVAL (type) = NULL;
     }
 
   /* Remove members that are not actually FIELD_DECLs from the field
@@ -5661,16 +5657,7 @@  find_decls_types_r (tree *tp, int *ws, void *data)
 	  tree tem;
 	  FOR_EACH_VEC_ELT (*BINFO_BASE_BINFOS (TYPE_BINFO (t)), i, tem)
 	    fld_worklist_push (TREE_TYPE (tem), fld);
-	  tem = BINFO_VIRTUALS (TYPE_BINFO (t));
-	  if (tem
-	      /* The Java FE overloads BINFO_VIRTUALS for its own purpose.  */
-	      && TREE_CODE (tem) == TREE_LIST)
-	    do
-	      {
-		fld_worklist_push (TREE_VALUE (tem), fld);
-		tem = TREE_CHAIN (tem);
-	      }
-	    while (tem);
+	  fld_worklist_push (BINFO_VIRTUALS (TYPE_BINFO (t)), fld);
 	}
       if (RECORD_OR_UNION_TYPE_P (t))
 	{
@@ -10799,7 +10786,7 @@  build_common_builtin_nodes (void)
 			ECF_PURE | ECF_NOTHROW | ECF_LEAF);
 
   /* If there's a possibility that we might use the ARM EABI, build the
-    alternate __cxa_end_cleanup node used to resume from C++ and Java.  */
+    alternate __cxa_end_cleanup node used to resume from C++.  */
   if (targetm.arm_eabi_unwinder)
     {
       ftype = build_function_type_list (void_type_node, NULL_TREE);
@@ -14029,15 +14016,6 @@  verify_type (const_tree t)
 				     TREE_TYPE (TYPE_MIN_VALUE (t))
 	 but does not for C sizetypes in LTO.  */
     }
-  /* Java uses TYPE_MINVAL for TYPE_ARGUMENT_SIGNATURE.  */
-  else if (TYPE_MINVAL (t)
-	   && ((TREE_CODE (t) != METHOD_TYPE && TREE_CODE (t) != FUNCTION_TYPE)
-	       || in_lto_p))
-    {
-      error ("TYPE_MINVAL non-NULL");
-      debug_tree (TYPE_MINVAL (t));
-      error_found = true;
-    }
 
   /* Check various uses of TYPE_MAXVAL.  */
   if (RECORD_OR_UNION_TYPE_P (t))
@@ -14109,14 +14087,6 @@  verify_type (const_tree t)
 	  debug_tree (TYPE_BINFO (t));
 	  error_found = true;
 	}
-      /* FIXME: Java builds invalid empty binfos that do not have
-         TREE_TYPE set.  */
-      else if (TREE_TYPE (TYPE_BINFO (t)) != TYPE_MAIN_VARIANT (t) && 0)
-	{
-	  error ("TYPE_BINFO type is not TYPE_MAIN_VARIANT");
-	  debug_tree (TREE_TYPE (TYPE_BINFO (t)));
-	  error_found = true;
-	}
     }
   else if (TYPE_LANG_SLOT_1 (t) && in_lto_p)
     {
@@ -14271,20 +14241,6 @@  verify_type (const_tree t)
       error ("TYPE_STRING_FLAG is set on wrong type code");
       error_found = true;
     }
-  else if (TYPE_STRING_FLAG (t))
-    {
-      const_tree b = t;
-      if (TREE_CODE (b) == ARRAY_TYPE)
-	b = TREE_TYPE (t);
-      /* Java builds arrays with TYPE_STRING_FLAG of promoted_char_type
-	 that is 32bits.  */
-      if (TREE_CODE (b) != INTEGER_TYPE)
-	{
-	  error ("TYPE_STRING_FLAG is set on type that does not look like "
-		 "char nor array of chars");
-	  error_found = true;
-	}
-    }
   
   /* ipa-devirt makes an assumption that TYPE_METHOD_BASETYPE is always
      TYPE_MAIN_VARIANT and it would be odd to add methods only to variatns
diff --git a/gcc/varasm.c b/gcc/varasm.c
index fbaebc1b5c0..45611a9a858 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2403,7 +2403,7 @@  assemble_external (tree decl ATTRIBUTE_UNUSED)
   gcc_assert (asm_out_file);
 
   /* In a perfect world, the following condition would be true.
-     Sadly, the Java and Go front ends emit assembly *from the front end*,
+     Sadly, the Go front end emit assembly *from the front end*,
      bypassing the call graph.  See PR52739.  Fix before GCC 4.8.  */
 #if 0
   /* This function should only be called if we are expanding, or have