Overlapping EH regions
John David Anglin
dave@hiauly1.hia.nrc.ca
Thu Oct 26 13:13:00 GMT 2000
In the process of investigating why the libio test program tFile.cc
requires an extremely large amount of memory to compile on the HPPA
under hpux, I have found that this is due to the use of the setjmp/longjmp
exception handling method and the setting of nonlocal_goto_handler_labels
by expand_builtin_setjmp. The problem is that the gcse pass assumes
that an exception in a call insn may arc back to any one the
nonlocal_goto_handler_labels. In fact, a call can only arc back to
the label associated with the innermost exception region that it is in.
Thus, there should be at most one extra edge on a basic block when sjlj
exceptions are used. At the moment, I am not certain how to fix
this problem in make_edges.
I noticed that, when DONT_USE_BUILTIN_SETJMP is defined and library
versions of setjmp/longjmp are used, nonlocal_goto_handler_labels
is not set. This might be a bug. On the other hand, it looked as
if this mode would not have the exhibit the problems associated
with a large number of exception related edges. There is also a
problem with the builtin setjmp/longjmp code on the pa when it is
used with shared libraries. Register r19, the pic offset pointer, is
not being saved/restored. Thus, I determined to do a test build
with DONT_USE_BUILTIN_SETJMP defined.
Using yesterdays source, I encountered two small problems. The first
was a prototype clash for longjmp in libgcc2.c. It turns out that when
DCE threads are being used, setjmp.h gets indirectly included. I
enclose a quick hack to get around the problem. However, I think
the fix is for the target to include setjmp.h or provide prototypes
for setjmp/longjmp if it defines DONT_USE_BUILTIN_SETJMP. Then, the
"prototype" in libgcc2.c could be removed.
The second problem is the following. I couldn't immediately see how
it is related to using DONT_USE_BUILTIN_SETJMP. The following error
occurs compiling libio/iostream.cc:
/xxx/gnu/gcc-2.97/objdir/gcc/g++ -B/xxx/gnu/gcc-2.97/objdir/gcc/ -nostdinc++ -isystem /xxx/gnu/gcc-2.97/libstdc++ -isystem /xxx/gnu/gcc-2.97/libstdc++/std -isystem /xxx/gnu/gcc-2.97/libstdc++/stl -isystem /xxx/gnu/gcc-2.97/libio -isystem /xxx/gnu/gcc-2.97/objdir/hppa1.1-hp-hpux10.20/libio -L/xxx/gnu/gcc-2.97/objdir/hppa1.1-hp-hpux10.20/libstdc++ -B/usr/local/hppa1.1-hp-hpux10.20/bin/ -B/usr/local/hppa1.1-hp-hpux10.20/lib/ -isystem /usr/local/hppa1.1-hp-hpux10.20/include -c -O3 -fno-implicit-templates -I. -I../../../libio -nostdinc++ ../../../libio/iostream.cc
../../../libio/iostream.cc: In constructor `iostream::iostream(streambuf *,
ostream *)':
../../../libio/iostream.cc:1038: Internal compiler error in , at except.c:2785
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
make[2]: *** [iostream.o] Error 1
make[2]: Leaving directory `/xxx/gnu/gcc-2.97/objdir/hppa1.1-hp-hpux10.20/libio'
make[1]: *** [all-target-libio] Error 2
make[1]: Leaving directory `/xxx/gnu/gcc-2.97/objdir'
make: *** [bootstrap-lean] Error 2
Putting a break at this point in cc1plus yields:
...
iostream::iostream(streambuf *, ostream *) iostream::iostream(streambuf *, ostr eam *)
Breakpoint 1, scan_region (insn=0x7adb44a0, n=894, delete_outer=0x7b03bb60)
at ../../gcc/except.c:2785
2785 abort ();
(gdb) p debug_rtx (insn)
(note 929 1408 1106 924 NOTE_INSN_EH_REGION_END -1347440721)
$1 = void
(gdb) p n
$2 = 894
Here are the NOTE_INSN_EH_REGION_END notes for the relevant function
from iostream.ii.00.rtl:
;; Function iostream::iostream(streambuf *, ostream *)
(note 130 127 132 886 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 272 269 273 894 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 364 363 448 894 NOTE_INSN_EH_REGION_END -1347440721)
(note 453 449 454 905 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 592 589 593 913 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 680 679 764 913 NOTE_INSN_EH_REGION_END -1347440721)
(note 769 765 770 924 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 929 928 1106 924 NOTE_INSN_EH_REGION_END -1347440721)
(note 1106 929 1283 905 NOTE_INSN_EH_REGION_END -1347440721)
(note 1283 1106 1366 886 NOTE_INSN_EH_REGION_END -1347440721)
(note 374 371 375 898 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 438 437 439 898 NOTE_INSN_EH_REGION_END -1347440721)
(note 690 687 691 917 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 754 753 755 917 NOTE_INSN_EH_REGION_END -1347440721)
(note 939 936 940 930 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 1096 1095 1097 930 NOTE_INSN_EH_REGION_END -1347440721)
(note 1116 1113 1117 941 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 1273 1272 1274 941 NOTE_INSN_EH_REGION_END -1347440721)
(note 1293 1290 1294 952 NOTE_INSN_EH_REGION_BEG -1347440721)
(note 1356 1355 1357 952 NOTE_INSN_EH_REGION_END -1347440721)
The notes for n = 894 are only in iostream.ii.00.rtl. Any thoughts
on what's going wrong?
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2000-10-26 J. David Anglin <dave@hiauly1.hia.nrc.ca>
* libgcc2.c: Don't provide an explicit prototype for longjmp since
this may clash with a previous included one.
--- libgcc2.c.orig Sat Oct 21 14:00:41 2000
+++ libgcc2.c Wed Oct 25 19:17:12 2000
@@ -3438,7 +3438,7 @@
method. */
#ifdef DONT_USE_BUILTIN_SETJMP
-extern void longjmp (void *, int);
+extern void longjmp ();
#endif
/* Routine to get the head of the current thread's dynamic handler chain
-------------------------------Cut---------------------------------------------
More information about the Gcc-bugs
mailing list