Bug 17587 - [4.0 regression] Mauve's UnicodeBase.java fails to compile
Summary: [4.0 regression] Mauve's UnicodeBase.java fails to compile
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Daniel Berlin
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks: 6182 17574
  Show dependency treegraph
 
Reported: 2004-09-21 16:07 UTC by Tom Tromey
Modified: 2004-09-22 23:50 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-09-22 01:02:01


Attachments
Test case extracted from Mauve (9.71 KB, application/octet-stream)
2004-09-21 19:22 UTC, Tom Tromey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2004-09-21 16:07:32 UTC
cvs trunk gcj gets ICE while compiling UnicodeBase.java
from Mauve.  To see this you must edit the mauve-libgcj
file and comment out the line referring to the unicode
tests.

CLASSPATH=.:../mauve gcj -fassume-compiled -g -O2 -c -o
gnu/testlet/java/lang/Character/UnicodeBase.o
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java: In class
`gnu.testlet.java.lang.Character.UnicodeBase':
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java: In method
`gnu.testlet.java.lang.Character.UnicodeBase.performTests()':
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:617: warning: The
method `isJavaLetter' in class `java.lang.Character' has been deprecated.
                Character.isJavaLetter(i))
                            ^
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:620: warning: The
method `isJavaLetter' in class `java.lang.Character' has been deprecated.
                            (Character.isJavaLetter(i)? "javaletter" :
                                         ^
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:626: warning: The
method `isJavaLetter' in class `java.lang.Character' has been deprecated.
            if ((Character.isJavaLetter(i) || Character.isDigit(i) ||
                             ^
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:628: warning: The
method `isJavaLetterOrDigit' in class `java.lang.Character' has been deprecated.
                Character.isJavaLetterOrDigit(i)
                            ^
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:632: warning: The
method `isJavaLetterOrDigit' in class `java.lang.Character' has been deprecated.
                            (Character.isJavaLetterOrDigit(i) ?
                                         ^
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:639: warning: The
method `isSpace' in class `java.lang.Character' has been deprecated.
                  i == '\f')) != Character.isSpace(i))
                                             ^
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:642: warning: The
method `isSpace' in class `java.lang.Character' has been deprecated.
                            (Character.isSpace(i) ? "space" : "non-space"));
                                         ^
7 warnings
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java:326: internal compiler
error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Tom Tromey 2004-09-21 19:08:29 UTC
Note that this failure only occurs with -O2.
Removing that lets the compilation succeed.

Stack trace:

Starting program:
/home/tromey/gnu/Trunk/install/libexec/gcc/i686-pc-linux-gnu/4.0.0/jc1
../mauve/gnu/testlet/java/lang/Character/UnicodeBase.java -fhash-synchronization
-fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions
-fno-omit-frame-pointer -fkeep-inline-functions -quiet -dumpbase
UnicodeBase.java -mtune=pentiumpro -auxbase-strip
gnu/testlet/java/lang/Character/UnicodeBase.o -O2 -version -fassume-compiled -o
/tmp/z.s

Program received signal SIGSEGV, Segmentation fault.
0x0816752e in insert_aux (block=0xf67a6244)
    at ../../gcc/gcc/tree-ssa-pre.c:1420
