[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#286715: gcj: segfaults instead of reporting the ambiguous expression



Package: gcj-3.4
Version: 3.4.3-4
Severity: normal
File: gcj


The gcj compiler segfaults when encountering an ambiguous piece of code.
The lack of parentheses around the expression 

      test ? "not" : "some"

creates the ambiguity:

   boolean test = ((args == null) || (args.length == 0));
   System.out.println("There are " + 
      test ? "not" : "some" +
      " arguments");

The Sun's compiler detects the ambiguity and reports this condition
gracefully.  

Surrounding the expression with parentheses allows to proceed with
compilation.

It would be nice if gcj could report on the ambiguity in the source code
instead of segfaulting.  Regards,

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-1-686
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)

Versions of packages gcj-3.4 depends on:
ii  g++-3.4                     3.4.3-4      The GNU C++ compiler
ii  gcc-3.4-base                3.4.3-4      The GNU Compiler Collection (base 
ii  java-common                 0.22         Base of all Java packages
ii  libc6                       2.3.2.ds1-19 GNU C Library: Shared libraries an
ii  libgcc1                     1:3.4.3-4    GCC support library
ii  libgcj5-common              3.4.3-4      Java runtime library for use with 
ii  zlib1g                      1:1.2.2-4    compression library - runtime

-- no debconf information
public class Test {
	public static void main(String[] args) {
		boolean test = ((args == null) || (args.length == 0));
		System.out.println("There are " + 
				test ? "not" : "some" +
				" arguments");
	}
}

public class Test2 {
	public static void main(String[] args) {
		boolean test = ((args == null) || (args.length == 0));
		System.out.println("There are " + 
				(test ? "not" : "some") +
				" arguments");
	}
}


Reply to: