* flags.h (flag_bounds_check, flag_bounded_pointers): New extern decls.
* toplev.c (flag_bounds_check, flag_bounded_pointers): New flags.
(f_options): Add "bounded-pointers" and "bounds-check" entries.
* c-lang.c (lang_init_options): Set flag_bounds_check as "unspecified".
(lang_init): Set default for flag_bounds_check if still "unspecified".
From-SVN: r30035
+Fri Oct 15 15:17:29 1999 Greg McGary <gkm@gnu.org>
+
+ * flags.h (flag_bounds_check, flag_bounded_pointers): New extern decls.
+ * toplev.c (flag_bounds_check, flag_bounded_pointers): New flags.
+ (f_options): Add "bounded-pointers" and "bounds-check" entries.
+ * c-lang.c (lang_init_options): Set flag_bounds_check as "unspecified".
+ (lang_init): Set default for flag_bounds_check if still "unspecified".
+
Sat Oct 16 13:42:29 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* config/c4x/c4x.md (HF mode patterns): Add missing modes.
/* Language-specific hook definitions for C front end.
- Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
#include "c-lex.h"
#include "toplev.h"
#include "output.h"
+#include "flags.h"
#include "ggc.h"
#if USE_CPPLIB
parse_in.opts = &parse_options;
cpp_options_init (&parse_options);
#endif
+ /* Mark as "unspecified". */
+ flag_bounds_check = -1;
}
void
lang_init ()
{
+ /* If still "unspecified", make it match -fbounded-pointers. */
+ if (flag_bounds_check < 0)
+ flag_bounds_check = flag_bounded_pointers;
+
/* the beginning of the file is a new line; check for # */
/* With luck, we discover the real source file's name from that
and put it in input_filename. */
/* Perform a peephole pass before sched2. */
extern int flag_peephole2;
+
+/* -fbounded-pointers causes gcc to compile pointers as composite
+ objects occupying three words: the pointer value, the base address
+ of the referent object, and the address immediately beyond the end
+ of the referent object. The base and extent allow us to perform
+ runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
+extern int flag_bounded_pointers;
+
+/* -fcheck-bounds causes gcc to generate array bounds checks.
+ For C, C++: defaults to value of flag_bounded_pointers.
+ For ObjC: defaults to off.
+ For Java: defaults to on.
+ For Fortran: defaults to off.
+ For CHILL: defaults to off. */
+extern int flag_bounds_check;
\f
/* Other basic status info about current function. */
/* This will perform a peephole pass before sched2. */
int flag_peephole2 = 0;
+/* -fbounded-pointers causes gcc to compile pointers as composite
+ objects occupying three words: the pointer value, the base address
+ of the referent object, and the address immediately beyond the end
+ of the referent object. The base and extent allow us to perform
+ runtime bounds checking. -fbounded-pointers implies -fcheck-bounds. */
+int flag_bounded_pointers = 0;
+
+/* -fcheck-bounds causes gcc to generate array bounds checks.
+ For C, C++: defaults to value of flag_bounded_pointers.
+ For ObjC: defaults to off.
+ For Java: defaults to on.
+ For Fortran: defaults to off.
+ For CHILL: defaults to off. */
+int flag_bounds_check = 0;
+
/* Values of the -falign-* flags: how much to align labels in code.
0 means `use default', 1 means `don't align'.
For each variable, there is an _log variant which is the power
{ "peephole2", &flag_peephole2, 1,
"Enables an rtl peephole pass run before sched2" },
{"math-errno", &flag_errno_math, 1,
- "Set errno after built-in math functions"}
+ "Set errno after built-in math functions"},
+ {"bounded-pointers", &flag_bounded_pointers, 1,
+ "Compile pointers as triples: value, base & end" },
+ {"bounds-check", &flag_bounds_check, 1,
+ "Generate code to check bounds before dereferencing pointers and arrays" }
};
#define NUM_ELEM(a) (sizeof (a) / sizeof ((a)[0]))