diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e4761d82e1f..231de304090 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2009-10-24 Eric Botcazou + + * init.c (__gnat_adjust_context_for_raise): Mention _Unwind_GetIPInfo. + * gcc-interface/Makefile.in (GNATLIBCFLAGS_FOR_C): Add HAVE_GETIPINFO. + Pass GNATLIBCFLAGS_FOR_C to recursive invocations. + 2009-10-21 Eric Botcazou * gcc-interfaces/decl.c (build_subst_list): Convert the expression of diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index cf717ac39cd..c9221fb5022 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -109,8 +109,11 @@ SOME_ADAFLAGS =-gnata FORCE_DEBUG_ADAFLAGS = -g GNATLIBFLAGS = -gnatpg -nostdinc GNATLIBCFLAGS = -g -O2 +# Pretend that _Unwind_GetIPInfo is available for the target by default. This +# should be autodetected during the configuration of libada and passed down to +# here, but we need something for --disable-libada and hope for the best. GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \ - -DIN_RTS + -DIN_RTS -DHAVE_GETIPINFO ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) MOST_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(SOME_ADAFLAGS) THREAD_KIND = native @@ -2422,6 +2425,7 @@ gnatlib-shared-default: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib @@ -2447,6 +2451,7 @@ gnatlib-shared-dual: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib-shared-default @@ -2455,6 +2460,7 @@ gnatlib-shared-dual: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib @@ -2464,6 +2470,7 @@ gnatlib-shared-dual-win32: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib-shared-win32 @@ -2472,6 +2479,7 @@ gnatlib-shared-dual-win32: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib @@ -2485,6 +2493,7 @@ gnatlib-shared-win32: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib @@ -2503,7 +2512,7 @@ gnatlib-shared-darwin: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) \ - -fno-common" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib @@ -2531,6 +2540,7 @@ gnatlib-shared-vms: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ gnatlib @@ -2559,6 +2569,7 @@ gnatlib-shared: $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \ @@ -2572,6 +2583,7 @@ gnatlib-sjlj: EH_MECHANISM="" \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib @@ -2584,6 +2596,7 @@ gnatlib-zcx: EH_MECHANISM="-gcc" \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib diff --git a/gcc/ada/init.c b/gcc/ada/init.c index 5fe46cd0ff2..0483d82724b 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -2301,8 +2301,10 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, { /* We used to compensate here for the raised from call vs raised from signal exception discrepancy with the GCC ZCX scheme, but this now can be dealt - with generically in the unwinder (see GCC PR other/26208). Only the VMS - ports still do the compensation described in the few lines below. + with generically in the unwinder (see GCC PR other/26208). This however + requires the use of the _Unwind_GetIPInfo routine in raise-gcc.c, which + is predicated on the definition of HAVE_GETIPINFO at compile time. Only + the VMS ports still do the compensation described in the few lines below. *** Call vs signal exception discrepancy with GCC ZCX scheme *** diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 676b5a73a55..73d8d6bf8e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-10-24 Eric Botcazou + + * gnat.dg/null_pointer_deref1.adb: New test. + * gnat.dg/null_pointer_deref2.adb: Likewise. + 2009-10-24 Paul Thomas PR fortran/41772 diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref1.adb b/gcc/testsuite/gnat.dg/null_pointer_deref1.adb new file mode 100644 index 00000000000..817155dc1c9 --- /dev/null +++ b/gcc/testsuite/gnat.dg/null_pointer_deref1.adb @@ -0,0 +1,21 @@ +-- { dg-do run } +-- { dg-options "-gnatp" } + +-- This test requires architecture- and OS-specific support code for unwinding +-- through signal frames (typically located in *-unwind.h) to pass. Feel free +-- to disable it if this code hasn't been implemented yet. + +procedure Null_Pointer_Deref1 is + type Int_Ptr is access all Integer; + + function Ident return Int_Ptr is + begin + return null; + end; + + Data : Int_Ptr := Ident; +begin + Data.all := 1; +exception + when Storage_Error => null; +end; diff --git a/gcc/testsuite/gnat.dg/null_pointer_deref2.adb b/gcc/testsuite/gnat.dg/null_pointer_deref2.adb new file mode 100644 index 00000000000..b1dd548f01b --- /dev/null +++ b/gcc/testsuite/gnat.dg/null_pointer_deref2.adb @@ -0,0 +1,28 @@ +-- { dg-do run } +-- { dg-options "-gnatp" } + +-- This test requires architecture- and OS-specific support code for unwinding +-- through signal frames (typically located in *-unwind.h) to pass. Feel free +-- to disable it if this code hasn't been implemented yet. + +procedure Null_Pointer_Deref2 is + + task T; + + task body T is + type Int_Ptr is access all Integer; + + function Ident return Int_Ptr is + begin + return null; + end; + Data : Int_Ptr := Ident; + begin + Data.all := 1; + exception + when Storage_Error => null; + end T; + +begin + null; +end; diff --git a/libada/ChangeLog b/libada/ChangeLog index a3add748971..deffec6515f 100644 --- a/libada/ChangeLog +++ b/libada/ChangeLog @@ -1,3 +1,11 @@ +2009-10-24 Eric Botcazou + + * Makefile.in (GNATLIBCFLAGS_FOR_C): New variable. + (LIBADA_FLAGS_TO_PASS): Add GNATLIBCFLAGS_FOR_C. + * configure.ac: Include config/unwind_ipinfo.m4. + Check for _Unwind_GetIPInfo. + * configure: Regenerate. + 2009-08-30 Paolo Bonzini PR ada/41122 diff --git a/libada/Makefile.in b/libada/Makefile.in index eec1649f9e1..01fa8362374 100644 --- a/libada/Makefile.in +++ b/libada/Makefile.in @@ -58,6 +58,8 @@ WARN_CFLAGS = @warn_cflags@ TARGET_LIBGCC2_CFLAGS= GNATLIBCFLAGS= -g -O2 +GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \ + -DIN_RTS @have_getipinfo@ # Get target-specific overrides for TARGET_LIBGCC2_CFLAGS. host_subdir = @host_subdir@ @@ -80,6 +82,7 @@ LIBADA_FLAGS_TO_PASS = \ "SHELL=$(SHELL)" \ "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \ "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \ + "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \ "TARGET_LIBGCC2_CFLAGS=$(TARGET_LIBGCC2_CFLAGS)" \ "THREAD_KIND=$(THREAD_KIND)" \ "TRACE=$(TRACE)" \ diff --git a/libada/configure b/libada/configure index ce8c0039e35..4137364df21 100755 --- a/libada/configure +++ b/libada/configure @@ -554,6 +554,7 @@ ac_unique_file="Makefile.in" ac_subst_vars='LTLIBOBJS LIBOBJS warn_cflags +have_getipinfo default_gnatlib_target LN_S AWK @@ -631,6 +632,7 @@ with_build_libsubdir enable_maintainer_mode enable_multilib enable_shared +with_system_libunwind ' ac_precious_vars='build_alias host_alias @@ -1258,6 +1260,7 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-build-libsubdir=DIR Directory where to find libraries for build system + --with-system-libunwind use installed libunwind Some influential environment variables: CC C compiler command @@ -2879,6 +2882,49 @@ else fi +# Check for _Unwind_GetIPInfo + + +# Check whether --with-system-libunwind was given. +if test "${with_system_libunwind+set}" = set; then : + withval=$with_system_libunwind; +fi + + # If system-libunwind was not specifically set, pick a default setting. + if test x$with_system_libunwind = x; then + case ${target} in + ia64-*-hpux*) with_system_libunwind=yes ;; + *) with_system_libunwind=no ;; + esac + fi + # Based on system-libunwind and target, do we have ipinfo? + if test x$with_system_libunwind = xyes; then + case ${target} in + ia64-*-*) have_unwind_getipinfo=no ;; + *) have_unwind_getipinfo=yes ;; + esac + else + # Darwin before version 9 does not have _Unwind_GetIPInfo. + + case ${target} in + *-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;; + *) have_unwind_getipinfo=yes ;; + esac + + fi + + if test x$have_unwind_getipinfo = xyes; then + +$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h + + fi + +have_getipinfo= +if test x$have_unwind_getipinfo = xyes; then + have_getipinfo=-DHAVE_GETIPINFO +fi + + warn_cflags= if test "x$GCC" = "xyes"; then warn_cflags='$(GCC_WARN_CFLAGS)' diff --git a/libada/configure.ac b/libada/configure.ac index 2fd8080f23b..3aa8a62a522 100644 --- a/libada/configure.ac +++ b/libada/configure.ac @@ -18,6 +18,7 @@ sinclude(../config/acx.m4) sinclude(../config/multi.m4) sinclude(../config/override.m4) +sinclude(../config/unwind_ipinfo.m4) AC_INIT AC_PREREQ([2.64]) @@ -131,6 +132,14 @@ else fi AC_SUBST([default_gnatlib_target]) +# Check for _Unwind_GetIPInfo +GCC_CHECK_UNWIND_GETIPINFO +have_getipinfo= +if test x$have_unwind_getipinfo = xyes; then + have_getipinfo=-DHAVE_GETIPINFO +fi +AC_SUBST(have_getipinfo) + warn_cflags= if test "x$GCC" = "xyes"; then warn_cflags='$(GCC_WARN_CFLAGS)'