This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: avoid crash with line number == -1
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 17 Apr 2005 15:34:07 -0600
- Subject: [gcjx] Patch: FYI: avoid crash with line number == -1
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This avoids a crash in gcc when the line number for a method is
thought by gcjx to be -1.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* treegen.cc (generate): Don't let -1 line number slip through.
* tree.cc (annotate): Do nothing with negative line number.
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.41
diff -u -r1.1.2.41 tree.cc
--- tree.cc 17 Apr 2005 21:29:28 -0000 1.1.2.41
+++ tree.cc 17 Apr 2005 21:35:09 -0000
@@ -72,7 +72,8 @@
tree_generator::annotate (tree val, model_element *element)
{
location where = element->get_location ();
- annotate_with_file_line (val, where.get_file (), where.get_line ());
+ if (where.get_line () >= 0)
+ annotate_with_file_line (val, where.get_file (), where.get_line ());
}
tree
Index: treegen.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/treegen.cc,v
retrieving revision 1.1.2.8
diff -u -r1.1.2.8 treegen.cc
--- treegen.cc 8 Mar 2005 23:02:05 -0000 1.1.2.8
+++ treegen.cc 17 Apr 2005 21:35:09 -0000
@@ -74,6 +74,8 @@
location_t gcc_loc;
LOCATION_FILE (gcc_loc) = end_loc.get_file ();
LOCATION_LINE (gcc_loc) = end_loc.get_line ();
+ if (LOCATION_LINE (gcc_loc) < 0)
+ LOCATION_LINE (gcc_loc) = 0;
cfun->function_end_locus = gcc_loc;
dump_function (TDI_original, method);