[PATCH] PR c/761: Document or remove command line options

Roger Sayle roger@eyesopen.com
Sat Oct 19 16:01:00 GMT 2002


This patch and the preceding one to the cfg_branch are an attempt to
resolve PR c/761.  This high priority PR concerns the GCC command
line options that are currently undocumented.  The patch below either
documents or removes each of the options listed in the current GNATS
audit trail.

Firstly, I've removed "-funsafe-profile-arcs" and its corresponding
flag_unsafe_profile_arcs from mainline.  It looks as though some
partial merge accidently brought across -funsafe-profile-arcs from
the CFG branch.  My previous posting adds documentation for this
option to that branch, and hopefully when thread-safe profiling is
fully moved to mainline, this new documentation will come with it.

I've also removed "-fbounded-pointers" and flag_bounded_pointers
from mainline.  This flag is both undocumented and effectively
unused.  In fact, this option has removed from the gcc-3_0-branch
by Mark Mitchell, but that patch was never applied to mainline,
so it reappeared in 3.1.  Doh!

http://gcc.gnu.org/ml/gcc-patches/2001-06/msg00715.html


Unlike Mark's 3.0 patch, I've kept both -feliminate-dwarf2-dups
and -fbounds-check.  It looks like flag_eliminate_dwarf2_dups is
clearly doing something in dwarf2out.c, but I'm not sure if it
actually works.  Similarly, "-fbounds-check" and "-fno-bounds-check"
are used by the Fortran and Java front-ends.  I also believe it
should be simple to support array index bounds checking in C at
some point.

Finally doc/invoke.texi is updated both to remove some of the
current overfull hbox warnings with "make dvi" and document the
remaining undocumented command line options.  Specifically:

--version
-feliminate-dwarf2-dups
-fno-sched-interblock
-fno-sched-spec
-fsched-spec-load
-fsched-spec-load-dangerous
-fsched-verbose=n
-fno-branch-count-reg
-fbounds-check


This patch has been tested with a complete "make bootstrap", all
languages except Ada and treelang, on i686-pc-linux-gnu.   And with
"make dvi", checking for overfull hboxes in invoke.texi.

Joseph, could you check for any TeX style issues?


Ok for mainline and to close high priority PR c/761?


2002-10-19  Roger Sayle  <roger@eyesopen.com>

	PR c/761
	* toplev.c (flag_unsafe_profile_arcs): Remove.
	(flag_bounded_pointers): Remove.
	(flag_bounds_check): Correct comments.
	(lang_independent_options): Remove -funsafe-profile-arcs and
	-fbounded-pointers.  Correct -fbounds-check comments.

	* flags.h: Correct flag_schedule_interblock comments.
	(flag_bounded_pointers): Remove prototype.
	(flag_bounds_check): Correct comments.

	* c-opts.c (c_common_init_options): No need to mark
	flag_bounds_check as unspecified.
	(c_common_post_options): And no need to set it from
	flag_bounded_pointers if its still unspecified.

	* doc/invoke.texi: Fix some overfull hboxes in "make dvi".
	Document --version, -feliminate-dwarf-2-dups, -fno-sched-interblock,
	-fno-sched-spec, -fsched-spec-load, -fsched-spec-load-dangerous,
	-fsched-verbose=n, -fno-branch-count-reg and -fbounds-check.


Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.682
diff -c -3 -p -r1.682 toplev.c
*** toplev.c	17 Oct 2002 13:54:32 -0000	1.682
--- toplev.c	19 Oct 2002 22:44:03 -0000
*************** int profile_flag = 0;
*** 375,385 ****

  int profile_arc_flag = 0;

- /* Nonzero if we should not attempt to generate thread-safe
-    code to profile program flow graph arcs.  */
-
- int flag_unsafe_profile_arcs = 0;
-
  /* Nonzero if generating info for gcov to calculate line test coverage.  */

  int flag_test_coverage = 0;
