Patchwork Disable Ada front-end checking in release mode

login
register
mail settings
Submitter Eric Botcazou
Date Jan. 11, 2013, 9:08 a.m.
Message ID <1477074.PI8pod8Vd6@polaris>
Download mbox | patch
Permalink /patch/211247/
State New
Headers show

Comments

Eric Botcazou - Jan. 11, 2013, 9:08 a.m.
Hi,

the Ada part of the Ada front-end is compiled with -gnata, which boils down to 
a form of dynamic type checking for the AST, i.e. something roughly equivalent 
to Tree checking for the front-ends of the C family of compilers.  This patch 
aligns the Ada compiler with them by disabling it in --enable-checking=release 
mode.  Issues flagged by this checking are usually benign on release branches 
and gigi has a slew of gcc_assert's that stop the compiler in serious cases.

Bootstrapped on x86_64-suse-linux (w and w/o --enable-checking=release), OK 
for the mainline?


2013-01-11  Eric Botcazou  <ebotcazou@adacore.com>

	* Makefile.tpl (BOOT_ADAFLAGS): Remove -gnata.
	* Makefile.in: Regenerate.


gcc/
2013-01-11  Eric Botcazou  <ebotcazou@adacore.com>

	* configure.ac (Tree checking): Set TREECHECKING to yes if enabled.
	Substitute TREECHECKING.
	* configure: Regenerate.
	* Makefile.in (TREECHECKING): New.


gcc/ada/
2013-01-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/Make-lang.in (COMMON_ADAFLAGS): Remove -gnata.
	(CHECKING_ADAFLAGS): New.
	(ALL_ADAFLAGS): Include CHECKING_ADAFLAGS.
Richard Guenther - Jan. 11, 2013, 10:32 a.m.
On Fri, Jan 11, 2013 at 10:08 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the Ada part of the Ada front-end is compiled with -gnata, which boils down to
> a form of dynamic type checking for the AST, i.e. something roughly equivalent
> to Tree checking for the front-ends of the C family of compilers.  This patch
> aligns the Ada compiler with them by disabling it in --enable-checking=release
> mode.  Issues flagged by this checking are usually benign on release branches
> and gigi has a slew of gcc_assert's that stop the compiler in serious cases.
>
> Bootstrapped on x86_64-suse-linux (w and w/o --enable-checking=release), OK
> for the mainline?

Ok.

Thanks,
Richard.

>
> 2013-01-11  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * Makefile.tpl (BOOT_ADAFLAGS): Remove -gnata.
>         * Makefile.in: Regenerate.
>
>
> gcc/
> 2013-01-11  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * configure.ac (Tree checking): Set TREECHECKING to yes if enabled.
>         Substitute TREECHECKING.
>         * configure: Regenerate.
>         * Makefile.in (TREECHECKING): New.
>
>
> gcc/ada/
> 2013-01-11  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * gcc-interface/Make-lang.in (COMMON_ADAFLAGS): Remove -gnata.
>         (CHECKING_ADAFLAGS): New.
>         (ALL_ADAFLAGS): Include CHECKING_ADAFLAGS.
>
>
> --
> Eric Botcazou

Patch

Index: gcc/ada/gcc-interface/Make-lang.in
===================================================================
--- gcc/ada/gcc-interface/Make-lang.in	(revision 195091)
+++ gcc/ada/gcc-interface/Make-lang.in	(working copy)
@@ -45,7 +45,12 @@  RMDIR = rm -rf
 
 
 # Extra flags to pass to recursive makes.
-COMMON_ADAFLAGS= -gnatpg -gnata
+COMMON_ADAFLAGS= -gnatpg
+ifeq ($(TREECHECKING),)
+CHECKING_ADAFLAGS=
+else
+CHECKING_ADAFLAGS= -gnata
+endif
 WARN_ADAFLAGS= -W -Wall
 
 # For native builds, the base compiler might be old and we need to arrange for
@@ -59,7 +64,8 @@  else
 ADAFLAGS= $(COMMON_ADAFLAGS)
 endif
 
-ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) $(WARN_ADAFLAGS)
+ALL_ADAFLAGS = \
+  $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) $(CHECKING_ADAFLAGS) $(WARN_ADAFLAGS)
 FORCE_DEBUG_ADAFLAGS = -g
 ADA_CFLAGS =
 ADA_INCLUDES = -nostdinc -I- -I. -Iada -I$(srcdir)/ada -I$(srcdir)/ada/gcc-interface
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 195012)
+++ gcc/configure.ac	(working copy)
@@ -471,6 +471,7 @@  if test x$ac_tree_checking != x ; then
    routines will also be enabled by this option.
    ])
   TREEBROWSER=tree-browser.o
+  TREECHECKING=yes
 fi
 if test x$ac_types_checking != x ; then
   AC_DEFINE(ENABLE_TYPES_CHECKING, 1,
@@ -479,6 +480,7 @@  if test x$ac_types_checking != x ; then
    ])
 fi
 AC_SUBST(TREEBROWSER)
+AC_SUBST(TREECHECKING)
 if test x$ac_rtl_checking != x ; then
   AC_DEFINE(ENABLE_RTL_CHECKING, 1,
 [Define if you want all operations on RTL (the basic data structure
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 195012)
+++ gcc/Makefile.in	(working copy)
@@ -1487,6 +1487,10 @@  ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS
 BACKEND = libbackend.a main.o @TREEBROWSER@ libcommon-target.a libcommon.a \
 	$(CPPLIB) $(LIBDECNUMBER)
 
+# This is defined to "yes" if Tree checking is enabled, which roughly means
+# front-end checking.
+TREECHECKING = @TREECHECKING@
+
 MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
  insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
  insn-attr.h insn-attr-common.h insn-attrtab.c insn-dfatab.c \
Index: Makefile.tpl
===================================================================
--- Makefile.tpl	(revision 195012)
+++ Makefile.tpl	(working copy)
@@ -367,7 +367,7 @@  BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 # here so that they can be overridden by Makefile fragments.
 BOOT_CFLAGS= -g -O2
 BOOT_LDFLAGS=
-BOOT_ADAFLAGS=-gnatpg -gnata
+BOOT_ADAFLAGS= -gnatpg
 
 AWK = @AWK@
 SED = @SED@