This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Java segfault in predict.c


Hi,

The following Java code (extracted from xerces) results in a segfault 
with the current mainline in estimate_probability at -O. This seems to 
be a recent regression, certainly it does not fail with GCC 3.1. You 
should be able to reproduce it with "gcj -c -O Crash.java"

regards

Bryce.


public class Crash
{
  public void checkXMLLangAttributeValue(String lang)
  {
      int offset = -1;
      if (lang.length() >= 2) {
          char ch0 = lang.charAt(0);
      }
      if (offset > 0) {
          char ch = lang.charAt(offset++);
          if (ch != '-') {
              offset = -1;
          } else {
              while (true)
          {
                if (ch == '-')
                  ch = lang.charAt(offset++);
                ch = lang.charAt(offset++);
              }
          }
      }
  }
}

Program received signal SIGSEGV, Segmentation fault.
0x082bbcf4 in estimate_probability (loops_info=0xbffff5f0)
    at ../../gcc/predict.c:431
431             if (TEST_BIT (loop->nodes, bb->index))
(gdb) bt
#0  0x082bbcf4 in estimate_probability (loops_info=0xbffff5f0)
    at ../../gcc/predict.c:431
#1  0x0832e893 in rest_of_compilation (decl=0x4019dee0)
    at ../../gcc/toplev.c:2952
#2  0x08071921 in source_end_java_method () at ../../gcc/java/parse.y:7474
#3  0x080746cf in java_expand_method_bodies (class=0x4019dc40)
    at ../../gcc/java/parse.y:8152
#4  0x08079553 in java_expand_classes () at ../../gcc/java/parse.y:9083
#5  0x080ec7dc in java_parse_file (set_yydebug=0)
    at ../../gcc/java/jcf-parse.c:1155
#6  0x0832c88d in compile_file () at ../../gcc/toplev.c:2089
#7  0x0833277f in do_compile () at ../../gcc/toplev.c:5188
#8  0x083327e3 in toplev_main (argc=13, argv=0xbffff914)
    at ../../gcc/toplev.c:5220
#9  0x0810649b in main (argc=-2, argv=0xfffffffe) at ../../gcc/main.c:35
#10 0x4003e647 in __libc_start_main (main=0x8106480 <main>, argc=13,
    ubp_av=0xbffff914, init=0x80492d4 <_init>, fini=0x8443300 <_fini>,
    rtld_fini=0x4000dcd4 <_dl_fini>, stack_end=0xbffff90c)
    at ../sysdeps/generic/libc-start.c:129




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