1420		  EXECUTE_IF_SET_IN_BITMAP (newset->expressions, 0, i,
#0  0x0816752e in insert_aux (block=0xf67a6244)
    at ../../gcc/gcc/tree-ssa-pre.c:1420
#1  0x08167b23 in insert_aux (block=0xf6803658)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#2  0x08167b23 in insert_aux (block=0xf68035e4)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#3  0x08167b23 in insert_aux (block=0xf6803570)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#4  0x08167b23 in insert_aux (block=0xf680332c)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#5  0x08167b23 in insert_aux (block=0xf681ec3c)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#6  0x08167b23 in insert_aux (block=0xf681e89c)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#7  0x08167b23 in insert_aux (block=0xf681e658)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#8  0x08167b23 in insert_aux (block=0xf681e3a0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#9  0x08167b23 in insert_aux (block=0xf681e0e8)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#10 0x08167b23 in insert_aux (block=0xf681b570)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#11 0x08167b23 in insert_aux (block=0xf681b488)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#12 0x08167b23 in insert_aux (block=0xf681b244)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#13 0x08167b23 in insert_aux (block=0xf6817f68)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#14 0x08167b23 in insert_aux (block=0xf6817cb0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#15 0x08167b23 in insert_aux (block=0xf6817000)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#16 0x08167b23 in insert_aux (block=0xf6813ef4)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#17 0x08167b23 in insert_aux (block=0xf6813cb0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#18 0x08167b23 in insert_aux (block=0xf68139f8)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#19 0x08167b23 in insert_aux (block=0xf68306cc)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#20 0x08167b23 in insert_aux (block=0xf68305e4)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#21 0x08167b23 in insert_aux (block=0xf68303a0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#22 0x08167b23 in insert_aux (block=0xf682c244)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#23 0x08167b23 in insert_aux (block=0xf6829f68)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#24 0x08167b23 in insert_aux (block=0xf6829d98)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#25 0x08167b23 in insert_aux (block=0xf6829ae0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#26 0x08167b23 in insert_aux (block=0xf6829828)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#27 0x08167b23 in insert_aux (block=0xf6829740)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#28 0x08167b23 in insert_aux (block=0xf68294fc)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#29 0x08167b23 in insert_aux (block=0xf6829244)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#30 0x08167b23 in insert_aux (block=0xf6829074)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#31 0x08167b23 in insert_aux (block=0xf6826d98)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#32 0x08167b23 in insert_aux (block=0xf6826cb0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#33 0x08167b23 in insert_aux (block=0xf6826a6c)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#34 0x08167b23 in insert_aux (block=0xf68267b4)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#35 0x08167b23 in insert_aux (block=0xf68266cc)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#36 0x08167b23 in insert_aux (block=0xf6826488)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#37 0x08167b23 in insert_aux (block=0xf68261d0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#38 0x08167b23 in insert_aux (block=0xf6822bc8)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#39 0x08167b23 in insert_aux (block=0xf6823f68)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#40 0x08167b23 in insert_aux (block=0xf6823cb0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#41 0x08167b23 in insert_aux (block=0xf6823a6c)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#42 0x08167b23 in insert_aux (block=0xf6823984)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#43 0x08167b23 in insert_aux (block=0xf68236cc)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#44 0x08167b23 in insert_aux (block=0xf6823488)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#45 0x08167b23 in insert_aux (block=0xf68233a0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#46 0x08167b23 in insert_aux (block=0xf68230e8)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#47 0x08167b23 in insert_aux (block=0xf6822e80)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#48 0x08167b23 in insert_aux (block=0xf6822d98)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#49 0x08167b23 in insert_aux (block=0xf6822cb0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#50 0x08167b23 in insert_aux (block=0xf6822ae0)
    at ../../gcc/gcc/tree-ssa-pre.c:1593
#51 0x08167ba1 in insert () at ../../gcc/gcc/tree-ssa-pre.c:1615
#52 0x081690da in execute_pre (do_fre=0 '\0')
    at ../../gcc/gcc/tree-ssa-pre.c:2032
#53 0x0816915f in do_pre () at ../../gcc/gcc/tree-ssa-pre.c:2054
#54 0x0812f880 in execute_one_pass (pass=0x8643c20)
    at ../../gcc/gcc/tree-optimize.c:501
#55 0x0812f96c in execute_pass_list (pass=0x8643c20)
    at ../../gcc/gcc/tree-optimize.c:536
#56 0x0812f98a in execute_pass_list (pass=0x8643920)
    at ../../gcc/gcc/tree-optimize.c:537
#57 0x0812fc28 in tree_rest_of_compilation (fndecl=0xf6d1cc3c, nested_p=0 '\0')
    at ../../gcc/gcc/tree-optimize.c:636
#58 0x080c923a in java_expand_body (fndecl=0xf6d1cc3c)
    at ../../gcc/gcc/java/decl.c:1967
#59 0x084f8067 in cgraph_expand_function (node=0xf6b4cbc8)
    at ../../gcc/gcc/cgraphunit.c:1044
#60 0x084fbf55 in cgraph_expand_all_functions ()
    at ../../gcc/gcc/cgraphunit.c:2710
#61 0x084fc325 in cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:2821
#62 0x080ed60f in java_parse_file (set_yydebug=0)
    at ../../gcc/gcc/java/jcf-parse.c:1162
#63 0x0848d638 in compile_file () at ../../gcc/gcc/toplev.c:991
#64 0x0848f061 in do_compile () at ../../gcc/gcc/toplev.c:2079
#65 0x0848f0c8 in toplev_main (argc=19, argv=0xfeecec34)
    at ../../gcc/gcc/toplev.c:2111
#66 0x0810807a in main (argc=19, argv=0xfeecec34) at ../../gcc/gcc/main.c:35


Comment 2 Andrew Pinski 2004-09-21 19:16:43 UTC
Tom is there an easy way to get a self contained example.

Danny, this looks like a bug in tree-ssa-pre but I could be wrong.
Comment 3 Tom Tromey 2004-09-21 19:22:38 UTC
Created attachment 7187 [details]
Test case extracted from Mauve

Untar and invoke:
gcj -fassume-compiled -O2 -c gnu/testlet/java/lang/Character/UnicodeBase.java
Comment 4 Andrew Pinski 2004-09-21 19:49:52 UTC
Confirmed reduced to:
gcj -fassume-compiled -O2 -c UnicodeBase.java
--- CharInfo.java ---
class CharInfo
{
  public String name;
  public String category;
  public int decimalDigit;
  public int digit;
  public int numericValue;
  public char uppercase;
  public char lowercase;
  public char titlecase;
}
--- end ---
---- UnicodeBase.java ----
import java.io.*;

public abstract class UnicodeBase
{
  public CharInfo[] chars = new CharInfo[0x10000];

  public String stringChar(int ch)
  {
    return "";
  }
	
  public void performTests()
  { 
    for (int x = 0; x <= 0xffff; x++)
      {
	char i = (char) x;
	
	char cs = (chars[i].lowercase != 0 ?
		   chars[i].lowercase : i);
	if (Character.toLowerCase(i) != cs)
	    stringChar(cs);
      
      }
  }
}
---- end ---
Comment 5 Andrew Pinski 2004-09-21 19:54:14 UTC
Here it is a little further without the depency on another class file:
import java.io.*;

public abstract class UnicodeBase
{
  public char[] chars = new char[0x10000];

  public String stringChar(int ch)
  {
    return "";
  }
	
  public void performTests()
  { 
    for (int x = 0; x <= 0xffff; x++)
      {
	char i = (char) x;
	char cs = (chars[i] != 0 ?  chars[i] : i);
	if (Character.toLowerCase(i) != cs)
	    stringChar(cs);
      }
  }
}
Comment 6 Daniel Berlin 2004-09-22 01:02:00 UTC
What happens is that we decide to split a non-critical edge, which is bad.
:)

I'm bootstrapping a fix now.
Comment 7 CVS Commits 2004-09-22 23:50:25 UTC
Subject: Bug 17587

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dberlin@gcc.gnu.org	2004-09-22 23:50:19

Modified files:
	gcc            : ChangeLog tree-ssa-pre.c 

Log message:
	2004-09-22  Daniel Berlin <dberlin@dberlin.org>
	
	Fix PR tree-optimization/17587
	* tree-ssa-pre.c (fini_pre): Commit edge inserts here.
	(insert_aux): Instead of here.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5572&r2=2.5573
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-pre.c.diff?cvsroot=gcc&r1=2.38&r2=2.39

Comment 8 Daniel Berlin 2004-09-22 23:50:46 UTC
Fixed