This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] target/37283: Fix -fno-unit-at-a-time and ?-fno-toplevel-reorder handling


* Janis Johnson <janis187@us.ibm.com> [2008-09-02 12:50:09 -0700]

| The comment was moved and now describes the code to which it is
| attached, but I think that code is wrong.  It doesn't disable
| section anchors for no toplevel reorder, and from what I've heard
| in this group before, section anchors should be disabled with
| no toplevel reorder.  At least that's the case for powerpc-linux
| which is now broken again for PR target/36756.

The code I moved now does what it describes indeed, while before the
patch it had a bogus effect. That being said, I have no idea of whether it
makes sense to implicitely use "-fno-toplevel-reorder -fsection-anchors"
as is currently done at -O0.

As you note, the code found a few lines below prohibits this
combination when the user asks for it explicitely:

  else if (!flag_toplevel_reorder)
    {
      if (flag_section_anchors == 1)
        error ("section anchors must be disabled when toplevel reorder is disabled");
      flag_section_anchors = 0;
    }

Does the following patch fix target/36756 for you?


diff --git a/gcc/opts.c b/gcc/opts.c
index 9bae6ea..d694a59 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1009,16 +1009,11 @@ decode_options (unsigned int argc, const char **argv)
   handle_options (argc, argv, lang_mask);
 
   /* -fno-unit-at-a-time and -fno-toplevel-reorder handling.  */
-  if (!flag_unit_at_a_time)
+  if (!flag_unit_at_a_time || (!optimize && flag_toplevel_reorder == 2))
     {
       flag_section_anchors = 0;
       flag_toplevel_reorder = 0;
     }
-  else if (!optimize && flag_toplevel_reorder == 2)
-    /* We disable toplevel reordering at -O0 to disable transformations that
-       might be surprising to end users and to get -fno-toplevel-reorder
-       tested, but we keep section anchors.  */
-    flag_toplevel_reorder = 0;
   else if (!flag_toplevel_reorder)
     {
       if (flag_section_anchors == 1)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]