--- 375,380 ----
*************** int flag_peephole2 = 0;
*** 863,881 ****
  /* This will try to guess branch probabilities.  */
  int flag_guess_branch_prob = 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;

  /* This will attempt to merge constant section constants, if 1 only
--- 858,867 ----
  /* This will try to guess branch probabilities.  */
  int flag_guess_branch_prob = 0;

  /* -fcheck-bounds causes gcc to generate array bounds checks.
!    For C, C++, ObjC: defaults to off.
     For Java: defaults to on.
!    For Fortran: defaults to off.  */
  int flag_bounds_check = 0;

  /* This will attempt to merge constant section constants, if 1 only
*************** static const lang_independent_options f_
*** 1104,1111 ****
     N_("Support synchronous non-call exceptions") },
    {"profile-arcs", &profile_arc_flag, 1,
     N_("Insert arc based program profiling code") },
-   {"unsafe-profile-arcs", &flag_unsafe_profile_arcs, 1,
-    N_("Avoid thread safety profiling overhead") },
    {"test-coverage", &flag_test_coverage, 1,
     N_("Create data files needed by gcov") },
    {"branch-probabilities", &flag_branch_probabilities, 1,
--- 1090,1095 ----
*************** static const lang_independent_options f_
*** 1190,1199 ****
     N_("Allow math optimizations that may violate IEEE or ANSI standards") },
    {"signaling-nans", &flag_signaling_nans, 1,
     N_("Disable optimizations observable by IEEE signaling NaNs") },
-   {"bounded-pointers", &flag_bounded_pointers, 1,
-    N_("Compile pointers as triples: value, base & end") },
    {"bounds-check", &flag_bounds_check, 1,
!    N_("Generate code to check bounds before dereferencing pointers and arrays") },
    {"single-precision-constant", &flag_single_precision_constant, 1,
     N_("Convert floating point constant to single precision constant") },
    {"time-report", &time_report, 1,
--- 1174,1181 ----
     N_("Allow math optimizations that may violate IEEE or ANSI standards") },
    {"signaling-nans", &flag_signaling_nans, 1,
     N_("Disable optimizations observable by IEEE signaling NaNs") },
    {"bounds-check", &flag_bounds_check, 1,
!    N_("Generate code to check bounds before indexing arrays") },
    {"single-precision-constant", &flag_single_precision_constant, 1,
     N_("Convert floating point constant to single precision constant") },
    {"time-report", &time_report, 1,
Index: flags.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flags.h,v
retrieving revision 1.92
diff -c -3 -p -r1.92 flags.h
*** flags.h	8 Oct 2002 19:20:16 -0000	1.92
--- flags.h	19 Oct 2002 22:44:03 -0000
*************** extern int flag_schedule_insns_after_rel
*** 431,437 ****
  /* The following flags have effect only for scheduling before register
     allocation:

!    flag_schedule_interblock means schedule insns accross basic blocks.
     flag_schedule_speculative means allow speculative motion of non-load insns.
     flag_schedule_speculative_load means allow speculative motion of some
     load insns.
--- 431,437 ----
  /* The following flags have effect only for scheduling before register
     allocation:

!    flag_schedule_interblock means schedule insns across basic blocks.
     flag_schedule_speculative means allow speculative motion of non-load insns.
     flag_schedule_speculative_load means allow speculative motion of some
     load insns.
*************** extern int flag_peephole2;
*** 563,581 ****
  /* Try to guess branch probablities.  */
  extern int flag_guess_branch_prob;

- /* -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;

  /* This will attempt to merge constant section constants, if 1 only
--- 563,572 ----
  /* Try to guess branch probablities.  */
  extern int flag_guess_branch_prob;

  /* -fcheck-bounds causes gcc to generate array bounds checks.
!    For C, C++ and ObjC: defaults off.
     For Java: defaults to on.
!    For Fortran: defaults to off.  */
  extern int flag_bounds_check;

  /* This will attempt to merge constant section constants, if 1 only
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 c-opts.c
*** c-opts.c	8 Oct 2002 19:20:15 -0000	1.21
--- c-opts.c	19 Oct 2002 22:44:03 -0000
*************** c_common_init_options (lang)
*** 515,523 ****
    warn_pointer_arith = (lang == clk_cplusplus);
    if (lang == clk_c)
      warn_sign_compare = -1;
-
-   /* Mark as "unspecified" (see c_common_post_options).  */
-   flag_bounds_check = -1;
  }

  /* Handle one command-line option in (argc, argv).
--- 515,520 ----
*************** c_common_post_options ()
*** 1373,1382 ****
  	  flag_inline_functions = 0;
  	}
      }
-
-   /* If still "unspecified", make it match -fbounded-pointers.  */
-   if (flag_bounds_check == -1)
-     flag_bounds_check = flag_bounded_pointers;

    /* Special format checking options don't work without -Wformat; warn if
       they are used.  */
