public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/4230: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
@ 2001-09-04 15:36 Tony Knaus
0 siblings, 0 replies; 4+ messages in thread
From: Tony Knaus @ 2001-09-04 15:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 4230
>Category: java
>Synopsis: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Tue Sep 04 15:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: awk@spinnakernet.com
>Release: 3.1 20010902 (experimental)
>Organization:
Spinnaker Networks Inc.
>Environment:
System: Linux panic 2.2.12-20 #1 Mon Sep 27 10:40:35 EDT 1999 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr/local/gcc-3.0 --enable-shared --enable-threads=posix --enable-version-specific-runtime-libs --enable-java-awt=xlib --enable-languages=c,c++,java
>Description:
gcj 3.1 generates a segmentation fault while building the xerces parser and
generating byte code. The compiler does not seg fault when compiling
to object code or just generating dependencies.
gcj -M -C --encoding=UTF-8 -CLASSPATH ":build/xerces/src:src/xerces/src:src/cimom:src/regexp/src/java:src/servlet/src:build/tomcat/src:src/tomcat/src:src/remotetea/src:src/j-dom/jdom/src/java:src/enhydra/SchemaMapper/src/java:src/tests:src/tools/formgen:src/tools/kbgen:src/tools/typegen:src/tools/utils:src/tools/logmessage:src/ui:src/providers:src/rpc:build/ui:build/tests" build/xerces/src/org/apache/xerces/utils/regex/Token.java > build/xerces/src/org/apache/xerces/utils/regex/.Token.u
build/xerces/src/org/apache/xerces/utils/regex/Token.java:1: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
cons: *** [build/xerces/src/org/apache/xerces/utils/regex/.Token.u] Error 1
cons: errors constructing build/xerces/src/org/apache/xerces/utils/regex/.Token.u
>
I have tracked the problem down to the initialization of
static strings with line continuation '+' characters. Folling is a
simple example that causes the seg-fault.
public class StringCrash {
static final String viramaString =
"f"
+"o"
+"o"
+"b"
+"a"
+"r";
public static void main(String[] args) {
System.out.println("viramaString= " + viramaString);
}
};
>How-To-Repeat:
> /usr/local/gcc-3.0/bin/gcj -v -C StringCrash.java
Reading specs from /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc/configure --prefix=/usr/local/gcc-3.0 --enable-shared --enable-threads=posix --enable-version-specific-runtime-libs --enable-java-awt=xlib --enable-languages=c,c++,java
Thread model: posix
gcc version 3.1 20010902 (experimental)
/usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.1/jc1 StringCrash.java -quiet -dumpbase StringCrash.java -g1 -version -fsyntax-only -femit-class-files -o /dev/null
GNU Java version 3.1 20010902 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 3.1 20010902 (experimental).
Class path starts here:
./
/usr/local/gcc-3.0/share/libgcj.jar/ (system) (zip)
StringCrash.java:1: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
> /usr/local/gcc-3.0/bin/gcj -v -E -C StringCrash.java
Reading specs from /usr/local/gcc-3.0/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc/configure --prefix=/usr/local/gcc-3.0 --enable-shared --enable-threads=posix --enable-version-specific-runtime-libs --enable-java-awt=xlib --enable-languages=c,c++,java
Thread model: posix
gcc version 3.1 20010902 (experimental)
>
Compile the above example with the '-C' option.
>Fix:
workarounds:
- don't compile to byte-code
- or don't use string continuation when compiling to byte code
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: java/4230: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
@ 2002-01-04 19:15 rodrigc
0 siblings, 0 replies; 4+ messages in thread
From: rodrigc @ 2002-01-04 19:15 UTC (permalink / raw)
To: apbianco, awk, gcc-bugs, gcc-prs, java-prs
Synopsis: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
State-Changed-From-To: feedback->closed
State-Changed-By: rodrigc
State-Changed-When: Fri Jan 4 19:15:34 2002
State-Changed-Why:
Patch applied:
http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00247.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4230
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: java/4230: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
@ 2001-09-06 0:35 apbianco
0 siblings, 0 replies; 4+ messages in thread
From: apbianco @ 2001-09-06 0:35 UTC (permalink / raw)
To: apbianco, awk, gcc-bugs, gcc-prs, java-prs, nobody
Synopsis: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
Responsible-Changed-From-To: unassigned->apbianco
Responsible-Changed-By: apbianco
Responsible-Changed-When: Thu Sep 6 00:35:27 2001
Responsible-Changed-Why:
Mine.
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Thu Sep 6 00:35:27 2001
State-Changed-Why:
I posted a patch.
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=4230&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: java/4230: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
@ 2001-09-05 21:06 Alexandre Petit-Bianco
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Petit-Bianco @ 2001-09-05 21:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR java/4230; it has been noted by GNATS.
From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: Tony Knaus <awk@panic.spinnakernet.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/4230: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental.
Date: Wed, 5 Sep 2001 20:59:07 -0700 (PDT)
Tony Knaus writes:
> gcj 3.1 generates a segmentation fault while building the xerces
> parser and generating byte code. The compiler does not seg fault
> when compiling to object code or just generating dependencies.
Hmm, sorry about that. It appeared recently.
> public class StringCrash {
> static final String viramaString =
> "f"
> +"o"
> +"o"
> +"b"
> +"a"
> +"r";
>
> public static void main(String[] args) {
> System.out.println("viramaString= " + viramaString);
> }
> };
Thank you for the test case. After a several hours in build hell, I'm
testing this patch.
./A
2001-09-05 Alexandre Petit-Bianco <apbianco@redhat.com>
* jcf-write.c (generate_classfile): Issue an error in case of
field/initial value mismatch.
* parse.y (analyze_clinit_body): Keep <clinit> if an array is
being initialized and we're generating bytecode.
(java_complete_lhs): In CASE_EXPR section: added comments,
set DECL_INITIAL properly when appropriate.
Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.87
diff -u -p -r1.87 jcf-write.c
--- jcf-write.c 2001/08/31 04:14:43 1.87
+++ jcf-write.c 2001/09/06 03:51:55
@@ -2899,8 +2899,8 @@ generate_classfile (clas, state)
{
tree init = DECL_INITIAL (part);
static tree ConstantValue_node = NULL_TREE;
- // This conversion is a work-around for front-end bug.
- init = convert (TREE_TYPE (part), init);
+ if (TREE_TYPE (part) != TREE_TYPE (init))
+ fatal_error ("field initializer type mismatch.");
ptr = append_chunk (NULL, 8, state);
if (ConstantValue_node == NULL_TREE)
ConstantValue_node = get_identifier ("ConstantValue");
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.307
diff -u -p -r1.307 parse.y
--- parse.y 2001/09/04 21:50:31 1.307
+++ parse.y 2001/09/06 03:52:04
@@ -7813,6 +7813,11 @@ analyze_clinit_body (bbody)
break;
case MODIFY_EXPR:
+ /* If we're generating to class file and we're dealing with an
+ array initialization, we return 1 to keep <clinit> */
+ if (TREE_CODE (TREE_OPERAND (bbody, 1)) == NEW_ARRAY_INIT
+ && flag_emit_class_files)
+ return 1;
/* Return 0 if the operand is constant, 1 otherwise. */
return ! TREE_CONSTANT (TREE_OPERAND (bbody, 1));
@@ -11898,16 +11903,31 @@ java_complete_lhs (node)
value = fold_constant_for_init (nn, nn);
+ /* When we have a primitype type, or a string and we're not
+ emitting a class file, we actually don't want to generate
+ anything for the assignment. */
if (value != NULL_TREE &&
(JPRIMITIVE_TYPE_P (TREE_TYPE (value)) ||
(TREE_TYPE (value) == string_ptr_type_node &&
! flag_emit_class_files)))
{
+ /* Prepare node for patch_assignment */
TREE_OPERAND (node, 1) = value;
+ /* Call patch assignment to verify the assignment */
if (patch_assignment (node, wfl_op1, value) == error_mark_node)
return error_mark_node;
+ /* Set DECL_INITIAL properly (a conversion might have
+ been decided by patch_assignment) and return the
+ empty statement. */
else
- return empty_stmt_node;
+ {
+ tree patched = patch_string (TREE_OPERAND (node, 1));
+ if (patched)
+ DECL_INITIAL (nn) = patched;
+ else
+ DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
+ return empty_stmt_node;
+ }
}
if (! flag_emit_class_files)
DECL_INITIAL (nn) = NULL_TREE;
@@ -11999,7 +12019,18 @@ java_complete_lhs (node)
|| JSTRING_P (TREE_TYPE (node))))
node = java_refold (node);
}
-
+
+ /* Seek to set DECL_INITIAL to a proper value, since it might have
+ undergone a conversion in patch_assignment. We do that only when
+ it's necessary to have DECL_INITIAL properly set. */
+ nn = TREE_OPERAND (node, 0);
+ if (TREE_CODE (nn) == VAR_DECL
+ && DECL_INITIAL (nn) && CONSTANT_VALUE_P (DECL_INITIAL (nn))
+ && FIELD_STATIC (nn) && FIELD_FINAL (nn)
+ && (JPRIMITIVE_TYPE_P (TREE_TYPE (nn))
+ || TREE_TYPE (nn) == string_ptr_type_node))
+ DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
+
CAN_COMPLETE_NORMALLY (node) = 1;
return node;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-01-05 3:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-04 15:36 java/4230: gcj -C segfaults on static string continuation '+' in gcj 3.1 expermental Tony Knaus
2001-09-05 21:06 Alexandre Petit-Bianco
2001-09-06 0:35 apbianco
2002-01-04 19:15 rodrigc
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).