[Bug middle-end/28034] [4.2 Regression] section anchors break -fprofile-generate

rsandifo at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jun 19 13:00:00 GMT 2006



------- Comment #2 from rsandifo at gcc dot gnu dot org  2006-06-19 12:57 -------
In response to comment #1, "tmp" isn't really the problem.
The problem is coverage_counter_alloc(), which initially
create an array of 1000 counters, and only supplies the
real type at the end of compilation:

      /* Generate and save a copy of this so it can be shared.  */
      /* We don't know the size yet; make it big enough that nobody
         will make any clever transformation on it.  */
      char buf[20];
      tree gcov_type_node = get_gcov_type ();
      tree domain_tree
        = build_index_type (build_int_cst (NULL_TREE, 1000)); /* replaced later
*/
      tree gcov_type_array_type
        = build_array_type (gcov_type_node, domain_tree);

If the final array has fewer than 1000 counters (as in the
reduced testcase), we get some silly padding, but correct code.
If the array has more than 1000 counters (as in the original
testcase), the offset calculation wraps.

Like the -ftree-vectorize thing, this is a chicken-and-egg ordering
problem.  The fix is to avoid using section anchors for tree_ctr_tables[].

Richard


-- 

rsandifo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rsandifo at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-06-19 12:57:46
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28034



More information about the Gcc-bugs mailing list