This is the mail archive of the java-prs@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcj/64: SEGV in jc1 (99-10-04) using optimizations



>Number:         64
>Category:       gcj
>Synopsis:       SEGV in jc1 (99-10-04) using optimizations
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 06 08:20:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Patrik Hägglund
>Release:        1999-10-04
>Organization:
>Environment:
sparc-sun-solaris2.7
>Description:
(gdb) run Test.java -fuse-divide-subroutine -quiet -O1 -version -o Test.s
Breakpoint 9 at 0x4e840: file ../../gcc/toplev.c, line 5219.
Starting program: /home/pelab/pub/pkg/gcc-19991004-gnu-as+ld/lib/gcc-lib/sparc-sun-solaris2.7/2.96/jc1 Test.java -fuse-divide-subroutine -quiet -O1 -version -o Test.s

GNU Java version 2.96 19991004 (experimental) (sparc-sun-solaris2.7) compiled by GNU C version 2.96 19990927 (experimental).

Program received signal SIGSEGV, Segmentation fault.
0x12220c in make_edges (label_value_list=0x0) at ../../gcc/flow.c:995
(gdb) bt
#0  0x12220c in make_edges (label_value_list=0x0) at ../../gcc/flow.c:995
#1  0x121654 in find_basic_blocks (f=0x307188, nregs=304, file=0x0, 
    do_cleanup=1) at ../../gcc/flow.c:417
#2  0x4c8d8 in rest_of_compilation (decl=0x25d538) at ../../gcc/toplev.c:3964
#3  0x1eb40 in source_end_java_method () at ./parse.y:5828
#4  0x1f210 in java_complete_expand_method (mdecl=0x25d538) at ./parse.y:6131
#5  0x1efe4 in java_complete_expand_methods () at ./parse.y:6049
#6  0x1f4fc in java_expand_classes () at ./parse.y:6275
#7  0x40038 in yyparse () at ../../../gcc/java/jcf-parse.c:900
#8  0x4aef8 in compile_file (name=0xffbee17d "Test.java")
    at ../../gcc/toplev.c:3177
#9  0x4eeec in main (argc=8, argv=0xffbedf64) at ../../gcc/toplev.c:5490
(gdb)

Test.java follows:

import java.util.*;
import java.io.*;

public class Test {

    static long errc = 0;

    public static int[] parseCoefficients(String a) {
        StringTokenizer st = new StringTokenizer(a);
        int[] p = new int[st.countTokens()];
        int i = 0;
        while(st.hasMoreTokens())
            p[i++] = Integer.parseInt(st.nextToken());
        return p;
    }

    public static int[] randomInformation(int[] a) {
        for(int i=0; i<a.length; i++)
            a[i] = (int) (Math.random()*16);
        return a;
    }

    public static int[] randomError(int[] a, double p) {
        for(int i=0; i<a.length; i++) {
            if (Math.random() < p) {
                a[i] = (int) (Math.random()*16);
                errc++;
            } else
                a[i] = 0;
        }
        return a;
    }

    
    public static void main(String[] args) throws Exception {
        GaloisField gf2 = new GaloisField(2);
        GaloisField gf16 = 
            GaloisField.extend(gf2, parseCoefficients("1 1 0 0 1"));
        RSCode rs = new RSCode(gf16, 3);
        System.out.println("Block length: " + rs.getBlockLength());
        System.out.println("Error tolerance: " + rs.getErrorTolerance());
        System.out.println();


        BufferedReader in =
            new BufferedReader(new InputStreamReader(System.in));
        System.out.print("Number of iterations: ");
        int iterc = Integer.parseInt(in.readLine());
        System.out.print("Error (0-1000) per transmitted word : ");
        double epw = ((double) Integer.parseInt(in.readLine()))/1000;
        
        int[] icoef = new int[9];
        int[] ecoef = new int[16];
        int unresolvedc = 0;

        long time0 = System.currentTimeMillis();
        for(int iter=0; iter<iterc; iter++) {
            Polynomial i = new Polynomial(randomInformation(icoef), gf16);
            Polynomial c = rs.encode(i);

            Polynomial e = new Polynomial(randomError(ecoef, epw), gf16);
            try {
                Polynomial r = rs.decode(Polynomial.add(c, e));
            } catch(TooManyErrorsException ex) {
                unresolvedc++;
            }
        }

        long time1 = System.currentTimeMillis();
        System.out.println("Trasmitted blocks: " + iterc);
        System.out.println("Unresolved blocks: " + unresolvedc);
        System.out.println("Errors/block: " + ((double) errc)/iterc);
        System.out.println("Time: " + ((double) time1-time0)/1000 + " s");
    }
}

I had the same problem with an other file.

>How-To-Repeat:
gcj -c -O Test.java

gcj -c Test.java works.
>Fix:
unknown
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]