public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/17352] New: Uninitialized char variable causes erratic behavior
@ 2004-09-07 18:35 dtiller at captechventures dot com
  2004-09-07 18:40 ` [Bug java/17352] " dtiller at captechventures dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: dtiller at captechventures dot com @ 2004-09-07 18:35 UTC (permalink / raw)
  To: java-prs

I am using gcj-3.4.1 to compile crimson-1.1.3.jar to a static object file. When
I leave a particular Java char variable uninitialized, String and char
operations return garbage. If I initialize the variable with a throwaway value,
the program runs as expected.

In order to reproduce this issue:

1) Download crimson-1.1.3 source from <a
href="http://xml.apache.org/dist/crimson/crimson-1.1.3-src.tar.gz">here</a> or
download the attached copy. Use the ant build script to create crimson.jar.

2) compile it to an object file anf then static library with: 
        gcj -c -o crimson.o crimson.jar
        ar r libcrimson.a crimson.o
        ranlib libcrimson.a

3) Compile and link the test program:
        gcj -o Test Test.java -Icrimson.jar -L. -lcrimson -static --main=Test

4) Execute the program. You may have to set the environment variable
LANG="en_US" to avoid bug #13708. This run will result in an Exception
complaining about a bad XML version number.

5) Change line 848 in org.apache.crimson.parser.Parser2.java to "char c = 'X';"
and perform steps 1-4 again. This time the test program will succeed.

test.xml:
-----CUT HERE-----
<?xml version="1.0" encoding="UTF-8" ?>
<test />
-----CUT HERE-----

Test.java:
-----CUT HERE-----
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import java.io.FileInputStream;

class Test {
	public static void main(String[] args) {
		try {
			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			dbf.setValidating(false);
			dbf.setNamespaceAware(true);
			dbf.setCoalescing(true);
			DocumentBuilder db = dbf.newDocumentBuilder();
			FileInputStream fis = new FileInputStream("test.xml");
			db.parse(fis);
		} catch (Exception e) {
			System.err.println("Caught " + e);
			e.printStackTrace();
		}
	}
}
-----CUT HERE-----

-- 
           Summary: Uninitialized char variable causes erratic behavior
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dtiller at captechventures dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug java/17352] Uninitialized char variable causes erratic behavior
  2004-09-07 18:35 [Bug java/17352] New: Uninitialized char variable causes erratic behavior dtiller at captechventures dot com
@ 2004-09-07 18:40 ` dtiller at captechventures dot com
  2004-09-07 19:13 ` tromey at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: dtiller at captechventures dot com @ 2004-09-07 18:40 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From dtiller at captechventures dot com  2004-09-07 18:40 -------
Created an attachment (id=7068)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7068&action=view)
Attached is a zip file containing crimson-1.1.3.tar, Test.java, and test.xml.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug java/17352] Uninitialized char variable causes erratic behavior
  2004-09-07 18:35 [Bug java/17352] New: Uninitialized char variable causes erratic behavior dtiller at captechventures dot com
  2004-09-07 18:40 ` [Bug java/17352] " dtiller at captechventures dot com
@ 2004-09-07 19:13 ` tromey at gcc dot gnu dot org
  2004-09-08 12:25 ` dtiller at captechventures dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: tromey at gcc dot gnu dot org @ 2004-09-07 19:13 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2004-09-07 19:13 -------
It would be helpful if you could try to make a smaller test case.
For instance, could you try taking the body of getQuotedString
and seeing if it can be made to fail in relative isolation?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug java/17352] Uninitialized char variable causes erratic behavior
  2004-09-07 18:35 [Bug java/17352] New: Uninitialized char variable causes erratic behavior dtiller at captechventures dot com
  2004-09-07 18:40 ` [Bug java/17352] " dtiller at captechventures dot com
  2004-09-07 19:13 ` tromey at gcc dot gnu dot org
@ 2004-09-08 12:25 ` dtiller at captechventures dot com
  2004-09-28  0:26 ` pinskia at gcc dot gnu dot org
  2004-10-29 17:37 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 8+ messages in thread
From: dtiller at captechventures dot com @ 2004-09-08 12:25 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From dtiller at captechventures dot com  2004-09-08 12:25 -------
Subject: RE:  Uninitialized char variable causes erratic behavior

Thanks for your prompt reply!

I will try to isolate the issue as soon as I get a chance. I fear it may
be one of those wiggly memory errors that are nearly impossible to
reproduce in a small test case.


-----Original Message-----
From: tromey at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org] 
Sent: Tuesday, September 07, 2004 3:13 PM
To: David Tiller
Subject: [Bug java/17352] Uninitialized char variable causes erratic
behavior



------- Additional Comments From tromey at gcc dot gnu dot org
2004-09-07 19:13 ------- It would be helpful if you could try to make a
smaller test case. For instance, could you try taking the body of
getQuotedString and seeing if it can be made to fail in relative
isolation?




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug java/17352] Uninitialized char variable causes erratic behavior
  2004-09-07 18:35 [Bug java/17352] New: Uninitialized char variable causes erratic behavior dtiller at captechventures dot com
                   ` (2 preceding siblings ...)
  2004-09-08 12:25 ` dtiller at captechventures dot com
@ 2004-09-28  0:26 ` pinskia at gcc dot gnu dot org
  2004-10-29 17:37 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-09-28  0:26 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-09-28 00:26 -------
Also try 4.0.0 because it might be easier to diagnose the problem there.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug java/17352] Uninitialized char variable causes erratic behavior
  2004-09-07 18:35 [Bug java/17352] New: Uninitialized char variable causes erratic behavior dtiller at captechventures dot com
                   ` (3 preceding siblings ...)
  2004-09-28  0:26 ` pinskia at gcc dot gnu dot org
@ 2004-10-29 17:37 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-29 17:37 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug java/17352] Uninitialized char variable causes erratic behavior
       [not found] <bug-17352-9267@http.gcc.gnu.org/bugzilla/>
  2005-11-28  5:14 ` pinskia at gcc dot gnu dot org
@ 2006-02-26 19:56 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-26 19:56 UTC (permalink / raw)
  To: java-prs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-02-26 19:56 -------
No feedback in over 3 months.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug java/17352] Uninitialized char variable causes erratic behavior
       [not found] <bug-17352-9267@http.gcc.gnu.org/bugzilla/>
@ 2005-11-28  5:14 ` pinskia at gcc dot gnu dot org
  2006-02-26 19:56 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-28  5:14 UTC (permalink / raw)
  To: java-prs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17352


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-02-26 19:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-07 18:35 [Bug java/17352] New: Uninitialized char variable causes erratic behavior dtiller at captechventures dot com
2004-09-07 18:40 ` [Bug java/17352] " dtiller at captechventures dot com
2004-09-07 19:13 ` tromey at gcc dot gnu dot org
2004-09-08 12:25 ` dtiller at captechventures dot com
2004-09-28  0:26 ` pinskia at gcc dot gnu dot org
2004-10-29 17:37 ` pinskia at gcc dot gnu dot org
     [not found] <bug-17352-9267@http.gcc.gnu.org/bugzilla/>
2005-11-28  5:14 ` pinskia at gcc dot gnu dot org
2006-02-26 19:56 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).