--- 1370,1375 ----
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.195
diff -c -3 -p -r1.195 invoke.texi
*** doc/invoke.texi	10 Oct 2002 17:38:35 -0000	1.195
--- doc/invoke.texi	19 Oct 2002 22:44:05 -0000
*************** in the following sections.
*** 157,163 ****
  @xref{Overall Options,,Options Controlling the Kind of Output}.
  @gccoptlist{
  -c  -S  -E  -o @var{file}  -pipe  -pass-exit-codes  -x @var{language} @gol
! -v  -###  --target-help  --help}

  @item C Language Options
  @xref{C Dialect Options,,Options Controlling C Dialect}.
--- 157,163 ----
  @xref{Overall Options,,Options Controlling the Kind of Output}.
  @gccoptlist{
  -c  -S  -E  -o @var{file}  -pipe  -pass-exit-codes  -x @var{language} @gol
! -v  -###  --help  --target-help  --version}

  @item C Language Options
  @xref{C Dialect Options,,Options Controlling C Dialect}.
*************** in the following sections.
*** 228,234 ****
  -Wno-import  -Wnonnull  -Wpacked  -Wpadded @gol
  -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
  -Wreturn-type  -Wsequence-point  -Wshadow @gol
! -Wsign-compare  -Wstrict-aliasing -Wswitch  -Wswitch-default -Wswitch-enum @gol
  -Wsystem-headers -Wtrigraphs  -Wundef  -Wuninitialized @gol
  -Wunknown-pragmas  -Wunreachable-code @gol
  -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
--- 228,235 ----
  -Wno-import  -Wnonnull  -Wpacked  -Wpadded @gol
  -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
  -Wreturn-type  -Wsequence-point  -Wshadow @gol
! -Wsign-compare  -Wstrict-aliasing @gol
! -Wswitch  -Wswitch-default -Wswitch-enum @gol
  -Wsystem-headers -Wtrigraphs  -Wundef  -Wuninitialized @gol
  -Wunknown-pragmas  -Wunreachable-code @gol
  -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
*************** in the following sections.
*** 236,243 ****

  @item C-only Warning Options
  @gccoptlist{
! -Wbad-function-cast  -Wmissing-declarations  -Wmissing-prototypes @gol
! -Wnested-externs  -Wstrict-prototypes  -Wtraditional}

  @item Debugging Options
  @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
--- 237,245 ----

  @item C-only Warning Options
  @gccoptlist{
! -Wbad-function-cast  -Wmissing-declarations @gol
! -Wmissing-prototypes  -Wnested-externs @gol
! -Wstrict-prototypes  -Wtraditional}

  @item Debugging Options
  @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
*************** in the following sections.
*** 247,254 ****
  -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
  -fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
  -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
! -fmem-report @gol
! -fprofile-arcs  -ftest-coverage  -ftime-report @gol
  -g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2 @gol
  -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
  -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
--- 249,257 ----
  -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
  -fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
  -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
! -feliminate-dwarf2-dups  -fmem-report @gol
! -fprofile-arcs  -fsched-verbose=@var{n} @gol
! -ftest-coverage  -ftime-report @gol
  -g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2 @gol
  -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
  -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
*************** in the following sections.
*** 261,266 ****
--- 264,270 ----
  @gccoptlist{
  -falign-functions=@var{n}  -falign-jumps=@var{n} @gol
  -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
+ -fbounds-check @gol
  -fbranch-probabilities  -fcaller-saves -fcprop-registers @gol
  -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
  -fdelayed-branch  -fdelete-null-pointer-checks @gol
*************** in the following sections.
*** 270,277 ****
  -fif-conversion -fif-conversion2 @gol
  -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
  -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
! -fmove-all-movables  -fnew-ra  -fno-default-inline @gol
! -fno-defer-pop @gol
  -fno-function-cse  -fno-guess-branch-probability @gol
  -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
  -funsafe-math-optimizations -ffinite-math-only @gol
--- 274,281 ----
  -fif-conversion -fif-conversion2 @gol
  -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
  -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
! -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
! -fno-default-inline  -fno-defer-pop @gol
  -fno-function-cse  -fno-guess-branch-probability @gol
  -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
  -funsafe-math-optimizations -ffinite-math-only @gol
*************** in the following sections.
*** 281,287 ****
  -freduce-all-givs -fregmove  -frename-registers @gol
  -freorder-blocks -freorder-functions @gol
  -frerun-cse-after-loop  -frerun-loop-opt @gol
! -fschedule-insns  -fschedule-insns2 -fsignaling-nans @gol
  -fsingle-precision-constant  -fssa -fssa-ccp -fssa-dce @gol
  -fstrength-reduce  -fstrict-aliasing  -ftracer -fthread-jumps @gol
  -ftrapv -funroll-all-loops  -funroll-loops  @gol
--- 285,293 ----
  -freduce-all-givs -fregmove  -frename-registers @gol
  -freorder-blocks -freorder-functions @gol
  -frerun-cse-after-loop  -frerun-loop-opt @gol
! -fschedule-insns  -fschedule-insns2 @gol
! -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
! -fsched-spec-load-dangerous  -fsignaling-nans @gol
  -fsingle-precision-constant  -fssa -fssa-ccp -fssa-dce @gol
  -fstrength-reduce  -fstrict-aliasing  -ftracer -fthread-jumps @gol
  -ftrapv -funroll-all-loops  -funroll-loops  @gol
*************** be displayed.
*** 929,934 ****
--- 935,944 ----
  @opindex target-help
  Print (on the standard output) a description of target specific command
  line options for each tool.
+
+ @item --version
+ @opindex version
+ Display the version number and copyrights of the invoked GCC.
  @end table

  @node Invoking G++
*************** and DWARF2, neither @option{-gdwarf} nor
*** 2923,2928 ****
--- 2933,2944 ----
  a concatenated debug level.  Instead use an additional @option{-g@var{level}}
  option to change the debug level for DWARF1 or DWARF2.

+ @item -feliminate-dwarf2-dups
+ @opindex feliminate-dwarf2-dups
+ Compress DWARF2 debugging information by eliminating duplicated
+ information about each symbol.  This option only makes sense when
+ generating DWARF2 debugging information with @option{-gdwarf-2}.
+
  @cindex @code{prof}
  @item -p
  @opindex p
*************** Dump after all tree based optimization,
*** 3224,3229 ****
--- 3240,3262 ----
  Dump after function inlining, to @file{@var{file}.inlined}.
  @end table

+ @item -fsched-verbose=@var{n}
+ @opindex fsched-verbose
+ On targets that use instruction scheduling, this option controls the
+ amount of debugging output the scheduler prints.  This information is
+ normally written to standard error unless the use specifies either
+ @option{-dS} or @option{-dR}, when it is output to the usual dump
+ listing file, @file{.sched} or @file{.sched2} respectively.  However
+ for @var{n} greater than nine, the output is always printed to standard
+ error.
+
+ For @var{n} greater than zero, @option{-fsched-verbose} outputs the
+ same information as @option{-dRS}.  For @var{n} greater than one, it
+ also output basic block probabilities, detailed ready list information
+ and unit/insn info.  For @var{n} greater than two, it includes RTL
+ at abort point, control-flow and regions info.  And for @var{n} over
+ four, @option{-fsched-verbose} also includes dependence info.
+
  @item -save-temps
  @opindex save-temps
  Store the usual ``temporary'' intermediate files permanently; place them
*************** Use a graph coloring register allocator.
*** 3527,3532 ****
--- 3560,3573 ----
  for testing, so we are interested to hear about miscompilations with
  @option{-fnew-ra}.

+ @item -fno-branch-count-reg
+ @opindex fno-branch-count-reg
+ Dp not use ``decrement and branch'' instructions on a count register,
+ but instead generate a sequence of instructions that decrement a
+ register, compare it against zero, then branch based upon the result.
+ This option is only meaningful on architectures that support such
+ instructions, which include x86, PowerPC, IA-64 and S/390.
+
  @item -fno-function-cse
  @opindex fno-function-cse
  Do not put function addresses in registers; make each instruction that
*************** resulting executable can find the beginn
*** 3631,3636 ****
--- 3672,3685 ----
  assumptions based on that.

  The default is @option{-fzero-initialized-in-bss}.
+
+ @item -fbounds-check
+ @opindex fbounds-check
+ For front-ends that support it, generate additional code to check that
+ indices used to access arrays are within the declared range.  This is
+ currenly only supported by the Java and Fortran 77 front-ends, where
+ this option defaults to true and false respectively.
+
  @end table

  The following options control specific optimizations.  The @option{-O2}
*************** Similar to @option{-fschedule-insns}, bu
*** 3780,3785 ****
--- 3829,3858 ----
  instruction scheduling after register allocation has been done.  This is
  especially useful on machines with a relatively small number of
  registers and where memory load instructions take more than one cycle.
+
+ @item -fno-sched-interblock
+ @opindex fno-sched-interblock
+ Don't schedule instructions across basic blocks.  This is normally
+ enabled by default when scheduling before register allocation, i.e.@:
+ with @option{-fschedule-insns} or at @option{-O2} or higher.
+
+ @item -fno-sched-spec
+ @opindex fno-sched-spec
+ Don't allow speculative motion of non-load instructions.  This is normally
+ enabled by default when scheduling before register allocation, i.e.@:
+ with @option{-fschedule-insns} or at @option{-O2} or higher.
+
+ @item -fsched-spec-load
+ @opindex fsched-spec-load
+ Allow speculative motion of some load instructions.  This only makes
+ sense when scheduling before register allocation, i.e.@: with
+ @option{-fschedule-insns} or at @option{-O2} or higher.
+
+ @item -fsched-spec-load-dangerous
+ @opindex fsched-spec-load-dangerous
+ Allow speculative motion of more load instructions.  This only makes
+ sense when scheduling before register allocation, i.e.@: with
+ @option{-fschedule-insns} or at @option{-O2} or higher.

  @item -ffunction-sections
  @itemx -fdata-sections

Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833



More information about the Gcc-patches mailing list